@bastani/atomic 0.9.9-alpha.1 → 0.9.9-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/builtin/cursor/CHANGELOG.md +6 -0
- package/dist/builtin/cursor/package.json +3 -3
- package/dist/builtin/intercom/CHANGELOG.md +7 -0
- package/dist/builtin/intercom/package.json +3 -3
- package/dist/builtin/mcp/CHANGELOG.md +7 -0
- package/dist/builtin/mcp/package.json +4 -4
- package/dist/builtin/subagents/CHANGELOG.md +7 -0
- package/dist/builtin/subagents/package.json +5 -5
- package/dist/builtin/web-access/CHANGELOG.md +7 -0
- package/dist/builtin/web-access/package.json +3 -3
- package/dist/builtin/web-access/web-search-tool.ts +1 -2
- package/dist/builtin/workflows/CHANGELOG.md +7 -0
- package/dist/builtin/workflows/package.json +3 -3
- package/dist/builtin/workflows/src/shared/serializable.ts +1 -1
- package/dist/bun/cli.d.ts.map +1 -1
- package/dist/bun/internal-intercom-broker.d.ts.map +1 -1
- package/dist/bun/register-bedrock.d.ts.map +1 -1
- package/dist/bun/restore-sandbox-env.d.ts.map +1 -1
- package/dist/bun/split-loader.d.ts.map +1 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/config-selector.d.ts.map +1 -1
- package/dist/cli/file-processor.d.ts.map +1 -1
- package/dist/cli/initial-message.d.ts.map +1 -1
- package/dist/cli/list-models.d.ts.map +1 -1
- package/dist/cli/project-trust.d.ts.map +1 -1
- package/dist/cli/session-picker.d.ts.map +1 -1
- package/dist/cli/startup-ui.d.ts.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/config-self-update.d.ts.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/core/agent-session-accessors.d.ts.map +1 -1
- package/dist/core/agent-session-auto-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-bash.d.ts.map +1 -1
- package/dist/core/agent-session-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-events.d.ts.map +1 -1
- package/dist/core/agent-session-export.d.ts.map +1 -1
- package/dist/core/agent-session-extension-bindings.d.ts.map +1 -1
- package/dist/core/agent-session-message-queue.d.ts.map +1 -1
- package/dist/core/agent-session-methods.d.ts.map +1 -1
- package/dist/core/agent-session-models.d.ts.map +1 -1
- package/dist/core/agent-session-prompt.d.ts.map +1 -1
- package/dist/core/agent-session-retry.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-skill-block.d.ts.map +1 -1
- package/dist/core/agent-session-state.d.ts.map +1 -1
- package/dist/core/agent-session-tool-hooks.d.ts.map +1 -1
- package/dist/core/agent-session-tool-registry.d.ts.map +1 -1
- package/dist/core/agent-session-tree.d.ts.map +1 -1
- package/dist/core/agent-session-types.d.ts.map +1 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/anthropic-thinking-guard.d.ts.map +1 -1
- package/dist/core/async/format.d.ts.map +1 -1
- package/dist/core/async/job-manager.d.ts.map +1 -1
- package/dist/core/async/session-manager.d.ts.map +1 -1
- package/dist/core/async/types.d.ts.map +1 -1
- package/dist/core/atomic-guide-command.d.ts.map +1 -1
- package/dist/core/auth-guidance.d.ts.map +1 -1
- package/dist/core/auth-storage-backends.d.ts.map +1 -1
- package/dist/core/auth-storage.d.ts +4 -0
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/bash-executor.d.ts.map +1 -1
- package/dist/core/builtin-packages.d.ts.map +1 -1
- package/dist/core/codex-fast-mode.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/compaction-boundary.d.ts.map +1 -1
- package/dist/core/compaction/compaction-parameters.d.ts.map +1 -1
- package/dist/core/compaction/compaction-runner.d.ts.map +1 -1
- package/dist/core/compaction/compaction-types.d.ts.map +1 -1
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/deleted-ranges.d.ts.map +1 -1
- package/dist/core/compaction/index.d.ts.map +1 -1
- package/dist/core/compaction/range-planner.d.ts.map +1 -1
- package/dist/core/compaction/transcript-serialization.d.ts.map +1 -1
- package/dist/core/compaction/utils.d.ts.map +1 -1
- package/dist/core/context-window.d.ts.map +1 -1
- package/dist/core/copilot-anthropic-sse-repair.d.ts.map +1 -1
- package/dist/core/copilot-errors.d.ts.map +1 -1
- package/dist/core/copilot-gemini-payload-sanitizer.d.ts.map +1 -1
- package/dist/core/copilot-gemini-reasoning.d.ts.map +1 -1
- package/dist/core/copilot-gemini-tool-arguments.d.ts.map +1 -1
- package/dist/core/copilot-hosts.d.ts.map +1 -1
- package/dist/core/copilot-model-catalog.d.ts.map +1 -1
- package/dist/core/copilot-model-static-fallbacks.d.ts.map +1 -1
- package/dist/core/copilot-model-synthesis.d.ts.map +1 -1
- package/dist/core/defaults.d.ts.map +1 -1
- package/dist/core/diagnostics.d.ts.map +1 -1
- package/dist/core/event-bus.d.ts.map +1 -1
- package/dist/core/exec.d.ts.map +1 -1
- package/dist/core/experimental.d.ts.map +1 -1
- package/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
- package/dist/core/export-html/index.d.ts.map +1 -1
- package/dist/core/export-html/template-script.d.ts.map +1 -1
- package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
- package/dist/core/extensions/agent-events.d.ts.map +1 -1
- package/dist/core/extensions/api-types.d.ts.map +1 -1
- package/dist/core/extensions/command-types.d.ts.map +1 -1
- package/dist/core/extensions/context-types.d.ts.map +1 -1
- package/dist/core/extensions/event-results.d.ts.map +1 -1
- package/dist/core/extensions/event-types.d.ts.map +1 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/loader-api.d.ts.map +1 -1
- package/dist/core/extensions/loader-core.d.ts.map +1 -1
- package/dist/core/extensions/loader-discovery.d.ts.map +1 -1
- package/dist/core/extensions/loader-resources.d.ts.map +1 -1
- package/dist/core/extensions/loader-runtime.d.ts.map +1 -1
- package/dist/core/extensions/loader-virtual-modules.d.ts.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/message-types.d.ts.map +1 -1
- package/dist/core/extensions/provider-types.d.ts.map +1 -1
- package/dist/core/extensions/reactive-widget.d.ts.map +1 -1
- package/dist/core/extensions/runner-context.d.ts.map +1 -1
- package/dist/core/extensions/runner-events.d.ts.map +1 -1
- package/dist/core/extensions/runner-handlers.d.ts.map +1 -1
- package/dist/core/extensions/runner-project-trust.d.ts.map +1 -1
- package/dist/core/extensions/runner-registries.d.ts.map +1 -1
- package/dist/core/extensions/runner-shortcuts.d.ts.map +1 -1
- package/dist/core/extensions/runner-ui.d.ts.map +1 -1
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runtime-types.d.ts.map +1 -1
- package/dist/core/extensions/session-events.d.ts.map +1 -1
- package/dist/core/extensions/tool-events.d.ts.map +1 -1
- package/dist/core/extensions/tool-types.d.ts.map +1 -1
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/ui-types.d.ts.map +1 -1
- package/dist/core/extensions/wrapper.d.ts.map +1 -1
- package/dist/core/flattened-tool-arguments.d.ts.map +1 -1
- package/dist/core/footer-data-provider.d.ts.map +1 -1
- package/dist/core/http-dispatcher.d.ts.map +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/messages.d.ts.map +1 -1
- package/dist/core/model-registry-auth.d.ts.map +1 -1
- package/dist/core/model-registry-builtins.d.ts.map +1 -1
- package/dist/core/model-registry-builtins.js.map +1 -1
- package/dist/core/model-registry-custom-loader.d.ts.map +1 -1
- package/dist/core/model-registry-custom-loader.js.map +1 -1
- package/dist/core/model-registry-dynamic.d.ts.map +1 -1
- package/dist/core/model-registry-loader.d.ts.map +1 -1
- package/dist/core/model-registry-schemas.d.ts +65 -13
- package/dist/core/model-registry-schemas.d.ts.map +1 -1
- package/dist/core/model-registry-schemas.js +5 -1
- package/dist/core/model-registry-schemas.js.map +1 -1
- package/dist/core/model-registry-types.d.ts.map +1 -1
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-resolver-cli.d.ts.map +1 -1
- package/dist/core/model-resolver-defaults.d.ts.map +1 -1
- package/dist/core/model-resolver-initial.d.ts.map +1 -1
- package/dist/core/model-resolver-patterns.d.ts.map +1 -1
- package/dist/core/model-resolver-scope.d.ts.map +1 -1
- package/dist/core/model-resolver-types.d.ts.map +1 -1
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/openai-responses-payload-sanitizer.d.ts.map +1 -1
- package/dist/core/output-guard.d.ts.map +1 -1
- package/dist/core/package-manager-auto-resources.d.ts.map +1 -1
- package/dist/core/package-manager-command.d.ts.map +1 -1
- package/dist/core/package-manager-constants.d.ts.map +1 -1
- package/dist/core/package-manager-env.d.ts.map +1 -1
- package/dist/core/package-manager-git.d.ts.map +1 -1
- package/dist/core/package-manager-manifest.d.ts.map +1 -1
- package/dist/core/package-manager-npm.d.ts.map +1 -1
- package/dist/core/package-manager-operations.d.ts.map +1 -1
- package/dist/core/package-manager-paths.d.ts.map +1 -1
- package/dist/core/package-manager-progress.d.ts.map +1 -1
- package/dist/core/package-manager-resolver.d.ts.map +1 -1
- package/dist/core/package-manager-resource-accumulator.d.ts.map +1 -1
- package/dist/core/package-manager-resource-collector.d.ts.map +1 -1
- package/dist/core/package-manager-resource-files.d.ts.map +1 -1
- package/dist/core/package-manager-resource-patterns.d.ts.map +1 -1
- package/dist/core/package-manager-settings.d.ts.map +1 -1
- package/dist/core/package-manager-source.d.ts.map +1 -1
- package/dist/core/package-manager-types.d.ts.map +1 -1
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/project-trust.d.ts.map +1 -1
- package/dist/core/prompt-templates-async.d.ts.map +1 -1
- package/dist/core/prompt-templates.d.ts.map +1 -1
- package/dist/core/provider-attribution.d.ts.map +1 -1
- package/dist/core/provider-context-usage.d.ts.map +1 -1
- package/dist/core/provider-display-names.d.ts.map +1 -1
- package/dist/core/resolve-config-value.d.ts.map +1 -1
- package/dist/core/resource-loader-assets.d.ts.map +1 -1
- package/dist/core/resource-loader-context-files.d.ts.map +1 -1
- package/dist/core/resource-loader-core.d.ts.map +1 -1
- package/dist/core/resource-loader-discovery.d.ts.map +1 -1
- package/dist/core/resource-loader-extensions.d.ts.map +1 -1
- package/dist/core/resource-loader-helpers.d.ts.map +1 -1
- package/dist/core/resource-loader-internals.d.ts.map +1 -1
- package/dist/core/resource-loader-package-resources.d.ts.map +1 -1
- package/dist/core/resource-loader-paths.d.ts.map +1 -1
- package/dist/core/resource-loader-reload.d.ts.map +1 -1
- package/dist/core/resource-loader-source-info.d.ts.map +1 -1
- package/dist/core/resource-loader-types.d.ts.map +1 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/sdk-exports.d.ts.map +1 -1
- package/dist/core/sdk-types.d.ts.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/session-cwd.d.ts.map +1 -1
- package/dist/core/session-entry-normalization.d.ts.map +1 -1
- package/dist/core/session-manager-archive.d.ts.map +1 -1
- package/dist/core/session-manager-classification.d.ts.map +1 -1
- package/dist/core/session-manager-core.d.ts.map +1 -1
- package/dist/core/session-manager-entries.d.ts.map +1 -1
- package/dist/core/session-manager-history.d.ts.map +1 -1
- package/dist/core/session-manager-list.d.ts.map +1 -1
- package/dist/core/session-manager-migrations.d.ts.map +1 -1
- package/dist/core/session-manager-paths.d.ts.map +1 -1
- package/dist/core/session-manager-storage.d.ts.map +1 -1
- package/dist/core/session-manager-types.d.ts.map +1 -1
- package/dist/core/session-manager-validation.d.ts.map +1 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/settings-manager-basic-accessors.d.ts.map +1 -1
- package/dist/core/settings-manager-core.d.ts.map +1 -1
- package/dist/core/settings-manager-internals.d.ts.map +1 -1
- package/dist/core/settings-manager-resource-accessors.d.ts.map +1 -1
- package/dist/core/settings-manager-ui-accessors.d.ts.map +1 -1
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-merge.d.ts.map +1 -1
- package/dist/core/settings-storage.d.ts.map +1 -1
- package/dist/core/settings-types.d.ts.map +1 -1
- package/dist/core/skills-async.d.ts.map +1 -1
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/source-info.d.ts.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/telemetry.d.ts.map +1 -1
- package/dist/core/thinking-blocks.d.ts.map +1 -1
- package/dist/core/timings.d.ts.map +1 -1
- package/dist/core/tools/artifact-protocol.d.ts.map +1 -1
- package/dist/core/tools/artifacts.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/ask-user-question.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/config.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/index.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/state/build-questionnaire.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/state/inline-input.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/state/key-router.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/state/questionnaire-session.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/state/row-intent.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/state/selectors/contract.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/state/selectors/derivations.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/state/selectors/focus.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/state/selectors/projections.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/state/state-reducer.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/state/state.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/tool/format-answer.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/tool/response-envelope.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/tool/types.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/tool/validate-questionnaire.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/view/body-residual-spacer.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/view/component-binding.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/view/components/chat-row-view.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/view/components/multi-select-view.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/view/components/option-list-view.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/view/components/preview/markdown-content-cache.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/view/components/preview/preview-block-renderer.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/view/components/preview/preview-box-renderer.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/view/components/preview/preview-layout-decider.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/view/components/preview/preview-pane.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/view/components/submit-picker.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/view/components/tab-bar.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/view/components/wrapping-select.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/view/dialog-builder.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/view/props-adapter.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/view/stateful-view.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/view/tab-components.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/view/tab-content-strategy.d.ts.map +1 -1
- package/dist/core/tools/bash-async-execution.d.ts.map +1 -1
- package/dist/core/tools/bash-async-jobs.d.ts.map +1 -1
- package/dist/core/tools/bash-async-output.d.ts.map +1 -1
- package/dist/core/tools/bash-interceptor.d.ts.map +1 -1
- package/dist/core/tools/bash-leading-cd.d.ts.map +1 -1
- package/dist/core/tools/bash-pty-native.d.ts.map +1 -1
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/block-resolver.d.ts.map +1 -1
- package/dist/core/tools/conflict-registry.d.ts.map +1 -1
- package/dist/core/tools/directory-tree.d.ts.map +1 -1
- package/dist/core/tools/edit-diff-preserve.d.ts.map +1 -1
- package/dist/core/tools/edit-diff.d.ts.map +1 -1
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/fetch-url.d.ts.map +1 -1
- package/dist/core/tools/file-mutation-queue.d.ts.map +1 -1
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/glob-path-utils.d.ts.map +1 -1
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/hashline-engine/apply.d.ts.map +1 -1
- package/dist/core/tools/hashline-engine/block.d.ts.map +1 -1
- package/dist/core/tools/hashline-engine/diff-preview.d.ts.map +1 -1
- package/dist/core/tools/hashline-engine/format.d.ts.map +1 -1
- package/dist/core/tools/hashline-engine/fs.d.ts.map +1 -1
- package/dist/core/tools/hashline-engine/index.d.ts.map +1 -1
- package/dist/core/tools/hashline-engine/input.d.ts.map +1 -1
- package/dist/core/tools/hashline-engine/messages.d.ts.map +1 -1
- package/dist/core/tools/hashline-engine/mismatch.d.ts.map +1 -1
- package/dist/core/tools/hashline-engine/normalize.d.ts.map +1 -1
- package/dist/core/tools/hashline-engine/parser.d.ts.map +1 -1
- package/dist/core/tools/hashline-engine/patcher.d.ts.map +1 -1
- package/dist/core/tools/hashline-engine/prefixes.d.ts.map +1 -1
- package/dist/core/tools/hashline-engine/recovery.d.ts.map +1 -1
- package/dist/core/tools/hashline-engine/snapshots.d.ts.map +1 -1
- package/dist/core/tools/hashline-engine/stream.d.ts.map +1 -1
- package/dist/core/tools/hashline-engine/tokenizer.d.ts.map +1 -1
- package/dist/core/tools/hashline-engine/types.d.ts.map +1 -1
- package/dist/core/tools/hashline.d.ts.map +1 -1
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/ls.d.ts.map +1 -1
- package/dist/core/tools/notebook.d.ts.map +1 -1
- package/dist/core/tools/output-accumulator.d.ts.map +1 -1
- package/dist/core/tools/oversized-tool-result.d.ts.map +1 -1
- package/dist/core/tools/path-utils.d.ts.map +1 -1
- package/dist/core/tools/read-document-extract.d.ts.map +1 -1
- package/dist/core/tools/read-selectors.d.ts.map +1 -1
- package/dist/core/tools/read-url.d.ts.map +1 -1
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/render-utils.d.ts.map +1 -1
- package/dist/core/tools/resource-selectors.d.ts.map +1 -1
- package/dist/core/tools/search-details.d.ts.map +1 -1
- package/dist/core/tools/search-line-ranges.d.ts.map +1 -1
- package/dist/core/tools/search-native.d.ts.map +1 -1
- package/dist/core/tools/search.d.ts.map +1 -1
- package/dist/core/tools/structured-output.d.ts.map +1 -1
- package/dist/core/tools/todos-execute.d.ts.map +1 -1
- package/dist/core/tools/todos-locks.d.ts.map +1 -1
- package/dist/core/tools/todos-model.d.ts.map +1 -1
- package/dist/core/tools/todos-mutations.d.ts.map +1 -1
- package/dist/core/tools/todos-paths.d.ts.map +1 -1
- package/dist/core/tools/todos-render.d.ts.map +1 -1
- package/dist/core/tools/todos-storage.d.ts.map +1 -1
- package/dist/core/tools/todos-types.d.ts.map +1 -1
- package/dist/core/tools/todos-types.js +1 -1
- package/dist/core/tools/todos-types.js.map +1 -1
- package/dist/core/tools/todos.d.ts.map +1 -1
- package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
- package/dist/core/tools/tool-definition-wrapper.js +6 -2
- package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
- package/dist/core/tools/tool-limits.d.ts.map +1 -1
- package/dist/core/tools/truncate.d.ts.map +1 -1
- package/dist/core/tools/url-ip-guards.d.ts.map +1 -1
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/trust-manager.d.ts.map +1 -1
- package/dist/core/typebox-compat.d.ts +12 -0
- package/dist/core/typebox-compat.d.ts.map +1 -0
- package/dist/core/typebox-compat.js +10 -0
- package/dist/core/typebox-compat.js.map +1 -0
- package/dist/index-extensions.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/main-app-mode.d.ts.map +1 -1
- package/dist/main-deferred-startup.d.ts.map +1 -1
- package/dist/main-early-input.d.ts.map +1 -1
- package/dist/main-session-options.d.ts.map +1 -1
- package/dist/main-session.d.ts.map +1 -1
- package/dist/main-stdio.d.ts.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/migrations-config-values.d.ts.map +1 -1
- package/dist/migrations.d.ts.map +1 -1
- package/dist/modes/index.d.ts.map +1 -1
- package/dist/modes/interactive/chat-input-actions.d.ts.map +1 -1
- package/dist/modes/interactive/components/armin.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/atomic-banner.d.ts.map +1 -1
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-message-renderer.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-actions.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-events.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-rendering.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-runtime.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-state.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-terminal-cleanup.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-types.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-utils.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-transcript.d.ts.map +1 -1
- package/dist/modes/interactive/components/compaction-boundary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/config-selector-list.d.ts.map +1 -1
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/context-window-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/daxnuts.d.ts.map +1 -1
- package/dist/modes/interactive/components/diff.d.ts.map +1 -1
- package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -1
- package/dist/modes/interactive/components/earendil-announcement.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-input.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/fast-mode-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/index.d.ts.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -1
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector-delete.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector-header.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector-list.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector-tree.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector-types.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector-utils.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector-handlers.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector-items.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector-options.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector-submenus.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector-types.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector-component.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector-content.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector-help.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector-label-input.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector-list.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector-model.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector-types.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector-viewport.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/trust-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -1
- package/dist/modes/interactive/components/working-status.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-agent-events.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-auth-login.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-auth-routing.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-autocomplete.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-bash-compact.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-child-ordering.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-deferred-startup.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-editor-actions.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-extension-context.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-extension-custom-ui.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-extension-dialogs.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-extension-runtime.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-extension-widgets.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-hotkeys-debug.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-input-handling.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-deps.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-helpers.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-types.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-model-routing.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-onboarding.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-process-lifecycle.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-queueing.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-render-chat.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-resource-disclosure.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-resource-paths.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-resource-rendering.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-selectors.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-session-routing.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-session-runtime.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-slash-commands.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-startup.d.ts.map +1 -1
- package/dist/modes/interactive/model-search.d.ts.map +1 -1
- package/dist/modes/interactive/theme/color-utils.d.ts.map +1 -1
- package/dist/modes/interactive/theme/export-colors.d.ts.map +1 -1
- package/dist/modes/interactive/theme/global-theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/terminal-detection.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-class.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-loading.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-parse.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-schema.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/tui-theme.d.ts.map +1 -1
- package/dist/modes/interactive/whimsical-messages.d.ts.map +1 -1
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/rpc/jsonl.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-command-handler.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-extension-ui.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-input.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-responses.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-session-binding.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/package-manager-cli-parser.d.ts.map +1 -1
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/rpc-entry.d.ts.map +1 -1
- package/dist/utils/ansi.d.ts.map +1 -1
- package/dist/utils/changelog.d.ts.map +1 -1
- package/dist/utils/child-process.d.ts.map +1 -1
- package/dist/utils/clipboard-image.d.ts.map +1 -1
- package/dist/utils/clipboard-native.d.ts.map +1 -1
- package/dist/utils/clipboard.d.ts.map +1 -1
- package/dist/utils/deprecation.d.ts.map +1 -1
- package/dist/utils/event-loop.d.ts.map +1 -1
- package/dist/utils/exif-orientation.d.ts.map +1 -1
- package/dist/utils/frontmatter.d.ts.map +1 -1
- package/dist/utils/fs-watch.d.ts.map +1 -1
- package/dist/utils/git-env.d.ts.map +1 -1
- package/dist/utils/git.d.ts.map +1 -1
- package/dist/utils/html.d.ts.map +1 -1
- package/dist/utils/image-convert.d.ts.map +1 -1
- package/dist/utils/image-process.d.ts.map +1 -1
- package/dist/utils/image-resize-core.d.ts.map +1 -1
- package/dist/utils/image-resize-worker.d.ts.map +1 -1
- package/dist/utils/image-resize.d.ts.map +1 -1
- package/dist/utils/json.d.ts.map +1 -1
- package/dist/utils/markit.d.ts.map +1 -1
- package/dist/utils/mime.d.ts.map +1 -1
- package/dist/utils/module-require.d.ts.map +1 -1
- package/dist/utils/open-browser.d.ts.map +1 -1
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/photon.d.ts.map +1 -1
- package/dist/utils/pi-user-agent.d.ts.map +1 -1
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/sleep.d.ts.map +1 -1
- package/dist/utils/split-launcher.d.ts.map +1 -1
- package/dist/utils/syntax-highlight.d.ts.map +1 -1
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/version-check.d.ts.map +1 -1
- package/dist/utils/windows-self-update.d.ts.map +1 -1
- package/docs/custom-provider.md +7 -1
- package/docs/extensions.md +6 -4
- package/examples/extensions/README.md +3 -1
- package/examples/extensions/subagent/schemas.ts +1 -1
- package/examples/extensions/tic-tac-toe.ts +1 -2
- package/examples/extensions/todo.ts +1 -2
- package/npm-shrinkwrap.json +214 -98
- package/package.json +12 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/tools/hashline-engine/index.ts"],"names":[],"mappings":"AAEA,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/tools/hashline-engine/index.ts"],"names":[],"mappings":"AAEA,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../../src/core/tools/hashline-engine/input.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AA+EjF,UAAU,UAAU;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACb;AA+CD;;;;GAIG;AACH,wBAAgB,sCAAsC,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAK7E;AAyED;;;;;GAKG;AACH,qBAAa,YAAY;;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAGtB,YAAY,GAAG,EAAE,UAAU,EAI1B;IAED;;;;OAIG;IACH,KAAK,IAAI;QAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAA;KAAE,CAGtD;IAED,qCAAqC;IACrC,IAAI,KAAK,IAAI,SAAS,IAAI,EAAE,CAE3B;IAED,uDAAuD;IACvD,IAAI,QAAQ,IAAI,SAAS,MAAM,EAAE,CAEhC;IAED;;;;OAIG;IACH,IAAI,mBAAmB,IAAI,OAAO,CAOjC;IAED,+EAA+E;IAC/E,kBAAkB,IAAI,SAAS,MAAM,EAAE,CAgBtC;IAED;;;;;;;;;OASG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,aAAa,GAAG,WAAW,CAchE;IAED;;;;;;;;;;OAUG;IACH,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,aAAa,GAAG,WAAW,CAYvE;CACD;AAED;;;;;;GAMG;AACH,qBAAa,KAAK;IACjB,QAAQ,CAAC,QAAQ,EAAE,SAAS,YAAY,EAAE,CAAC;IAE3C,OAAO,eAEN;IAED;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,YAAiB,GAAG,KAAK,CAG7D;IAED;;;;OAIG;IACH,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,YAAiB,GAAG,YAAY,CAK1E;CACD","sourcesContent":["// @generated vendored verbatim from oh-my-pi packages/hashline @ 15b5c1397fc -- DO NOT EDIT.\n// Parity source for the Atomic hashline edit engine (issue #1483); adapted only for Atomic's Node runtime (relative imports, Bun->Node host calls, erasable constructor syntax).\n/**\n * Top-level patch parser. Splits an authored hashline input into a list of\n * {@link PatchSection}s, each rooted at a `[PATH#HASH]` header, then exposes\n * a {@link Patch} class that gives lazy access to the parsed edits per\n * section.\n *\n * The splitter is purely lexical — it doesn't know whether a section's path\n * actually exists. That's the patcher's job.\n */\nimport * as path from \"node:path\";\nimport { applyEdits } from \"./apply.js\";\nimport { resolveBlockEdits } from \"./block.js\";\nimport { HL_FILE_HASH_EXAMPLES, HL_FILE_HASH_LENGTH, HL_FILE_HASH_SEP, HL_FILE_PREFIX, HL_FILE_SUFFIX } from \"./format.js\";\nimport { parsePatch, parsePatchStreaming } from \"./parser.js\";\nimport { Tokenizer } from \"./tokenizer.js\";\nimport type { ApplyResult, BlockResolver, Edit, SplitOptions } from \"./types.js\";\n\n// Pure classification — single shared tokenizer is safe.\nconst TOKENIZER = new Tokenizer();\n\nfunction unquoteHashlinePath(pathText: string): string {\n\tif (pathText.length < 2) return pathText;\n\tconst first = pathText[0];\n\tconst last = pathText[pathText.length - 1];\n\tif ((first === '\"' || first === \"'\") && first === last) return pathText.slice(1, -1);\n\treturn pathText;\n}\n\n/**\n * Strip apply_patch-style noise that models reflexively prepend to the\n * path. Examples observed in benchmark traces:\n *\n * `Update File:foo.ts`, `Update:foo.ts`, `UpdateFile:foo.ts`,\n * `Update/File:foo.ts`, `Update-file:foo.ts`, `Update(File):foo.ts`,\n * `Update<File:foo.ts`, `Add File:foo.ts`, `Delete File:foo.ts`,\n * `Move to:foo.ts`, `***foo.ts`, `***Update File:foo.ts`.\n *\n * We strip a leading `***` (the model duplicating the header sigil) and a\n * leading `(Update|Add|Delete|Move)[<separator>]*(File|to)?[<separator>]*:`\n * keyword block, case-insensitive. The remaining text is the real path.\n */\nconst APPLY_PATCH_PATH_NOISE_RE =\n\t/^\\*{0,3}\\s*(?:(?:update|add|delete|move)[^A-Za-z0-9]*(?:file|to)?[^A-Za-z0-9]*:)?\\s*\\*{0,3}\\s*/i;\n\nfunction stripApplyPatchPathNoise(pathText: string): string {\n\treturn pathText.replace(APPLY_PATCH_PATH_NOISE_RE, \"\");\n}\n\n/**\n * Best-effort recovery for bracketed header lines the strict tokenizer\n * rejects. Strips apply_patch keyword noise (`Update File:`, `Update:`,\n * etc.) and an extra leading `***` (some models emit a hybrid\n * `[***foo.ts#HASH]` shape), then expects `PATH(#HASH)?`.\n * Returns `null` when no clean path can be salvaged.\n */\nfunction tryParseRecoveryHeader(line: string, cwd?: string): RawSection | null {\n\tif (!line.startsWith(HL_FILE_PREFIX) || !line.endsWith(HL_FILE_SUFFIX)) return null;\n\tconst body = stripApplyPatchPathNoise(line.slice(HL_FILE_PREFIX.length, line.length - HL_FILE_SUFFIX.length).trim());\n\tif (body.length === 0) return null;\n\n\t// Trailing `#XXXX` is the tag; everything before it is the path. The\n\t// path may contain whitespace (Windows OneDrive folders, Program Files,\n\t// etc.), so we anchor the tag at end-of-body rather than scanning\n\t// forward and stopping at the first space.\n\tconst trailing = new RegExp(`#([0-9A-Fa-f]{${HL_FILE_HASH_LENGTH}})\\\\s*$`).exec(body);\n\tlet pathText: string;\n\tlet fileHash: string | undefined;\n\tif (trailing !== null) {\n\t\tpathText = body.slice(0, trailing.index);\n\t\tfileHash = trailing[1].toUpperCase();\n\t} else {\n\t\tpathText = body.replace(/\\s+$/, \"\");\n\t}\n\n\t// Same rule as the strict tokenizer: the hashline header grammar uses\n\t// `#` as the path/tag separator and does not allow `#` inside\n\t// filenames. Anything `#` left in the path body — short tags, non-hex\n\t// tags, over-long tags, stale-tag copy-paste, line-suffixed tags —\n\t// means the header is malformed, not a path with an embedded hash.\n\tif (pathText.includes(\"#\")) return null;\n\n\tconst path = normalizeHashlinePath(pathText, cwd);\n\tif (path.length === 0) return null;\n\treturn fileHash !== undefined ? { path, fileHash, diff: \"\" } : { path, diff: \"\" };\n}\n\nfunction normalizeHashlinePath(rawPath: string, cwd?: string): string {\n\tconst unquoted = stripApplyPatchPathNoise(unquoteHashlinePath(rawPath.trim()));\n\tif (!cwd || !path.isAbsolute(unquoted)) return unquoted;\n\tconst relative = path.relative(path.resolve(cwd), path.resolve(unquoted));\n\tconst isWithinCwd = relative === \"\" || (!relative.startsWith(\"..\") && !path.isAbsolute(relative));\n\treturn isWithinCwd ? relative || \".\" : unquoted;\n}\n\ninterface RawSection {\n\tpath: string;\n\tfileHash?: string;\n\tdiff: string;\n}\n\n/**\n * Parse a `[PATH]` or `[PATH#hash]` header line. Returns `null` for lines that do\n * not start with `[`. Throws the strict \"Input header must be …\" error\n * when a bracketed line fails the strict shape (so malformed paths\n * surface immediately instead of being silently re-classified as payload).\n */\nfunction parseHashlineHeaderLine(line: string, cwd?: string): RawSection | null {\n\tconst trimmed = line.trimEnd();\n\tif (!trimmed.startsWith(HL_FILE_PREFIX)) return null;\n\n\tconst token = TOKENIZER.tokenize(trimmed);\n\tif (token.kind !== \"header\") {\n\t\t// Recovery: try to extract a path from the raw line after stripping\n\t\t// apply_patch noise. This handles `[*** Update File:foo.ts#CB5A]` and\n\t\t// the half-dozen variants models actually emit.\n\t\tconst recovered = tryParseRecoveryHeader(trimmed, cwd);\n\t\tif (recovered !== null) return recovered;\n\t\tthrow new Error(\n\t\t\t`Input header must be ${HL_FILE_PREFIX}PATH${HL_FILE_SUFFIX} or ${HL_FILE_PREFIX}PATH${HL_FILE_HASH_SEP}TAG${HL_FILE_SUFFIX} with a ${HL_FILE_HASH_LENGTH}-hex content-hash tag; got ${JSON.stringify(trimmed)}.`,\n\t\t);\n\t}\n\n\tconst parsedPath = normalizeHashlinePath(token.path, cwd);\n\tif (parsedPath.length === 0) {\n\t\tthrow new Error(`Input header \"${HL_FILE_PREFIX}${HL_FILE_SUFFIX}\" is empty; provide a file path.`);\n\t}\n\treturn token.fileHash !== undefined\n\t\t? { path: parsedPath, fileHash: token.fileHash, diff: \"\" }\n\t\t: { path: parsedPath, diff: \"\" };\n}\n\nfunction stripLeadingBlankLines(input: string): string {\n\tconst stripped = input.startsWith(\"\\uFEFF\") ? input.slice(1) : input;\n\tconst lines = stripped.split(\"\\n\");\n\twhile (lines.length > 0) {\n\t\tconst head = lines[0].replace(/\\r$/, \"\");\n\t\tif (head.trim().length === 0 || TOKENIZER.tokenize(head).kind === \"envelope-begin\") {\n\t\t\tlines.shift();\n\t\t\tcontinue;\n\t\t}\n\t\tbreak;\n\t}\n\treturn lines.join(\"\\n\");\n}\n\n/**\n * Returns true when the input contains at least one line that the tokenizer\n * recognizes as a hashline op. Used by streaming previews to decide whether\n * the partial input is worth treating as a hashline patch yet.\n */\nexport function containsRecognizableHashlineOperations(input: string): boolean {\n\tfor (const line of input.split(/\\r?\\n/)) {\n\t\tif (TOKENIZER.isOp(line)) return true;\n\t}\n\treturn false;\n}\n\nfunction normalizeFallbackInput(input: string, options: SplitOptions): string {\n\tconst stripped = input.startsWith(\"\\uFEFF\") ? input.slice(1) : input;\n\tconst hasExplicitHeader = stripped\n\t\t.split(/\\r?\\n/)\n\t\t.some(rawLine => parseHashlineHeaderLine(rawLine, options.cwd) !== null);\n\tif (hasExplicitHeader) return input;\n\n\tif (!options.path || !containsRecognizableHashlineOperations(input)) return input;\n\tconst fallbackPath = normalizeHashlinePath(options.path, options.cwd);\n\tif (fallbackPath.length === 0) return input;\n\treturn `${HL_FILE_PREFIX}${fallbackPath}${HL_FILE_SUFFIX}\\n${input}`;\n}\n\nfunction splitRawSections(input: string, options: SplitOptions = {}): RawSection[] {\n\tconst stripped = stripLeadingBlankLines(normalizeFallbackInput(input, options));\n\tconst lines = stripped.split(/\\r?\\n/);\n\tconst firstLine = lines[0] ?? \"\";\n\n\tif (parseHashlineHeaderLine(firstLine, options.cwd) === null) {\n\t\t// Catch unified-diff hunk-header contamination on the first line so\n\t\t// the model sees a focused error.\n\t\tconst firstTrimmed = firstLine.trimEnd();\n\t\tif (/^@@\\s+[-+]?\\d+,\\d+\\s+[-+]?\\d+,\\d+\\s+@@/.test(firstTrimmed)) {\n\t\t\tthrow new Error(\n\t\t\t\t\"unified-diff hunk header (`@@ -N,M +N,M @@`) is not valid in hashline. \" +\n\t\t\t\t\t`File sections start with \\`${HL_FILE_PREFIX}path${HL_FILE_HASH_SEP}HASH${HL_FILE_SUFFIX}\\`; use \\`replace\\`, \\`delete\\`, or \\`insert\\` ops.`,\n\t\t\t);\n\t\t}\n\t\tconst preview = JSON.stringify(firstLine.slice(0, 120));\n\t\tthrow new Error(\n\t\t\t`input must begin with \"${HL_FILE_PREFIX}PATH${HL_FILE_HASH_SEP}HASH${HL_FILE_SUFFIX}\" on the first non-blank line for anchored edits; got: ${preview}. ` +\n\t\t\t\t`Example: \"${HL_FILE_PREFIX}src/foo.ts${HL_FILE_HASH_SEP}${HL_FILE_HASH_EXAMPLES[0]}${HL_FILE_SUFFIX}\" then edit ops.`,\n\t\t);\n\t}\n\n\tconst sections: RawSection[] = [];\n\tlet current: RawSection | undefined;\n\tlet currentLines: string[] = [];\n\n\tconst flush = () => {\n\t\tif (!current) return;\n\t\tconst hasOps = currentLines.some(line => line.trim().length > 0);\n\t\tif (hasOps) sections.push({ ...current, diff: currentLines.join(\"\\n\") });\n\t\tcurrentLines = [];\n\t};\n\n\tfor (const line of lines) {\n\t\tconst trimmed = line.trimEnd();\n\t\tconst token = TOKENIZER.tokenize(line);\n\t\tif (token.kind === \"envelope-end\" || token.kind === \"abort\") break;\n\t\tif (token.kind === \"envelope-begin\") continue;\n\n\t\t// Route every bracket-prefixed line through parseHashlineHeaderLine so\n\t\t// malformed headers still raise the strict \"Input header must be …\"\n\t\t// diagnostic (the tokenizer alone would silently classify them as\n\t\t// payload).\n\t\tif (trimmed.startsWith(HL_FILE_PREFIX)) {\n\t\t\tconst header = parseHashlineHeaderLine(line, options.cwd);\n\t\t\tif (header !== null) {\n\t\t\t\tflush();\n\t\t\t\tcurrent = header;\n\t\t\t\tcurrentLines = [];\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\tcurrentLines.push(line);\n\t}\n\tflush();\n\treturn sections;\n}\n\n/**\n * Snapshot of one section in a parsed {@link Patch}: a target file plus the\n * lazily-parsed list of edits that should land on it. Constructed by\n * {@link Patch.parse}; consumers usually iterate `patch.sections` rather\n * than build these directly.\n */\nexport class PatchSection {\n\treadonly path: string;\n\treadonly fileHash: string | undefined;\n\treadonly diff: string;\n\t#parsed: { edits: Edit[]; warnings: string[] } | undefined;\n\n\tconstructor(raw: RawSection) {\n\t\tthis.path = raw.path;\n\t\tthis.fileHash = raw.fileHash;\n\t\tthis.diff = raw.diff;\n\t}\n\n\t/**\n\t * Parse this section's diff body. Cached: subsequent calls return the\n\t * same `{ edits, warnings }` object so callers can safely call this from\n\t * multiple paths (preflight, apply, diff-preview).\n\t */\n\tparse(): { edits: Edit[]; warnings: readonly string[] } {\n\t\tthis.#parsed ??= parsePatch(this.diff);\n\t\treturn this.#parsed;\n\t}\n\n\t/** Parsed edits for this section. */\n\tget edits(): readonly Edit[] {\n\t\treturn this.parse().edits;\n\t}\n\n\t/** Warnings emitted during parsing of this section. */\n\tget warnings(): readonly string[] {\n\t\treturn this.parse().warnings;\n\t}\n\n\t/**\n\t * True when at least one edit anchors to concrete file content. Pure\n\t * `insert head:` / `insert tail:` literal inserts do not count: those are\n\t * safe to apply to files that don't yet exist.\n\t */\n\tget hasAnchorScopedEdit(): boolean {\n\t\treturn this.edits.some(edit => {\n\t\t\tif (edit.kind === \"delete\") return true;\n\t\t\t// A `replace block N:` edit is anchored to concrete content on line N.\n\t\t\tif (edit.kind === \"block\") return true;\n\t\t\treturn edit.cursor.kind === \"before_anchor\" || edit.cursor.kind === \"after_anchor\";\n\t\t});\n\t}\n\n\t/** Anchor lines touched by this section, sorted ascending and deduplicated. */\n\tcollectAnchorLines(): readonly number[] {\n\t\tconst lines = new Set<number>();\n\t\tfor (const edit of this.edits) {\n\t\t\tif (edit.kind === \"delete\") {\n\t\t\t\tlines.add(edit.anchor.line);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (edit.kind === \"block\") {\n\t\t\t\tlines.add(edit.anchor.line);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (edit.cursor.kind === \"before_anchor\" || edit.cursor.kind === \"after_anchor\") {\n\t\t\t\tlines.add(edit.cursor.anchor.line);\n\t\t\t}\n\t\t}\n\t\treturn [...lines].sort((a, b) => a - b);\n\t}\n\n\t/**\n\t * Apply this section's edits to `text` and return the post-edit result.\n\t * Pure: does no I/O, does not validate the section snapshot tag. The\n\t * {@link Patcher} owns tag validation and recovery; reach for this\n\t * method directly when you've already validated the file content and\n\t * just want the result.\n\t *\n\t * `blockResolver` resolves any `replace block N:` edits against `text`; an\n\t * unresolvable block throws (this is the final, authoritative preview path).\n\t */\n\tapplyTo(text: string, blockResolver?: BlockResolver): ApplyResult {\n\t\tconst { edits, warnings } = this.parse();\n\t\tconst resolveWarnings: string[] = [];\n\t\tconst resolved = resolveBlockEdits(edits, text, this.path, blockResolver, {\n\t\t\tonUnresolved: \"throw\",\n\t\t\tonWarning: warning => resolveWarnings.push(warning),\n\t\t});\n\t\tconst result = applyEdits(text, resolved);\n\t\t// Preserve parse warnings so consumers don't need to call `parse()`\n\t\t// separately.\n\t\tconst merged = [...warnings, ...resolveWarnings, ...(result.warnings ?? [])];\n\t\treturn merged.length > 0\n\t\t\t? { ...result, warnings: merged }\n\t\t\t: { text: result.text, firstChangedLine: result.firstChangedLine };\n\t}\n\n\t/**\n\t * Streaming-tolerant counterpart to {@link applyTo}. Uses\n\t * {@link parsePatchStreaming} so a trailing in-flight op (no payload yet,\n\t * or a per-token parse error mid-stream) does not throw or emit a phantom\n\t * empty-payload edit. Intended for incremental diff previews; the writer\n\t * path should always use {@link applyTo}.\n\t *\n\t * `blockResolver` resolves any `replace block N:` edits against `text`; an\n\t * unresolvable block is silently dropped so a half-written file does not\n\t * throw mid-stream.\n\t */\n\tapplyPartialTo(text: string, blockResolver?: BlockResolver): ApplyResult {\n\t\tconst { edits, warnings } = parsePatchStreaming(this.diff);\n\t\tconst resolveWarnings: string[] = [];\n\t\tconst resolved = resolveBlockEdits(edits, text, this.path, blockResolver, {\n\t\t\tonUnresolved: \"drop\",\n\t\t\tonWarning: warning => resolveWarnings.push(warning),\n\t\t});\n\t\tconst result = applyEdits(text, resolved);\n\t\tconst merged = [...warnings, ...resolveWarnings, ...(result.warnings ?? [])];\n\t\treturn merged.length > 0\n\t\t\t? { ...result, warnings: merged }\n\t\t\t: { text: result.text, firstChangedLine: result.firstChangedLine };\n\t}\n}\n\n/**\n * A parsed hashline patch — zero or more {@link PatchSection}s, each rooted\n * at a `[PATH#HASH]` header. Construct via {@link Patch.parse}.\n *\n * `Patch` is pure data: parsing is line-anchored and does not look at the\n * filesystem. To apply a patch, hand it to {@link Patcher.apply}.\n */\nexport class Patch {\n\treadonly sections: readonly PatchSection[];\n\n\tprivate constructor(sections: PatchSection[]) {\n\t\tthis.sections = sections;\n\t}\n\n\t/**\n\t * Parse `input` into a {@link Patch}. `options.cwd` resolves absolute\n\t * paths inside headers to cwd-relative form; `options.path` provides a\n\t * fallback when the input lacks a header but contains hashline ops\n\t * (useful for streaming previews).\n\t *\n\t * Consecutive sections targeting the same path are merged into a single\n\t * section with concatenated diff bodies. Anchors authored against the\n\t * same file snapshot must be applied as one batch; otherwise the first\n\t * sub-edit shifts line numbers out from under the second's anchors and\n\t * validation fails.\n\t */\n\tstatic parse(input: string, options: SplitOptions = {}): Patch {\n\t\tconst raw = mergeSamePathSections(splitRawSections(input, options));\n\t\treturn new Patch(raw.map(section => new PatchSection(section)));\n\t}\n\n\t/**\n\t * Parse `input` and return only the first section. Throws if the input\n\t * has zero sections. Convenience for the single-section case where the\n\t * caller already knows the patch is one hunk.\n\t */\n\tstatic parseSingle(input: string, options: SplitOptions = {}): PatchSection {\n\t\tconst patch = Patch.parse(input, options);\n\t\tconst first = patch.sections[0];\n\t\tif (!first) throw new Error(\"Patch input did not produce any sections.\");\n\t\treturn first;\n\t}\n}\n\n/**\n * Collapse consecutive or interleaved sections targeting the same path into a\n * single section with concatenated diffs. Anchors authored against the same\n * file snapshot must be applied as one batch; otherwise the first sub-edit\n * shifts line numbers out from under the second's anchors and validation\n * fails. Path order is preserved by first occurrence.\n */\nfunction mergeSamePathSections(sections: RawSection[]): RawSection[] {\n\tconst byPath = new Map<string, { fileHash?: string; diffs: string[] }>();\n\tfor (const section of sections) {\n\t\tconst existing = byPath.get(section.path);\n\t\tif (existing) {\n\t\t\tif (\n\t\t\t\texisting.fileHash !== undefined &&\n\t\t\t\tsection.fileHash !== undefined &&\n\t\t\t\texisting.fileHash !== section.fileHash\n\t\t\t) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Conflicting hashline snapshot tags for ${section.path}: #${existing.fileHash} and #${section.fileHash}. Re-read the file and retry with one current header.`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (existing.fileHash === undefined && section.fileHash !== undefined) existing.fileHash = section.fileHash;\n\t\t\texisting.diffs.push(section.diff);\n\t\t\tcontinue;\n\t\t}\n\t\tbyPath.set(section.path, {\n\t\t\t...(section.fileHash !== undefined ? { fileHash: section.fileHash } : {}),\n\t\t\tdiffs: [section.diff],\n\t\t});\n\t}\n\treturn Array.from(byPath, ([sectionPath, entry]) => ({\n\t\tpath: sectionPath,\n\t\t...(entry.fileHash !== undefined ? { fileHash: entry.fileHash } : {}),\n\t\tdiff: entry.diffs.join(\"\\n\"),\n\t}));\n}\n"]}
|
|
1
|
+
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../../src/core/tools/hashline-engine/input.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AA+EjF,UAAU,UAAU;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACb;AA+CD;;;;GAIG;AACH,wBAAgB,sCAAsC,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAK7E;AAyED;;;;;GAKG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iD,CAAC;AAEzF,gCAAgC;AAChC,eAAO,MAAM,YAAY,kDAAkD,CAAC;AAE5E;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAE/G;AAED;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAElH;AAED,+DAA+D;AAC/D,eAAO,MAAM,yBAAyB,qHAC6E,CAAC;AAEpH,6DAA6D;AAC7D,eAAO,MAAM,8BAA8B,4HAC+E,CAAC;AAE3H;;;;;GAKG;AACH,eAAO,MAAM,+BAA+B,wLAC0I,CAAC;AAEvL;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,sMAC4J,CAAC;AAEhM;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAErE","sourcesContent":["// @generated vendored verbatim from oh-my-pi packages/hashline @ 15b5c1397fc -- DO NOT EDIT.\n// Parity source for the Atomic hashline edit engine (issue #1483); adapted only for Atomic's Node runtime (relative imports, Bun->Node host calls, erasable constructor syntax).\n/** Centralized error/warning text for the hashline parser, applier, and patcher. */\n\nimport { formatNumberedLine, HL_FILE_HASH_SEP, HL_FILE_PREFIX, HL_FILE_SUFFIX } from \"./format.js\";\n\n/** Lines of context shown either side of a hash mismatch. */\nexport const MISMATCH_CONTEXT = 2;\n\n/**\n * Numbered `LINE:TEXT` rows around `anchorLines` (±{@link MISMATCH_CONTEXT}),\n * `*`-marking anchors, `...` between non-adjacent runs. Out-of-range anchors\n * contribute no rows.\n */\nexport function formatAnchoredContext(anchorLines: readonly number[], fileLines: readonly string[]): string[] {\n\tconst displayLines = new Set<number>();\n\tfor (const line of anchorLines) {\n\t\tif (line < 1 || line > fileLines.length) continue;\n\t\tconst lo = Math.max(1, line - MISMATCH_CONTEXT);\n\t\tconst hi = Math.min(fileLines.length, line + MISMATCH_CONTEXT);\n\t\tfor (let lineNum = lo; lineNum <= hi; lineNum++) displayLines.add(lineNum);\n\t}\n\tconst anchorSet = new Set(anchorLines);\n\tconst rows: string[] = [];\n\tlet previous = -1;\n\tfor (const lineNum of [...displayLines].sort((a, b) => a - b)) {\n\t\tif (previous !== -1 && lineNum > previous + 1) rows.push(\"...\");\n\t\tprevious = lineNum;\n\t\tconst marker = anchorSet.has(lineNum) ? \"*\" : \" \";\n\t\trows.push(`${marker}${formatNumberedLine(lineNum, fileLines[lineNum - 1] ?? \"\")}`);\n\t}\n\treturn rows;\n}\n\n/** Optional patch envelope start marker; silently consumed. */\nexport const BEGIN_PATCH_MARKER = \"*** Begin Patch\";\n\n/** Optional patch envelope end marker; terminates parsing. */\nexport const END_PATCH_MARKER = \"*** End Patch\";\n\n/**\n * Truncation sentinel emitted by an agent loop mid-call. Ends parsing like\n * {@link END_PATCH_MARKER}, without a warning.\n */\nexport const ABORT_MARKER = \"*** Abort\";\n\n/** Two consecutive hunks targeted the exact same concrete range. */\nexport const REPLACE_PAIR_COALESCED_WARNING =\n\t\"Two hunks targeted the same range; kept only the second. One `replace N..M:` hunk per range — the body is the final content, never old+new.\";\n\n/** Bare bodyless hunk followed by an overlapping concrete hunk. */\nexport const REPLACE_PAIR_COALESCED_OVERLAP_WARNING =\n\t\"Dropped a bare hunk overlapped by the concrete hunk after it. One `replace N..M:` hunk per range — the body is the final content, never old+new.\";\n\n/** Bare body rows auto-converted to literal `+` rows. */\nexport const BARE_BODY_AUTO_PIPED_WARNING =\n\t\"Auto-prefixed bare body row(s) with `+`. Body rows must be `+TEXT` literal lines.\";\n\n/** Unified-diff-style `-` row in a hunk body. */\nexport const MINUS_ROW_REJECTED =\n\t\"`-` rows are not valid; the range already names the lines being changed. For a literal `-` line, write `+-…`.\";\n\n/** Replace hunk with no body. */\nexport const EMPTY_REPLACE = \"`replace N..M:` needs at least one `+TEXT` body row. To delete lines, use `delete N..M`.\";\n\n/** `replace block N:` hunk with no body. */\nexport const EMPTY_BLOCK =\n\t\"`replace block N:` needs at least one `+TEXT` body row. To delete a block, use `delete block N`.\";\n\n/**\n * Block-anchored replace/delete could not resolve to a syntactic block\n * (unsupported language, blank/out-of-range line, no node beginning on N, or\n * parse error). Appends a {@link formatAnchoredContext} preview when\n * `fileLines` is given. `insert after block N:` never reaches this — it is\n * lowered to plain `insert after N:` instead (see\n * {@link insertAfterBlockUnresolvedLoweredWarning}).\n */\nexport function blockUnresolvedMessage(\n\tline: number,\n\top: \"replace\" | \"delete\" = \"replace\",\n\tfileLines?: readonly string[],\n): string {\n\tconst phrase = op === \"delete\" ? `delete block ${line}` : `replace block ${line}:`;\n\tconst fallback = op === \"delete\" ? `delete ${line}..M` : `replace ${line}..M:`;\n\tlet message =\n\t\t`\\`${phrase}\\` could not resolve a syntactic block beginning on line ${line} ` +\n\t\t`(unsupported language, blank/closer line, or parse error). Use \\`${fallback}\\` with explicit lines.`;\n\tif (fileLines) {\n\t\tconst context = formatAnchoredContext([line], fileLines);\n\t\tif (context.length > 0) message += `\\n\\n${context.join(\"\\n\")}`;\n\t}\n\treturn message;\n}\n\n/** Block-anchored edit reached a path with no {@link BlockResolver} wired in — a host-configuration bug. */\nexport const BLOCK_RESOLVER_UNAVAILABLE =\n\t\"`replace block`/`delete block`/`insert after block` are not available here (no block resolver configured). Use a concrete line range.\";\n\n/**\n * `insert after block N:` anchored on a closing-delimiter line, lowered to\n * plain `insert after N:` — the closer ends a block, and inserting after it\n * is exactly what the plain form does.\n */\nexport function insertAfterBlockCloserLoweredWarning(line: number): string {\n\treturn `\\`insert after block ${line}:\\` anchors on a closing delimiter, so it was applied as plain \\`insert after ${line}:\\`. Anchor on the line that OPENS the construct.`;\n}\n\n/**\n * `insert after block N:` anchor unresolvable (unsupported language, blank\n * line, parse error, or no resolver), lowered to plain `insert after N:` —\n * applying with a warning beats failing the patch.\n */\nexport function insertAfterBlockUnresolvedLoweredWarning(line: number): string {\n\treturn `\\`insert after block ${line}:\\` could not resolve a syntactic block on line ${line}, so it was applied as plain \\`insert after ${line}:\\`. Verify the landing line; anchor on a line that OPENS a construct.`;\n}\n\n/**\n * Internal invariant: `applyEdits` received an unresolved `replace block N:`\n * edit; `resolveBlockEdits` must run first. Wiring bug, not authored input.\n */\nexport const UNRESOLVED_BLOCK_INTERNAL =\n\t\"internal error: unresolved `replace block` edit reached the applier (resolveBlockEdits was not run).\";\n\n/** Delete hunk received a body row. */\nexport const DELETE_TAKES_NO_BODY = \"`delete N..M` does not take body rows. Remove the body, or use `replace N..M:`.\";\n\n/** `delete block N` hunk received a body row. */\nexport const DELETE_BLOCK_TAKES_NO_BODY =\n\t\"`delete block N` does not take body rows. Remove the body, or use `replace block N:`.\";\n\n/** Insert hunk with no body. */\nexport const EMPTY_INSERT = \"`insert` needs at least one `+TEXT` body row.\";\n\n/**\n * `insert after` body indented shallower than the anchor: the landing slid\n * forward past trailing closer lines — the common \"anchored on the last line\n * I read instead of after the block\" mistake.\n */\nexport function afterInsertLandingShiftWarning(anchorLine: number, landingLine: number, crossed: number): string {\n\treturn `insert after ${anchorLine}: body indented shallower than the anchor, so the landing moved past ${crossed} closing line${crossed === 1 ? \"\" : \"s\"} to after line ${landingLine}. For the deeper position inside the block, re-issue with the body indented to match.`;\n}\n\n/**\n * `insert after block N:` body indented deeper than the block's closer: the\n * landing was pulled inside the block — a deeper body almost always means\n * \"append inside the block's body\".\n */\nexport function blockInsertLandingShiftWarning(blockStart: number, closerLine: number, landingLine: number): string {\n\treturn `insert after block ${blockStart}: body indented deeper than closing line ${closerLine}, so it was placed inside the block, after line ${landingLine}. \\`insert after block\\` lands AFTER the block at sibling depth — if inside was intended, use plain \\`insert after ${closerLine}:\\`.`;\n}\n\n/** `Recovery`: an external write matched a cached snapshot. */\nexport const RECOVERY_EXTERNAL_WARNING =\n\t\"Recovered from a stale file hash using a previous read snapshot (file changed externally between read and edit).\";\n\n/** `Recovery`: a prior in-session edit advanced the hash. */\nexport const RECOVERY_SESSION_CHAIN_WARNING =\n\t\"Recovered from a stale file hash using an earlier in-session snapshot (a prior edit in this session advanced the hash).\";\n\n/**\n * `Recovery`: session-chain replay fast-path. Less certain than\n * {@link RECOVERY_SESSION_CHAIN_WARNING} — the 3-way merge refused, the\n * anchor-content gate passed, but a coincidental insert+delete earlier in\n * the chain could still misplace an anchor — hence the verify hedge.\n */\nexport const RECOVERY_SESSION_REPLAY_WARNING =\n\t\"Recovered by replaying your edits onto the current file content (a prior in-session edit changed the lines you re-targeted with a stale hash). Verify the diff matches your intent.\";\n\n/**\n * `insert head:`/`insert tail:` applied despite a stale snapshot tag.\n * Head/tail position is content-independent, so drift is non-fatal: apply\n * onto live content and warn instead of hard-failing.\n */\nexport const HEADTAIL_DRIFT_WARNING =\n\t\"Applied the `insert head:`/`insert tail:` edit despite a stale snapshot tag (file changed since your read) — head/tail position is content-independent. Re-read if the drift was unexpected.\";\n\n/**\n * Section omitted the mandatory snapshot tag. Shared by the apply\n * ({@link Patcher.prepare}) and preview/diff paths so both stay in lockstep.\n */\nexport function missingSnapshotTagMessage(sectionPath: string): string {\n\treturn `Missing hashline snapshot tag for ${sectionPath}; use \\`${HL_FILE_PREFIX}${sectionPath}${HL_FILE_HASH_SEP}tag${HL_FILE_SUFFIX}\\` from your latest read/search output. To create a new file, use the write tool.`;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../../src/core/tools/hashline-engine/messages.ts"],"names":[],"mappings":"AAEA,oFAAoF;AAIpF,6DAA6D;AAC7D,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAElC;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,EAAE,SAAS,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,CAkB5G;AAED,+DAA+D;AAC/D,eAAO,MAAM,kBAAkB,oBAAoB,CAAC;AAEpD,8DAA8D;AAC9D,eAA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E,MAAM,EAAE,CAAC;IAC7B,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IAEjC,YAAY,OAAO,EAAE,eAAe,EASnC;IAED,IAAI,cAAc,IAAI,MAAM,CAS3B;IAED,MAAM,CAAC,eAAe,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,EAAE,CAazD;IAED,MAAM,CAAC,oBAAoB,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,CAE5D;IAED,MAAM,CAAC,aAAa,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,CAMrD;CACD;AAED,0EAA0E;AAC1E,wBAAgB,eAAe,CAAC,GAAG,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,IAAI,CAIhF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../../../src/core/tools/hashline-engine/normalize.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;AAE9C,+FAA+F;AAC/F,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,CAO5D;AAED,yCAAyC;AACzC,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,wDAAwD;AACxD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,MAAM,CAG3E;AAED,MAAM,WAAW,SAAS;IACzB,yEAAyE;IACzE,GAAG,EAAE,MAAM,CAAC;IACZ,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAC;CACb;AAED,kFAAkF;AAClF,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAEnD"
|
|
1
|
+
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../../../src/core/tools/hashline-engine/normalize.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;AAE9C,+FAA+F;AAC/F,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,CAO5D;AAED,yCAAyC;AACzC,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,wDAAwD;AACxD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,MAAM,CAG3E;AAED,MAAM,WAAW,SAAS;IACzB,yEAAyE;IACzE,GAAG,EAAE,MAAM,CAAC;IACZ,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAC;CACb;AAED,kFAAkF;AAClF,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAEnD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../../../src/core/tools/hashline-engine/parser.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAmD,KAAK,KAAK,EAAa,MAAM,gBAAgB,CAAC;AACxG,OAAO,KAAK,EAAkB,IAAI,EAAE,MAAM,YAAY,CAAC;AAyFvD,qBAAa,QAAQ;;IAkBpB,IAAI,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CA0CvB;IAED,GAAG,IAAI;QAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;KAAE,CAK3C;IAED,YAAY,IAAI;QAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;KAAE,CAQpD;IAED,KAAK,IAAI,IAAI,CAOZ;CAqMD;AAOD,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAK9E;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAMvF","sourcesContent":["// @generated vendored verbatim from oh-my-pi packages/hashline @ 15b5c1397fc -- DO NOT EDIT.\n// Parity source for the Atomic hashline edit engine (issue #1483); adapted only for Atomic's Node runtime (relative imports, Bun->Node host calls, erasable constructor syntax).\n/**\n * Token-driven state machine that turns a stream of {@link Token}s into a\n * flat list of {@link Edit}s. Sits between the {@link Tokenizer} and the\n * applier.\n */\nimport { HL_PAYLOAD_REPLACE } from \"./format.js\";\nimport {\n\tBARE_BODY_AUTO_PIPED_WARNING,\n\tDELETE_BLOCK_TAKES_NO_BODY,\n\tDELETE_TAKES_NO_BODY,\n\tEMPTY_BLOCK,\n\tEMPTY_INSERT,\n\tMINUS_ROW_REJECTED,\n} from \"./messages.js\";\nimport { stripOneLeadingHashlinePrefix } from \"./prefixes.js\";\nimport { type BlockTarget, cloneCursor, type ParsedRange, type Token, Tokenizer } from \"./tokenizer.js\";\nimport type { Anchor, Cursor, Edit } from \"./types.js\";\n\nfunction validateRangeOrder(range: ParsedRange, lineNum: number): void {\n\tif (range.end.line < range.start.line) {\n\t\tthrow new Error(`line ${lineNum}: range ${range.start.line}..${range.end.line} ends before it starts.`);\n\t}\n}\n\nfunction expandRange(range: ParsedRange): Anchor[] {\n\tconst anchors: Anchor[] = [];\n\tfor (let line = range.start.line; line <= range.end.line; line++) anchors.push({ line });\n\treturn anchors;\n}\n\nfunction isSkippableCommentLine(line: string): boolean {\n\treturn line.trimStart().startsWith(\"#\");\n}\n\n/**\n * Stripped remainder of a bare `N: <value>` row that is a lone quoted or\n * numeric literal (optionally comma-terminated) — the shape of a numeric-keyed\n * dict/YAML body rather than read-output paste.\n */\nconst BARE_LITERAL_VALUE_RE = /^\\s*(?:\"[^\"]*\"|'[^']*'|[-+]?\\d+(?:\\.\\d+)?)\\s*,?\\s*$/;\n\nfunction detectApplyPatchContamination(text: string, _hasPending: boolean): string | null {\n\tconst trimmed = text.trimStart();\n\tif (trimmed.length === 0) return null;\n\tif (\n\t\ttrimmed.startsWith(\"*** Update File:\") ||\n\t\ttrimmed.startsWith(\"*** Add File:\") ||\n\t\ttrimmed.startsWith(\"*** Delete File:\") ||\n\t\ttrimmed.startsWith(\"*** Move to:\")\n\t) {\n\t\tconst preview = trimmed.length > 48 ? `${trimmed.slice(0, 48)}…` : trimmed;\n\t\treturn (\n\t\t\t`apply_patch sentinel ${JSON.stringify(preview)} is not valid in hashline. ` +\n\t\t\t\"File sections start with `[path#HASH]` (no `Update File:` / `Add File:` keyword). \" +\n\t\t\t\"Use `replace N..M:`, `delete N..M`, or `insert before|after|head|tail:` ops.\"\n\t\t);\n\t}\n\tif (/^@@\\s+[-+]?\\d+,\\d+\\s+[-+]?\\d+,\\d+\\s+@@/.test(trimmed)) {\n\t\treturn (\n\t\t\t\"unified-diff hunk header (`@@ -N,M +N,M @@`) is not valid in hashline. \" +\n\t\t\t\"Use `replace N..M:`, `delete N..M`, or `insert before|after|head|tail:` ops.\"\n\t\t);\n\t}\n\tif (trimmed.startsWith(\"@@\")) {\n\t\tconst preview = trimmed.length > 48 ? `${trimmed.slice(0, 48)}…` : trimmed;\n\t\treturn (\n\t\t\t`\\`@@\\`-bracketed hunk header ${JSON.stringify(preview)} is not valid in hashline. ` +\n\t\t\t\"Drop the `@@ ... @@` brackets and write a verb header such as `replace N..M:`.\"\n\t\t);\n\t}\n\tif (/^delete\\s+[1-9]\\d*(?:\\s*(?:\\.\\.|-|…|\\s)\\s*[1-9]\\d*)?\\s*:/.test(trimmed)) {\n\t\treturn \"`delete N..M` has no colon and no body. Remove the colon and body rows.\";\n\t}\n\tif (/^[1-9]\\d*\\s*$/.test(trimmed)) {\n\t\treturn `hunk headers need a verb. Use \\`replace ${trimmed}..${trimmed}:\\` to replace, or \\`delete ${trimmed}\\` to delete.`;\n\t}\n\tconst bareRange = /^([1-9]\\d*)\\s*[-. …]+\\s*([1-9]\\d*)\\s*:?$/.exec(trimmed);\n\tif (bareRange !== null) {\n\t\treturn (\n\t\t\t`bare range hunk header ${JSON.stringify(trimmed)} is not valid. ` +\n\t\t\t`Hunk headers need a verb: write \\`replace ${bareRange[1]}..${bareRange[2]}:\\` or \\`delete ${bareRange[1]}..${bareRange[2]}\\`.`\n\t\t);\n\t}\n\treturn null;\n}\n\ninterface PendingComment {\n\tlineNum: number;\n\ttext: string;\n}\n\ntype PayloadRow = { kind: \"literal\"; text: string; lineNum: number; bare?: boolean };\n\ninterface Pending {\n\ttarget: BlockTarget;\n\tlineNum: number;\n\tpayloads: PayloadRow[];\n\t/**\n\t * Blank rows seen after the body started. Interior blanks are committed to\n\t * the payload when the next non-blank row arrives; trailing blanks before\n\t * the next header/op are layout separators and are discarded on flush.\n\t */\n\tdeferredBlanks: PayloadRow[];\n}\n\nexport class Executor {\n\t#edits: Edit[] = [];\n\t#warnings: string[] = [];\n\t#editIndex = 0;\n\t#pending: Pending | undefined;\n\t#terminated = false;\n\t#skippableComments: PendingComment[] = [];\n\n\t#discardPendingSkippableComments(): void {\n\t\tthis.#skippableComments = [];\n\t}\n\n\t#consumePendingSkippableComments(): void {\n\t\tif (this.#skippableComments.length === 0) return;\n\t\tfor (const comment of this.#skippableComments) this.#handleRaw(comment.text, comment.lineNum);\n\t\tthis.#skippableComments = [];\n\t}\n\n\tfeed(token: Token): void {\n\t\tif (this.#terminated) return;\n\t\tswitch (token.kind) {\n\t\t\tcase \"envelope-begin\":\n\t\t\t\tthis.#consumePendingSkippableComments();\n\t\t\t\treturn;\n\t\t\tcase \"envelope-end\":\n\t\t\t\tthis.#consumePendingSkippableComments();\n\t\t\t\tthis.#terminated = true;\n\t\t\t\treturn;\n\t\t\tcase \"abort\":\n\t\t\t\tthis.#terminated = true;\n\t\t\t\treturn;\n\t\t\tcase \"header\":\n\t\t\t\tthis.#consumePendingSkippableComments();\n\t\t\t\tthis.#flushPending();\n\t\t\t\treturn;\n\t\t\tcase \"blank\":\n\t\t\t\tthis.#consumePendingSkippableComments();\n\t\t\t\tthis.#handleBlank(\"\", token.lineNum);\n\t\t\t\treturn;\n\t\t\tcase \"payload-literal\":\n\t\t\t\tthis.#consumePendingSkippableComments();\n\t\t\t\tthis.#handleLiteralPayload(token.text, token.lineNum);\n\t\t\t\treturn;\n\t\t\tcase \"raw\":\n\t\t\t\tif (this.#pending === undefined && isSkippableCommentLine(token.text)) {\n\t\t\t\t\tthis.#skippableComments.push({ text: token.text, lineNum: token.lineNum });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tthis.#consumePendingSkippableComments();\n\t\t\t\tthis.#handleRaw(token.text, token.lineNum);\n\t\t\t\treturn;\n\t\t\tcase \"op-block\":\n\t\t\t\tthis.#discardPendingSkippableComments();\n\t\t\t\tif (token.target.kind === \"replace\" || token.target.kind === \"delete\") {\n\t\t\t\t\tvalidateRangeOrder(token.target.range, token.lineNum);\n\t\t\t\t}\n\t\t\t\tthis.#flushPending();\n\t\t\t\tthis.#pending = { target: token.target, lineNum: token.lineNum, payloads: [], deferredBlanks: [] };\n\t\t\t\treturn;\n\t\t}\n\t}\n\n\tend(): { edits: Edit[]; warnings: string[] } {\n\t\tthis.#consumePendingSkippableComments();\n\t\tthis.#flushPending();\n\t\tthis.#validateNoOverlappingDeletes();\n\t\treturn { edits: this.#edits, warnings: this.#warnings };\n\t}\n\n\tendStreaming(): { edits: Edit[]; warnings: string[] } {\n\t\tthis.#consumePendingSkippableComments();\n\t\tif (this.#pending && this.#pending.payloads.length > 0) this.#flushPending();\n\t\telse if (this.#pending?.target.kind === \"delete\" || this.#pending?.target.kind === \"delete_block\")\n\t\t\tthis.#flushPending();\n\t\telse this.#pending = undefined;\n\t\tthis.#validateNoOverlappingDeletes();\n\t\treturn { edits: this.#edits, warnings: this.#warnings };\n\t}\n\n\treset(): void {\n\t\tthis.#edits = [];\n\t\tthis.#warnings = [];\n\t\tthis.#editIndex = 0;\n\t\tthis.#pending = undefined;\n\t\tthis.#skippableComments = [];\n\t\tthis.#terminated = false;\n\t}\n\n\t#validateNoOverlappingDeletes(): void {\n\t\tconst sourceLinesByAnchor = new Map<number, number[]>();\n\t\tfor (const edit of this.#edits) {\n\t\t\tif (edit.kind !== \"delete\") continue;\n\t\t\tlet sourceLines = sourceLinesByAnchor.get(edit.anchor.line);\n\t\t\tif (sourceLines === undefined) {\n\t\t\t\tsourceLines = [];\n\t\t\t\tsourceLinesByAnchor.set(edit.anchor.line, sourceLines);\n\t\t\t}\n\t\t\tif (!sourceLines.includes(edit.lineNum)) sourceLines.push(edit.lineNum);\n\t\t}\n\t\tfor (const [anchorLine, sourceLines] of sourceLinesByAnchor) {\n\t\t\tif (sourceLines.length < 2) continue;\n\t\t\tconst [firstBlock, secondBlock] = [...sourceLines].sort((a, b) => a - b);\n\t\t\tthrow new Error(\n\t\t\t\t`line ${secondBlock}: anchor line ${anchorLine} is already targeted by another hunk on line ${firstBlock}. ` +\n\t\t\t\t\t\"Issue ONE hunk per range; payload is only the final desired content, never a before/after pair.\",\n\t\t\t);\n\t\t}\n\t}\n\n\t#handleLiteralPayload(text: string, lineNum: number): void {\n\t\tconst pending = this.#pending;\n\t\tif (!pending) {\n\t\t\tthrow new Error(\n\t\t\t\t`line ${lineNum}: payload line has no preceding hunk header. ` +\n\t\t\t\t\t`Got ${JSON.stringify(`${HL_PAYLOAD_REPLACE}${text}`)}.`,\n\t\t\t);\n\t\t}\n\t\tif (pending.target.kind === \"delete\") throw new Error(`line ${lineNum}: ${DELETE_TAKES_NO_BODY}`);\n\t\tif (pending.target.kind === \"delete_block\") throw new Error(`line ${lineNum}: ${DELETE_BLOCK_TAKES_NO_BODY}`);\n\t\tthis.#commitDeferredBlanks(pending);\n\t\tpending.payloads.push({ kind: \"literal\", text, lineNum });\n\t}\n\n\t#handleRaw(text: string, lineNum: number): void {\n\t\tconst contamination = detectApplyPatchContamination(text, this.#pending !== undefined);\n\t\tif (contamination !== null) throw new Error(`line ${lineNum}: ${contamination}`);\n\t\tif (this.#pending) {\n\t\t\tif (text.trim().length === 0) {\n\t\t\t\tthis.#handleBlank(text, lineNum);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (this.#pending.target.kind === \"delete\") throw new Error(`line ${lineNum}: ${DELETE_TAKES_NO_BODY}`);\n\t\t\tif (this.#pending.target.kind === \"delete_block\")\n\t\t\t\tthrow new Error(`line ${lineNum}: ${DELETE_BLOCK_TAKES_NO_BODY}`);\n\t\t\tif (text.trimStart().charCodeAt(0) === 45 /* - */) throw new Error(`line ${lineNum}: ${MINUS_ROW_REJECTED}`);\n\t\t\tif (!this.#warnings.includes(BARE_BODY_AUTO_PIPED_WARNING)) this.#warnings.push(BARE_BODY_AUTO_PIPED_WARNING);\n\t\t\tthis.#commitDeferredBlanks(this.#pending);\n\t\t\t// Defer read-output line-number stripping to #flushPending: a bare\n\t\t\t// \"N:text\" row is only a copy-paste artifact from snapshot output\n\t\t\t// when *every* bare row in the hunk carries that prefix. Stripping a\n\t\t\t// row in isolation would corrupt a genuine body that merely starts\n\t\t\t// with \"digits:\" (YAML ports \"42:hello\", timestamps \"12:30\") when it\n\t\t\t// sits next to an unprefixed sibling. Rows with an explicit \"+\" go\n\t\t\t// through #handleLiteralPayload and are never bare, never stripped.\n\t\t\tthis.#pending.payloads.push({ kind: \"literal\", text, lineNum, bare: true });\n\t\t\treturn;\n\t\t}\n\t\tif (text.trim().length === 0) return;\n\t\tthrow new Error(\n\t\t\t`line ${lineNum}: payload line has no preceding hunk header. ` +\n\t\t\t\t`Use \\`replace N..M:\\`, \\`delete N..M\\`, or \\`insert before|after|head|tail:\\` above the body. Got ${JSON.stringify(text)}.`,\n\t\t);\n\t}\n\n\t/**\n\t * A blank row inside a hunk body is ambiguous: interior blanks are body\n\t * content (a bare-pasted body legitimately contains empty lines), while\n\t * blanks before the body starts or trailing into the next op are layout.\n\t * Defer them; {@link #commitDeferredBlanks} folds them in only when a later\n\t * non-blank row proves they were interior.\n\t */\n\t#handleBlank(text: string, lineNum: number): void {\n\t\tconst pending = this.#pending;\n\t\tif (!pending) return;\n\t\tif (pending.target.kind === \"delete\" || pending.target.kind === \"delete_block\") return;\n\t\tif (pending.payloads.length === 0) return;\n\t\tpending.deferredBlanks.push({ kind: \"literal\", text, lineNum, bare: true });\n\t}\n\n\t#commitDeferredBlanks(pending: Pending): void {\n\t\tif (pending.deferredBlanks.length === 0) return;\n\t\tif (!this.#warnings.includes(BARE_BODY_AUTO_PIPED_WARNING)) this.#warnings.push(BARE_BODY_AUTO_PIPED_WARNING);\n\t\tpending.payloads.push(...pending.deferredBlanks);\n\t\tpending.deferredBlanks = [];\n\t}\n\n\t/**\n\t * Strip a single read-output line-number prefix (`N:`) from every bare body\n\t * row, but only when *all* bare rows carry one. A uniform set of prefixes is\n\t * the signature of content pasted straight from `read`/`search` output; a\n\t * mixed set means the `N:` is genuine payload content and must stay. Rows\n\t * authored with an explicit `+` are not bare and are never touched.\n\t */\n\t#stripBarePrefixesIfUniform(payloads: PayloadRow[]): void {\n\t\tlet sawBare = false;\n\t\tlet allLiteralValues = true;\n\t\tfor (const row of payloads) {\n\t\t\tif (!row.bare || row.text.trim().length === 0) continue;\n\t\t\tsawBare = true;\n\t\t\tconst stripped = stripOneLeadingHashlinePrefix(row.text);\n\t\t\tif (stripped === row.text) return;\n\t\t\tallLiteralValues &&= BARE_LITERAL_VALUE_RE.test(stripped);\n\t\t}\n\t\tif (!sawBare) return;\n\t\t// A body where every stripped remainder is a lone quoted/numeric literal\n\t\t// (optionally comma-terminated) is the shape of a numeric-keyed dict or\n\t\t// YAML mapping (`1: \"one\",`), not read-output paste; stripping the \"N:\"\n\t\t// keys would mangle every line. Leave such bodies untouched.\n\t\tif (allLiteralValues) return;\n\t\tfor (const row of payloads) {\n\t\t\tif (row.bare && row.text.trim().length > 0) row.text = stripOneLeadingHashlinePrefix(row.text);\n\t\t}\n\t}\n\n\t#pushInsert(cursor: Cursor, text: string, lineNum: number, mode?: \"replacement\"): void {\n\t\tthis.#edits.push({\n\t\t\tkind: \"insert\",\n\t\t\tcursor: cloneCursor(cursor),\n\t\t\ttext,\n\t\t\tlineNum,\n\t\t\tindex: this.#editIndex++,\n\t\t\t...(mode === undefined ? {} : { mode }),\n\t\t});\n\t}\n\n\t#pushDelete(anchor: Anchor, lineNum: number): void {\n\t\tthis.#edits.push({ kind: \"delete\", anchor: { ...anchor }, lineNum, index: this.#editIndex++ });\n\t}\n\n\t#pushBlock(anchor: Anchor, payloads: readonly PayloadRow[], lineNum: number, mode?: \"insert_after\"): void {\n\t\tthis.#edits.push({\n\t\t\tkind: \"block\",\n\t\t\tanchor: { ...anchor },\n\t\t\tpayloads: payloads.map(payload => payload.text),\n\t\t\t...(mode === undefined ? {} : { mode }),\n\t\t\tlineNum,\n\t\t\tindex: this.#editIndex++,\n\t\t});\n\t}\n\n\t#emitPayloadRows(cursor: Cursor, payloads: readonly PayloadRow[], lineNum: number, mode?: \"replacement\"): void {\n\t\tfor (const payload of payloads) this.#pushInsert(cursor, payload.text, lineNum, mode);\n\t}\n\n\t#flushPending(): void {\n\t\tconst pending = this.#pending;\n\t\tif (!pending) return;\n\t\tconst { target, lineNum, payloads } = pending;\n\t\tthis.#stripBarePrefixesIfUniform(payloads);\n\t\tthis.#pending = undefined;\n\t\tif (target.kind === \"delete\") {\n\t\t\tfor (const anchor of expandRange(target.range)) this.#pushDelete(anchor, lineNum);\n\t\t\treturn;\n\t\t}\n\t\tif (target.kind === \"delete_block\") {\n\t\t\t// A block edit with no payloads resolves to a pure block deletion.\n\t\t\tthis.#pushBlock(target.anchor, [], lineNum);\n\t\t\treturn;\n\t\t}\n\t\tif (target.kind === \"block\") {\n\t\t\tif (payloads.length === 0) throw new Error(`line ${lineNum}: ${EMPTY_BLOCK}`);\n\t\t\tthis.#pushBlock(target.anchor, payloads, lineNum);\n\t\t\treturn;\n\t\t}\n\t\tif (target.kind === \"insert_after_block\") {\n\t\t\tif (payloads.length === 0) throw new Error(`line ${lineNum}: ${EMPTY_INSERT}`);\n\t\t\tthis.#pushBlock(target.anchor, payloads, lineNum, \"insert_after\");\n\t\t\treturn;\n\t\t}\n\t\tif (payloads.length === 0) {\n\t\t\tif (target.kind === \"replace\") {\n\t\t\t\tfor (const anchor of expandRange(target.range)) this.#pushDelete(anchor, lineNum);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthrow new Error(`line ${lineNum}: ${EMPTY_INSERT}`);\n\t\t}\n\t\tif (target.kind === \"replace\") {\n\t\t\tconst cursor: Cursor = { kind: \"before_anchor\", anchor: { ...target.range.start } };\n\t\t\tthis.#emitPayloadRows(cursor, payloads, lineNum, \"replacement\");\n\t\t\tfor (const anchor of expandRange(target.range)) this.#pushDelete(anchor, lineNum);\n\t\t\treturn;\n\t\t}\n\t\tif (target.kind === \"insert_before\") {\n\t\t\tthis.#emitPayloadRows({ kind: \"before_anchor\", anchor: { ...target.anchor } }, payloads, lineNum);\n\t\t\treturn;\n\t\t}\n\t\tif (target.kind === \"insert_after\") {\n\t\t\tthis.#emitPayloadRows({ kind: \"after_anchor\", anchor: { ...target.anchor } }, payloads, lineNum);\n\t\t\treturn;\n\t\t}\n\t\tconst cursor: Cursor = target.kind === \"bof\" ? { kind: \"bof\" } : { kind: \"eof\" };\n\t\tthis.#emitPayloadRows(cursor, payloads, lineNum);\n\t}\n}\n\nfunction drain(executor: Executor, tokenizer: Tokenizer): { edits: Edit[]; warnings: string[] } {\n\tfor (const token of tokenizer.end()) executor.feed(token);\n\treturn executor.end();\n}\n\nexport function parsePatch(diff: string): { edits: Edit[]; warnings: string[] } {\n\tconst tokenizer = new Tokenizer();\n\tconst executor = new Executor();\n\tfor (const token of tokenizer.feed(diff)) executor.feed(token);\n\treturn drain(executor, tokenizer);\n}\n\nexport function parsePatchStreaming(diff: string): { edits: Edit[]; warnings: string[] } {\n\tconst tokenizer = new Tokenizer();\n\tconst executor = new Executor();\n\tfor (const token of tokenizer.feed(diff)) executor.feed(token);\n\tfor (const token of tokenizer.end()) executor.feed(token);\n\treturn executor.endStreaming();\n}\n"]}
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../../../src/core/tools/hashline-engine/parser.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAmD,KAAK,KAAK,EAAa,MAAM,gBAAgB,CAAC;AACxG,OAAO,KAAK,EAAkB,IAAI,EAAE,MAAM,YAAY,CAAC;AAyFvD,qBAAa,QAAQ;;IAkBpB,IAAI,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CA0CvB;IAED,GAAG,IAAI;QAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;KAAE,CAK3C;IAED,YAAY,IAAI;QAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;KAAE,CAQpD;IAED,KAAK,IAAI,IAAI,CAOZ;CAqMD;AAOD,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAK9E;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAMvF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"patcher.d.ts","sourceRoot":"","sources":["../../../../src/core/tools/hashline-engine/patcher.ts"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EAAE,UAAU,EAAe,MAAM,SAAS,CAAC;AAEvD,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAGtD,OAAO,EAAoB,KAAK,UAAU,EAA+C,MAAM,gBAA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sourcesContent":["// @generated vendored verbatim from oh-my-pi packages/hashline @ 15b5c1397fc -- DO NOT EDIT.\n// Parity source for the Atomic hashline edit engine (issue #1483); adapted only for Atomic's Node runtime (relative imports, Bun->Node host calls, erasable constructor syntax).\n/**\n * High-level patch orchestrator. Reads each section's target file via the\n * configured {@link Filesystem}, strips BOM and normalizes line endings,\n * validates the section snapshot tag (with {@link Recovery}), applies the\n * result back through the same {@link Filesystem}.\n *\n * Two layers:\n * - {@link Patcher.apply} — high-level, preflight-atomic. It validates and\n * applies every section in memory before any write hits disk, then commits\n * in order. It is not write-transactional: a mid-batch filesystem failure\n * can leave earlier sections already written, and the thrown error reports\n * which sections landed.\n * - {@link Patcher.prepare} / {@link Patcher.commit} — granular primitives\n * for callers that need per-section control (e.g. batched LSP flush,\n * custom interleaving). `prepare` performs all the read-side work,\n * validates the section snapshot tag (with recovery), and applies the\n * edits in memory. `commit` writes the prepared result and records a\n * fresh snapshot.\n *\n * Because `prepare` already runs the full apply, a multi-section batch fails\n * before any write when parsing, stale-tag validation, or in-memory apply fails.\n *\n * The patcher itself is stateless across calls; reuse one instance per\n * filesystem configuration.\n */\nimport { applyEdits } from \"./apply.js\";\nimport { hasBlockEdit, resolveBlockEdits } from \"./block.js\";\nimport { computeFileHash, formatHashlineHeader } from \"./format.js\";\nimport type { Filesystem, WriteResult } from \"./fs.js\";\nimport { isNotFound } from \"./fs.js\";\nimport type { Patch, PatchSection } from \"./input.js\";\nimport { HEADTAIL_DRIFT_WARNING, missingSnapshotTagMessage } from \"./messages.js\";\nimport { MismatchError } from \"./mismatch.js\";\nimport { detectLineEnding, type LineEnding, normalizeToLF, restoreLineEndings, stripBom } from \"./normalize.js\";\nimport { Recovery, type RecoveryResult } from \"./recovery.js\";\nimport type { SnapshotStore } from \"./snapshots.js\";\nimport type { ApplyResult, BlockResolution, BlockResolver, Edit } from \"./types.js\";\n\nexport interface PatcherOptions {\n\t/** Storage backend used for all reads and writes. */\n\tfs: Filesystem;\n\t/** Snapshot store that minted and resolves hashline section tags. Required. */\n\tsnapshots: SnapshotStore;\n\t/**\n\t * Resolves `replace block N:` anchors to concrete line spans via tree-sitter.\n\t * Optional: when omitted, any `replace block N:` edit throws on apply (the\n\t * host did not wire a resolver). Plain line-range ops never need it.\n\t */\n\tblockResolver?: BlockResolver;\n}\n\n/** Per-section result returned by {@link Patcher.apply} / {@link Patcher.commit}. */\nexport interface PatchSectionResult {\n\t/** Section path (as authored, after cwd-resolution at parse time). */\n\tpath: string;\n\t/** Filesystem-canonical key for this section (e.g. absolute path). */\n\tcanonicalPath: string;\n\t/** `\"noop\"` when the apply produced no change; otherwise `\"create\"` / `\"update\"`. */\n\top: \"create\" | \"update\" | \"noop\";\n\t/** Pre-edit text (LF-normalized, BOM-stripped). */\n\tbefore: string;\n\t/** Post-edit text (LF-normalized, BOM-stripped). For `\"noop\"` equals `before`. */\n\tafter: string;\n\t/** Same text as `after` but with the original BOM and line ending restored. */\n\tpersisted: string;\n\t/** Final text that the {@link Filesystem} actually wrote (may differ if the FS transformed it). */\n\twritten: string;\n\t/** 4-hex content-hash tag for `after`. Use to anchor follow-up edits. */\n\tfileHash: string;\n\t/** Hashline section header (`[path#tag]`) of the post-edit content. */\n\theader: string;\n\t/** 1-indexed first changed line in `after`, or `undefined` for noops. */\n\tfirstChangedLine?: number;\n\t/** Warnings collected by the parser, applier, and (optionally) recovery. */\n\twarnings: string[];\n\t/**\n\t * Resolved spans for any `replace block`/`delete block` ops, present when the\n\t * apply matched the tagged content. Undefined for patches with no block ops\n\t * (and for resolutions routed through drift recovery, where numbers shift).\n\t */\n\tblockResolutions?: BlockResolution[];\n}\n\nexport interface PatcherApplyResult {\n\tsections: PatchSectionResult[];\n}\n\n/**\n * Opaque token returned by {@link Patcher.prepare}. Carries the section, the\n * raw file content read off disk, and the in-memory apply result.\n * {@link Patcher.commit} just writes the {@link PreparedSection.applyResult}.\n */\nexport class PreparedSection {\n\treadonly section: PatchSection;\n\treadonly canonicalPath: string;\n\treadonly exists: boolean;\n\treadonly rawContent: string;\n\treadonly bom: string;\n\treadonly lineEnding: LineEnding;\n\treadonly normalized: string;\n\treadonly applyResult: ApplyResult;\n\treadonly parseWarnings: readonly string[];\n\t/** @internal */\n\tconstructor(\n\t\tsection: PatchSection,\n\t\tcanonicalPath: string,\n\t\texists: boolean,\n\t\trawContent: string,\n\t\tbom: string,\n\t\tlineEnding: LineEnding,\n\t\tnormalized: string,\n\t\tapplyResult: ApplyResult,\n\t\tparseWarnings: readonly string[],\n\t) {\n\t\tthis.section = section;\n\t\tthis.canonicalPath = canonicalPath;\n\t\tthis.exists = exists;\n\t\tthis.rawContent = rawContent;\n\t\tthis.bom = bom;\n\t\tthis.lineEnding = lineEnding;\n\t\tthis.normalized = normalized;\n\t\tthis.applyResult = applyResult;\n\t\tthis.parseWarnings = parseWarnings;\n\t}\n\n\t/** Convenience: returns true when the apply produced no change. */\n\tget isNoop(): boolean {\n\t\treturn this.applyResult.text === this.normalized;\n\t}\n}\n\nfunction hasAnchorScopedEdit(edits: readonly Edit[]): boolean {\n\treturn edits.some(edit => {\n\t\tif (edit.kind === \"delete\") return true;\n\t\t// A `replace block N:` edit anchors to concrete content on line N.\n\t\tif (edit.kind === \"block\") return true;\n\t\treturn edit.cursor.kind === \"before_anchor\" || edit.cursor.kind === \"after_anchor\";\n\t});\n}\n\nfunction assertSectionHashPresent(sectionPath: string, fileHash: string | undefined): void {\n\tif (fileHash !== undefined) return;\n\tthrow new Error(missingSnapshotTagMessage(sectionPath));\n}\n\nfunction recoveryToApplyResult(result: RecoveryResult): ApplyResult {\n\treturn {\n\t\ttext: result.text,\n\t\tfirstChangedLine: result.firstChangedLine,\n\t\twarnings: result.warnings,\n\t};\n}\nfunction mergeWarnings(...sources: ReadonlyArray<readonly string[] | undefined>): string[] {\n\tconst out: string[] = [];\n\tfor (const source of sources) {\n\t\tif (!source) continue;\n\t\tfor (const warning of source) out.push(warning);\n\t}\n\treturn out;\n}\n\nfunction assertUniqueCanonicalPaths(prepared: readonly PreparedSection[]): void {\n\tconst seen = new Map<string, string>();\n\tfor (const entry of prepared) {\n\t\tconst previous = seen.get(entry.canonicalPath);\n\t\tif (previous !== undefined) {\n\t\t\tthrow new Error(\n\t\t\t\t`Multiple hashline sections resolve to the same file (${previous} and ${entry.section.path}). Merge their ops under one header before applying.`,\n\t\t\t);\n\t\t}\n\t\tseen.set(entry.canonicalPath, entry.section.path);\n\t}\n}\n\n/**\n * High-level patcher. Wires a {@link Filesystem} and a required\n * {@link SnapshotStore} together with the parsing + applying core.\n *\n * Construct once per FS configuration; reuse across patches.\n */\nexport class Patcher {\n\treadonly fs: Filesystem;\n\treadonly snapshots: SnapshotStore;\n\treadonly recovery: Recovery;\n\treadonly blockResolver: BlockResolver | undefined;\n\n\tconstructor(options: PatcherOptions) {\n\t\tif (!options.snapshots) {\n\t\t\tthrow new Error(\"Hashline Patcher requires a SnapshotStore; section tags are opaque store pointers.\");\n\t\t}\n\t\tthis.fs = options.fs;\n\t\tthis.snapshots = options.snapshots;\n\t\tthis.recovery = new Recovery(options.snapshots);\n\t\tthis.blockResolver = options.blockResolver;\n\t}\n\n\t/**\n\t * Apply every section in `patch`. `prepare` runs the full apply for each\n\t * section in memory before any write hits the filesystem, so a\n\t * multi-section batch fails before writing on parse/validation/apply errors.\n\t * Write commits are sequential rather than transactional; if a write fails,\n\t * earlier sections may already be on disk and are listed in the thrown error.\n\t * Returns one {@link PatchSectionResult} per section in the original patch order.\n\t */\n\tasync apply(patch: Patch): Promise<PatcherApplyResult> {\n\t\t// Single-section fast path.\n\t\tif (patch.sections.length === 1) {\n\t\t\tconst prepared = await this.prepare(patch.sections[0]);\n\t\t\treturn { sections: [await this.commit(prepared)] };\n\t\t}\n\n\t\t// Prepare every section first so any failure (stale hash, missing\n\t\t// file, parse error, in-memory no-op) surfaces before any write.\n\t\tconst prepared: PreparedSection[] = [];\n\t\tfor (const section of patch.sections) prepared.push(await this.prepare(section));\n\t\tassertUniqueCanonicalPaths(prepared);\n\t\tfor (const entry of prepared) {\n\t\t\tif (entry.isNoop) {\n\t\t\t\tthrow new Error(`Edits to ${entry.section.path} resulted in no changes being made.`);\n\t\t\t}\n\t\t}\n\n\t\tconst results: PatchSectionResult[] = [];\n\t\tfor (let index = 0; index < prepared.length; index++) {\n\t\t\ttry {\n\t\t\t\tresults.push(await this.commit(prepared[index]));\n\t\t\t} catch (error) {\n\t\t\t\t// A mid-batch write failure leaves earlier sections on disk with no\n\t\t\t\t// rollback; report exactly which sections landed so the caller can\n\t\t\t\t// re-issue only the missing ones instead of double-applying.\n\t\t\t\tconst written = prepared.slice(0, index).map(entry => entry.section.path);\n\t\t\t\tconst notWritten = prepared.slice(index + 1).map(entry => entry.section.path);\n\t\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Failed to write ${prepared[index].section.path}: ${message}` +\n\t\t\t\t\t\t(written.length > 0 ? ` Sections already written: ${written.join(\", \")}.` : \"\") +\n\t\t\t\t\t\t(notWritten.length > 0 ? ` Sections not written: ${notWritten.join(\", \")}.` : \"\"),\n\t\t\t\t\t{ cause: error },\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\treturn { sections: results };\n\t}\n\n\t/**\n\t * Run the preflight pass only: read, parse, validate, apply-in-memory.\n\t * No writes hit the filesystem. Use for CI checks and dry runs.\n\t */\n\tasync preflight(patch: Patch): Promise<void> {\n\t\tconst prepared: PreparedSection[] = [];\n\t\tfor (const section of patch.sections) prepared.push(await this.prepare(section));\n\t\tassertUniqueCanonicalPaths(prepared);\n\t\tfor (const entry of prepared) {\n\t\t\tif (entry.isNoop) {\n\t\t\t\tthrow new Error(`Edits to ${entry.section.path} resulted in no changes being made.`);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Read a section's target file, parse the section, validate the snapshot\n\t * tag (with recovery), and apply the edits in memory. Returns a\n\t * {@link PreparedSection} which can be fed to {@link commit} to land\n\t * the result on the filesystem.\n\t *\n\t * Throws on parse error, missing-file-for-anchored-edit, or unrecovered\n\t * tag mismatch ({@link MismatchError}).\n\t */\n\tasync prepare(section: PatchSection): Promise<PreparedSection> {\n\t\tconst { edits, warnings: parseWarnings } = section.parse();\n\t\tassertSectionHashPresent(section.path, section.fileHash);\n\n\t\tconst canonicalPath = this.fs.canonicalPath(section.path);\n\t\tawait this.fs.preflightWrite(section.path);\n\t\tconst { exists, rawContent } = await this.#tryRead(section.path);\n\t\tif (!exists) {\n\t\t\tthrow new Error(`File not found: ${section.path}. Use the write tool to create new files.`);\n\t\t}\n\n\t\tconst { bom, text } = stripBom(rawContent);\n\t\tconst lineEnding = detectLineEnding(text);\n\t\tconst normalized = normalizeToLF(text);\n\n\t\tconst applyResult = this.#applyWithRecovery({\n\t\t\tsection,\n\t\t\tcanonicalPath,\n\t\t\texists,\n\t\t\tnormalized,\n\t\t\tedits,\n\t\t});\n\n\t\treturn new PreparedSection(\n\t\t\tsection,\n\t\t\tcanonicalPath,\n\t\t\texists,\n\t\t\trawContent,\n\t\t\tbom,\n\t\t\tlineEnding,\n\t\t\tnormalized,\n\t\t\tapplyResult,\n\t\t\tparseWarnings,\n\t\t);\n\t}\n\n\t/**\n\t * Commit a previously {@link prepare}d section to the filesystem.\n\t * Restores line endings and BOM, writes via the {@link Filesystem}, and\n\t * records a fresh snapshot in the {@link SnapshotStore} keyed by the\n\t * filesystem-canonical path.\n\t */\n\tasync commit(prepared: PreparedSection): Promise<PatchSectionResult> {\n\t\tconst { section, normalized, bom, lineEnding, parseWarnings, exists, applyResult, canonicalPath } = prepared;\n\t\tconst after = applyResult.text;\n\t\tconst warnings = mergeWarnings(parseWarnings, applyResult.warnings);\n\n\t\tif (after === normalized) {\n\t\t\tconst hash = this.#recordFullSnapshot(canonicalPath, normalized);\n\t\t\treturn {\n\t\t\t\tpath: section.path,\n\t\t\t\tcanonicalPath,\n\t\t\t\top: \"noop\",\n\t\t\t\tbefore: normalized,\n\t\t\t\tafter: normalized,\n\t\t\t\tpersisted: prepared.rawContent,\n\t\t\t\twritten: prepared.rawContent,\n\t\t\t\tfileHash: hash,\n\t\t\t\theader: formatHashlineHeader(section.path, hash),\n\t\t\t\twarnings,\n\t\t\t};\n\t\t}\n\n\t\tconst persisted = bom + restoreLineEndings(after, lineEnding);\n\t\tconst write: WriteResult = await this.fs.writeText(section.path, persisted);\n\t\tconst fileHash = this.#recordFullSnapshot(canonicalPath, after);\n\t\tconst op = exists ? \"update\" : \"create\";\n\n\t\treturn {\n\t\t\tpath: section.path,\n\t\t\tcanonicalPath,\n\t\t\top,\n\t\t\tbefore: normalized,\n\t\t\tafter,\n\t\t\tpersisted,\n\t\t\twritten: write.text,\n\t\t\tfileHash,\n\t\t\theader: formatHashlineHeader(section.path, fileHash),\n\t\t\tfirstChangedLine: applyResult.firstChangedLine,\n\t\t\tblockResolutions: applyResult.blockResolutions,\n\t\t\twarnings,\n\t\t};\n\t}\n\n\tasync #tryRead(path: string): Promise<{ exists: boolean; rawContent: string }> {\n\t\ttry {\n\t\t\tconst content = await this.fs.readText(path);\n\t\t\treturn { exists: true, rawContent: content };\n\t\t} catch (error) {\n\t\t\tif (isNotFound(error)) return { exists: false, rawContent: \"\" };\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t#recordFullSnapshot(canonicalPath: string, normalized: string): string {\n\t\treturn this.snapshots.record(canonicalPath, normalized);\n\t}\n\t#mismatchError(\n\t\tsection: PatchSection,\n\t\tcanonicalPath: string,\n\t\tnormalized: string,\n\t\texpected: string,\n\t\thashRecognized: boolean,\n\t): MismatchError {\n\t\tconst actualFileHash = this.#recordFullSnapshot(canonicalPath, normalized);\n\t\treturn new MismatchError({\n\t\t\tpath: section.path,\n\t\t\texpectedFileHash: expected,\n\t\t\tactualFileHash,\n\t\t\tfileLines: normalized.split(\"\\n\"),\n\t\t\tanchorLines: section.collectAnchorLines(),\n\t\t\thashRecognized,\n\t\t});\n\t}\n\n\t#applyWithRecovery(args: {\n\t\tsection: PatchSection;\n\t\tcanonicalPath: string;\n\t\texists: boolean;\n\t\tnormalized: string;\n\t\tedits: readonly Edit[];\n\t}): ApplyResult {\n\t\tconst { section, canonicalPath, exists, normalized, edits } = args;\n\t\tconst expected = exists ? section.fileHash : undefined;\n\t\tconst expectedSnapshot = expected === undefined ? null : this.snapshots.byHash(canonicalPath, expected);\n\t\tconst liveHashMatches = expected !== undefined && computeFileHash(normalized) === expected;\n\t\tconst liveSnapshot = expected === undefined ? null : this.snapshots.byHashAndText(canonicalPath, expected, normalized);\n\t\tconst liveMatches = liveHashMatches && liveSnapshot !== null;\n\t\tif (liveHashMatches && !liveMatches) {\n\t\t\tthrow this.#mismatchError(section, canonicalPath, normalized, expected, expectedSnapshot !== null);\n\t\t}\n\n\t\t// Resolve `replace block N:` edits to concrete ranges before recovery\n\t\t// runs. Block anchors are expressed against the snapshot the section tag\n\t\t// names, so resolve against that exact text:\n\t\t// - live content matches the tag (or there is no tag) → resolve against\n\t\t// the live, normalized content;\n\t\t// - the file drifted → resolve against the tagged snapshot's text so the\n\t\t// resulting ranges flow through the 3-way-merge recovery below.\n\t\t// When a block edit needs the tagged snapshot but it is unavailable, the\n\t\t// range cannot be placed safely — reject with a MismatchError (re-read).\n\t\tconst blockResolutions: BlockResolution[] = [];\n\t\tconst resolveWarnings: string[] = [];\n\t\tlet resolved: readonly Edit[] = edits;\n\t\tif (hasBlockEdit(edits)) {\n\t\t\tconst baseText =\n\t\t\t\texpected === undefined || liveMatches ? normalized : expectedSnapshot?.text;\n\t\t\tif (baseText === undefined) {\n\t\t\t\tthrow this.#mismatchError(section, canonicalPath, normalized, expected ?? \"\", false);\n\t\t\t}\n\t\t\tresolved = resolveBlockEdits(edits, baseText, section.path, this.blockResolver, {\n\t\t\t\tonUnresolved: \"throw\",\n\t\t\t\tonResolved: resolution => blockResolutions.push(resolution),\n\t\t\t\tonWarning: warning => resolveWarnings.push(warning),\n\t\t\t});\n\t\t}\n\t\tconst withResolveWarnings = (result: ApplyResult): ApplyResult =>\n\t\t\tresolveWarnings.length === 0\n\t\t\t\t? result\n\t\t\t\t: { ...result, warnings: [...resolveWarnings, ...(result.warnings ?? [])] };\n\n\t\t// No tag, or the tag still names the live content: an edit anchored at any\n\t\t// line is safe to apply, and the resolved block spans line up with what\n\t\t// the caller read, so echo them back. (A drifted file falls through to\n\t\t// recovery below, where line numbers shift, so resolutions are dropped.)\n\t\tif (expected === undefined || liveMatches) {\n\t\t\tconst result = applyEdits(normalized, resolved);\n\t\t\treturn withResolveWarnings(blockResolutions.length > 0 ? { ...result, blockResolutions } : result);\n\t\t}\n\t\t// Head/tail-only inserts are position-stable: \"start\"/\"end\" cannot move\n\t\t// with content drift, so a stale tag is non-fatal. Apply onto the live\n\t\t// content and warn instead of hard-failing — unlike an anchored\n\t\t// mismatch, which cannot be safely relocated and must reject.\n\t\tif (!hasAnchorScopedEdit(resolved)) {\n\t\t\tconst result = applyEdits(normalized, resolved);\n\t\t\treturn withResolveWarnings({ ...result, warnings: [HEADTAIL_DRIFT_WARNING, ...(result.warnings ?? [])] });\n\t\t}\n\t\t// File drifted: try to replay the edit against the version the tag\n\t\t// names and 3-way-merge it onto the live content.\n\t\tconst recovered = this.recovery.tryRecover({\n\t\t\tpath: canonicalPath,\n\t\t\tcurrentText: normalized,\n\t\t\tfileHash: expected,\n\t\t\tedits: resolved,\n\t\t});\n\t\tif (recovered) return withResolveWarnings(recoveryToApplyResult(recovered));\n\t\tconst hashRecognized = expectedSnapshot !== null;\n\t\tthrow this.#mismatchError(section, canonicalPath, normalized, expected, hashRecognized);\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"patcher.d.ts","sourceRoot":"","sources":["../../../../src/core/tools/hashline-engine/patcher.ts"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EAAE,UAAU,EAAe,MAAM,SAAS,CAAC;AAEvD,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAGtD,OAAO,EAAoB,KAAK,UAAU,EAA+C,MAAM,gBAAgB,C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|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prefixes.d.ts","sourceRoot":"","sources":["../../../../src/core/tools/hashline-engine/prefixes.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AAmBH;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAElE;AAwCD;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAwB9D;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAQ/D;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,EAAE,CAOtF"
|
|
1
|
+
{"version":3,"file":"prefixes.d.ts","sourceRoot":"","sources":["../../../../src/core/tools/hashline-engine/prefixes.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AAmBH;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAElE;AAwCD;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAwB9D;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAQ/D;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,EAAE,CAOtF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recovery.d.ts","sourceRoot":"","sources":["../../../../src/core/tools/hashline-engine/recovery.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAY,aAAa,EAAE,MAAM,g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
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../../../src/core/tools/hashline-engine/stream.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAoFhD,wBAAuB,eAAe,CACrC,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,GAAG,aAAa,CAAC,UAAU,CAAC,EAC9D,OAAO,GAAE,aAAkB,GACzB,cAAc,CAAC,MAAM,CAAC,CAkCxB"
|
|
1
|
+
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../../../src/core/tools/hashline-engine/stream.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAoFhD,wBAAuB,eAAe,CACrC,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,GAAG,aAAa,CAAC,UAAU,CAAC,EAC9D,OAAO,GAAE,aAAkB,GACzB,cAAc,CAAC,MAAM,CAAC,CAkCxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokenizer.d.ts","sourceRoot":"","sources":["../../../../src/core/tools/hashline-engine/tokenizer.ts"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AA8D9D,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAiBzD;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAIlD;AAoBD,kEAAkE;AAClE,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAW7D;AAsDD,MAAM,MAAM,WAAW,GACpB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,WAAW,CAAA;CAAE,GACvC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACjC;IAAE,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BAAa,SAAS;;IAKrB,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,EAAE,CAK3B;IAED,GAAG,IAAI,KAAK,EAAE,CASb;IAED,KAAK,IAAI,IAAI,CAIZ;IAED,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,EAAE,CAKjC;IAED,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,SAAI,GAAG,KAAK,CAEzC;IAED,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE1B;IAED,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE9B;IAED,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAMtC;CAgBD;AAED,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC","sourcesContent":["// @generated vendored verbatim from oh-my-pi packages/hashline @ 15b5c1397fc -- DO NOT EDIT.\n// Parity source for the Atomic hashline edit engine (issue #1483); adapted only for Atomic's Node runtime (relative imports, Bun->Node host calls, erasable constructor syntax).\n/**\n * Stateful, line-oriented classifier for hashline diff text.\n *\n * Format shape:\n * ```\n * [path/to/file.ts#1A2B]\n * replace 5..7:\n * +literal new line\n * ```\n */\nimport {\n\tdescribeAnchorExamples,\n\tHL_BLOCK_KEYWORD,\n\tHL_DELETE_KEYWORD,\n\tHL_FILE_HASH_LENGTH,\n\tHL_FILE_HASH_SEP,\n\tHL_FILE_PREFIX,\n\tHL_FILE_SUFFIX,\n\tHL_HEADER_COLON,\n\tHL_INSERT_AFTER,\n\tHL_INSERT_BEFORE,\n\tHL_INSERT_HEAD,\n\tHL_INSERT_KEYWORD,\n\tHL_INSERT_TAIL,\n\tHL_PAYLOAD_REPLACE,\n\tHL_REPLACE_KEYWORD,\n} from \"./format.js\";\nimport { ABORT_MARKER, BEGIN_PATCH_MARKER, END_PATCH_MARKER } from \"./messages.js\";\nimport type { Anchor, Cursor, ParsedRange } from \"./types.js\";\n\nconst CHAR_LINE_FEED = 10;\nconst CHAR_CARRIAGE_RETURN = 13;\nconst CHAR_ZERO = 48;\nconst CHAR_NINE = 57;\nconst CHAR_HASH = 35;\nconst CHAR_TAB = 9;\nconst CHAR_SPACE = 32;\nconst CHAR_DOT = 46;\nconst CHAR_HYPHEN = 45;\nconst CHAR_ELLIPSIS = 0x2026;\n\nconst CHAR_UPPER_A = 65;\nconst CHAR_UPPER_F = 70;\nconst CHAR_LOWER_A = 97;\nconst CHAR_LOWER_F = 102;\nconst CHAR_PAYLOAD_REPLACE = HL_PAYLOAD_REPLACE.charCodeAt(0);\nconst CHAR_COLON = HL_HEADER_COLON.charCodeAt(0);\nconst FILE_PREFIX_LENGTH = HL_FILE_PREFIX.length;\nconst FILE_SUFFIX_LENGTH = HL_FILE_SUFFIX.length;\n\nfunction isDigitCode(code: number): boolean {\n\treturn code >= CHAR_ZERO && code <= CHAR_NINE;\n}\n\nfunction isNonZeroDigitCode(code: number): boolean {\n\treturn code > CHAR_ZERO && code <= CHAR_NINE;\n}\n\nfunction isHexDigitCode(code: number): boolean {\n\treturn (\n\t\tisDigitCode(code) ||\n\t\t(code >= CHAR_UPPER_A && code <= CHAR_UPPER_F) ||\n\t\t(code >= CHAR_LOWER_A && code <= CHAR_LOWER_F)\n\t);\n}\n\nfunction isWhitespaceCode(code: number): boolean {\n\treturn code === CHAR_SPACE || (code >= CHAR_TAB && code <= CHAR_CARRIAGE_RETURN);\n}\n\nfunction skipWhitespace(line: string, index: number, end = line.length): number {\n\twhile (index < end && isWhitespaceCode(line.charCodeAt(index))) index++;\n\treturn index;\n}\n\nfunction trimEndIndex(line: string): number {\n\tlet end = line.length;\n\twhile (end > 0 && isWhitespaceCode(line.charCodeAt(end - 1))) end--;\n\treturn end;\n}\n\nfunction isEmptyLine(line: string): boolean {\n\treturn line.length === 0;\n}\n\nfunction markerLineEquals(line: string, marker: string): boolean {\n\tconst end = trimEndIndex(line);\n\treturn end === marker.length && line.startsWith(marker);\n}\n\nexport function splitHashlineLines(text: string): string[] {\n\tif (text.length === 0) return [\"\"];\n\tconst lines: string[] = [];\n\tlet start = 0;\n\tfor (let index = 0; index < text.length; index++) {\n\t\tif (text.charCodeAt(index) !== CHAR_LINE_FEED) continue;\n\t\tlet end = index;\n\t\tif (end > start && text.charCodeAt(end - 1) === CHAR_CARRIAGE_RETURN) end--;\n\t\tlines.push(text.slice(start, end));\n\t\tstart = index + 1;\n\t}\n\tif (start < text.length) {\n\t\tlet end = text.length;\n\t\tif (end > start && text.charCodeAt(end - 1) === CHAR_CARRIAGE_RETURN) end--;\n\t\tlines.push(text.slice(start, end));\n\t}\n\treturn lines;\n}\n\nexport function cloneCursor(cursor: Cursor): Cursor {\n\tif (cursor.kind === \"before_anchor\") return { kind: \"before_anchor\", anchor: { ...cursor.anchor } };\n\tif (cursor.kind === \"after_anchor\") return { kind: \"after_anchor\", anchor: { ...cursor.anchor } };\n\treturn cursor;\n}\n\ninterface NumberScan {\n\tline: number;\n\tnextIndex: number;\n}\n\nfunction scanLineNumber(line: string, index: number, end: number): NumberScan | null {\n\tif (index >= end || !isNonZeroDigitCode(line.charCodeAt(index))) return null;\n\tlet lineNumber = 0;\n\tlet nextIndex = index;\n\twhile (nextIndex < end) {\n\t\tconst code = line.charCodeAt(nextIndex);\n\t\tif (!isDigitCode(code)) break;\n\t\tlineNumber = lineNumber * 10 + (code - CHAR_ZERO);\n\t\tnextIndex++;\n\t}\n\treturn { line: lineNumber, nextIndex };\n}\n\n/** Parse a bare line-number anchor. Throws on malformed input. */\nexport function parseLid(raw: string, lineNum: number): Anchor {\n\tconst end = trimEndIndex(raw);\n\tconst numberStart = skipWhitespace(raw, 0, end);\n\tconst number = scanLineNumber(raw, numberStart, end);\n\tif (number === null || skipWhitespace(raw, number.nextIndex, end) !== end) {\n\t\tthrow new Error(\n\t\t\t`line ${lineNum}: expected a line number such as ${describeAnchorExamples(\"119\")}; ` +\n\t\t\t\t`got ${JSON.stringify(raw)}. Use ${HL_FILE_PREFIX}PATH${HL_FILE_HASH_SEP}hash${HL_FILE_SUFFIX} from your latest read for file-version binding.`,\n\t\t);\n\t}\n\treturn { line: number.line };\n}\n\ninterface RangeScan {\n\trange: ParsedRange;\n\tnextIndex: number;\n}\n\nfunction scanRangeSeparator(line: string, index: number, end: number): number | null {\n\tlet cursor = index;\n\tlet consumedSeparator = false;\n\twhile (cursor < end) {\n\t\tconst code = line.charCodeAt(cursor);\n\t\tif (isWhitespaceCode(code)) {\n\t\t\tcursor++;\n\t\t\tconsumedSeparator = true;\n\t\t\tcontinue;\n\t\t}\n\t\tif (code === CHAR_HYPHEN || code === CHAR_ELLIPSIS) {\n\t\t\tcursor++;\n\t\t\tconsumedSeparator = true;\n\t\t\tcontinue;\n\t\t}\n\t\tif (code === CHAR_DOT && cursor + 1 < end && line.charCodeAt(cursor + 1) === CHAR_DOT) {\n\t\t\tcursor += 2;\n\t\t\tconsumedSeparator = true;\n\t\t\tcontinue;\n\t\t}\n\t\tbreak;\n\t}\n\tif (!consumedSeparator) return null;\n\tif (cursor >= end || !isNonZeroDigitCode(line.charCodeAt(cursor))) return null;\n\treturn cursor;\n}\n\nfunction scanHeaderRange(line: string, index = 0, end = trimEndIndex(line), allowSingle = false): RangeScan | null {\n\tconst numberStart = skipWhitespace(line, index, end);\n\tconst start = scanLineNumber(line, numberStart, end);\n\tif (start === null) return null;\n\tconst afterFirst = scanRangeSeparator(line, start.nextIndex, end);\n\tif (afterFirst === null) {\n\t\tif (!allowSingle) return null;\n\t\treturn {\n\t\t\trange: { start: { line: start.line }, end: { line: start.line } },\n\t\t\tnextIndex: skipWhitespace(line, start.nextIndex, end),\n\t\t};\n\t}\n\tconst endNumber = scanLineNumber(line, afterFirst, end);\n\tif (endNumber === null) return null;\n\treturn {\n\t\trange: { start: { line: start.line }, end: { line: endNumber.line } },\n\t\tnextIndex: skipWhitespace(line, endNumber.nextIndex, end),\n\t};\n}\n\nexport type BlockTarget =\n\t| { kind: \"replace\"; range: ParsedRange }\n\t| { kind: \"block\"; anchor: Anchor }\n\t| { kind: \"delete\"; range: ParsedRange }\n\t| { kind: \"delete_block\"; anchor: Anchor }\n\t| { kind: \"insert_before\"; anchor: Anchor }\n\t| { kind: \"insert_after\"; anchor: Anchor }\n\t| { kind: \"insert_after_block\"; anchor: Anchor }\n\t| { kind: \"bof\" }\n\t| { kind: \"eof\" };\n\ninterface TargetScan {\n\ttarget: BlockTarget;\n\tnextIndex: number;\n}\n\nfunction scanKeyword(line: string, index: number, end: number, keyword: string): number | null {\n\tif (!line.startsWith(keyword, index)) return null;\n\tconst next = index + keyword.length;\n\tif (next < end) {\n\t\tconst code = line.charCodeAt(next);\n\t\tif (!isWhitespaceCode(code) && code !== CHAR_COLON) return null;\n\t}\n\treturn next;\n}\n\nfunction consumeOptionalColon(line: string, index: number, end: number): number {\n\tconst cursor = skipWhitespace(line, index, end);\n\treturn cursor < end && line.charCodeAt(cursor) === CHAR_COLON ? skipWhitespace(line, cursor + 1, end) : cursor;\n}\n\nfunction scanInsertTarget(line: string, index: number, end: number): TargetScan | null {\n\tconst cursor = skipWhitespace(line, index, end);\n\tconst beforeEnd = scanKeyword(line, cursor, end, HL_INSERT_BEFORE);\n\tif (beforeEnd !== null) {\n\t\tconst anchor = scanLineNumber(line, skipWhitespace(line, beforeEnd, end), end);\n\t\tif (anchor === null) return null;\n\t\tconst nextIndex = consumeOptionalColon(line, anchor.nextIndex, end);\n\t\treturn { target: { kind: \"insert_before\", anchor: { line: anchor.line } }, nextIndex };\n\t}\n\tconst afterEnd = scanKeyword(line, cursor, end, HL_INSERT_AFTER);\n\tif (afterEnd !== null) {\n\t\t// `insert after block N:` — resolve N to a tree-sitter block range at\n\t\t// apply time and insert after its last line. Try the `block` sub-keyword\n\t\t// before falling back to a literal `insert after N:` anchor.\n\t\tconst blockEnd = scanKeyword(line, skipWhitespace(line, afterEnd, end), end, HL_BLOCK_KEYWORD);\n\t\tif (blockEnd !== null) {\n\t\t\tconst anchor = scanLineNumber(line, skipWhitespace(line, blockEnd, end), end);\n\t\t\tif (anchor === null) return null;\n\t\t\tconst nextIndex = consumeOptionalColon(line, anchor.nextIndex, end);\n\t\t\treturn { target: { kind: \"insert_after_block\", anchor: { line: anchor.line } }, nextIndex };\n\t\t}\n\t\tconst anchor = scanLineNumber(line, skipWhitespace(line, afterEnd, end), end);\n\t\tif (anchor === null) return null;\n\t\tconst nextIndex = consumeOptionalColon(line, anchor.nextIndex, end);\n\t\treturn { target: { kind: \"insert_after\", anchor: { line: anchor.line } }, nextIndex };\n\t}\n\tconst headEnd = scanKeyword(line, cursor, end, HL_INSERT_HEAD);\n\tif (headEnd !== null) return { target: { kind: \"bof\" }, nextIndex: consumeOptionalColon(line, headEnd, end) };\n\tconst tailEnd = scanKeyword(line, cursor, end, HL_INSERT_TAIL);\n\tif (tailEnd !== null) return { target: { kind: \"eof\" }, nextIndex: consumeOptionalColon(line, tailEnd, end) };\n\treturn null;\n}\n\nfunction scanHunkAnchor(line: string, start: number, end: number): TargetScan | null {\n\tconst cursor = skipWhitespace(line, start, end);\n\tconst replaceEnd = scanKeyword(line, cursor, end, HL_REPLACE_KEYWORD);\n\tif (replaceEnd !== null) {\n\t\t// `replace block N:` — resolve N to a tree-sitter block range at apply\n\t\t// time. Try the `block` sub-keyword before falling back to a literal\n\t\t// `replace N..M:` range.\n\t\tconst blockEnd = scanKeyword(line, skipWhitespace(line, replaceEnd, end), end, HL_BLOCK_KEYWORD);\n\t\tif (blockEnd !== null) {\n\t\t\tconst anchor = scanLineNumber(line, skipWhitespace(line, blockEnd, end), end);\n\t\t\tif (anchor === null) return null;\n\t\t\treturn {\n\t\t\t\ttarget: { kind: \"block\", anchor: { line: anchor.line } },\n\t\t\t\tnextIndex: consumeOptionalColon(line, anchor.nextIndex, end),\n\t\t\t};\n\t\t}\n\t\tconst range = scanHeaderRange(line, replaceEnd, end, true);\n\t\tif (range === null) return null;\n\t\treturn {\n\t\t\ttarget: { kind: \"replace\", range: range.range },\n\t\t\tnextIndex: consumeOptionalColon(line, range.nextIndex, end),\n\t\t};\n\t}\n\tconst deleteEnd = scanKeyword(line, cursor, end, HL_DELETE_KEYWORD);\n\tif (deleteEnd !== null) {\n\t\t// `delete block N` — resolve N to a tree-sitter block range at apply\n\t\t// time and delete its whole span. Like `delete N..M`, it takes no body\n\t\t// and no trailing colon.\n\t\tconst blockEnd = scanKeyword(line, skipWhitespace(line, deleteEnd, end), end, HL_BLOCK_KEYWORD);\n\t\tif (blockEnd !== null) {\n\t\t\tconst anchor = scanLineNumber(line, skipWhitespace(line, blockEnd, end), end);\n\t\t\tif (anchor === null) return null;\n\t\t\tconst next = skipWhitespace(line, anchor.nextIndex, end);\n\t\t\tif (next < end && line.charCodeAt(next) === CHAR_COLON) return null;\n\t\t\treturn { target: { kind: \"delete_block\", anchor: { line: anchor.line } }, nextIndex: next };\n\t\t}\n\t\tconst range = scanHeaderRange(line, deleteEnd, end, true);\n\t\tif (range === null) return null;\n\t\tconst next = skipWhitespace(line, range.nextIndex, end);\n\t\tif (next < end && line.charCodeAt(next) === CHAR_COLON) return null;\n\t\treturn { target: { kind: \"delete\", range: range.range }, nextIndex: next };\n\t}\n\tconst insertEnd = scanKeyword(line, cursor, end, HL_INSERT_KEYWORD);\n\tif (insertEnd !== null) return scanInsertTarget(line, insertEnd, end);\n\treturn null;\n}\n\ninterface ParsedHunkHeader {\n\ttarget: BlockTarget;\n}\n\nfunction tryParseHunkHeader(line: string): ParsedHunkHeader | null {\n\tconst end = trimEndIndex(line);\n\tconst start = skipWhitespace(line, 0, end);\n\tif (start >= end) return null;\n\tconst scan = scanHunkAnchor(line, start, end);\n\tif (scan === null) return null;\n\tif (scan.nextIndex !== end) return null;\n\treturn { target: scan.target };\n}\n\nfunction tryParseHeader(line: string): { path: string; fileHash?: string } | null {\n\tif (!line.startsWith(HL_FILE_PREFIX)) return null;\n\tconst end = trimEndIndex(line);\n\tif (FILE_PREFIX_LENGTH + FILE_SUFFIX_LENGTH >= end) return null;\n\tif (!line.endsWith(HL_FILE_SUFFIX, end)) return null;\n\tconst bodyEnd = end - FILE_SUFFIX_LENGTH;\n\tif (FILE_PREFIX_LENGTH >= bodyEnd) return null;\n\n\t// The snapshot tag, when present, is the trailing `#XXXX` block inside the\n\t// bracketed header. We detect it from the suffix so the path may\n\t// legitimately contain whitespace (e.g. `OneDrive - Company/file.ts`).\n\tlet pathEnd = bodyEnd;\n\tlet fileHash: string | undefined;\n\tconst trailingHashStart = bodyEnd - HL_FILE_HASH_LENGTH - 1;\n\tif (trailingHashStart >= FILE_PREFIX_LENGTH && line.charCodeAt(trailingHashStart) === CHAR_HASH) {\n\t\tlet allHex = true;\n\t\tfor (let probe = trailingHashStart + 1; probe < bodyEnd; probe++) {\n\t\t\tif (!isHexDigitCode(line.charCodeAt(probe))) {\n\t\t\t\tallHex = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (allHex) {\n\t\t\tpathEnd = trailingHashStart;\n\t\t\tfileHash = line.slice(trailingHashStart + 1, bodyEnd).toUpperCase();\n\t\t}\n\t}\n\n\t// The hashline header grammar uses `#` as the path/tag separator and\n\t// does not allow `#` inside filenames. Anything `#` left in the path\n\t// body — short tags (`#1A2`), non-hex tags (`#1A2G`), over-long tags\n\t// (`#1A2B5`), stale-tag copy-paste (`#1A2B copied from read`), or\n\t// line-suffixed tags (`#1A2B:42`) — means the header is malformed.\n\t// Surface the focused diagnostic instead of silently mis-routing the\n\t// edit or reporting a missing tag downstream.\n\tfor (let i = FILE_PREFIX_LENGTH; i < pathEnd; i++) {\n\t\tif (line.charCodeAt(i) === CHAR_HASH) return null;\n\t}\n\n\tif (pathEnd === FILE_PREFIX_LENGTH) return null;\n\tconst path = line.slice(FILE_PREFIX_LENGTH, pathEnd);\n\treturn fileHash !== undefined ? { path, fileHash } : { path };\n}\n\ninterface TokenBase {\n\tlineNum: number;\n}\n\nexport type Token =\n\t| (TokenBase & { kind: \"blank\" })\n\t| (TokenBase & { kind: \"envelope-begin\" })\n\t| (TokenBase & { kind: \"envelope-end\" })\n\t| (TokenBase & { kind: \"abort\" })\n\t| (TokenBase & { kind: \"header\"; path: string; fileHash?: string })\n\t| (TokenBase & { kind: \"op-block\"; target: BlockTarget })\n\t| (TokenBase & { kind: \"payload-literal\"; text: string })\n\t| (TokenBase & { kind: \"raw\"; text: string });\n\nfunction classifyLine(line: string, lineNum: number): Token {\n\tif (isEmptyLine(line)) return { kind: \"blank\", lineNum };\n\tif (markerLineEquals(line, BEGIN_PATCH_MARKER)) return { kind: \"envelope-begin\", lineNum };\n\tif (markerLineEquals(line, END_PATCH_MARKER)) return { kind: \"envelope-end\", lineNum };\n\tif (markerLineEquals(line, ABORT_MARKER)) return { kind: \"abort\", lineNum };\n\tconst firstCode = line.charCodeAt(0);\n\tif (line.startsWith(HL_FILE_PREFIX)) {\n\t\tconst header = tryParseHeader(line);\n\t\tif (header !== null) {\n\t\t\treturn header.fileHash !== undefined\n\t\t\t\t? { kind: \"header\", lineNum, path: header.path, fileHash: header.fileHash }\n\t\t\t\t: { kind: \"header\", lineNum, path: header.path };\n\t\t}\n\t}\n\tconst lead = skipWhitespace(line, 0);\n\tconst isHunkLead =\n\t\tline.startsWith(HL_REPLACE_KEYWORD, lead) ||\n\t\tline.startsWith(HL_DELETE_KEYWORD, lead) ||\n\t\tline.startsWith(HL_INSERT_KEYWORD, lead);\n\tif (isHunkLead) {\n\t\tconst hunk = tryParseHunkHeader(line);\n\t\tif (hunk !== null) return { kind: \"op-block\", lineNum, target: hunk.target };\n\t}\n\tif (firstCode === CHAR_PAYLOAD_REPLACE) return { kind: \"payload-literal\", lineNum, text: line.slice(1) };\n\treturn { kind: \"raw\", lineNum, text: line };\n}\n\nexport class Tokenizer {\n\t#buffer = \"\";\n\t#nextLineNum = 1;\n\t#closed = false;\n\n\tfeed(chunk: string): Token[] {\n\t\tif (this.#closed) throw new Error(\"Tokenizer is closed; call reset() before reusing.\");\n\t\tif (chunk.length === 0) return [];\n\t\tthis.#buffer = this.#buffer ? this.#buffer + chunk : chunk;\n\t\treturn this.#drainCompleteLines();\n\t}\n\n\tend(): Token[] {\n\t\tif (this.#closed) return [];\n\t\tthis.#closed = true;\n\t\tconst buf = this.#buffer;\n\t\tthis.#buffer = \"\";\n\t\tif (buf.length === 0) return [];\n\t\tlet stop = buf.length;\n\t\tif (buf.charCodeAt(stop - 1) === CHAR_CARRIAGE_RETURN) stop--;\n\t\treturn [classifyLine(buf.slice(0, stop), this.#nextLineNum++)];\n\t}\n\n\treset(): void {\n\t\tthis.#buffer = \"\";\n\t\tthis.#nextLineNum = 1;\n\t\tthis.#closed = false;\n\t}\n\n\ttokenizeAll(text: string): Token[] {\n\t\tthis.reset();\n\t\tconst first = this.feed(text);\n\t\tconst last = this.end();\n\t\treturn last.length === 0 ? first : first.concat(last);\n\t}\n\n\ttokenize(line: string, lineNum = 0): Token {\n\t\treturn classifyLine(line, lineNum);\n\t}\n\n\tisOp(line: string): boolean {\n\t\treturn tryParseHunkHeader(line) !== null;\n\t}\n\n\tisHeader(line: string): boolean {\n\t\treturn tryParseHeader(line) !== null;\n\t}\n\n\tisEnvelopeMarker(line: string): boolean {\n\t\treturn (\n\t\t\tmarkerLineEquals(line, BEGIN_PATCH_MARKER) ||\n\t\t\tmarkerLineEquals(line, END_PATCH_MARKER) ||\n\t\t\tmarkerLineEquals(line, ABORT_MARKER)\n\t\t);\n\t}\n\n\t#drainCompleteLines(): Token[] {\n\t\tconst tokens: Token[] = [];\n\t\tconst buf = this.#buffer;\n\t\tlet start = 0;\n\t\tfor (let index = 0; index < buf.length; index++) {\n\t\t\tif (buf.charCodeAt(index) !== CHAR_LINE_FEED) continue;\n\t\t\tlet stop = index;\n\t\t\tif (stop > start && buf.charCodeAt(stop - 1) === CHAR_CARRIAGE_RETURN) stop--;\n\t\t\ttokens.push(classifyLine(buf.slice(start, stop), this.#nextLineNum++));\n\t\t\tstart = index + 1;\n\t\t}\n\t\tthis.#buffer = start < buf.length ? buf.slice(start) : \"\";\n\t\treturn tokens;\n\t}\n}\n\nexport type { ParsedRange }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ACpC,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAC;IACb,iFAAiF;IACjF,IAAI,EAAE,MAAM,CAAC;IACb,8CAA8C;IAC9C,IAAI,EAAE,MAAM,CAAC;CACb;AAED;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,EAAE,oBAAoB,KAAK,SAAS,GAAG,IAAI,CAAC"
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/core/tools/hashline-engine/types.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,wCAAwC;AACxC,MAAM,WAAW,MAAM;IACtB,IAAI,EAAE,MAAM,CAAC;CACb;AAED,uEAAuE;AACvE,MAAM,MAAM,MAAM,GACf;IAAE,IAAI,EAAE,KAAK,CAAA;CAAE,GACf;IAAE,IAAI,EAAE,KAAK,CAAA;CAAE,GACf;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACzC;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAE5C;;;;;;GAMG;AACH,MAAM,MAAM,IAAI,GACb;IACA,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACnB,GACD;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,GACzF;IACA;;;;;;;;;;;OAWG;IACH,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IAC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E,qBAAqB,GAAG,MAAM,CAExI;AAED,wBAAgB,+BAA+B,CAAC,QAAQ,EAAE,gBAAgB,EAAE,IAAI,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,QAAQ,GAAE,SAAS,MAAM,EAAO,GAAG,MAAM,CAExK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,cAAc,EACd,wBAAwB,EACxB,yBAAyB,GACzB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,cAAc,EACd,wBAAwB,EACxB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,eAAe,GACpB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EACN,cAAc,EACd,wBAAwB,EACxB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,eAAe,GACpB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,gBAAgB,EAChB,0BAA0B,EAC1B,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,iBAAiB,GACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EACN,YAAY,EACZ,sBAAsB,EACtB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,aAAa,GAClB,MAAM,SAAS,CAAC;AACjB,OAAO,EACN,cAAc,EACd,wBAAwB,EACxB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,eAAe,GACpB,MAAM,WAAW,CAAC;AAC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,QAAQ,EAAE,OAAO,CAAC,CAavG;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,IAAI,EAAE,CAU7E;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,IAAI,EAAE,CAQ/E;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,CAa1F","sourcesContent":["export {\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tcreateBashTool,\n\tcreateBashToolDefinition,\n\tcreateLocalBashOperations,\n} from \"./bash.ts\";\nexport {\n\tcreateEditTool,\n\tcreateEditToolDefinition,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n} from \"./edit.ts\";\nexport { withFileMutationQueue } from \"./file-mutation-queue.ts\";\nexport {\n\tcreateFindTool,\n\tcreateFindToolDefinition,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n} from \"./find.ts\";\nexport {\n\tcreateSearchTool,\n\tcreateSearchToolDefinition,\n\ttype SearchToolDetails,\n\ttype SearchToolInput,\n\ttype SearchToolOptions,\n} from \"./search.ts\";\nexport {\n\tcreateLsTool,\n\tcreateLsToolDefinition,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n} from \"./ls.ts\";\nexport {\n\tcreateReadTool,\n\tcreateReadToolDefinition,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n} from \"./read.ts\";\nexport {\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\tformatSize,\n\ttype TruncationOptions,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateLine,\n\ttruncateTail,\n} from \"./truncate.ts\";\nexport {\n\tcreateWriteTool,\n\tcreateWriteToolDefinition,\n\ttype WriteOperations,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n} from \"./write.ts\";\nexport { createAskUserQuestionToolDefinition } from \"./ask-user-question/index.ts\";\nexport {\n\tSTRUCTURED_OUTPUT_TOOL_NAME,\n\tcreateStructuredOutputCapture,\n\tcreateStructuredOutputTool,\n\ttype JsonObject,\n\ttype JsonPrimitive,\n\ttype JsonValue,\n\ttype StructuredOutputCapture,\n\ttype StructuredOutputFileCapture,\n\ttype StructuredOutputToolOptions,\n} from \"./structured-output.ts\";\nexport { createTodoToolDefinition } from \"./todos.ts\";\n\nimport type { AgentTool } from \"@earendil-works/pi-agent-core\";\nimport type { TSchema } from \"typebox\";\nimport type { ToolDefinition } from \"../extensions/types.ts\";\nimport { createAskUserQuestionToolDefinition } from \"./ask-user-question/index.ts\";\nimport { createHashlineSnapshotStore, type HashlineSnapshotStore } from \"./hashline.ts\";\nimport { type BashToolOptions, createBashTool, createBashToolDefinition } from \"./bash.ts\";\nimport { createEditTool, createEditToolDefinition, type EditToolOptions } from \"./edit.ts\";\nimport { createFindTool, createFindToolDefinition, type FindToolOptions } from \"./find.ts\";\nimport { createLsTool, createLsToolDefinition, type LsToolOptions } from \"./ls.ts\";\nimport { createSearchTool, createSearchToolDefinition, type SearchToolOptions } from \"./search.ts\";\nimport { createReadTool, createReadToolDefinition, type ReadToolOptions } from \"./read.ts\";\nimport { createTodoToolDefinition } from \"./todos.ts\";\nimport { wrapToolDefinition } from \"./tool-definition-wrapper.ts\";\nimport { createWriteTool, createWriteToolDefinition, type WriteToolOptions } from \"./write.ts\";\n\nexport type Tool = AgentTool<TSchema, unknown>;\nexport type ToolDef = ToolDefinition<TSchema, unknown>;\nexport type ToolName =\n\t| \"read\"\n\t| \"bash\"\n\t| \"edit\"\n\t| \"write\"\n\t| \"find\"\n\t| \"search\"\n\t| \"ls\"\n\t| \"ask_user_question\"\n\t| \"todo\";\nexport const allToolNames: Set<ToolName> = new Set([\n\t\"read\",\n\t\"bash\",\n\t\"edit\",\n\t\"write\",\n\t\"find\",\n\t\"search\",\n\t\"ls\",\n\t\"ask_user_question\",\n\t\"todo\",\n]);\n\nexport const defaultToolNames: readonly ToolName[] = [\n\t\"read\",\n\t\"bash\",\n\t\"edit\",\n\t\"write\",\n\t\"find\",\n\t\"search\",\n\t\"ask_user_question\",\n\t\"todo\",\n];\n\nexport interface ToolsOptions {\n\tread?: ReadToolOptions;\n\tbash?: BashToolOptions;\n\twrite?: WriteToolOptions;\n\tedit?: EditToolOptions;\n\tfind?: FindToolOptions;\n\tsearch?: SearchToolOptions;\n\tls?: LsToolOptions;\n\thashlineStore?: HashlineSnapshotStore;\n}\n\nexport function createToolDefinition(toolName: ToolName, cwd: string, options?: ToolsOptions): ToolDef {\n\t// Default a shared store so the singular factories don't hand read/edit/\n\t// write/search isolated stores (which silently degrades drift recovery).\n\tconst hashlineStore = options?.hashlineStore ?? createHashlineSnapshotStore();\n\tswitch (toolName) {\n\t\tcase \"read\":\n\t\t\treturn createReadToolDefinition(cwd, { ...options?.read, hashlineStore });\n\t\tcase \"bash\":\n\t\t\treturn createBashToolDefinition(cwd, options?.bash);\n\t\tcase \"edit\":\n\t\t\treturn createEditToolDefinition(cwd, { ...options?.edit, hashlineStore });\n\t\tcase \"write\":\n\t\t\treturn createWriteToolDefinition(cwd, { ...options?.write, hashlineStore });\n\t\tcase \"find\":\n\t\t\treturn createFindToolDefinition(cwd, options?.find);\n\t\tcase \"search\":\n\t\t\treturn createSearchToolDefinition(cwd, { ...options?.search, hashlineStore });\n\t\tcase \"ls\":\n\t\t\treturn createLsToolDefinition(cwd, options?.ls);\n\t\tcase \"ask_user_question\":\n\t\t\treturn createAskUserQuestionToolDefinition();\n\t\tcase \"todo\":\n\t\t\treturn createTodoToolDefinition(cwd);\n\t\tdefault:\n\t\t\tthrow new Error(`Unknown tool name: ${toolName}`);\n\t}\n}\n\nexport function createTool(toolName: ToolName, cwd: string, options?: ToolsOptions): Tool {\n\tconst hashlineStore = options?.hashlineStore ?? createHashlineSnapshotStore();\n\tswitch (toolName) {\n\t\tcase \"read\":\n\t\t\treturn createReadTool(cwd, { ...options?.read, hashlineStore });\n\t\tcase \"bash\":\n\t\t\treturn createBashTool(cwd, options?.bash);\n\t\tcase \"edit\":\n\t\t\treturn createEditTool(cwd, { ...options?.edit, hashlineStore });\n\t\tcase \"write\":\n\t\t\treturn createWriteTool(cwd, { ...options?.write, hashlineStore });\n\t\tcase \"find\":\n\t\t\treturn createFindTool(cwd, options?.find);\n\t\tcase \"search\":\n\t\t\treturn createSearchTool(cwd, { ...options?.search, hashlineStore });\n\t\tcase \"ls\":\n\t\t\treturn createLsTool(cwd, options?.ls);\n\t\tcase \"ask_user_question\":\n\t\t\treturn wrapToolDefinition(createAskUserQuestionToolDefinition());\n\t\tcase \"todo\":\n\t\t\treturn wrapToolDefinition(createTodoToolDefinition(cwd));\n\t\tdefault:\n\t\t\tthrow new Error(`Unknown tool name: ${toolName}`);\n\t}\n}\n\nexport function createCodingToolDefinitions(cwd: string, options?: ToolsOptions): ToolDef[] {\n\tconst hashlineStore = options?.hashlineStore ?? createHashlineSnapshotStore();\n\treturn [\n\t\tcreateReadToolDefinition(cwd, { ...options?.read, hashlineStore }),\n\t\tcreateBashToolDefinition(cwd, { asyncEnabled: true, ...options?.bash }),\n\t\tcreateEditToolDefinition(cwd, { ...options?.edit, hashlineStore }),\n\t\tcreateWriteToolDefinition(cwd, { ...options?.write, hashlineStore }),\n\t\tcreateFindToolDefinition(cwd, options?.find),\n\t\tcreateSearchToolDefinition(cwd, { ...options?.search, hashlineStore }),\n\t];\n}\n\nexport function createReadOnlyToolDefinitions(cwd: string, options?: ToolsOptions): ToolDef[] {\n\tconst hashlineStore = options?.hashlineStore ?? createHashlineSnapshotStore();\n\treturn [\n\t\tcreateReadToolDefinition(cwd, { ...options?.read, hashlineStore }),\n\t\tcreateFindToolDefinition(cwd, options?.find),\n\t\tcreateSearchToolDefinition(cwd, { ...options?.search, hashlineStore }),\n\t\tcreateLsToolDefinition(cwd, options?.ls),\n\t];\n}\n\nexport function createAllToolDefinitions(cwd: string, options?: ToolsOptions): Record<ToolName, ToolDef> {\n\tconst hashlineStore = options?.hashlineStore ?? createHashlineSnapshotStore();\n\treturn {\n\t\tread: createReadToolDefinition(cwd, { ...options?.read, hashlineStore }),\n\t\tbash: createBashToolDefinition(cwd, { asyncEnabled: true, ...options?.bash }),\n\t\tedit: createEditToolDefinition(cwd, { ...options?.edit, hashlineStore }),\n\t\twrite: createWriteToolDefinition(cwd, { ...options?.write, hashlineStore }),\n\t\tfind: createFindToolDefinition(cwd, options?.find),\n\t\tsearch: createSearchToolDefinition(cwd, { ...options?.search, hashlineStore }),\n\t\tls: createLsToolDefinition(cwd, options?.ls),\n\t\task_user_question: createAskUserQuestionToolDefinition(),\n\t\ttodo: createTodoToolDefinition(cwd),\n\t};\n}\n\nexport function createCodingTools(cwd: string, options?: ToolsOptions): Tool[] {\n\tconst hashlineStore = options?.hashlineStore ?? createHashlineSnapshotStore();\n\treturn [\n\t\tcreateReadTool(cwd, { ...options?.read, hashlineStore }),\n\t\tcreateBashTool(cwd, { asyncEnabled: true, ...options?.bash }),\n\t\tcreateEditTool(cwd, { ...options?.edit, hashlineStore }),\n\t\tcreateWriteTool(cwd, { ...options?.write, hashlineStore }),\n\t\tcreateFindTool(cwd, options?.find),\n\t\tcreateSearchTool(cwd, { ...options?.search, hashlineStore }),\n\t];\n}\n\nexport function createReadOnlyTools(cwd: string, options?: ToolsOptions): Tool[] {\n\tconst hashlineStore = options?.hashlineStore ?? createHashlineSnapshotStore();\n\treturn [\n\t\tcreateReadTool(cwd, { ...options?.read, hashlineStore }),\n\t\tcreateFindTool(cwd, options?.find),\n\t\tcreateSearchTool(cwd, { ...options?.search, hashlineStore }),\n\t\tcreateLsTool(cwd, options?.ls),\n\t];\n}\n\nexport function createAllTools(cwd: string, options?: ToolsOptions): Record<ToolName, Tool> {\n\tconst hashlineStore = options?.hashlineStore ?? createHashlineSnapshotStore();\n\treturn {\n\t\tread: createReadTool(cwd, { ...options?.read, hashlineStore }),\n\t\tbash: createBashTool(cwd, { asyncEnabled: true, ...options?.bash }),\n\t\tedit: createEditTool(cwd, { ...options?.edit, hashlineStore }),\n\t\twrite: createWriteTool(cwd, { ...options?.write, hashlineStore }),\n\t\tfind: createFindTool(cwd, options?.find),\n\t\tsearch: createSearchTool(cwd, { ...options?.search, hashlineStore }),\n\t\tls: createLsTool(cwd, options?.ls),\n\t\task_user_question: wrapToolDefinition(createAskUserQuestionToolDefinition()),\n\t\ttodo: wrapToolDefinition(createTodoToolDefinition(cwd)),\n\t};\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,cAAc,EACd,wBAAwB,EACxB,yBAAyB,GACzB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,cAAc,EACd,wBAAwB,EACxB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,eAAe,GACpB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EACN,cAAc,EACd,wBAAwB,EACxB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,eAAe,GACpB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,gBAAgB,EAChB,0BAA0B,EAC1B,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,iBAAiB,GACtB,MAAM,aAAa,CAAC;AAC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AC5B,2BAA2B;IAC3B,MAAM,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IAC7D,wDAAwD;IACxD,IAAI,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,OAAO,CAAA;KAAE,CAAC,GAAG;QAAE,WAAW,EAAE,MAAM,OAAO,CAAA;KAAE,CAAC;IACzG,6BAA6B;IAC7B,OAAO,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC;CAChE;AAQD,MAAM,WAAW,aAAa;IAC7B,yEAAyE;IACzE,UAAU,CAAC,EAAE,YAAY,CAAC;CAC1B;AAkDD,wBAAgB,sBAAsB,CACrC,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,aAAa,GACrB,cAAc,CAAC,OAAO,QAAQ,EAAE,aAAa,GAAG,SAAS,CAAC,CA4H5D;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC,OAAO,QAAQ,CAAC,CAE7F","sourcesContent":["import { readdir as fsReaddir, stat as fsStat } from \"node:fs/promises\";\nimport type { AgentTool } from \"@earendil-works/pi-agent-core\";\nimport { Text } from \"@earendil-works/pi-tui\";\nimport nodePath from \"path\";\nimport { type Static, Type } from \"typebox\";\nimport { keyHint } from \"../../modes/interactive/components/keybinding-hints.ts\";\nimport type { ToolDefinition, ToolRenderResultOptions } from \"../extensions/types.ts\";\nimport { pathExists, resolveToCwd } from \"./path-utils.ts\";\nimport { getTextOutput, invalidArgText, shortenPath, str } from \"./render-utils.ts\";\nimport { wrapToolDefinition } from \"./tool-definition-wrapper.ts\";\nimport { DEFAULT_MAX_BYTES, formatSize, type TruncationResult, truncateHead } from \"./truncate.ts\";\n\nconst lsSchema = Type.Object({\n\tpath: Type.Optional(Type.String({ description: \"Directory to list (default: current directory)\" })),\n\tlimit: Type.Optional(Type.Number({ description: \"Maximum number of entries to return (default: 500)\" })),\n});\n\nexport type LsToolInput = Static<typeof lsSchema>;\n\nconst DEFAULT_LIMIT = 500;\n\nexport interface LsToolDetails {\n\ttruncation?: TruncationResult;\n\tentryLimitReached?: number;\n}\n\n/**\n * Pluggable operations for the ls tool.\n * Override these to delegate directory listing to remote systems (for example SSH).\n */\nexport interface LsOperations {\n\t/** Check if path exists */\n\texists: (absolutePath: string) => Promise<boolean> | boolean;\n\t/** Get file or directory stats. Throws if not found. */\n\tstat: (absolutePath: string) => Promise<{ isDirectory: () => boolean }> | { isDirectory: () => boolean };\n\t/** Read directory entries */\n\treaddir: (absolutePath: string) => Promise<string[]> | string[];\n}\n\nconst defaultLsOperations: LsOperations = {\n\texists: pathExists,\n\tstat: fsStat,\n\treaddir: fsReaddir,\n};\n\nexport interface LsToolOptions {\n\t/** Custom operations for directory listing. Default: local filesystem */\n\toperations?: LsOperations;\n}\n\nfunction formatLsCall(\n\targs: { path?: string; limit?: number } | undefined,\n\ttheme: typeof import(\"../../modes/interactive/theme/theme.ts\").theme,\n): string {\n\tconst rawPath = str(args?.path);\n\tconst path = rawPath !== null ? shortenPath(rawPath || \".\") : null;\n\tconst limit = args?.limit;\n\tconst invalidArg = invalidArgText(theme);\n\tlet text = `${theme.fg(\"toolTitle\", theme.bold(\"ls\"))} ${path === null ? invalidArg : theme.fg(\"accent\", path)}`;\n\tif (limit !== undefined) {\n\t\ttext += theme.fg(\"toolOutput\", ` (limit ${limit})`);\n\t}\n\treturn text;\n}\n\nfunction formatLsResult(\n\tresult: {\n\t\tcontent: Array<{ type: string; text?: string; data?: string; mimeType?: string }>;\n\t\tdetails?: LsToolDetails;\n\t},\n\toptions: ToolRenderResultOptions,\n\ttheme: typeof import(\"../../modes/interactive/theme/theme.ts\").theme,\n\tshowImages: boolean,\n): string {\n\tconst output = getTextOutput(result, showImages).trim();\n\tlet text = \"\";\n\tif (output) {\n\t\tconst lines = output.split(\"\\n\");\n\t\tconst maxLines = options.expanded ? lines.length : 20;\n\t\tconst displayLines = lines.slice(0, maxLines);\n\t\tconst remaining = lines.length - maxLines;\n\t\ttext += `\\n${displayLines.map((line) => theme.fg(\"toolOutput\", line)).join(\"\\n\")}`;\n\t\tif (remaining > 0) {\n\t\t\ttext += `${theme.fg(\"muted\", `\\n... (${remaining} more lines,`)} ${keyHint(\"app.tools.expand\", \"Expand\")}${theme.fg(\"muted\", \")\")}`;\n\t\t}\n\t}\n\n\tconst entryLimit = result.details?.entryLimitReached;\n\tconst truncation = result.details?.truncation;\n\tif (entryLimit || truncation?.truncated) {\n\t\tconst warnings: string[] = [];\n\t\tif (entryLimit) warnings.push(`${entryLimit} entries limit`);\n\t\tif (truncation?.truncated) warnings.push(`${formatSize(truncation.maxBytes ?? DEFAULT_MAX_BYTES)} limit`);\n\t\ttext += `\\n${theme.fg(\"warning\", `[Truncated: ${warnings.join(\", \")}]`)}`;\n\t}\n\treturn text;\n}\n\nexport function createLsToolDefinition(\n\tcwd: string,\n\toptions?: LsToolOptions,\n): ToolDefinition<typeof lsSchema, LsToolDetails | undefined> {\n\tconst ops = options?.operations ?? defaultLsOperations;\n\treturn {\n\t\tname: \"ls\",\n\t\tlabel: \"ls\",\n\t\tdescription: `List directory contents. Returns entries sorted alphabetically, with '/' suffix for directories. Includes dotfiles. Output is truncated to ${DEFAULT_LIMIT} entries or ${DEFAULT_MAX_BYTES / 1024}KB (whichever is hit first).`,\n\t\tpromptSnippet: \"List directory contents\",\n\t\tparameters: lsSchema,\n\t\tasync execute(\n\t\t\t_toolCallId,\n\t\t\t{ path, limit }: { path?: string; limit?: number },\n\t\t\tsignal?: AbortSignal,\n\t\t\t_onUpdate?,\n\t\t\t_ctx?,\n\t\t) {\n\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\tif (signal?.aborted) {\n\t\t\t\t\treject(new Error(\"Operation aborted\"));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst onAbort = () => reject(new Error(\"Operation aborted\"));\n\t\t\t\tsignal?.addEventListener(\"abort\", onAbort, { once: true });\n\n\t\t\t\t(async () => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst dirPath = resolveToCwd(path || \".\", cwd);\n\t\t\t\t\t\tconst effectiveLimit = limit ?? DEFAULT_LIMIT;\n\n\t\t\t\t\t\t// Check if path exists.\n\t\t\t\t\t\tif (!(await ops.exists(dirPath))) {\n\t\t\t\t\t\t\treject(new Error(`Path not found: ${dirPath}`));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Check if path is a directory.\n\t\t\t\t\t\tconst stat = await ops.stat(dirPath);\n\t\t\t\t\t\tif (!stat.isDirectory()) {\n\t\t\t\t\t\t\treject(new Error(`Not a directory: ${dirPath}`));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Read directory entries.\n\t\t\t\t\t\tlet entries: string[];\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tentries = await ops.readdir(dirPath);\n\t\t\t\t\t\t} catch (e: unknown) {\n\t\t\t\t\t\t\tconst message = e instanceof Error ? e.message : String(e);\n\t\t\t\t\t\t\treject(new Error(`Cannot read directory: ${message}`));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Sort alphabetically, case-insensitive.\n\t\t\t\t\t\tentries.sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase()));\n\n\t\t\t\t\t\t// Format entries with directory indicators.\n\t\t\t\t\t\tconst results: string[] = [];\n\t\t\t\t\t\tlet entryLimitReached = false;\n\t\t\t\t\t\tfor (const entry of entries) {\n\t\t\t\t\t\t\tif (results.length >= effectiveLimit) {\n\t\t\t\t\t\t\t\tentryLimitReached = true;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst fullPath = nodePath.join(dirPath, entry);\n\t\t\t\t\t\t\tlet suffix = \"\";\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tconst entryStat = await ops.stat(fullPath);\n\t\t\t\t\t\t\t\tif (entryStat.isDirectory()) suffix = \"/\";\n\t\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t\t// Skip entries we cannot stat.\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tresults.push(entry + suffix);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\n\t\t\t\t\t\tif (results.length === 0) {\n\t\t\t\t\t\t\tresolve({ content: [{ type: \"text\", text: \"(empty directory)\" }], details: undefined });\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst rawOutput = results.join(\"\\n\");\n\t\t\t\t\t\t// Apply byte truncation. There is no separate line limit because entry count is already capped.\n\t\t\t\t\t\tconst truncation = truncateHead(rawOutput, { maxLines: Number.MAX_SAFE_INTEGER });\n\t\t\t\t\t\tlet output = truncation.content;\n\t\t\t\t\t\tconst details: LsToolDetails = {};\n\t\t\t\t\t\t// Build actionable notices for truncation and entry limits.\n\t\t\t\t\t\tconst notices: string[] = [];\n\t\t\t\t\t\tif (entryLimitReached) {\n\t\t\t\t\t\t\tnotices.push(`${effectiveLimit} entries limit reached. Use limit=${effectiveLimit * 2} for more`);\n\t\t\t\t\t\t\tdetails.entryLimitReached = effectiveLimit;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (truncation.truncated) {\n\t\t\t\t\t\t\tnotices.push(`${formatSize(DEFAULT_MAX_BYTES)} limit reached`);\n\t\t\t\t\t\t\tdetails.truncation = truncation;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (notices.length > 0) {\n\t\t\t\t\t\t\toutput += `\\n\\n[${notices.join(\". \")}]`;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tresolve({\n\t\t\t\t\t\t\tcontent: [{ type: \"text\", text: output }],\n\t\t\t\t\t\t\tdetails: Object.keys(details).length > 0 ? details : undefined,\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch (e: unknown) {\n\t\t\t\t\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\t\t\t\t\t\treject(e);\n\t\t\t\t\t}\n\t\t\t\t})();\n\t\t\t});\n\t\t},\n\t\trenderCall(args, theme, context) {\n\t\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0);\n\t\t\ttext.setText(formatLsCall(args, theme));\n\t\t\treturn text;\n\t\t},\n\t\trenderResult(result, options, theme, context) {\n\t\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0);\n\t\t\ttext.setText(formatLsResult(result, options, theme, context.showImages));\n\t\t\treturn text;\n\t\t},\n\t};\n}\n\nexport function createLsTool(cwd: string, options?: LsToolOptions): AgentTool<typeof lsSchema> {\n\treturn wrapToolDefinition(createLsToolDefinition(cwd, options));\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ls.d.ts","sourceRoot":"","sources":["../../../src/core/tools/ls.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAG/D,OAAO,EAAE,KAAK,MAAM,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,KAAK,EAAE,cAAc,EAA2B,MAAM,wBAAwB,CAAC;AAItF,OAAO,EAAiC,KAAK,gBAAgB,EAAgB,MAAM,eAAe,CAAC;AAEnG,QAAA,MAAM,QAAQ;;;EAGZ,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,QAAQ,CAAC,CAAC;AAIlD,MAAM,WAAW,aAAa;IAC7B,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC5B,2BAA2B;IAC3B,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