opentasks 0.0.5 → 0.0.7
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 +108 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +217 -8
- package/dist/cli.js.map +1 -1
- package/dist/client/client.d.ts +47 -1
- package/dist/client/client.d.ts.map +1 -1
- package/dist/client/client.js +71 -0
- package/dist/client/client.js.map +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/config/schema.d.ts +232 -4
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +161 -7
- package/dist/config/schema.js.map +1 -1
- package/dist/context-files/context-files.d.ts +72 -0
- package/dist/context-files/context-files.d.ts.map +1 -0
- package/dist/context-files/context-files.js +145 -0
- package/dist/context-files/context-files.js.map +1 -0
- package/dist/context-files/index.d.ts +16 -0
- package/dist/context-files/index.d.ts.map +1 -0
- package/dist/context-files/index.js +14 -0
- package/dist/context-files/index.js.map +1 -0
- package/dist/context-files/resolver.d.ts +43 -0
- package/dist/context-files/resolver.d.ts.map +1 -0
- package/dist/context-files/resolver.js +127 -0
- package/dist/context-files/resolver.js.map +1 -0
- package/dist/context-files/types.d.ts +94 -0
- package/dist/context-files/types.d.ts.map +1 -0
- package/dist/context-files/types.js +10 -0
- package/dist/context-files/types.js.map +1 -0
- package/dist/context-files/watcher-integration.d.ts +47 -0
- package/dist/context-files/watcher-integration.d.ts.map +1 -0
- package/dist/context-files/watcher-integration.js +47 -0
- package/dist/context-files/watcher-integration.js.map +1 -0
- package/dist/core/merge-driver.d.ts +11 -2
- package/dist/core/merge-driver.d.ts.map +1 -1
- package/dist/core/merge-driver.js +46 -7
- package/dist/core/merge-driver.js.map +1 -1
- package/dist/core/worktree.js +1 -1
- package/dist/core/worktree.js.map +1 -1
- package/dist/daemon/index.d.ts +6 -4
- package/dist/daemon/index.d.ts.map +1 -1
- package/dist/daemon/index.js +3 -2
- package/dist/daemon/index.js.map +1 -1
- package/dist/daemon/ipc.d.ts.map +1 -1
- package/dist/daemon/ipc.js +12 -2
- package/dist/daemon/ipc.js.map +1 -1
- package/dist/daemon/lifecycle.d.ts.map +1 -1
- package/dist/daemon/lifecycle.js +143 -25
- package/dist/daemon/lifecycle.js.map +1 -1
- package/dist/daemon/location-state.d.ts +12 -6
- package/dist/daemon/location-state.d.ts.map +1 -1
- package/dist/daemon/location-state.js +50 -20
- package/dist/daemon/location-state.js.map +1 -1
- package/dist/daemon/methods/context-files.d.ts +14 -0
- package/dist/daemon/methods/context-files.d.ts.map +1 -0
- package/dist/daemon/methods/context-files.js +95 -0
- package/dist/daemon/methods/context-files.js.map +1 -0
- package/dist/daemon/methods/provider.d.ts.map +1 -1
- package/dist/daemon/methods/provider.js +15 -0
- package/dist/daemon/methods/provider.js.map +1 -1
- package/dist/daemon/methods/tools.d.ts +1 -1
- package/dist/daemon/methods/tools.d.ts.map +1 -1
- package/dist/daemon/methods/tools.js +3 -2
- package/dist/daemon/methods/tools.js.map +1 -1
- package/dist/daemon/sessionlog-linker.d.ts +71 -0
- package/dist/daemon/sessionlog-linker.d.ts.map +1 -0
- package/dist/daemon/sessionlog-linker.js +472 -0
- package/dist/daemon/sessionlog-linker.js.map +1 -0
- package/dist/daemon/sessionlog-watcher.d.ts +79 -0
- package/dist/daemon/sessionlog-watcher.d.ts.map +1 -0
- package/dist/daemon/sessionlog-watcher.js +289 -0
- package/dist/daemon/sessionlog-watcher.js.map +1 -0
- package/dist/graph/git-graph-syncer.js +1 -1
- package/dist/graph/git-graph-syncer.js.map +1 -1
- package/dist/graph/index.d.ts +1 -1
- package/dist/graph/index.d.ts.map +1 -1
- package/dist/graph/index.js.map +1 -1
- package/dist/graph/provider-store.d.ts +78 -4
- package/dist/graph/provider-store.d.ts.map +1 -1
- package/dist/graph/provider-store.js +579 -55
- package/dist/graph/provider-store.js.map +1 -1
- package/dist/graph/store.d.ts.map +1 -1
- package/dist/graph/store.js +3 -0
- package/dist/graph/store.js.map +1 -1
- package/dist/graph/types.d.ts +16 -0
- package/dist/graph/types.d.ts.map +1 -1
- package/dist/graph/types.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -3
- package/dist/index.js.map +1 -1
- package/dist/materialization/git-archive-store.js +2 -2
- package/dist/materialization/git-archive-store.js.map +1 -1
- package/dist/materialization/git-remote-store.js +2 -2
- package/dist/materialization/git-remote-store.js.map +1 -1
- package/dist/materialization/snapshot.js +4 -4
- package/dist/materialization/snapshot.js.map +1 -1
- package/dist/mcp/index.d.ts +8 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +8 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/server.d.ts +39 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +677 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/stdio.d.ts +14 -0
- package/dist/mcp/stdio.d.ts.map +1 -0
- package/dist/mcp/stdio.js +19 -0
- package/dist/mcp/stdio.js.map +1 -0
- package/dist/providers/beads.d.ts.map +1 -1
- package/dist/providers/beads.js +17 -1
- package/dist/providers/beads.js.map +1 -1
- package/dist/providers/claude-tasks-fs.d.ts +22 -0
- package/dist/providers/claude-tasks-fs.d.ts.map +1 -0
- package/dist/providers/claude-tasks-fs.js +158 -0
- package/dist/providers/claude-tasks-fs.js.map +1 -0
- package/dist/providers/claude-tasks.d.ts +13 -4
- package/dist/providers/claude-tasks.d.ts.map +1 -1
- package/dist/providers/claude-tasks.js +318 -5
- package/dist/providers/claude-tasks.js.map +1 -1
- package/dist/providers/from-config.d.ts +3 -0
- package/dist/providers/from-config.d.ts.map +1 -1
- package/dist/providers/from-config.js +64 -17
- package/dist/providers/from-config.js.map +1 -1
- package/dist/providers/global.d.ts.map +1 -1
- package/dist/providers/global.js +5 -0
- package/dist/providers/global.js.map +1 -1
- package/dist/providers/index.d.ts +9 -4
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/index.js +10 -3
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/map-client-factory.d.ts +55 -0
- package/dist/providers/map-client-factory.d.ts.map +1 -0
- package/dist/providers/map-client-factory.js +123 -0
- package/dist/providers/map-client-factory.js.map +1 -0
- package/dist/providers/map-event-bridge.d.ts +146 -0
- package/dist/providers/map-event-bridge.d.ts.map +1 -0
- package/dist/providers/map-event-bridge.js +208 -0
- package/dist/providers/map-event-bridge.js.map +1 -0
- package/dist/providers/map.d.ts +115 -0
- package/dist/providers/map.d.ts.map +1 -0
- package/dist/providers/map.js +381 -0
- package/dist/providers/map.js.map +1 -0
- package/dist/providers/materialization.d.ts +23 -5
- package/dist/providers/materialization.d.ts.map +1 -1
- package/dist/providers/materialization.js +95 -4
- package/dist/providers/materialization.js.map +1 -1
- package/dist/providers/native.d.ts.map +1 -1
- package/dist/providers/native.js +5 -0
- package/dist/providers/native.js.map +1 -1
- package/dist/providers/sessionlog.d.ts +81 -0
- package/dist/providers/sessionlog.d.ts.map +1 -0
- package/dist/providers/sessionlog.js +478 -0
- package/dist/providers/sessionlog.js.map +1 -0
- package/dist/providers/sudocode.d.ts.map +1 -1
- package/dist/providers/sudocode.js +17 -1
- package/dist/providers/sudocode.js.map +1 -1
- package/dist/providers/traits/Reconcilable.d.ts +57 -0
- package/dist/providers/traits/Reconcilable.d.ts.map +1 -0
- package/dist/providers/traits/Reconcilable.js +18 -0
- package/dist/providers/traits/Reconcilable.js.map +1 -0
- package/dist/providers/traits/index.d.ts +2 -0
- package/dist/providers/traits/index.d.ts.map +1 -1
- package/dist/providers/traits/index.js +1 -0
- package/dist/providers/traits/index.js.map +1 -1
- package/dist/providers/types.d.ts +63 -0
- package/dist/providers/types.d.ts.map +1 -1
- package/dist/providers/types.js +22 -0
- package/dist/providers/types.js.map +1 -1
- package/dist/schema/edges.d.ts +3 -3
- package/dist/schema/edges.d.ts.map +1 -1
- package/dist/sessionlog/agent/agents/claude-code.d.ts +76 -0
- package/dist/sessionlog/agent/agents/claude-code.d.ts.map +1 -0
- package/dist/sessionlog/agent/agents/claude-code.js +759 -0
- package/dist/sessionlog/agent/agents/claude-code.js.map +1 -0
- package/dist/sessionlog/agent/agents/cursor.d.ts +35 -0
- package/dist/sessionlog/agent/agents/cursor.d.ts.map +1 -0
- package/dist/sessionlog/agent/agents/cursor.js +294 -0
- package/dist/sessionlog/agent/agents/cursor.js.map +1 -0
- package/dist/sessionlog/agent/agents/gemini-cli.d.ts +62 -0
- package/dist/sessionlog/agent/agents/gemini-cli.d.ts.map +1 -0
- package/dist/sessionlog/agent/agents/gemini-cli.js +462 -0
- package/dist/sessionlog/agent/agents/gemini-cli.js.map +1 -0
- package/dist/sessionlog/agent/agents/opencode.d.ts +100 -0
- package/dist/sessionlog/agent/agents/opencode.d.ts.map +1 -0
- package/dist/sessionlog/agent/agents/opencode.js +423 -0
- package/dist/sessionlog/agent/agents/opencode.js.map +1 -0
- package/dist/sessionlog/agent/registry.d.ts +54 -0
- package/dist/sessionlog/agent/registry.d.ts.map +1 -0
- package/dist/sessionlog/agent/registry.js +123 -0
- package/dist/sessionlog/agent/registry.js.map +1 -0
- package/dist/sessionlog/agent/session-types.d.ts +45 -0
- package/dist/sessionlog/agent/session-types.d.ts.map +1 -0
- package/dist/sessionlog/agent/session-types.js +50 -0
- package/dist/sessionlog/agent/session-types.js.map +1 -0
- package/dist/sessionlog/agent/types.d.ts +126 -0
- package/dist/sessionlog/agent/types.d.ts.map +1 -0
- package/dist/sessionlog/agent/types.js +39 -0
- package/dist/sessionlog/agent/types.js.map +1 -0
- package/dist/sessionlog/commands/clean.d.ts +40 -0
- package/dist/sessionlog/commands/clean.d.ts.map +1 -0
- package/dist/sessionlog/commands/clean.js +105 -0
- package/dist/sessionlog/commands/clean.js.map +1 -0
- package/dist/sessionlog/commands/disable.d.ts +23 -0
- package/dist/sessionlog/commands/disable.d.ts.map +1 -0
- package/dist/sessionlog/commands/disable.js +57 -0
- package/dist/sessionlog/commands/disable.js.map +1 -0
- package/dist/sessionlog/commands/doctor.d.ts +43 -0
- package/dist/sessionlog/commands/doctor.d.ts.map +1 -0
- package/dist/sessionlog/commands/doctor.js +97 -0
- package/dist/sessionlog/commands/doctor.js.map +1 -0
- package/dist/sessionlog/commands/enable.d.ts +31 -0
- package/dist/sessionlog/commands/enable.d.ts.map +1 -0
- package/dist/sessionlog/commands/enable.js +102 -0
- package/dist/sessionlog/commands/enable.js.map +1 -0
- package/dist/sessionlog/commands/explain.d.ts +69 -0
- package/dist/sessionlog/commands/explain.d.ts.map +1 -0
- package/dist/sessionlog/commands/explain.js +185 -0
- package/dist/sessionlog/commands/explain.js.map +1 -0
- package/dist/sessionlog/commands/reset.d.ts +23 -0
- package/dist/sessionlog/commands/reset.d.ts.map +1 -0
- package/dist/sessionlog/commands/reset.js +68 -0
- package/dist/sessionlog/commands/reset.js.map +1 -0
- package/dist/sessionlog/commands/resume.d.ts +42 -0
- package/dist/sessionlog/commands/resume.d.ts.map +1 -0
- package/dist/sessionlog/commands/resume.js +134 -0
- package/dist/sessionlog/commands/resume.js.map +1 -0
- package/dist/sessionlog/commands/rewind.d.ts +40 -0
- package/dist/sessionlog/commands/rewind.d.ts.map +1 -0
- package/dist/sessionlog/commands/rewind.js +155 -0
- package/dist/sessionlog/commands/rewind.js.map +1 -0
- package/dist/sessionlog/commands/status.d.ts +54 -0
- package/dist/sessionlog/commands/status.d.ts.map +1 -0
- package/dist/sessionlog/commands/status.js +95 -0
- package/dist/sessionlog/commands/status.js.map +1 -0
- package/dist/sessionlog/config.d.ts +40 -0
- package/dist/sessionlog/config.d.ts.map +1 -0
- package/dist/sessionlog/config.js +126 -0
- package/dist/sessionlog/config.js.map +1 -0
- package/dist/sessionlog/git-operations.d.ts +173 -0
- package/dist/sessionlog/git-operations.d.ts.map +1 -0
- package/dist/sessionlog/git-operations.js +399 -0
- package/dist/sessionlog/git-operations.js.map +1 -0
- package/dist/sessionlog/hooks/git-hooks.d.ts +22 -0
- package/dist/sessionlog/hooks/git-hooks.d.ts.map +1 -0
- package/dist/sessionlog/hooks/git-hooks.js +145 -0
- package/dist/sessionlog/hooks/git-hooks.js.map +1 -0
- package/dist/sessionlog/hooks/lifecycle.d.ts +21 -0
- package/dist/sessionlog/hooks/lifecycle.d.ts.map +1 -0
- package/dist/sessionlog/hooks/lifecycle.js +179 -0
- package/dist/sessionlog/hooks/lifecycle.js.map +1 -0
- package/dist/sessionlog/index.d.ts +69 -0
- package/dist/sessionlog/index.d.ts.map +1 -0
- package/dist/sessionlog/index.js +154 -0
- package/dist/sessionlog/index.js.map +1 -0
- package/dist/sessionlog/security/redaction.d.ts +35 -0
- package/dist/sessionlog/security/redaction.d.ts.map +1 -0
- package/dist/sessionlog/security/redaction.js +221 -0
- package/dist/sessionlog/security/redaction.js.map +1 -0
- package/dist/sessionlog/session/state-machine.d.ts +90 -0
- package/dist/sessionlog/session/state-machine.d.ts.map +1 -0
- package/dist/sessionlog/session/state-machine.js +347 -0
- package/dist/sessionlog/session/state-machine.js.map +1 -0
- package/dist/sessionlog/store/checkpoint-store.d.ts +47 -0
- package/dist/sessionlog/store/checkpoint-store.d.ts.map +1 -0
- package/dist/sessionlog/store/checkpoint-store.js +309 -0
- package/dist/sessionlog/store/checkpoint-store.js.map +1 -0
- package/dist/sessionlog/store/native-store.d.ts +21 -0
- package/dist/sessionlog/store/native-store.d.ts.map +1 -0
- package/dist/sessionlog/store/native-store.js +162 -0
- package/dist/sessionlog/store/native-store.js.map +1 -0
- package/dist/sessionlog/store/provider-types.d.ts +78 -0
- package/dist/sessionlog/store/provider-types.d.ts.map +1 -0
- package/dist/sessionlog/store/provider-types.js +12 -0
- package/dist/sessionlog/store/provider-types.js.map +1 -0
- package/dist/sessionlog/store/session-store.d.ts +28 -0
- package/dist/sessionlog/store/session-store.d.ts.map +1 -0
- package/dist/sessionlog/store/session-store.js +187 -0
- package/dist/sessionlog/store/session-store.js.map +1 -0
- package/dist/sessionlog/strategy/attribution.d.ts +39 -0
- package/dist/sessionlog/strategy/attribution.d.ts.map +1 -0
- package/dist/sessionlog/strategy/attribution.js +227 -0
- package/dist/sessionlog/strategy/attribution.js.map +1 -0
- package/dist/sessionlog/strategy/common.d.ts +60 -0
- package/dist/sessionlog/strategy/common.d.ts.map +1 -0
- package/dist/sessionlog/strategy/common.js +162 -0
- package/dist/sessionlog/strategy/common.js.map +1 -0
- package/dist/sessionlog/strategy/content-overlap.d.ts +33 -0
- package/dist/sessionlog/strategy/content-overlap.d.ts.map +1 -0
- package/dist/sessionlog/strategy/content-overlap.js +168 -0
- package/dist/sessionlog/strategy/content-overlap.js.map +1 -0
- package/dist/sessionlog/strategy/manual-commit.d.ts +35 -0
- package/dist/sessionlog/strategy/manual-commit.d.ts.map +1 -0
- package/dist/sessionlog/strategy/manual-commit.js +732 -0
- package/dist/sessionlog/strategy/manual-commit.js.map +1 -0
- package/dist/sessionlog/strategy/types.d.ts +163 -0
- package/dist/sessionlog/strategy/types.d.ts.map +1 -0
- package/dist/sessionlog/strategy/types.js +49 -0
- package/dist/sessionlog/strategy/types.js.map +1 -0
- package/dist/sessionlog/summarize/claude-generator.d.ts +25 -0
- package/dist/sessionlog/summarize/claude-generator.d.ts.map +1 -0
- package/dist/sessionlog/summarize/claude-generator.js +87 -0
- package/dist/sessionlog/summarize/claude-generator.js.map +1 -0
- package/dist/sessionlog/summarize/summarize.d.ts +52 -0
- package/dist/sessionlog/summarize/summarize.d.ts.map +1 -0
- package/dist/sessionlog/summarize/summarize.js +335 -0
- package/dist/sessionlog/summarize/summarize.js.map +1 -0
- package/dist/sessionlog/types.d.ts +298 -0
- package/dist/sessionlog/types.d.ts.map +1 -0
- package/dist/sessionlog/types.js +104 -0
- package/dist/sessionlog/types.js.map +1 -0
- package/dist/sessionlog/utils/chunk-files.d.ts +25 -0
- package/dist/sessionlog/utils/chunk-files.d.ts.map +1 -0
- package/dist/sessionlog/utils/chunk-files.js +47 -0
- package/dist/sessionlog/utils/chunk-files.js.map +1 -0
- package/dist/sessionlog/utils/commit-message.d.ts +11 -0
- package/dist/sessionlog/utils/commit-message.d.ts.map +1 -0
- package/dist/sessionlog/utils/commit-message.js +54 -0
- package/dist/sessionlog/utils/commit-message.js.map +1 -0
- package/dist/sessionlog/utils/detect-agent.d.ts +19 -0
- package/dist/sessionlog/utils/detect-agent.d.ts.map +1 -0
- package/dist/sessionlog/utils/detect-agent.js +34 -0
- package/dist/sessionlog/utils/detect-agent.js.map +1 -0
- package/dist/sessionlog/utils/hook-managers.d.ts +24 -0
- package/dist/sessionlog/utils/hook-managers.d.ts.map +1 -0
- package/dist/sessionlog/utils/hook-managers.js +87 -0
- package/dist/sessionlog/utils/hook-managers.js.map +1 -0
- package/dist/sessionlog/utils/ide-tags.d.ts +12 -0
- package/dist/sessionlog/utils/ide-tags.d.ts.map +1 -0
- package/dist/sessionlog/utils/ide-tags.js +30 -0
- package/dist/sessionlog/utils/ide-tags.js.map +1 -0
- package/dist/sessionlog/utils/paths.d.ts +32 -0
- package/dist/sessionlog/utils/paths.d.ts.map +1 -0
- package/dist/sessionlog/utils/paths.js +55 -0
- package/dist/sessionlog/utils/paths.js.map +1 -0
- package/dist/sessionlog/utils/preview-rewind.d.ts +23 -0
- package/dist/sessionlog/utils/preview-rewind.d.ts.map +1 -0
- package/dist/sessionlog/utils/preview-rewind.js +63 -0
- package/dist/sessionlog/utils/preview-rewind.js.map +1 -0
- package/dist/sessionlog/utils/rewind-conflict.d.ts +52 -0
- package/dist/sessionlog/utils/rewind-conflict.d.ts.map +1 -0
- package/dist/sessionlog/utils/rewind-conflict.js +79 -0
- package/dist/sessionlog/utils/rewind-conflict.js.map +1 -0
- package/dist/sessionlog/utils/shadow-branch.d.ts +53 -0
- package/dist/sessionlog/utils/shadow-branch.d.ts.map +1 -0
- package/dist/sessionlog/utils/shadow-branch.js +97 -0
- package/dist/sessionlog/utils/shadow-branch.js.map +1 -0
- package/dist/sessionlog/utils/string-utils.d.ts +24 -0
- package/dist/sessionlog/utils/string-utils.d.ts.map +1 -0
- package/dist/sessionlog/utils/string-utils.js +47 -0
- package/dist/sessionlog/utils/string-utils.js.map +1 -0
- package/dist/sessionlog/utils/todo-extract.d.ts +52 -0
- package/dist/sessionlog/utils/todo-extract.d.ts.map +1 -0
- package/dist/sessionlog/utils/todo-extract.js +167 -0
- package/dist/sessionlog/utils/todo-extract.js.map +1 -0
- package/dist/sessionlog/utils/trailers.d.ts +36 -0
- package/dist/sessionlog/utils/trailers.d.ts.map +1 -0
- package/dist/sessionlog/utils/trailers.js +149 -0
- package/dist/sessionlog/utils/trailers.js.map +1 -0
- package/dist/sessionlog/utils/transcript-parse.d.ts +57 -0
- package/dist/sessionlog/utils/transcript-parse.d.ts.map +1 -0
- package/dist/sessionlog/utils/transcript-parse.js +126 -0
- package/dist/sessionlog/utils/transcript-parse.js.map +1 -0
- package/dist/sessionlog/utils/transcript-timestamp.d.ts +22 -0
- package/dist/sessionlog/utils/transcript-timestamp.d.ts.map +1 -0
- package/dist/sessionlog/utils/transcript-timestamp.js +56 -0
- package/dist/sessionlog/utils/transcript-timestamp.js.map +1 -0
- package/dist/sessionlog/utils/tree-ops.d.ts +47 -0
- package/dist/sessionlog/utils/tree-ops.d.ts.map +1 -0
- package/dist/sessionlog/utils/tree-ops.js +145 -0
- package/dist/sessionlog/utils/tree-ops.js.map +1 -0
- package/dist/sessionlog/utils/tty.d.ts +25 -0
- package/dist/sessionlog/utils/tty.d.ts.map +1 -0
- package/dist/sessionlog/utils/tty.js +70 -0
- package/dist/sessionlog/utils/tty.js.map +1 -0
- package/dist/sessionlog/utils/validation.d.ts +31 -0
- package/dist/sessionlog/utils/validation.d.ts.map +1 -0
- package/dist/sessionlog/utils/validation.js +59 -0
- package/dist/sessionlog/utils/validation.js.map +1 -0
- package/dist/sessionlog/utils/worktree.d.ts +16 -0
- package/dist/sessionlog/utils/worktree.d.ts.map +1 -0
- package/dist/sessionlog/utils/worktree.js +50 -0
- package/dist/sessionlog/utils/worktree.js.map +1 -0
- package/dist/storage/sqlite-schema.d.ts.map +1 -1
- package/dist/storage/sqlite-schema.js +2 -0
- package/dist/storage/sqlite-schema.js.map +1 -1
- package/dist/storage/sqlite.d.ts.map +1 -1
- package/dist/storage/sqlite.js +18 -4
- package/dist/storage/sqlite.js.map +1 -1
- package/dist/tools/index.d.ts +1 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/query.d.ts +2 -1
- package/dist/tools/query.d.ts.map +1 -1
- package/dist/tools/query.js +217 -7
- package/dist/tools/query.js.map +1 -1
- package/dist/tools/types.d.ts +57 -0
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/tools/types.js.map +1 -1
- package/dist/tracking/transcript-extractor.d.ts +3 -3
- package/dist/tracking/transcript-extractor.d.ts.map +1 -1
- package/dist/tracking/transcript-extractor.js +1 -1
- package/dist/tracking/transcript-extractor.js.map +1 -1
- package/package.json +3 -1
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git Tree Manipulation
|
|
3
|
+
*
|
|
4
|
+
* Structured tree operations for building and modifying git tree objects.
|
|
5
|
+
* Provides higher-level abstractions over raw `git mktree` / `git ls-tree`.
|
|
6
|
+
*
|
|
7
|
+
* Ported from Go: checkpoint/parse_tree.go
|
|
8
|
+
*/
|
|
9
|
+
export interface TreeEntry {
|
|
10
|
+
mode: string;
|
|
11
|
+
type: string;
|
|
12
|
+
hash: string;
|
|
13
|
+
name: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const enum MergeMode {
|
|
16
|
+
/** Replace the entire subtree at the target path */
|
|
17
|
+
ReplaceAll = 0,
|
|
18
|
+
/** Merge into existing subtree, keeping existing entries */
|
|
19
|
+
MergeKeepExisting = 1
|
|
20
|
+
}
|
|
21
|
+
export interface TreeChange {
|
|
22
|
+
path: string;
|
|
23
|
+
mode: string;
|
|
24
|
+
hash: string;
|
|
25
|
+
deleted?: boolean;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Update (or create) a subtree at a given path within a root tree.
|
|
29
|
+
*
|
|
30
|
+
* @param rootTree - The root tree hash (or empty string for a new tree)
|
|
31
|
+
* @param subtreePath - The path to the subtree (e.g., "a3/b2c4d5e6f7")
|
|
32
|
+
* @param newSubtreeHash - The hash of the new subtree to place at path
|
|
33
|
+
* @param mergeMode - How to handle existing entries at the path
|
|
34
|
+
* @param cwd - Working directory for git commands
|
|
35
|
+
*/
|
|
36
|
+
export declare function updateSubtree(rootTree: string, subtreePath: string, newSubtreeHash: string, mergeMode?: MergeMode, cwd?: string): Promise<string>;
|
|
37
|
+
/**
|
|
38
|
+
* Apply a batch of file-level changes to a tree.
|
|
39
|
+
* Returns the hash of the new root tree.
|
|
40
|
+
*/
|
|
41
|
+
export declare function applyTreeChanges(rootTree: string, changes: TreeChange[], cwd?: string): Promise<string>;
|
|
42
|
+
/**
|
|
43
|
+
* Create a tree from a map of file paths to content strings.
|
|
44
|
+
* Useful for building trees from scratch in tests.
|
|
45
|
+
*/
|
|
46
|
+
export declare function createTreeFromMap(files: Record<string, string>, cwd?: string): Promise<string>;
|
|
47
|
+
//# sourceMappingURL=tree-ops.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree-ops.d.ts","sourceRoot":"","sources":["../../../src/sessionlog/utils/tree-ops.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAYH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,0BAAkB,SAAS;IACzB,oDAAoD;IACpD,UAAU,IAAI;IACd,4DAA4D;IAC5D,iBAAiB,IAAI;CACtB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAMD;;;;;;;;GAQG;AACH,wBAAsB,aAAa,CACjC,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,MAAM,EACtB,SAAS,GAAE,SAAgC,EAC3C,GAAG,CAAC,EAAE,MAAM,GACX,OAAO,CAAC,MAAM,CAAC,CAMjB;AAiGD;;;GAGG;AACH,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,UAAU,EAAE,EACrB,GAAG,CAAC,EAAE,MAAM,GACX,OAAO,CAAC,MAAM,CAAC,CAiCjB;AAED;;;GAGG;AACH,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC7B,GAAG,CAAC,EAAE,MAAM,GACX,OAAO,CAAC,MAAM,CAAC,CAcjB"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git Tree Manipulation
|
|
3
|
+
*
|
|
4
|
+
* Structured tree operations for building and modifying git tree objects.
|
|
5
|
+
* Provides higher-level abstractions over raw `git mktree` / `git ls-tree`.
|
|
6
|
+
*
|
|
7
|
+
* Ported from Go: checkpoint/parse_tree.go
|
|
8
|
+
*/
|
|
9
|
+
import { lsTree, mktree, hashObject, } from '../git-operations.js';
|
|
10
|
+
// ============================================================================
|
|
11
|
+
// Tree Operations
|
|
12
|
+
// ============================================================================
|
|
13
|
+
/**
|
|
14
|
+
* Update (or create) a subtree at a given path within a root tree.
|
|
15
|
+
*
|
|
16
|
+
* @param rootTree - The root tree hash (or empty string for a new tree)
|
|
17
|
+
* @param subtreePath - The path to the subtree (e.g., "a3/b2c4d5e6f7")
|
|
18
|
+
* @param newSubtreeHash - The hash of the new subtree to place at path
|
|
19
|
+
* @param mergeMode - How to handle existing entries at the path
|
|
20
|
+
* @param cwd - Working directory for git commands
|
|
21
|
+
*/
|
|
22
|
+
export async function updateSubtree(rootTree, subtreePath, newSubtreeHash, mergeMode = 0 /* MergeMode.ReplaceAll */, cwd) {
|
|
23
|
+
const parts = subtreePath.split('/').filter(Boolean);
|
|
24
|
+
if (parts.length === 0)
|
|
25
|
+
return newSubtreeHash;
|
|
26
|
+
// Walk the tree path, collecting existing entries at each level
|
|
27
|
+
return updateSubtreeRecursive(rootTree, parts, 0, newSubtreeHash, mergeMode, cwd);
|
|
28
|
+
}
|
|
29
|
+
async function updateSubtreeRecursive(currentTree, pathParts, depth, newSubtreeHash, mergeMode, cwd) {
|
|
30
|
+
const targetName = pathParts[depth];
|
|
31
|
+
const isLeaf = depth === pathParts.length - 1;
|
|
32
|
+
// Get existing entries at this tree level
|
|
33
|
+
let existingEntries = [];
|
|
34
|
+
if (currentTree) {
|
|
35
|
+
try {
|
|
36
|
+
existingEntries = await lsTree(currentTree, undefined, cwd);
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
// Tree doesn't exist or is empty
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
if (isLeaf) {
|
|
43
|
+
let finalHash = newSubtreeHash;
|
|
44
|
+
// If merge mode, combine existing and new entries
|
|
45
|
+
if (mergeMode === 1 /* MergeMode.MergeKeepExisting */) {
|
|
46
|
+
const existingEntry = existingEntries.find(e => e.name === targetName);
|
|
47
|
+
if (existingEntry && existingEntry.type === 'tree') {
|
|
48
|
+
finalHash = await mergeTreesKeepExisting(existingEntry.hash, newSubtreeHash, cwd);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
// Replace or add the entry at this level
|
|
52
|
+
const filtered = existingEntries.filter(e => e.name !== targetName);
|
|
53
|
+
filtered.push({
|
|
54
|
+
mode: '040000',
|
|
55
|
+
type: 'tree',
|
|
56
|
+
hash: finalHash,
|
|
57
|
+
name: targetName,
|
|
58
|
+
});
|
|
59
|
+
return mktree(filtered, cwd);
|
|
60
|
+
}
|
|
61
|
+
// Intermediate level: find or create the subtree
|
|
62
|
+
const existingEntry = existingEntries.find(e => e.name === targetName);
|
|
63
|
+
const childTree = existingEntry?.hash ?? '';
|
|
64
|
+
const updatedChildHash = await updateSubtreeRecursive(childTree, pathParts, depth + 1, newSubtreeHash, mergeMode, cwd);
|
|
65
|
+
const filtered = existingEntries.filter(e => e.name !== targetName);
|
|
66
|
+
filtered.push({
|
|
67
|
+
mode: '040000',
|
|
68
|
+
type: 'tree',
|
|
69
|
+
hash: updatedChildHash,
|
|
70
|
+
name: targetName,
|
|
71
|
+
});
|
|
72
|
+
return mktree(filtered, cwd);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Merge two trees, keeping existing entries when conflicts arise.
|
|
76
|
+
*/
|
|
77
|
+
async function mergeTreesKeepExisting(existingTreeHash, newTreeHash, cwd) {
|
|
78
|
+
const existingEntries = await lsTree(existingTreeHash, undefined, cwd);
|
|
79
|
+
const newEntries = await lsTree(newTreeHash, undefined, cwd);
|
|
80
|
+
const existingNames = new Set(existingEntries.map(e => e.name));
|
|
81
|
+
const merged = [...existingEntries];
|
|
82
|
+
for (const entry of newEntries) {
|
|
83
|
+
if (!existingNames.has(entry.name)) {
|
|
84
|
+
merged.push(entry);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return mktree(merged, cwd);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Apply a batch of file-level changes to a tree.
|
|
91
|
+
* Returns the hash of the new root tree.
|
|
92
|
+
*/
|
|
93
|
+
export async function applyTreeChanges(rootTree, changes, cwd) {
|
|
94
|
+
if (changes.length === 0)
|
|
95
|
+
return rootTree;
|
|
96
|
+
// Get existing entries
|
|
97
|
+
let entries = [];
|
|
98
|
+
if (rootTree) {
|
|
99
|
+
try {
|
|
100
|
+
entries = await lsTree(rootTree, undefined, cwd);
|
|
101
|
+
}
|
|
102
|
+
catch {
|
|
103
|
+
// Empty tree
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
for (const change of changes) {
|
|
107
|
+
if (change.deleted) {
|
|
108
|
+
entries = entries.filter(e => e.name !== change.path);
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
const existing = entries.findIndex(e => e.name === change.path);
|
|
112
|
+
const entry = {
|
|
113
|
+
mode: change.mode,
|
|
114
|
+
type: change.mode === '040000' ? 'tree' : 'blob',
|
|
115
|
+
hash: change.hash,
|
|
116
|
+
name: change.path,
|
|
117
|
+
};
|
|
118
|
+
if (existing >= 0) {
|
|
119
|
+
entries[existing] = entry;
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
entries.push(entry);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return mktree(entries, cwd);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Create a tree from a map of file paths to content strings.
|
|
130
|
+
* Useful for building trees from scratch in tests.
|
|
131
|
+
*/
|
|
132
|
+
export async function createTreeFromMap(files, cwd) {
|
|
133
|
+
const entries = [];
|
|
134
|
+
for (const [name, content] of Object.entries(files)) {
|
|
135
|
+
const hash = await hashObject(content, cwd);
|
|
136
|
+
entries.push({
|
|
137
|
+
mode: '100644',
|
|
138
|
+
type: 'blob',
|
|
139
|
+
hash,
|
|
140
|
+
name,
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
return mktree(entries, cwd);
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=tree-ops.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree-ops.js","sourceRoot":"","sources":["../../../src/sessionlog/utils/tree-ops.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,MAAM,EACN,MAAM,EACN,UAAU,GACX,MAAM,sBAAsB,CAAC;AA2B9B,+EAA+E;AAC/E,kBAAkB;AAClB,+EAA+E;AAE/E;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,QAAgB,EAChB,WAAmB,EACnB,cAAsB,EACtB,wC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EAAE,MAAM,CAAC,IAAI;gBACjB,IAAI,EAAE,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM;gBAChD,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,IAAI,EAAE,MAAM,CAAC,IAAI;aAClB,CAAC;YACF,IAAI,QAAQ,IAAI,CAAC,EAAE,CAAC;gBAClB,OAAO,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC;YAC5B,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACtB,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AAC9B,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,KAA6B,EAC7B,GAAY;IAEZ,MAAM,OAAO,GAAgB,EAAE,CAAC;IAEhC,KAAK,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACpD,MAAM,IAAI,GAAG,MAAM,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QAC5C,OAAO,CAAC,IAAI,CAAC;YACX,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,MAAM;YACZ,IAAI;YACJ,IAAI;SACL,CAAC,CAAC;IACL,CAAC;IAED,OAAO,MAAM,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TTY Interaction Helpers
|
|
3
|
+
*
|
|
4
|
+
* Utilities for detecting and interacting with a controlling terminal.
|
|
5
|
+
* Important for git hooks which need user confirmation even when stdin
|
|
6
|
+
* is redirected.
|
|
7
|
+
*
|
|
8
|
+
* Ported from Go: strategy/manual_commit_hooks.go
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Detect if a controlling terminal (TTY) is available.
|
|
12
|
+
*
|
|
13
|
+
* Respects environment variables:
|
|
14
|
+
* - `SESSIONLOG_TEST_TTY=1` forces TTY detection to true (for testing)
|
|
15
|
+
* - `GEMINI_CLI=1` forces TTY detection to false (Gemini runs non-interactively)
|
|
16
|
+
*/
|
|
17
|
+
export declare function hasTTY(): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Prompt the user for yes/no confirmation via /dev/tty.
|
|
20
|
+
*
|
|
21
|
+
* This works even when stdin is redirected (important for git hooks).
|
|
22
|
+
* Returns false if no TTY is available or the user declines.
|
|
23
|
+
*/
|
|
24
|
+
export declare function askConfirmTTY(prompt: string): Promise<boolean>;
|
|
25
|
+
//# sourceMappingURL=tty.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tty.d.ts","sourceRoot":"","sources":["../../../src/sessionlog/utils/tty.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH;;;;;;GAMG;AACH,wBAAgB,MAAM,IAAI,OAAO,CAahC;AAED;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CA8BpE"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TTY Interaction Helpers
|
|
3
|
+
*
|
|
4
|
+
* Utilities for detecting and interacting with a controlling terminal.
|
|
5
|
+
* Important for git hooks which need user confirmation even when stdin
|
|
6
|
+
* is redirected.
|
|
7
|
+
*
|
|
8
|
+
* Ported from Go: strategy/manual_commit_hooks.go
|
|
9
|
+
*/
|
|
10
|
+
import * as fs from 'node:fs';
|
|
11
|
+
import * as readline from 'node:readline';
|
|
12
|
+
/**
|
|
13
|
+
* Detect if a controlling terminal (TTY) is available.
|
|
14
|
+
*
|
|
15
|
+
* Respects environment variables:
|
|
16
|
+
* - `SESSIONLOG_TEST_TTY=1` forces TTY detection to true (for testing)
|
|
17
|
+
* - `GEMINI_CLI=1` forces TTY detection to false (Gemini runs non-interactively)
|
|
18
|
+
*/
|
|
19
|
+
export function hasTTY() {
|
|
20
|
+
// Check environment overrides
|
|
21
|
+
if (process.env.SESSIONLOG_TEST_TTY === '1')
|
|
22
|
+
return true;
|
|
23
|
+
if (process.env.GEMINI_CLI === '1')
|
|
24
|
+
return false;
|
|
25
|
+
// Try opening /dev/tty — this works even when stdin is redirected
|
|
26
|
+
try {
|
|
27
|
+
const fd = fs.openSync('/dev/tty', 'r');
|
|
28
|
+
fs.closeSync(fd);
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Prompt the user for yes/no confirmation via /dev/tty.
|
|
37
|
+
*
|
|
38
|
+
* This works even when stdin is redirected (important for git hooks).
|
|
39
|
+
* Returns false if no TTY is available or the user declines.
|
|
40
|
+
*/
|
|
41
|
+
export async function askConfirmTTY(prompt) {
|
|
42
|
+
if (!hasTTY())
|
|
43
|
+
return false;
|
|
44
|
+
let ttyIn;
|
|
45
|
+
let ttyOut;
|
|
46
|
+
try {
|
|
47
|
+
ttyIn = fs.createReadStream('/dev/tty');
|
|
48
|
+
ttyOut = fs.createWriteStream('/dev/tty');
|
|
49
|
+
const rl = readline.createInterface({
|
|
50
|
+
input: ttyIn,
|
|
51
|
+
output: ttyOut,
|
|
52
|
+
});
|
|
53
|
+
const result = await new Promise((resolve) => {
|
|
54
|
+
rl.question(`${prompt} [y/N] `, (answer) => {
|
|
55
|
+
rl.close();
|
|
56
|
+
const normalized = answer.trim().toLowerCase();
|
|
57
|
+
resolve(normalized === 'y' || normalized === 'yes');
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
return result;
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
finally {
|
|
66
|
+
ttyIn?.destroy();
|
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,IAAI,OAAO,CAAU,CAAC,OAAO,EAAE,EAAE;YACpD,EAAE,CAAC,QAAQ,CAAC,GAAG,MAAM,SAAS,EAAE,CAAC,MAAM,EAAE,EAAE;gBACzC,EAAE,CAAC,KAAK,EAAE,CAAC;gBACX,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;gBAC/C,OAAO,CAAC,UAAU,KAAK,GAAG,IAAI,UAAU,KAAK,KAAK,CAAC,CAAC;YACtD,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;YAAS,CAAC;QACT,KAAK,EAAE,OAAO,EAAE,CAAC;QACjB,MAAM,EAAE,OAAO,EAAE,CAAC;IACpB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Input Validation
|
|
3
|
+
*
|
|
4
|
+
* Validates user-supplied IDs to prevent path traversal attacks when
|
|
5
|
+
* IDs are used to construct file paths (session state, metadata, etc.).
|
|
6
|
+
*
|
|
7
|
+
* This module has no dependencies to avoid import cycles.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Validate that a session ID doesn't contain path separators.
|
|
11
|
+
* Prevents path traversal when session IDs are used in file paths.
|
|
12
|
+
*/
|
|
13
|
+
export declare function validateSessionID(id: string): void;
|
|
14
|
+
/**
|
|
15
|
+
* Validate that a tool use ID contains only safe characters for paths.
|
|
16
|
+
* Tool use IDs can be UUIDs or prefixed identifiers like "toolu_xxx".
|
|
17
|
+
* Empty is allowed (optional field).
|
|
18
|
+
*/
|
|
19
|
+
export declare function validateToolUseID(id: string): void;
|
|
20
|
+
/**
|
|
21
|
+
* Validate that an agent ID contains only safe characters for paths.
|
|
22
|
+
* Empty is allowed (optional field).
|
|
23
|
+
*/
|
|
24
|
+
export declare function validateAgentID(id: string): void;
|
|
25
|
+
/**
|
|
26
|
+
* Validate that an agent session ID contains only safe characters for paths.
|
|
27
|
+
* Agent session IDs can be UUIDs (Claude Code), test identifiers, or other
|
|
28
|
+
* formats depending on the agent.
|
|
29
|
+
*/
|
|
30
|
+
export declare function validateAgentSessionID(id: string): void;
|
|
31
|
+
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../src/sessionlog/utils/validation.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAOlD;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAOlD;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAOhD;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CASvD"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Input Validation
|
|
3
|
+
*
|
|
4
|
+
* Validates user-supplied IDs to prevent path traversal attacks when
|
|
5
|
+
* IDs are used to construct file paths (session state, metadata, etc.).
|
|
6
|
+
*
|
|
7
|
+
* This module has no dependencies to avoid import cycles.
|
|
8
|
+
*/
|
|
9
|
+
/** Matches alphanumeric characters, underscores, and hyphens only. */
|
|
10
|
+
const pathSafeRegex = /^[a-zA-Z0-9_-]+$/;
|
|
11
|
+
/**
|
|
12
|
+
* Validate that a session ID doesn't contain path separators.
|
|
13
|
+
* Prevents path traversal when session IDs are used in file paths.
|
|
14
|
+
*/
|
|
15
|
+
export function validateSessionID(id) {
|
|
16
|
+
if (!id) {
|
|
17
|
+
throw new Error('session ID cannot be empty');
|
|
18
|
+
}
|
|
19
|
+
if (id.includes('/') || id.includes('\\')) {
|
|
20
|
+
throw new Error(`invalid session ID "${id}": contains path separators`);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Validate that a tool use ID contains only safe characters for paths.
|
|
25
|
+
* Tool use IDs can be UUIDs or prefixed identifiers like "toolu_xxx".
|
|
26
|
+
* Empty is allowed (optional field).
|
|
27
|
+
*/
|
|
28
|
+
export function validateToolUseID(id) {
|
|
29
|
+
if (!id)
|
|
30
|
+
return;
|
|
31
|
+
if (!pathSafeRegex.test(id)) {
|
|
32
|
+
throw new Error(`invalid tool use ID "${id}": must be alphanumeric with underscores/hyphens only`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Validate that an agent ID contains only safe characters for paths.
|
|
37
|
+
* Empty is allowed (optional field).
|
|
38
|
+
*/
|
|
39
|
+
export function validateAgentID(id) {
|
|
40
|
+
if (!id)
|
|
41
|
+
return;
|
|
42
|
+
if (!pathSafeRegex.test(id)) {
|
|
43
|
+
throw new Error(`invalid agent ID "${id}": must be alphanumeric with underscores/hyphens only`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Validate that an agent session ID contains only safe characters for paths.
|
|
48
|
+
* Agent session IDs can be UUIDs (Claude Code), test identifiers, or other
|
|
49
|
+
* formats depending on the agent.
|
|
50
|
+
*/
|
|
51
|
+
export function validateAgentSessionID(id) {
|
|
52
|
+
if (!id) {
|
|
53
|
+
throw new Error('agent session ID cannot be empty');
|
|
54
|
+
}
|
|
55
|
+
if (!pathSafeRegex.test(id)) {
|
|
56
|
+
throw new Error(`invalid agent session ID "${id}": must be alphanumeric with underscores/hyphens only`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../../src/sessionlog/utils/validation.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;A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2
|
+
* Git Worktree Utilities
|
|
3
|
+
*
|
|
4
|
+
* Provides detection and identification of git worktrees.
|
|
5
|
+
* Linked worktrees have `.git` as a file pointing to the main repository,
|
|
6
|
+
* while the main worktree has `.git` as a directory.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Get the internal git worktree identifier for the given path.
|
|
10
|
+
*
|
|
11
|
+
* - For the main worktree (where .git is a directory), returns empty string.
|
|
12
|
+
* - For linked worktrees (where .git is a file), extracts the name from
|
|
13
|
+
* `.git/worktrees/<name>/` path. This name is stable across `git worktree move`.
|
|
14
|
+
*/
|
|
15
|
+
export declare function getWorktreeID(worktreePath: string): Promise<string>;
|
|
16
|
+
//# sourceMappingURL=worktree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worktree.d.ts","sourceRoot":"","sources":["../../../src/sessionlog/utils/worktree.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH;;;;;;GAMG;AACH,wBAAsB,aAAa,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAuCzE"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git Worktree Utilities
|
|
3
|
+
*
|
|
4
|
+
* Provides detection and identification of git worktrees.
|
|
5
|
+
* Linked worktrees have `.git` as a file pointing to the main repository,
|
|
6
|
+
* while the main worktree has `.git` as a directory.
|
|
7
|
+
*/
|
|
8
|
+
import * as fs from 'node:fs';
|
|
9
|
+
import * as path from 'node:path';
|
|
10
|
+
/**
|
|
11
|
+
* Get the internal git worktree identifier for the given path.
|
|
12
|
+
*
|
|
13
|
+
* - For the main worktree (where .git is a directory), returns empty string.
|
|
14
|
+
* - For linked worktrees (where .git is a file), extracts the name from
|
|
15
|
+
* `.git/worktrees/<name>/` path. This name is stable across `git worktree move`.
|
|
16
|
+
*/
|
|
17
|
+
export async function getWorktreeID(worktreePath) {
|
|
18
|
+
const gitPath = path.join(worktreePath, '.git');
|
|
19
|
+
let stat;
|
|
20
|
+
try {
|
|
21
|
+
stat = await fs.promises.stat(gitPath);
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
throw new Error(`failed to stat .git: ${gitPath}`);
|
|
25
|
+
}
|
|
26
|
+
// Main worktree has .git as a directory
|
|
27
|
+
if (stat.isDirectory()) {
|
|
28
|
+
return '';
|
|
29
|
+
}
|
|
30
|
+
// Linked worktree has .git as a file with content: "gitdir: /path/to/.git/worktrees/<name>"
|
|
31
|
+
const content = await fs.promises.readFile(gitPath, 'utf-8');
|
|
32
|
+
const line = content.trim();
|
|
33
|
+
if (!line.startsWith('gitdir: ')) {
|
|
34
|
+
throw new Error(`invalid .git file format: ${line}`);
|
|
35
|
+
}
|
|
36
|
+
const gitdir = line.slice('gitdir: '.length);
|
|
37
|
+
// Extract worktree name from path like /repo/.git/worktrees/<name>
|
|
38
|
+
const marker = '.git/worktrees/';
|
|
39
|
+
const idx = gitdir.indexOf(marker);
|
|
40
|
+
if (idx === -1) {
|
|
41
|
+
throw new Error(`unexpected gitdir format (no worktrees): ${gitdir}`);
|
|
42
|
+
}
|
|
43
|
+
let worktreeID = gitdir.slice(idx + marker.length);
|
|
44
|
+
// Remove trailing slashes if any
|
|
45
|
+
if (worktreeID.endsWith('/')) {
|
|
46
|
+
worktreeID = worktreeID.slice(0, -1);
|
|
47
|
+
}
|
|
48
|
+
return worktreeID;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=worktree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worktree.js","sourceRoot":"","sources":["../../../src/sessionlog/utils/worktree.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,YAAoB;IACtD,MAAM,OAAO,G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AAC,CAAC,CAAC,CAAC;IACvC,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqlite-schema.d.ts","sourceRoot":"","sources":["../../src/storage/sqlite-schema.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,eAAO,MAAM,kBAAkB,mzBA2C9B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB,iMAOlC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,kRAa9B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB,4GAKpC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,0BAA0B,iHAKtC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,UAW1B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,mXAc7B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"sqlite-schema.d.ts","sourceRoot":"","sources":["../../src/storage/sqlite-schema.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,eAAO,MAAM,kBAAkB,mzBA2C9B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB,iMAOlC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,kRAa9B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB,4GAKpC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,0BAA0B,iHAKtC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,UAW1B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,mXAc7B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,UAAU,UAMtB,CAAC;AAEF;;GAEG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE;IAAE,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE,GAAG,IAAI,CAYzE;AAED;;GAEG;AACH,eAAO,MAAM,UAAU,UAQtB,CAAC"}
|
|
@@ -136,6 +136,8 @@ export const MIGRATIONS = [
|
|
|
136
136
|
// Add metadata and cached_at columns to edges table (v1.1.0)
|
|
137
137
|
`ALTER TABLE edges ADD COLUMN metadata TEXT`,
|
|
138
138
|
`ALTER TABLE edges ADD COLUMN cached_at TEXT`,
|
|
139
|
+
// Add metadata column to nodes table (v1.2.0) — for provider reconciliation
|
|
140
|
+
`ALTER TABLE nodes ADD COLUMN metadata TEXT`,
|
|
139
141
|
];
|
|
140
142
|
/**
|
|
141
143
|
* Apply migrations safely (ignores "duplicate column" errors)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqlite-schema.js","sourceRoot":"","sources":["../../src/storage/sqlite-schema.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2CjC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG;;;;;;;CAOrC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;;;;;;;;;;;;;CAajC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG;;;;;CAKvC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG;;;;;CAKzC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,0DAA0D;IAC1D,8DAA8D;IAC9D,iEAAiE;IACjE,kEAAkE;IAClE,gEAAgE;IAChE,6DAA6D;IAC7D,yDAAyD;IACzD,0DAA0D;IAC1D,8DAA8D;IAC9D,oEAAoE;CACrE,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;;;;;;;;;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,KAAK,EAAE,CAAC;YACf,oEAAoE;YACpE,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACvE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAAC,EAAE,CAAC;gBAC/C,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,kBAAkB;IAClB,sBAAsB;IACtB,kBAAkB;IAClB,wBAAwB;IACxB,0BAA0B;IAC1B,GAAG,cAAc;IACjB,iBAAiB;CAClB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqlite.d.ts","sourceRoot":"","sources":["../../src/storage/sqlite.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAKvE;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;IAEb,6DAA6D;IAC7D,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;
|
|
1
|
+
{"version":3,"file":"sqlite.d.ts","sourceRoot":"","sources":["../../src/storage/sqlite.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,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AAG,eAAe,CAOvE"}
|
package/dist/storage/sqlite.js
CHANGED
|
@@ -69,6 +69,14 @@ function rowToNode(row) {
|
|
|
69
69
|
node.location = row.location;
|
|
70
70
|
if (row.branch != null)
|
|
71
71
|
node.branch = row.branch;
|
|
72
|
+
if (row.metadata != null) {
|
|
73
|
+
try {
|
|
74
|
+
node.metadata = JSON.parse(row.metadata);
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
// Ignore parse errors
|
|
78
|
+
}
|
|
79
|
+
}
|
|
72
80
|
return node;
|
|
73
81
|
}
|
|
74
82
|
/**
|
|
@@ -163,13 +171,13 @@ export class SQLitePersister {
|
|
|
163
171
|
assignee, parent_id, source, archived, created_at, updated_at,
|
|
164
172
|
target_id, feedback_type, thread_id, reply_to_id, resolved, dismissed,
|
|
165
173
|
uri, materialized, cached_at, stale, external_status,
|
|
166
|
-
claimed_by, claimed_at, lock_until, location, branch
|
|
174
|
+
claimed_by, claimed_at, lock_until, location, branch, metadata
|
|
167
175
|
) VALUES (
|
|
168
176
|
@id, @uuid, @type, @title, @content, @content_hash, @status, @priority,
|
|
169
177
|
@assignee, @parent_id, @source, @archived, @created_at, @updated_at,
|
|
170
178
|
@target_id, @feedback_type, @thread_id, @reply_to_id, @resolved, @dismissed,
|
|
171
179
|
@uri, @materialized, @cached_at, @stale, @external_status,
|
|
172
|
-
@claimed_by, @claimed_at, @lock_until, @location, @branch
|
|
180
|
+
@claimed_by, @claimed_at, @lock_until, @location, @branch, @metadata
|
|
173
181
|
)
|
|
174
182
|
`);
|
|
175
183
|
stmt.run({
|
|
@@ -203,6 +211,7 @@ export class SQLitePersister {
|
|
|
203
211
|
lock_until: node.lock_until ?? null,
|
|
204
212
|
location: node.location ?? null,
|
|
205
213
|
branch: node.branch ?? null,
|
|
214
|
+
metadata: node.metadata ? JSON.stringify(node.metadata) : null,
|
|
206
215
|
});
|
|
207
216
|
}
|
|
208
217
|
async getNode(id) {
|
|
@@ -495,13 +504,13 @@ export class SQLitePersister {
|
|
|
495
504
|
assignee, parent_id, source, archived, created_at, updated_at,
|
|
496
505
|
target_id, feedback_type, thread_id, reply_to_id, resolved, dismissed,
|
|
497
506
|
uri, materialized, cached_at, stale, external_status,
|
|
498
|
-
claimed_by, claimed_at, lock_until, location, branch
|
|
507
|
+
claimed_by, claimed_at, lock_until, location, branch, metadata
|
|
499
508
|
) VALUES (
|
|
500
509
|
@id, @uuid, @type, @title, @content, @content_hash, @status, @priority,
|
|
501
510
|
@assignee, @parent_id, @source, @archived, @created_at, @updated_at,
|
|
502
511
|
@target_id, @feedback_type, @thread_id, @reply_to_id, @resolved, @dismissed,
|
|
503
512
|
@uri, @materialized, @cached_at, @stale, @external_status,
|
|
504
|
-
@claimed_by, @claimed_at, @lock_until, @location, @branch
|
|
513
|
+
@claimed_by, @claimed_at, @lock_until, @location, @branch, @metadata
|
|
505
514
|
)
|
|
506
515
|
`);
|
|
507
516
|
stmt.run({
|
|
@@ -535,6 +544,7 @@ export class SQLitePersister {
|
|
|
535
544
|
lock_until: node.lock_until ?? null,
|
|
536
545
|
location: node.location ?? null,
|
|
537
546
|
branch: node.branch ?? null,
|
|
547
|
+
metadata: node.metadata ? JSON.stringify(node.metadata) : null,
|
|
538
548
|
});
|
|
539
549
|
}
|
|
540
550
|
updateNodeSync(id, updates) {
|
|
@@ -568,6 +578,7 @@ export class SQLitePersister {
|
|
|
568
578
|
'lock_until',
|
|
569
579
|
'location',
|
|
570
580
|
'branch',
|
|
581
|
+
'metadata',
|
|
571
582
|
];
|
|
572
583
|
for (const field of updateableFields) {
|
|
573
584
|
if (field in updates) {
|
|
@@ -576,6 +587,9 @@ export class SQLitePersister {
|
|
|
576
587
|
if (typeof value === 'boolean') {
|
|
577
588
|
value = value ? 1 : 0;
|
|
578
589
|
}
|
|
590
|
+
else if (field === 'metadata' && typeof value === 'object' && value !== null) {
|
|
591
|
+
value = JSON.stringify(value);
|
|
592
|
+
}
|
|
579
593
|
values[field] = value ?? null;
|
|
580
594
|
}
|
|
581
595
|
}
|