@bastani/atomic 0.9.74 → 0.9.75
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 +136 -0
- package/dist/builtin/intercom/package.json +2 -2
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +21 -0
- package/dist/builtin/subagents/package.json +3 -3
- package/dist/builtin/subagents/skills/agent-browser/SKILL.md +8 -10
- package/dist/builtin/subagents/skills/agent-desktop/SKILL.md +9 -5
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +7 -1
- package/dist/builtin/web-access/package.json +2 -2
- package/dist/builtin/workflows/CHANGELOG.md +64 -0
- package/dist/builtin/workflows/README.md +5 -2
- package/dist/builtin/workflows/builtin/{chunk-m8eg152f.js → chunk-89we7r4p.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-a4fdm2cw.js → chunk-8yfssw01.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-774myqzs.js → chunk-v8mb0005.js} +366 -45
- package/dist/builtin/workflows/builtin/{chunk-d5cxskkp.js → chunk-wh2p4qjg.js} +2 -2
- package/dist/builtin/workflows/builtin/goal.js +2 -2
- package/dist/builtin/workflows/builtin/index.d.ts +10 -0
- package/dist/builtin/workflows/builtin/index.js +4 -4
- package/dist/builtin/workflows/builtin/open-claude-design.d.ts +12 -0
- package/dist/builtin/workflows/builtin/open-claude-design.js +1 -1
- package/dist/builtin/workflows/builtin/ralph.js +2 -2
- package/dist/builtin/workflows/package.json +2 -2
- package/dist/builtin/workflows/skills/impeccable/SKILL.md +4 -4
- package/dist/builtin/workflows/skills/impeccable/reference/android.md +1 -1
- package/dist/builtin/workflows/skills/impeccable/reference/audit.md +2 -2
- package/dist/builtin/workflows/skills/impeccable/reference/craft-floor.md +1 -1
- package/dist/builtin/workflows/skills/impeccable/reference/degraded/asset-producer.md +1 -1
- package/dist/builtin/workflows/skills/impeccable/reference/degraded/documenter.md +4 -4
- package/dist/builtin/workflows/skills/impeccable/reference/degraded/finish-reviewer.md +2 -2
- package/dist/builtin/workflows/skills/impeccable/reference/degraded/manual-edit-applier.md +3 -2
- package/dist/builtin/workflows/skills/impeccable/reference/distill.md +3 -3
- package/dist/builtin/workflows/skills/impeccable/reference/doctor.md +1 -1
- package/dist/builtin/workflows/skills/impeccable/reference/document.md +3 -3
- package/dist/builtin/workflows/skills/impeccable/reference/harden.md +19 -0
- package/dist/builtin/workflows/skills/impeccable/reference/hooks.md +15 -8
- package/dist/builtin/workflows/skills/impeccable/reference/init.md +2 -0
- package/dist/builtin/workflows/skills/impeccable/reference/live.md +8 -6
- package/dist/builtin/workflows/skills/impeccable/reference/new-work.md +4 -4
- package/dist/builtin/workflows/skills/impeccable/reference/optimize.md +0 -1
- package/dist/builtin/workflows/skills/impeccable/reference/visualize.md +1 -1
- package/dist/builtin/workflows/skills/impeccable/scripts/VERSION +1 -1
- package/dist/builtin/workflows/skills/impeccable/scripts/command-metadata.json +2 -2
- package/dist/builtin/workflows/skills/impeccable/scripts/engine-checksums.txt +9 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/impeccable +98 -44
- package/dist/builtin/workflows/skills/impeccable/scripts/impeccable.cmd +101 -34
- package/dist/builtin/workflows/skills/impeccable/scripts/live-browser-ignores.js +6 -2
- package/dist/builtin/workflows/skills/impeccable/scripts/live-browser-session.js +4 -1
- package/dist/builtin/workflows/skills/impeccable/scripts/live-browser.js +444 -144
- package/dist/builtin/workflows/skills/prompt-engineer/SKILL.md +3 -1
- package/dist/builtin/workflows/skills/prompt-engineer/references/advanced_patterns.md +2 -2
- package/dist/builtin/workflows/skills/prompt-engineer/references/claude_fable_5.md +13 -11
- package/dist/builtin/workflows/skills/prompt-engineer/references/claude_fable_5_1.md +10 -8
- package/dist/builtin/workflows/skills/prompt-engineer/references/claude_fable_5_2.md +143 -0
- package/dist/builtin/workflows/skills/prompt-engineer/references/claude_haiku_5_5.md +11 -7
- package/dist/builtin/workflows/skills/prompt-engineer/references/claude_opus_4_8.md +3 -3
- package/dist/builtin/workflows/skills/prompt-engineer/references/claude_opus_5.md +6 -2
- package/dist/builtin/workflows/skills/prompt-engineer/references/claude_opus_5_5.md +7 -7
- package/dist/builtin/workflows/skills/prompt-engineer/references/claude_sonnet_5.md +2 -2
- package/dist/builtin/workflows/skills/prompt-engineer/references/claude_sonnet_5_5.md +3 -3
- package/dist/builtin/workflows/skills/prompt-engineer/references/gpt_5_5.md +2 -2
- package/dist/builtin/workflows/skills/prompt-engineer/references/gpt_5_6.md +2 -2
- package/dist/builtin/workflows/skills/prompt-engineer/references/gpt_6.md +6 -5
- package/dist/builtin/workflows/skills/prompt-engineer/references/gpt_6_1_sol.md +4 -4
- package/dist/builtin/workflows/skills/prompt-engineer/references/gpt_6_1_terra.md +2 -2
- package/dist/builtin/workflows/skills/prompt-engineer/references/quality_improvement.md +4 -3
- package/dist/builtin/workflows/skills/skill-creator/scripts/aggregate_benchmark.py +0 -0
- package/dist/builtin/workflows/skills/skill-creator/scripts/generate_report.py +0 -0
- package/dist/builtin/workflows/skills/skill-creator/scripts/improve_description.py +0 -0
- package/dist/builtin/workflows/skills/skill-creator/scripts/package_skill.py +0 -0
- package/dist/builtin/workflows/skills/skill-creator/scripts/quick_validate.py +0 -0
- package/dist/builtin/workflows/skills/skill-creator/scripts/run_eval.py +0 -0
- package/dist/builtin/workflows/skills/skill-creator/scripts/run_loop.py +0 -0
- package/dist/builtin/workflows/skills/unslop/SKILL.md +15 -34
- package/dist/builtin/workflows/src/durable/journal/memory-run-journal.d.ts +1 -0
- package/dist/builtin/workflows/src/durable/journal/values.d.ts +2 -0
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +809 -410
- package/dist/builtin/workflows/src/extension/local-worker-entry.mjs +695 -305
- package/dist/builtin/workflows/src/index.js +685 -295
- package/dist/builtin/workflows/src/local-worker-entry.mjs +695 -305
- package/dist/builtin/workflows/src/shared/authoring-contract-stage.d.ts +6 -6
- package/dist/builtin/workflows/src/shared/authoring-contract-ui.d.ts +2 -2
- package/dist/builtin/workflows/src/shared/serializable-error-families.d.ts +2 -0
- package/dist/bun/app-host-modules.d.ts +1 -1
- package/dist/bun/app-host-modules.d.ts.map +1 -1
- package/dist/bun/app-host-modules.js.map +1 -1
- package/dist/bun/internal-workflow-worker.d.ts +2 -0
- package/dist/bun/internal-workflow-worker.d.ts.map +1 -1
- package/dist/bun/internal-workflow-worker.js +2 -1
- package/dist/bun/internal-workflow-worker.js.map +1 -1
- package/dist/codemode-worker.js +2 -0
- package/dist/config.d.ts +8 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +14 -0
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session-bash.d.ts.map +1 -1
- package/dist/core/agent-session-bash.js +2 -1
- package/dist/core/agent-session-bash.js.map +1 -1
- package/dist/core/agent-session-blueprint-environment.d.ts +10 -0
- package/dist/core/agent-session-blueprint-environment.d.ts.map +1 -0
- package/dist/core/agent-session-blueprint-environment.js +28 -0
- package/dist/core/agent-session-blueprint-environment.js.map +1 -0
- package/dist/core/agent-session-events.d.ts.map +1 -1
- package/dist/core/agent-session-events.js +2 -0
- package/dist/core/agent-session-events.js.map +1 -1
- package/dist/core/agent-session-methods.d.ts +1 -0
- package/dist/core/agent-session-methods.d.ts.map +1 -1
- package/dist/core/agent-session-methods.js.map +1 -1
- package/dist/core/agent-session-retry.d.ts.map +1 -1
- package/dist/core/agent-session-retry.js +14 -4
- package/dist/core/agent-session-retry.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts +20 -0
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +55 -6
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-tool-registry.d.ts.map +1 -1
- package/dist/core/agent-session-tool-registry.js +2 -1
- package/dist/core/agent-session-tool-registry.js.map +1 -1
- package/dist/core/agent-session.d.ts +2 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +2 -0
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/async-scope.d.ts +13 -0
- package/dist/core/async-scope.d.ts.map +1 -0
- package/dist/core/async-scope.js +20 -0
- package/dist/core/async-scope.js.map +1 -0
- package/dist/core/cache-warmer.d.ts +3 -14
- package/dist/core/cache-warmer.d.ts.map +1 -1
- package/dist/core/cache-warmer.js +8 -60
- package/dist/core/cache-warmer.js.map +1 -1
- package/dist/core/extensions/extension-work.js +2 -2
- package/dist/core/extensions/extension-work.js.map +1 -1
- package/dist/core/extensions/loader-host-modules.d.ts.map +1 -1
- package/dist/core/extensions/loader-host-modules.js +3 -1
- package/dist/core/extensions/loader-host-modules.js.map +1 -1
- package/dist/core/extensions/ui-types.d.ts +2 -1
- package/dist/core/extensions/ui-types.d.ts.map +1 -1
- package/dist/core/extensions/ui-types.js.map +1 -1
- package/dist/core/extensions/workflow-events.d.ts +1 -1
- package/dist/core/extensions/workflow-events.d.ts.map +1 -1
- package/dist/core/extensions/workflow-events.js.map +1 -1
- package/dist/core/extensions/workflow-run-control.d.ts +4 -2
- package/dist/core/extensions/workflow-run-control.d.ts.map +1 -1
- package/dist/core/extensions/workflow-run-control.js.map +1 -1
- package/dist/core/model-fallback-failures.d.ts +6 -0
- package/dist/core/model-fallback-failures.d.ts.map +1 -1
- package/dist/core/model-fallback-failures.js +10 -1
- package/dist/core/model-fallback-failures.js.map +1 -1
- package/dist/core/preferred-providers.d.ts +19 -0
- package/dist/core/preferred-providers.d.ts.map +1 -0
- package/dist/core/preferred-providers.js +25 -0
- package/dist/core/preferred-providers.js.map +1 -0
- package/dist/core/provider-alias.d.ts.map +1 -1
- package/dist/core/provider-alias.js +4 -0
- package/dist/core/provider-alias.js.map +1 -1
- package/dist/core/provider-composer.d.ts.map +1 -1
- package/dist/core/provider-composer.js +1 -0
- package/dist/core/provider-composer.js.map +1 -1
- package/dist/core/remote-catalog-provider.d.ts.map +1 -1
- package/dist/core/remote-catalog-provider.js +3 -0
- package/dist/core/remote-catalog-provider.js.map +1 -1
- package/dist/core/resume/blueprint/action-expressions.d.ts +32 -0
- package/dist/core/resume/blueprint/action-expressions.d.ts.map +1 -0
- package/dist/core/resume/blueprint/action-expressions.js +389 -0
- package/dist/core/resume/blueprint/action-expressions.js.map +1 -0
- package/dist/core/resume/blueprint/actions.d.ts +90 -0
- package/dist/core/resume/blueprint/actions.d.ts.map +1 -0
- package/dist/core/resume/blueprint/actions.js +818 -0
- package/dist/core/resume/blueprint/actions.js.map +1 -0
- package/dist/core/resume/blueprint/build.d.ts +102 -0
- package/dist/core/resume/blueprint/build.d.ts.map +1 -0
- package/dist/core/resume/blueprint/build.js +535 -0
- package/dist/core/resume/blueprint/build.js.map +1 -0
- package/dist/core/resume/blueprint/context.d.ts +11 -0
- package/dist/core/resume/blueprint/context.d.ts.map +1 -0
- package/dist/core/resume/blueprint/context.js +106 -0
- package/dist/core/resume/blueprint/context.js.map +1 -0
- package/dist/core/resume/blueprint/envrc.d.ts +19 -0
- package/dist/core/resume/blueprint/envrc.d.ts.map +1 -0
- package/dist/core/resume/blueprint/envrc.js +77 -0
- package/dist/core/resume/blueprint/envrc.js.map +1 -0
- package/dist/core/resume/blueprint/errors.d.ts +179 -0
- package/dist/core/resume/blueprint/errors.d.ts.map +1 -0
- package/dist/core/resume/blueprint/errors.js +169 -0
- package/dist/core/resume/blueprint/errors.js.map +1 -0
- package/dist/core/resume/blueprint/ledger.d.ts +51 -0
- package/dist/core/resume/blueprint/ledger.d.ts.map +1 -0
- package/dist/core/resume/blueprint/ledger.js +119 -0
- package/dist/core/resume/blueprint/ledger.js.map +1 -0
- package/dist/core/resume/blueprint/notices.d.ts +14 -0
- package/dist/core/resume/blueprint/notices.d.ts.map +1 -0
- package/dist/core/resume/blueprint/notices.js +44 -0
- package/dist/core/resume/blueprint/notices.js.map +1 -0
- package/dist/core/resume/blueprint/process.d.ts +44 -0
- package/dist/core/resume/blueprint/process.d.ts.map +1 -0
- package/dist/core/resume/blueprint/process.js +142 -0
- package/dist/core/resume/blueprint/process.js.map +1 -0
- package/dist/core/resume/blueprint/resume.d.ts +73 -0
- package/dist/core/resume/blueprint/resume.d.ts.map +1 -0
- package/dist/core/resume/blueprint/resume.js +206 -0
- package/dist/core/resume/blueprint/resume.js.map +1 -0
- package/dist/core/resume/blueprint/schema.d.ts +26 -0
- package/dist/core/resume/blueprint/schema.d.ts.map +1 -0
- package/dist/core/resume/blueprint/schema.js +243 -0
- package/dist/core/resume/blueprint/schema.js.map +1 -0
- package/dist/core/resume/blueprint/steps.d.ts +54 -0
- package/dist/core/resume/blueprint/steps.d.ts.map +1 -0
- package/dist/core/resume/blueprint/steps.js +155 -0
- package/dist/core/resume/blueprint/steps.js.map +1 -0
- package/dist/core/resume/blueprint/types.d.ts +63 -0
- package/dist/core/resume/blueprint/types.d.ts.map +1 -0
- package/dist/core/resume/blueprint/types.js +2 -0
- package/dist/core/resume/blueprint/types.js.map +1 -0
- package/dist/core/resume/errors.d.ts +7 -35
- package/dist/core/resume/errors.d.ts.map +1 -1
- package/dist/core/resume/errors.js +1 -21
- package/dist/core/resume/errors.js.map +1 -1
- package/dist/core/resume/index.d.ts +12 -4
- package/dist/core/resume/index.d.ts.map +1 -1
- package/dist/core/resume/index.js +11 -4
- package/dist/core/resume/index.js.map +1 -1
- package/dist/core/resume/run-setup.d.ts +36 -15
- package/dist/core/resume/run-setup.d.ts.map +1 -1
- package/dist/core/resume/run-setup.js +70 -54
- package/dist/core/resume/run-setup.js.map +1 -1
- package/dist/core/resume/session-resume.d.ts +34 -20
- package/dist/core/resume/session-resume.d.ts.map +1 -1
- package/dist/core/resume/session-resume.js +244 -106
- package/dist/core/resume/session-resume.js.map +1 -1
- package/dist/core/retry-policy.d.ts +19 -1
- package/dist/core/retry-policy.d.ts.map +1 -1
- package/dist/core/retry-policy.js +26 -1
- package/dist/core/retry-policy.js.map +1 -1
- package/dist/core/sdk.js +1 -1
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-cwd.d.ts +56 -1
- package/dist/core/session-cwd.d.ts.map +1 -1
- package/dist/core/session-cwd.js +94 -4
- package/dist/core/session-cwd.js.map +1 -1
- package/dist/core/session-manager-core.d.ts +1 -1
- package/dist/core/session-manager-core.d.ts.map +1 -1
- package/dist/core/session-manager-core.js +10 -5
- package/dist/core/session-manager-core.js.map +1 -1
- package/dist/core/session-worktree-snapshots.d.ts +11 -0
- package/dist/core/session-worktree-snapshots.d.ts.map +1 -1
- package/dist/core/session-worktree-snapshots.js +10 -4
- package/dist/core/session-worktree-snapshots.js.map +1 -1
- package/dist/core/settings-defaults.d.ts +1 -1
- package/dist/core/settings-defaults.d.ts.map +1 -1
- package/dist/core/settings-defaults.js +1 -1
- package/dist/core/settings-defaults.js.map +1 -1
- package/dist/core/settings-manager-basic-accessors.d.ts +3 -2
- package/dist/core/settings-manager-basic-accessors.d.ts.map +1 -1
- package/dist/core/settings-manager-basic-accessors.js.map +1 -1
- package/dist/core/settings-schema.d.ts.map +1 -1
- package/dist/core/settings-schema.js +2 -1
- package/dist/core/settings-schema.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +4 -0
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/storage/write-ahead-log.d.ts +2 -1
- package/dist/core/storage/write-ahead-log.d.ts.map +1 -1
- package/dist/core/storage/write-ahead-log.js +27 -6
- package/dist/core/storage/write-ahead-log.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +10 -0
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/file-tool-errors.d.ts +1 -1
- package/dist/core/tools/file-tool-errors.js +1 -1
- package/dist/core/tools/file-tool-errors.js.map +1 -1
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +52 -26
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.d.ts +2 -0
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/powershell.d.ts.map +1 -1
- package/dist/core/tools/powershell.js +10 -2
- package/dist/core/tools/powershell.js.map +1 -1
- package/dist/core/tools/tool-concurrency.d.ts.map +1 -1
- package/dist/core/tools/tool-concurrency.js +2 -2
- package/dist/core/tools/tool-concurrency.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/main-session.d.ts +12 -4
- package/dist/main-session.d.ts.map +1 -1
- package/dist/main-session.js +28 -4
- package/dist/main-session.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +6 -8
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.d.ts +5 -1
- package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.js +6 -1
- package/dist/modes/interactive/components/chat-session-host.js.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts +10 -3
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.js +34 -13
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
- package/dist/modes/interactive/components/provider-brand.d.ts +16 -0
- package/dist/modes/interactive/components/provider-brand.d.ts.map +1 -0
- package/dist/modes/interactive/components/provider-brand.js +67 -0
- package/dist/modes/interactive/components/provider-brand.js.map +1 -0
- package/dist/modes/interactive/interactive-auth-routing.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-auth-routing.js +8 -6
- package/dist/modes/interactive/interactive-auth-routing.js.map +1 -1
- package/dist/modes/interactive/interactive-extension-dialogs.js +4 -3
- package/dist/modes/interactive/interactive-extension-dialogs.js.map +1 -1
- package/dist/modes/interactive/interactive-extension-runtime.js +8 -3
- package/dist/modes/interactive/interactive-extension-runtime.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-deps.d.ts +1 -1
- package/dist/modes/interactive/interactive-mode-deps.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-deps.js +1 -1
- package/dist/modes/interactive/interactive-mode-deps.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.d.ts +12 -2
- package/dist/modes/interactive/interactive-mode-surface.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.js.map +1 -1
- package/dist/modes/interactive/interactive-session-routing.js +59 -21
- package/dist/modes/interactive/interactive-session-routing.js.map +1 -1
- package/dist/modes/interactive/interactive-slash-commands.js +23 -12
- package/dist/modes/interactive/interactive-slash-commands.js.map +1 -1
- package/dist/modes/interactive/login-provider-options.d.ts.map +1 -1
- package/dist/modes/interactive/login-provider-options.js +2 -1
- package/dist/modes/interactive/login-provider-options.js.map +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.d.ts +2 -0
- package/dist/modes/interactive-engine/isolated-runtime.d.ts.map +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.js +8 -3
- package/dist/modes/interactive-engine/isolated-runtime.js.map +1 -1
- package/dist/modes/rpc/rpc-client-api.d.ts +2 -1
- package/dist/modes/rpc/rpc-client-api.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client-api.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +0 -1
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +2 -18
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-command-handler.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-command-handler.js +8 -2
- package/dist/modes/rpc/rpc-command-handler.js.map +1 -1
- package/dist/modes/rpc/rpc-error-decoding.d.ts +7 -0
- package/dist/modes/rpc/rpc-error-decoding.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-error-decoding.js +25 -0
- package/dist/modes/rpc/rpc-error-decoding.js.map +1 -0
- package/dist/modes/rpc/rpc-responses.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-responses.js +12 -0
- package/dist/modes/rpc/rpc-responses.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +11 -0
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +12 -3
- package/dist/package-manager-cli.js.map +1 -1
- package/docs/background-tasks.md +1 -1
- package/docs/codemode.md +22 -0
- package/docs/extensions/api-reference.md +27 -1
- package/docs/extensions/authoring.md +1 -1
- package/docs/extensions/ui.md +1 -1
- package/docs/getting-started/first-session.md +1 -1
- package/docs/guides/resume-on-any-machine.md +72 -19
- package/docs/models/evals.md +85 -17
- package/docs/models/reference.md +1 -1
- package/docs/providers.md +38 -5
- package/docs/reference/cli.md +2 -0
- package/docs/rpc/protocol.md +11 -1
- package/docs/sdk/reference.md +36 -4
- package/docs/sdk.md +2 -2
- package/docs/sessions.md +11 -1
- package/docs/settings.md +7 -2
- package/docs/skills.md +3 -3
- package/docs/storage.md +1 -1
- package/docs/tools.md +3 -1
- package/docs/workflows/api-reference.md +14 -12
- package/docs/workflows/authoring.md +29 -1
- package/docs/workflows/builtins.md +9 -1
- package/docs/workflows/operations.md +8 -8
- package/docs/worktree-snapshots.md +3 -2
- package/npm-shrinkwrap.json +83 -67
- package/package.json +7 -7
- package/schemas/settings.schema.json +3 -2
- package/dist/core/resume/setup-hook.d.ts +0 -69
- package/dist/core/resume/setup-hook.d.ts.map +0 -1
- package/dist/core/resume/setup-hook.js +0 -261
- package/dist/core/resume/setup-hook.js.map +0 -1
|
@@ -13,13 +13,17 @@
|
|
|
13
13
|
'use strict';
|
|
14
14
|
if (typeof window === 'undefined') return;
|
|
15
15
|
|
|
16
|
+
// Take the helper token out of the global before anything else, including
|
|
17
|
+
// on the double-init return below: each served copy re-prepends it.
|
|
18
|
+
const TOKEN = window.__IMPECCABLE_TOKEN__;
|
|
19
|
+
try { delete window.__IMPECCABLE_TOKEN__; } catch { /* non-configurable */ }
|
|
20
|
+
|
|
16
21
|
// Guard against double-init. Bun's HTML loader may process the <script> tag
|
|
17
22
|
// and create a bundled copy alongside the external load, or HMR may re-execute.
|
|
18
|
-
// Check BEFORE reading
|
|
23
|
+
// Check BEFORE reading port to catch all cases.
|
|
19
24
|
if (window.__IMPECCABLE_LIVE_INIT__) return;
|
|
20
25
|
window.__IMPECCABLE_LIVE_INIT__ = true;
|
|
21
26
|
|
|
22
|
-
const TOKEN = window.__IMPECCABLE_TOKEN__;
|
|
23
27
|
const PORT = window.__IMPECCABLE_PORT__;
|
|
24
28
|
const APP_ROOT = window.__IMPECCABLE_APP_ROOT__ || null;
|
|
25
29
|
if (!TOKEN || !PORT) {
|
|
@@ -58,16 +62,22 @@
|
|
|
58
62
|
const Z = { highlight: 100001, bar: 100005, picker: 100007, toast: 100010 };
|
|
59
63
|
const EASE = 'cubic-bezier(0.22, 1, 0.36, 1)'; // ease-out-quint
|
|
60
64
|
const PREFIX = 'impeccable-live';
|
|
65
|
+
// A removed element stays in the DOM, hidden by this attribute, so a
|
|
66
|
+
// framework that owns the node never reconciles against a missing child;
|
|
67
|
+
// Undo and Discard restore it by dropping the attribute.
|
|
68
|
+
const REMOVED_ATTR = 'data-impeccable-removed';
|
|
61
69
|
const IMPECCABLE_COMMAND = (window.__IMPECCABLE_COMMAND_PREFIX__ || '/') + 'impeccable';
|
|
62
70
|
const PICK_CURSOR_STYLE_ID = PREFIX + '-pick-cursor-style';
|
|
63
71
|
const MANUAL_APPLY_STATE_TTL_MS = 15 * 60 * 1000;
|
|
64
72
|
// No idFactory: the session helper's default works on plain-HTTP origins,
|
|
65
73
|
// where the secure-context-only randomUUID does not exist (issue #1055).
|
|
74
|
+
let liveStorage = null;
|
|
75
|
+
try { liveStorage = window.localStorage; } catch { /* storage denied */ }
|
|
66
76
|
let sessionState = null;
|
|
67
77
|
try {
|
|
68
78
|
sessionState = window.__IMPECCABLE_LIVE_SESSION__?.createLiveBrowserSessionState({
|
|
69
79
|
prefix: PREFIX,
|
|
70
|
-
storage:
|
|
80
|
+
storage: liveStorage,
|
|
71
81
|
});
|
|
72
82
|
} catch (err) {
|
|
73
83
|
console.error('[impeccable] Live mode could not create its session state.', err);
|
|
@@ -968,6 +978,10 @@
|
|
|
968
978
|
|
|
969
979
|
function stripManualEditRuntimeState(root) {
|
|
970
980
|
if (!root || root.nodeType !== 1) return;
|
|
981
|
+
// A removed element is gone as far as the agent is concerned: drop it from
|
|
982
|
+
// the clone rather than describing a hidden child it might regenerate.
|
|
983
|
+
for (const removed of root.querySelectorAll('[' + REMOVED_ATTR + ']')) removed.remove();
|
|
984
|
+
root.removeAttribute(REMOVED_ATTR);
|
|
971
985
|
unwrapMixedContentTextNodes(root);
|
|
972
986
|
const nodes = [root, ...root.querySelectorAll('[data-impeccable-editable], [data-impeccable-original-text], [data-impeccable-text-wrap]')];
|
|
973
987
|
for (const node of nodes) {
|
|
@@ -2512,7 +2526,7 @@
|
|
|
2512
2526
|
row.appendChild(buildConfigureTrailingCluster([action, count], voiceBtn, go));
|
|
2513
2527
|
syncConfigureInputChrome();
|
|
2514
2528
|
|
|
2515
|
-
if (!controlsLocked) setTimeout(() => input.focus(), 60);
|
|
2529
|
+
if (!controlsLocked && !touchPrimary()) setTimeout(() => input.focus(), 60);
|
|
2516
2530
|
|
|
2517
2531
|
return row;
|
|
2518
2532
|
}
|
|
@@ -2616,7 +2630,7 @@
|
|
|
2616
2630
|
row.appendChild(buildConfigureTrailingCluster([count], voiceBtn, create));
|
|
2617
2631
|
syncInsertCreateButton(create, input);
|
|
2618
2632
|
syncConfigureInputChrome();
|
|
2619
|
-
if (!controlsLocked) setTimeout(() => input.focus(), 60);
|
|
2633
|
+
if (!controlsLocked && !touchPrimary()) setTimeout(() => input.focus(), 60);
|
|
2620
2634
|
return row;
|
|
2621
2635
|
}
|
|
2622
2636
|
|
|
@@ -3124,6 +3138,12 @@
|
|
|
3124
3138
|
let paramsPanelBody = null; // grid holding the knob cells
|
|
3125
3139
|
let paramsCurrentValues = {}; // {paramId: value} - mirror of the visible variant's live values
|
|
3126
3140
|
let tuneOpen = false; // whether the Tune popover is open right now
|
|
3141
|
+
// Tune values to keep for one session and variant: {sessionId, variant,
|
|
3142
|
+
// values}. A reload restores them from the saved session and every knob
|
|
3143
|
+
// edit replaces them. Cycling refreshes of that session and variant keep
|
|
3144
|
+
// them (a resume, or the last progressive variant landing, refreshes more
|
|
3145
|
+
// than once); a refresh for any other variant drops them.
|
|
3146
|
+
let keptParamValues = null;
|
|
3127
3147
|
|
|
3128
3148
|
// Theme-aware Tune popover. Appears as a drawer that slides out from the
|
|
3129
3149
|
// contextual bar's bar-facing edge (below if the bar sits below the
|
|
@@ -3260,6 +3280,54 @@
|
|
|
3260
3280
|
}
|
|
3261
3281
|
}
|
|
3262
3282
|
|
|
3283
|
+
function rememberSavedParamValues(saved) {
|
|
3284
|
+
const values = saved.paramValues;
|
|
3285
|
+
if (!values || typeof values !== 'object' || Array.isArray(values)) return;
|
|
3286
|
+
if (Object.keys(values).length === 0) return;
|
|
3287
|
+
const variant = Number(saved.visible != null ? saved.visible : saved.visibleVariant) || 0;
|
|
3288
|
+
keptParamValues = { sessionId: saved.id || null, variant, values: { ...values } };
|
|
3289
|
+
}
|
|
3290
|
+
|
|
3291
|
+
function keptParamValuesForVisibleVariant() {
|
|
3292
|
+
const kept = keptParamValues;
|
|
3293
|
+
if (!kept) return null;
|
|
3294
|
+
if (kept.sessionId === currentSessionId && kept.variant === visibleVariant) return kept.values;
|
|
3295
|
+
keptParamValues = null;
|
|
3296
|
+
return null;
|
|
3297
|
+
}
|
|
3298
|
+
|
|
3299
|
+
// The local save is what a reload resumes from, so an edit is saved there
|
|
3300
|
+
// as well as checkpointed to the server.
|
|
3301
|
+
function noteParamEdited() {
|
|
3302
|
+
keptParamValues = { sessionId: currentSessionId, variant: visibleVariant, values: { ...paramsCurrentValues } };
|
|
3303
|
+
saveSession();
|
|
3304
|
+
queueCheckpoint('param_changed');
|
|
3305
|
+
}
|
|
3306
|
+
|
|
3307
|
+
// A saved value comes from storage the page does not own, and the variant
|
|
3308
|
+
// may have been regenerated since, so it must still fit the param it names.
|
|
3309
|
+
function isValidSavedParamValue(p, value) {
|
|
3310
|
+
if (p.kind === 'range') {
|
|
3311
|
+
if (typeof value !== 'number' || !Number.isFinite(value)) return false;
|
|
3312
|
+
const min = p.min != null ? Number(p.min) : 0;
|
|
3313
|
+
const max = p.max != null ? Number(p.max) : 1;
|
|
3314
|
+
return value >= min && value <= max;
|
|
3315
|
+
}
|
|
3316
|
+
if (p.kind === 'toggle') return typeof value === 'boolean';
|
|
3317
|
+
if (p.kind === 'steps') {
|
|
3318
|
+
return (p.options || []).some(o => (o && typeof o === 'object' ? o.value : o) === value);
|
|
3319
|
+
}
|
|
3320
|
+
return false;
|
|
3321
|
+
}
|
|
3322
|
+
|
|
3323
|
+
function applySavedParamValues(variantEl, params, saved) {
|
|
3324
|
+
for (const p of params) {
|
|
3325
|
+
if (!Object.hasOwn(saved, p.id) || !isValidSavedParamValue(p, saved[p.id])) continue;
|
|
3326
|
+
paramsCurrentValues[p.id] = saved[p.id];
|
|
3327
|
+
applyParamValue(variantEl, p, saved[p.id]);
|
|
3328
|
+
}
|
|
3329
|
+
}
|
|
3330
|
+
|
|
3263
3331
|
function formatRangeValue(input) {
|
|
3264
3332
|
const max = parseFloat(input.max), min = parseFloat(input.min);
|
|
3265
3333
|
const v = parseFloat(input.value);
|
|
@@ -3271,6 +3339,14 @@
|
|
|
3271
3339
|
const P = paramsPanelPalette || barPaletteForTheme(detectPageTheme());
|
|
3272
3340
|
paramsPanelBody.innerHTML = '';
|
|
3273
3341
|
for (const p of params) {
|
|
3342
|
+
// A knob the panel shows must be in the live values and on the variant,
|
|
3343
|
+
// or accept drops it and the preview ignores it. Seed only missing keys
|
|
3344
|
+
// so a reopen keeps edits.
|
|
3345
|
+
if (!Object.hasOwn(paramsCurrentValues, p.id)) {
|
|
3346
|
+
paramsCurrentValues[p.id] = p.default;
|
|
3347
|
+
applyParamValue(variantEl, p, p.default);
|
|
3348
|
+
}
|
|
3349
|
+
const value = paramsCurrentValues[p.id];
|
|
3274
3350
|
const row = el('div', { display: 'flex', flexDirection: 'column', gap: '6px' });
|
|
3275
3351
|
const labelRow = el('div', {
|
|
3276
3352
|
display: 'flex', justifyContent: 'space-between',
|
|
@@ -3295,7 +3371,7 @@
|
|
|
3295
3371
|
input.min = String(p.min != null ? p.min : 0);
|
|
3296
3372
|
input.max = String(p.max != null ? p.max : 1);
|
|
3297
3373
|
input.step = String(p.step != null ? p.step : 0.05);
|
|
3298
|
-
input.value = String(
|
|
3374
|
+
input.value = String(value);
|
|
3299
3375
|
Object.assign(input.style, {
|
|
3300
3376
|
width: '100%', accentColor: C.brand, cursor: 'pointer',
|
|
3301
3377
|
});
|
|
@@ -3306,11 +3382,11 @@
|
|
|
3306
3382
|
paramsCurrentValues[p.id] = v;
|
|
3307
3383
|
readout.textContent = formatRangeValue(input);
|
|
3308
3384
|
applyParamValue(variantEl, p, v);
|
|
3309
|
-
|
|
3385
|
+
noteParamEdited();
|
|
3310
3386
|
});
|
|
3311
3387
|
row.appendChild(input);
|
|
3312
3388
|
} else if (p.kind === 'toggle') {
|
|
3313
|
-
const initial = !!
|
|
3389
|
+
const initial = !!value;
|
|
3314
3390
|
readout.textContent = initial ? 'On' : 'Off';
|
|
3315
3391
|
const track = el('button', {
|
|
3316
3392
|
position: 'relative', width: '36px', height: '20px',
|
|
@@ -3337,15 +3413,15 @@
|
|
|
3337
3413
|
knob.style.left = next ? '18px' : '2px';
|
|
3338
3414
|
readout.textContent = next ? 'On' : 'Off';
|
|
3339
3415
|
applyParamValue(variantEl, p, next);
|
|
3340
|
-
|
|
3416
|
+
noteParamEdited();
|
|
3341
3417
|
});
|
|
3342
3418
|
row.appendChild(track);
|
|
3343
3419
|
} else if (p.kind === 'steps') {
|
|
3344
3420
|
const opts = (p.options || []).map(o =>
|
|
3345
3421
|
typeof o === 'string' ? { value: o, label: o } : o
|
|
3346
3422
|
);
|
|
3347
|
-
const activeOpt = opts.find(o => o.value ===
|
|
3348
|
-
readout.textContent = activeOpt ? activeOpt.label : String(
|
|
3423
|
+
const activeOpt = opts.find(o => o.value === value) || opts[0];
|
|
3424
|
+
readout.textContent = activeOpt ? activeOpt.label : String(value);
|
|
3349
3425
|
const segRow = el('div', {
|
|
3350
3426
|
display: 'grid',
|
|
3351
3427
|
gridTemplateColumns: 'repeat(' + opts.length + ', 1fr)',
|
|
@@ -3354,7 +3430,7 @@
|
|
|
3354
3430
|
});
|
|
3355
3431
|
const segBtns = [];
|
|
3356
3432
|
opts.forEach(o => {
|
|
3357
|
-
const active = o.value ===
|
|
3433
|
+
const active = o.value === value;
|
|
3358
3434
|
const b = el('button', {
|
|
3359
3435
|
padding: '5px 4px', border: 'none', borderRadius: '3px',
|
|
3360
3436
|
background: active ? C.brand : 'transparent',
|
|
@@ -3374,7 +3450,7 @@
|
|
|
3374
3450
|
btn.style.color = on ? C.ink : P.text;
|
|
3375
3451
|
});
|
|
3376
3452
|
applyParamValue(variantEl, p, o.value);
|
|
3377
|
-
|
|
3453
|
+
noteParamEdited();
|
|
3378
3454
|
});
|
|
3379
3455
|
segRow.appendChild(b);
|
|
3380
3456
|
segBtns.push({ btn: b, val: o.value });
|
|
@@ -3788,6 +3864,156 @@
|
|
|
3788
3864
|
return out;
|
|
3789
3865
|
}
|
|
3790
3866
|
|
|
3867
|
+
function ensureRemovedElementStyle() {
|
|
3868
|
+
if (document.getElementById(PREFIX + '-removed-style')) return;
|
|
3869
|
+
const style = document.createElement('style');
|
|
3870
|
+
style.id = PREFIX + '-removed-style';
|
|
3871
|
+
style.textContent = '[' + REMOVED_ATTR + '] { display: none !important; }';
|
|
3872
|
+
(document.head || document.documentElement).appendChild(style);
|
|
3873
|
+
}
|
|
3874
|
+
|
|
3875
|
+
// The text the applier and the verifier look for in source: a text leaf
|
|
3876
|
+
// (preferring one free of characters source tends to entity-encode, so the
|
|
3877
|
+
// literal search finds it), else the attribute that names the element, else
|
|
3878
|
+
// its id.
|
|
3879
|
+
function removalOriginalText(el) {
|
|
3880
|
+
const leaves = collectEditableTextRows(el, { isOwn: own })
|
|
3881
|
+
.map((row) => normalizeManualContextText(row.text))
|
|
3882
|
+
.filter(Boolean);
|
|
3883
|
+
const plain = leaves.find((text) => !/[&<>"]/.test(text));
|
|
3884
|
+
if (plain || leaves.length) return (plain || leaves[0]).slice(0, 200);
|
|
3885
|
+
for (const attr of ['alt', 'aria-label', 'title']) {
|
|
3886
|
+
const value = normalizeManualContextText(el.getAttribute?.(attr));
|
|
3887
|
+
if (value) return value.slice(0, 200);
|
|
3888
|
+
}
|
|
3889
|
+
for (const attr of ['src', 'href']) {
|
|
3890
|
+
const value = String(el.getAttribute?.(attr) || '').split(/[?#]/)[0];
|
|
3891
|
+
const base = value.split('/').filter(Boolean).pop();
|
|
3892
|
+
if (base) return base.slice(0, 200);
|
|
3893
|
+
}
|
|
3894
|
+
if (el.id) return el.id;
|
|
3895
|
+
const cls = [...(el.classList || [])].find((c) => c.indexOf('impeccable-') !== 0);
|
|
3896
|
+
if (cls) return cls;
|
|
3897
|
+
return normalizeManualContextText(el.textContent).slice(0, 200);
|
|
3898
|
+
}
|
|
3899
|
+
|
|
3900
|
+
function removalDisallowedReason(el) {
|
|
3901
|
+
if (!el || !el.isConnected || own(el)) return 'no_selection';
|
|
3902
|
+
const tag = el.tagName.toLowerCase();
|
|
3903
|
+
if (tag === 'html' || tag === 'body') return 'root';
|
|
3904
|
+
if (el.hasAttribute('data-impeccable-insert-placeholder')) return 'placeholder';
|
|
3905
|
+
if (el.closest('[data-impeccable-variants], [data-impeccable-carbonize]')) return 'variant';
|
|
3906
|
+
return null;
|
|
3907
|
+
}
|
|
3908
|
+
|
|
3909
|
+
// Remove badge: stage one removal op through the same buffer copy edits
|
|
3910
|
+
// use, hide the element, and offer Undo. The source edit happens when the
|
|
3911
|
+
// user clicks Apply, like every other staged edit.
|
|
3912
|
+
async function removeSelectedElement() {
|
|
3913
|
+
if (pendingApplyInFlight) { showManualApplyBusyToast(); return; }
|
|
3914
|
+
const target = selectedElement;
|
|
3915
|
+
const refused = removalDisallowedReason(target);
|
|
3916
|
+
if (refused) {
|
|
3917
|
+
if (refused !== 'no_selection') showToast('This element cannot be removed from here.', 3500);
|
|
3918
|
+
return;
|
|
3919
|
+
}
|
|
3920
|
+
const parent = target.parentElement;
|
|
3921
|
+
const ref = documentRefForElement(target);
|
|
3922
|
+
const originalText = removalOriginalText(target);
|
|
3923
|
+
if (!originalText) {
|
|
3924
|
+
// Nothing to find it by in source, so the applier could neither locate
|
|
3925
|
+
// nor verify the removal. Better to say so than to stage a dead op.
|
|
3926
|
+
showToast('Nothing identifies this element in source; give it an id or class, or remove it in the editor.', 5000);
|
|
3927
|
+
return;
|
|
3928
|
+
}
|
|
3929
|
+
const op = {
|
|
3930
|
+
ref,
|
|
3931
|
+
tag: target.tagName.toLowerCase(),
|
|
3932
|
+
elementId: target.id || null,
|
|
3933
|
+
classes: [...target.classList].filter((cls) => cls.indexOf('impeccable-') !== 0),
|
|
3934
|
+
originalText,
|
|
3935
|
+
deleted: true,
|
|
3936
|
+
removeElement: true,
|
|
3937
|
+
leaf: copyEditLeafContext(target, originalText, ''),
|
|
3938
|
+
};
|
|
3939
|
+
const contextRef = documentRefForElement(parent);
|
|
3940
|
+
if (contextRef) op.contextRef = contextRef;
|
|
3941
|
+
const container = copyEditContainerContext(parent);
|
|
3942
|
+
if (container) op.container = container;
|
|
3943
|
+
const sourceHint = sourceHintForElement(target);
|
|
3944
|
+
if (sourceHint) op.sourceHint = sourceHint;
|
|
3945
|
+
hideConfigureBarTooltip();
|
|
3946
|
+
let stashResult;
|
|
3947
|
+
try {
|
|
3948
|
+
const res = await fetch('http://localhost:' + PORT + '/manual-edit-stash?token=' + encodeURIComponent(TOKEN), {
|
|
3949
|
+
method: 'POST',
|
|
3950
|
+
headers: { 'Content-Type': 'application/json' },
|
|
3951
|
+
body: JSON.stringify({
|
|
3952
|
+
token: TOKEN,
|
|
3953
|
+
id: id8(),
|
|
3954
|
+
pageUrl: location.pathname,
|
|
3955
|
+
element: extractContext(parent || target),
|
|
3956
|
+
ops: [op],
|
|
3957
|
+
}),
|
|
3958
|
+
});
|
|
3959
|
+
if (!res.ok) {
|
|
3960
|
+
const errBody = await res.json().catch(() => ({}));
|
|
3961
|
+
throw new Error(errBody.error || ('HTTP ' + res.status));
|
|
3962
|
+
}
|
|
3963
|
+
stashResult = await res.json();
|
|
3964
|
+
} catch (err) {
|
|
3965
|
+
console.error('[impeccable] element removal stash failed:', err);
|
|
3966
|
+
showToast('Remove failed - retry or cancel', 4000);
|
|
3967
|
+
return;
|
|
3968
|
+
}
|
|
3969
|
+
ensureRemovedElementStyle();
|
|
3970
|
+
target.setAttribute(REMOVED_ATTR, ref || op.tag);
|
|
3971
|
+
selectedElement = null;
|
|
3972
|
+
exitConfigureToPicking('remove-element', { clearHover: true });
|
|
3973
|
+
updatePendingCounter(stashResult.pendingCount || 0);
|
|
3974
|
+
showToast('Removed ' + desc(target), 6000, {
|
|
3975
|
+
action: { label: 'Undo', onClick: () => undoElementRemoval(target, ref) },
|
|
3976
|
+
});
|
|
3977
|
+
}
|
|
3978
|
+
|
|
3979
|
+
async function undoElementRemoval(target, ref) {
|
|
3980
|
+
if (pendingApplyInFlight) { showManualApplyBusyToast(); return; }
|
|
3981
|
+
dismissToast();
|
|
3982
|
+
try {
|
|
3983
|
+
const res = await fetch(
|
|
3984
|
+
'http://localhost:' + PORT + '/manual-edit-discard?token=' + encodeURIComponent(TOKEN)
|
|
3985
|
+
+ '&pageUrl=' + encodeURIComponent(location.pathname)
|
|
3986
|
+
+ '&ref=' + encodeURIComponent(ref || ''),
|
|
3987
|
+
{ method: 'POST' },
|
|
3988
|
+
);
|
|
3989
|
+
if (res.status === 409) {
|
|
3990
|
+
// An Apply owns this page's edits (started from another tab, or
|
|
3991
|
+
// before our dock caught up); the removal stays staged and hidden.
|
|
3992
|
+
showToast('Apply is running; undo once it finishes', 4000);
|
|
3993
|
+
fetchPendingCount();
|
|
3994
|
+
return;
|
|
3995
|
+
}
|
|
3996
|
+
if (!res.ok) throw new Error('HTTP ' + res.status);
|
|
3997
|
+
const result = await res.json().catch(() => ({}));
|
|
3998
|
+
target.removeAttribute(REMOVED_ATTR);
|
|
3999
|
+
const remaining = remainingManualEditCount(result);
|
|
4000
|
+
if (remaining === null) fetchPendingCount();
|
|
4001
|
+
else updatePendingCounter(remaining);
|
|
4002
|
+
showToast('Restored ' + desc(target), 2500);
|
|
4003
|
+
} catch (err) {
|
|
4004
|
+
console.error('[impeccable] undo removal failed:', err);
|
|
4005
|
+
showToast('Undo failed - see console', 4000);
|
|
4006
|
+
}
|
|
4007
|
+
}
|
|
4008
|
+
|
|
4009
|
+
function restoreRemovedElement(op) {
|
|
4010
|
+
const ref = typeof op?.ref === 'string' ? op.ref : '';
|
|
4011
|
+
if (!ref) return;
|
|
4012
|
+
for (const el of document.querySelectorAll('[' + REMOVED_ATTR + ']')) {
|
|
4013
|
+
if (el.getAttribute(REMOVED_ATTR) === ref) el.removeAttribute(REMOVED_ATTR);
|
|
4014
|
+
}
|
|
4015
|
+
}
|
|
4016
|
+
|
|
3791
4017
|
async function applyEditing() {
|
|
3792
4018
|
if (pendingApplyInFlight) { showManualApplyBusyToast(); return; }
|
|
3793
4019
|
const ops = [];
|
|
@@ -3916,7 +4142,7 @@
|
|
|
3916
4142
|
}
|
|
3917
4143
|
|
|
3918
4144
|
function pendingApplyLabel(count) {
|
|
3919
|
-
return count === 1 ? 'Apply
|
|
4145
|
+
return count === 1 ? 'Apply edit' : 'Apply edits';
|
|
3920
4146
|
}
|
|
3921
4147
|
|
|
3922
4148
|
function showManualApplyBusyToast() {
|
|
@@ -3991,13 +4217,13 @@
|
|
|
3991
4217
|
const max = Number(stored.repairMaxAttempts) || 3;
|
|
3992
4218
|
return 'Fixing apply issue, attempt ' + attempt + '/' + max;
|
|
3993
4219
|
}
|
|
3994
|
-
if (stored?.phase === 'verifying') return 'Verifying
|
|
4220
|
+
if (stored?.phase === 'verifying') return 'Verifying edits';
|
|
3995
4221
|
const remaining = Number.isFinite(Number(stored?.remainingCount))
|
|
3996
4222
|
? Number(stored.remainingCount)
|
|
3997
4223
|
: Number(fallbackCount) || 0;
|
|
3998
4224
|
return remaining > 0
|
|
3999
|
-
? 'Applying ' + remaining + '
|
|
4000
|
-
: 'Verifying
|
|
4225
|
+
? 'Applying ' + remaining + ' edit' + (remaining === 1 ? '' : 's')
|
|
4226
|
+
: 'Verifying edits';
|
|
4001
4227
|
}
|
|
4002
4228
|
|
|
4003
4229
|
function resetManualApplyProgress(count) {
|
|
@@ -4053,7 +4279,7 @@
|
|
|
4053
4279
|
}
|
|
4054
4280
|
if (editBadgeEl && editBadgeEl.style.display !== 'none') {
|
|
4055
4281
|
if (pendingApplyInFlight) renderEditBadge('idle-disabled');
|
|
4056
|
-
else if (state === 'CONFIGURING' && selectedElement
|
|
4282
|
+
else if (state === 'CONFIGURING' && selectedElement) renderEditBadge('idle');
|
|
4057
4283
|
}
|
|
4058
4284
|
updateGlobalBarState();
|
|
4059
4285
|
}
|
|
@@ -4063,32 +4289,46 @@
|
|
|
4063
4289
|
retryDeclinedAgentTargets();
|
|
4064
4290
|
clearStoredManualApplyState();
|
|
4065
4291
|
if (pendingIntroAnimation) { pendingIntroAnimation.cancel(); pendingIntroAnimation = null; }
|
|
4292
|
+
renderPendingDockControls('normal', 0);
|
|
4066
4293
|
if (pendingDockEl) pendingDockEl.style.display = 'none';
|
|
4067
4294
|
if (pendingPillEl) {
|
|
4068
4295
|
pendingPillEl.dataset.count = '0';
|
|
4069
4296
|
pendingPillEl.style.display = 'none';
|
|
4070
|
-
pendingPillEl.
|
|
4071
|
-
pendingPillEl.setAttribute('aria-busy', 'false');
|
|
4072
|
-
pendingPillEl.setAttribute('aria-label', 'Apply copy edits to source');
|
|
4073
|
-
pendingPillEl.style.cursor = 'pointer';
|
|
4074
|
-
pendingPillEl.style.filter = 'none';
|
|
4075
|
-
pendingPillEl.style.transform = 'scale(1)';
|
|
4297
|
+
pendingPillEl.setAttribute('aria-label', 'Apply edits to source');
|
|
4076
4298
|
}
|
|
4077
|
-
if (
|
|
4078
|
-
if (
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4299
|
+
if (pendingPillCountEl) pendingPillCountEl.textContent = '0';
|
|
4300
|
+
if (pendingTrashBtn) pendingTrashBtn.style.display = 'none';
|
|
4301
|
+
refreshLiveControlsForManualApply();
|
|
4302
|
+
}
|
|
4303
|
+
|
|
4304
|
+
// Sets every control the dock's modes differ in, so leaving a mode can never
|
|
4305
|
+
// leave its controls behind. 'normal': Apply and Discard enabled.
|
|
4306
|
+
// 'applying': a spinner, both disabled. 'decision': Keep fixing and Rollback.
|
|
4307
|
+
function renderPendingDockControls(mode, count) {
|
|
4308
|
+
const applying = mode === 'applying';
|
|
4309
|
+
const decision = mode === 'decision';
|
|
4310
|
+
const normal = !applying && !decision;
|
|
4311
|
+
if (pendingPillSpinnerEl) pendingPillSpinnerEl.style.display = applying ? 'inline-block' : 'none';
|
|
4312
|
+
if (pendingPillLabelEl) {
|
|
4313
|
+
pendingPillLabelEl.textContent = decision ? 'Apply needs attention'
|
|
4314
|
+
: applying ? manualApplyLoadingText(count) : pendingApplyLabel(count);
|
|
4315
|
+
}
|
|
4316
|
+
if (pendingPillCountEl) pendingPillCountEl.style.display = normal ? 'inline-flex' : 'none';
|
|
4317
|
+
if (pendingPillEl) {
|
|
4318
|
+
pendingPillEl.disabled = !normal;
|
|
4319
|
+
pendingPillEl.setAttribute('aria-busy', applying ? 'true' : 'false');
|
|
4320
|
+
pendingPillEl.style.cursor = applying ? 'wait' : decision ? 'default' : 'pointer';
|
|
4321
|
+
pendingPillEl.style.filter = applying ? 'brightness(0.98)' : 'none';
|
|
4322
|
+
pendingPillEl.style.transform = 'scale(1)';
|
|
4082
4323
|
}
|
|
4083
4324
|
if (pendingTrashBtn) {
|
|
4084
|
-
pendingTrashBtn.style.display = 'none';
|
|
4085
|
-
pendingTrashBtn.disabled =
|
|
4086
|
-
pendingTrashBtn.style.cursor = 'pointer';
|
|
4087
|
-
pendingTrashBtn.style.opacity = '1';
|
|
4325
|
+
pendingTrashBtn.style.display = decision ? 'none' : 'inline-flex';
|
|
4326
|
+
pendingTrashBtn.disabled = !normal;
|
|
4327
|
+
pendingTrashBtn.style.cursor = normal ? 'pointer' : 'not-allowed';
|
|
4328
|
+
pendingTrashBtn.style.opacity = normal ? '1' : '0.58';
|
|
4088
4329
|
}
|
|
4089
|
-
if (pendingKeepFixingBtn) pendingKeepFixingBtn.style.display = 'none';
|
|
4090
|
-
if (pendingRollbackBtn) pendingRollbackBtn.style.display = 'none';
|
|
4091
|
-
refreshLiveControlsForManualApply();
|
|
4330
|
+
if (pendingKeepFixingBtn) pendingKeepFixingBtn.style.display = decision ? 'inline-flex' : 'none';
|
|
4331
|
+
if (pendingRollbackBtn) pendingRollbackBtn.style.display = decision ? 'inline-flex' : 'none';
|
|
4092
4332
|
}
|
|
4093
4333
|
|
|
4094
4334
|
function setPendingApplyLoading(loading, count) {
|
|
@@ -4098,24 +4338,7 @@
|
|
|
4098
4338
|
const currentCount = count || parseInt(pendingPillEl.dataset.count || '0', 10) || 0;
|
|
4099
4339
|
if (pendingApplyInFlight) storeManualApplyState(currentCount);
|
|
4100
4340
|
else clearStoredManualApplyState();
|
|
4101
|
-
|
|
4102
|
-
pendingPillLabelEl.textContent = pendingApplyInFlight
|
|
4103
|
-
? manualApplyLoadingText(currentCount)
|
|
4104
|
-
: pendingApplyLabel(currentCount);
|
|
4105
|
-
pendingPillCountEl.style.display = pendingApplyInFlight ? 'none' : 'inline-flex';
|
|
4106
|
-
pendingPillEl.disabled = pendingApplyInFlight;
|
|
4107
|
-
pendingPillEl.setAttribute('aria-busy', pendingApplyInFlight ? 'true' : 'false');
|
|
4108
|
-
pendingPillEl.style.cursor = pendingApplyInFlight ? 'wait' : 'pointer';
|
|
4109
|
-
pendingPillEl.style.filter = pendingApplyInFlight ? 'brightness(0.98)' : 'none';
|
|
4110
|
-
pendingPillEl.style.transform = 'scale(1)';
|
|
4111
|
-
pendingTrashBtn.disabled = pendingApplyInFlight;
|
|
4112
|
-
pendingTrashBtn.style.cursor = pendingApplyInFlight ? 'not-allowed' : 'pointer';
|
|
4113
|
-
pendingTrashBtn.style.opacity = pendingApplyInFlight ? '0.58' : '1';
|
|
4114
|
-
if (pendingApplyInFlight) {
|
|
4115
|
-
if (pendingKeepFixingBtn) pendingKeepFixingBtn.style.display = 'none';
|
|
4116
|
-
if (pendingRollbackBtn) pendingRollbackBtn.style.display = 'none';
|
|
4117
|
-
pendingTrashBtn.style.display = 'inline-flex';
|
|
4118
|
-
}
|
|
4341
|
+
renderPendingDockControls(pendingApplyInFlight ? 'applying' : 'normal', currentCount);
|
|
4119
4342
|
schedulePendingDockPosition();
|
|
4120
4343
|
refreshLiveControlsForManualApply();
|
|
4121
4344
|
}
|
|
@@ -4129,12 +4352,13 @@
|
|
|
4129
4352
|
}
|
|
4130
4353
|
pendingPillLabelEl.textContent = pendingApplyLabel(currentPageCount);
|
|
4131
4354
|
pendingPillCountEl.textContent = String(currentPageCount);
|
|
4132
|
-
pendingPillEl.setAttribute('aria-label', 'Apply ' + currentPageCount + '
|
|
4355
|
+
pendingPillEl.setAttribute('aria-label', 'Apply ' + currentPageCount + ' edit' + (currentPageCount === 1 ? '' : 's') + ' to source');
|
|
4133
4356
|
pendingPillEl.style.display = 'inline-flex';
|
|
4134
4357
|
pendingTrashBtn.style.display = 'inline-flex';
|
|
4135
4358
|
pendingDockEl.style.display = 'inline-flex';
|
|
4136
4359
|
pendingPillEl.dataset.count = String(currentPageCount);
|
|
4137
|
-
if (
|
|
4360
|
+
if (readStoredManualApplyState()?.phase === 'repair-decision') showManualApplyDecision();
|
|
4361
|
+
else if (pendingApplyInFlight || shouldResumeManualApplyLoading(currentPageCount)) setPendingApplyLoading(true, currentPageCount);
|
|
4138
4362
|
schedulePendingDockPosition();
|
|
4139
4363
|
if (previousCount <= 0) playPendingIntroAnimation();
|
|
4140
4364
|
}
|
|
@@ -4142,7 +4366,7 @@
|
|
|
4142
4366
|
function maybeShowFirstSaveToast() {
|
|
4143
4367
|
if (!firstSaveOfSession) return;
|
|
4144
4368
|
firstSaveOfSession = false;
|
|
4145
|
-
showToast('Saved. Click "Apply
|
|
4369
|
+
showToast('Saved. Click "Apply edits" to write changes.', 4500);
|
|
4146
4370
|
}
|
|
4147
4371
|
|
|
4148
4372
|
async function fetchPendingCount() {
|
|
@@ -4161,7 +4385,7 @@
|
|
|
4161
4385
|
async function onPendingPillClick() {
|
|
4162
4386
|
const count = parseInt(pendingPillEl?.dataset.count || '0', 10);
|
|
4163
4387
|
if (count <= 0 || pendingApplyInFlight) return;
|
|
4164
|
-
const ok = confirm('Apply ' + count + '
|
|
4388
|
+
const ok = confirm('Apply ' + count + ' edit' + (count === 1 ? '' : 's') + ' to source?');
|
|
4165
4389
|
if (!ok) return;
|
|
4166
4390
|
let waitForSseCompletion = false;
|
|
4167
4391
|
resetManualApplyProgress(count);
|
|
@@ -4208,7 +4432,7 @@
|
|
|
4208
4432
|
async function onPendingTrashClick() {
|
|
4209
4433
|
const count = parseInt(pendingPillEl?.dataset.count || '0', 10);
|
|
4210
4434
|
if (count <= 0 || pendingApplyInFlight) return;
|
|
4211
|
-
const ok = confirm('Discard ' + count + '
|
|
4435
|
+
const ok = confirm('Discard ' + count + ' edit' + (count === 1 ? '' : 's') + ' on this page?');
|
|
4212
4436
|
if (!ok) return;
|
|
4213
4437
|
try {
|
|
4214
4438
|
const res = await fetch(
|
|
@@ -4220,9 +4444,9 @@
|
|
|
4220
4444
|
const restoreFailures = restoreDiscardedManualEdits(result.entries || []);
|
|
4221
4445
|
updatePendingCounter(0);
|
|
4222
4446
|
if (restoreFailures > 0) {
|
|
4223
|
-
showToast('Discarded ' + count + '
|
|
4447
|
+
showToast('Discarded ' + count + ' edit' + (count === 1 ? '' : 's') + ' - refresh to reset ' + restoreFailures, 4000);
|
|
4224
4448
|
} else {
|
|
4225
|
-
showToast('Discarded ' + count + '
|
|
4449
|
+
showToast('Discarded ' + count + ' edit' + (count === 1 ? '' : 's'), 2500);
|
|
4226
4450
|
}
|
|
4227
4451
|
} catch (err) {
|
|
4228
4452
|
console.error('[impeccable] discard failed:', err);
|
|
@@ -4238,18 +4462,8 @@
|
|
|
4238
4462
|
repairAttempt: numberOrNull(msg?.repair?.attempts) || numberOrNull(msg?.repair?.attempt) || 3,
|
|
4239
4463
|
repairMaxAttempts: numberOrNull(msg?.repair?.maxAttempts) || 3,
|
|
4240
4464
|
});
|
|
4241
|
-
|
|
4242
|
-
if (
|
|
4243
|
-
if (pendingPillCountEl) pendingPillCountEl.style.display = 'none';
|
|
4244
|
-
if (pendingPillEl) {
|
|
4245
|
-
pendingPillEl.disabled = true;
|
|
4246
|
-
pendingPillEl.setAttribute('aria-busy', 'false');
|
|
4247
|
-
pendingPillEl.style.cursor = 'default';
|
|
4248
|
-
pendingPillEl.style.display = 'inline-flex';
|
|
4249
|
-
}
|
|
4250
|
-
if (pendingTrashBtn) pendingTrashBtn.style.display = 'none';
|
|
4251
|
-
if (pendingKeepFixingBtn) pendingKeepFixingBtn.style.display = 'inline-flex';
|
|
4252
|
-
if (pendingRollbackBtn) pendingRollbackBtn.style.display = 'inline-flex';
|
|
4465
|
+
renderPendingDockControls('decision', count);
|
|
4466
|
+
if (pendingPillEl) pendingPillEl.style.display = 'inline-flex';
|
|
4253
4467
|
if (pendingDockEl) pendingDockEl.style.display = 'inline-flex';
|
|
4254
4468
|
schedulePendingDockPosition();
|
|
4255
4469
|
refreshLiveControlsForManualApply();
|
|
@@ -4265,9 +4479,6 @@
|
|
|
4265
4479
|
{ method: 'POST', keepalive: true },
|
|
4266
4480
|
);
|
|
4267
4481
|
if (!res.ok) throw new Error('HTTP ' + res.status);
|
|
4268
|
-
if (pendingKeepFixingBtn) pendingKeepFixingBtn.style.display = 'none';
|
|
4269
|
-
if (pendingRollbackBtn) pendingRollbackBtn.style.display = 'none';
|
|
4270
|
-
if (pendingTrashBtn) pendingTrashBtn.style.display = 'inline-flex';
|
|
4271
4482
|
} catch (err) {
|
|
4272
4483
|
console.error('[impeccable] repair retry failed:', err);
|
|
4273
4484
|
showToast('Repair retry failed - see console', 4000);
|
|
@@ -4289,9 +4500,9 @@
|
|
|
4289
4500
|
);
|
|
4290
4501
|
if (!res.ok) throw new Error('HTTP ' + res.status);
|
|
4291
4502
|
const result = await res.json().catch(() => ({}));
|
|
4292
|
-
|
|
4503
|
+
setPendingApplyLoading(false);
|
|
4293
4504
|
updatePendingCounter(numberOrNull(result.remainingCount) || 0);
|
|
4294
|
-
showToast('Rolled back source;
|
|
4505
|
+
showToast('Rolled back source; edits are still staged.', 3500);
|
|
4295
4506
|
} catch (err) {
|
|
4296
4507
|
console.error('[impeccable] manual Apply rollback failed:', err);
|
|
4297
4508
|
showToast('Rollback failed - see console', 4000);
|
|
@@ -4352,7 +4563,7 @@
|
|
|
4352
4563
|
}
|
|
4353
4564
|
|
|
4354
4565
|
if (msg.type === 'manual_edit_repair_rollback_done') {
|
|
4355
|
-
|
|
4566
|
+
setPendingApplyLoading(false);
|
|
4356
4567
|
fetchPendingCount();
|
|
4357
4568
|
return;
|
|
4358
4569
|
}
|
|
@@ -4396,7 +4607,11 @@
|
|
|
4396
4607
|
function restoreDiscardedManualEdits(entries) {
|
|
4397
4608
|
let failures = 0;
|
|
4398
4609
|
for (const entry of entries || []) {
|
|
4399
|
-
|
|
4610
|
+
// A removal that superseded a copy edit carries it; a discard that
|
|
4611
|
+
// drops both must restore the text as well as the element.
|
|
4612
|
+
const ops = (entry.ops || []).flatMap((op) => (op?.supersededOp ? [op, op.supersededOp] : [op]));
|
|
4613
|
+
for (const op of ops) {
|
|
4614
|
+
if (op?.removeElement === true) { restoreRemovedElement(op); continue; }
|
|
4400
4615
|
if (restoreMixedTextNodeManualEdit(op)) continue;
|
|
4401
4616
|
const el = findManualEditRestoreElement(op);
|
|
4402
4617
|
if (!el || typeof op.originalText !== 'string' || !canRestoreManualEditElement(el, op)) {
|
|
@@ -4537,6 +4752,14 @@
|
|
|
4537
4752
|
'<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">' +
|
|
4538
4753
|
'<path d="M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z"/><path d="m15 5 4 4"/>' +
|
|
4539
4754
|
'</svg>';
|
|
4755
|
+
const REMOVE_ELEMENT_LABEL = 'Remove element';
|
|
4756
|
+
const REMOVE_ELEMENT_ICON =
|
|
4757
|
+
'<svg width="12" height="12" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">' +
|
|
4758
|
+
'<path d="M3 4h8"/><path d="M5 4V3a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v1"/><path d="M4 4l.5 7a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1L10 4"/>' +
|
|
4759
|
+
'</svg>';
|
|
4760
|
+
// Coral chip, ink glyph: the pencil's own recipe in a destructive hue, so
|
|
4761
|
+
// the two badges carry equal weight on light and dark pages.
|
|
4762
|
+
const REMOVE_BADGE_FILL = 'oklch(66% 0.17 30)';
|
|
4540
4763
|
|
|
4541
4764
|
function usesShadowChromeRoot() {
|
|
4542
4765
|
const root = liveUiRoot();
|
|
@@ -4775,40 +4998,49 @@
|
|
|
4775
4998
|
if (mode === 'idle' || mode === 'idle-disabled') {
|
|
4776
4999
|
const disabled = mode === 'idle-disabled';
|
|
4777
5000
|
editBadgeEl.innerHTML = '';
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
|
|
4795
|
-
|
|
4796
|
-
|
|
4797
|
-
|
|
4798
|
-
|
|
4799
|
-
|
|
4800
|
-
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
|
|
4804
|
-
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
|
-
|
|
4808
|
-
|
|
4809
|
-
|
|
5001
|
+
editBadgeEl.style.gap = '4px';
|
|
5002
|
+
const chip = (icon, label, fill, onClick) => {
|
|
5003
|
+
const btn = document.createElement('button');
|
|
5004
|
+
btn.type = 'button';
|
|
5005
|
+
btn.innerHTML = icon;
|
|
5006
|
+
btn.setAttribute('aria-label', label);
|
|
5007
|
+
Object.assign(btn.style, calloutStyle(
|
|
5008
|
+
disabled ? MUTED : PRIMARY_TEXT,
|
|
5009
|
+
disabled ? HAIRLINE : fill,
|
|
5010
|
+
));
|
|
5011
|
+
Object.assign(btn.style, {
|
|
5012
|
+
padding: '4px',
|
|
5013
|
+
minWidth: '22px',
|
|
5014
|
+
width: '22px',
|
|
5015
|
+
height: '22px',
|
|
5016
|
+
minHeight: '22px',
|
|
5017
|
+
display: 'inline-flex',
|
|
5018
|
+
alignItems: 'center',
|
|
5019
|
+
justifyContent: 'center',
|
|
5020
|
+
lineHeight: '0',
|
|
5021
|
+
letterSpacing: '0',
|
|
5022
|
+
background: disabled ? SURFACE : fill,
|
|
5023
|
+
});
|
|
5024
|
+
if (disabled) {
|
|
5025
|
+
btn.style.cursor = 'not-allowed';
|
|
5026
|
+
btn.style.opacity = '0.55';
|
|
5027
|
+
btn.disabled = true;
|
|
5028
|
+
const disabledTip = label + ' is disabled while the current edit is applying';
|
|
5029
|
+
btn.addEventListener('mouseenter', () => showConfigureBarTooltip(btn, disabledTip));
|
|
5030
|
+
btn.addEventListener('mouseleave', hideConfigureBarTooltip);
|
|
5031
|
+
} else {
|
|
5032
|
+
btn.addEventListener('mouseenter', () => showConfigureBarTooltip(btn, label));
|
|
5033
|
+
btn.addEventListener('mouseleave', hideConfigureBarTooltip);
|
|
5034
|
+
btn.onclick = onClick;
|
|
5035
|
+
}
|
|
5036
|
+
return btn;
|
|
5037
|
+
};
|
|
5038
|
+
// The pencil only shows when there is copy to edit; Remove is the last
|
|
5039
|
+
// chip on every selection, the destructive action at the far end.
|
|
5040
|
+
if (selectedElement && hasTextRows(selectedElement)) {
|
|
5041
|
+
editBadgeEl.appendChild(chip(EDIT_COPY_ICON, EDIT_COPY_LABEL, ACCENT, enterEditingMode));
|
|
4810
5042
|
}
|
|
4811
|
-
editBadgeEl.appendChild(
|
|
5043
|
+
editBadgeEl.appendChild(chip(REMOVE_ELEMENT_ICON, REMOVE_ELEMENT_LABEL, REMOVE_BADGE_FILL, removeSelectedElement));
|
|
4812
5044
|
} else {
|
|
4813
5045
|
// 'editing' - show Cancel + Save separated
|
|
4814
5046
|
editBadgeEl.innerHTML = '';
|
|
@@ -4912,7 +5144,7 @@
|
|
|
4912
5144
|
}
|
|
4913
5145
|
|
|
4914
5146
|
// Build/rebuild the panel's contents for the current variant AND apply
|
|
4915
|
-
// its
|
|
5147
|
+
// its values to the variant wrapper (so scoped CSS responds even before
|
|
4916
5148
|
// the user opens the popover). Visibility is governed by tuneOpen.
|
|
4917
5149
|
function refreshParamsPanel() {
|
|
4918
5150
|
if (state !== 'CYCLING') {
|
|
@@ -4923,6 +5155,9 @@
|
|
|
4923
5155
|
}
|
|
4924
5156
|
const variantEl = getVisibleVariantEl();
|
|
4925
5157
|
const params = parseVariantParams(variantEl);
|
|
5158
|
+
// Values kept for this session and variant (restored by a reload, or the
|
|
5159
|
+
// last knob edit) come back; any other variant starts from its defaults.
|
|
5160
|
+
const kept = keptParamValuesForVisibleVariant();
|
|
4926
5161
|
if (!variantEl || params.length === 0) {
|
|
4927
5162
|
paramsCurrentValues = {};
|
|
4928
5163
|
tuneOpen = false;
|
|
@@ -4931,6 +5166,7 @@
|
|
|
4931
5166
|
return;
|
|
4932
5167
|
}
|
|
4933
5168
|
applyParamDefaults(variantEl, params);
|
|
5169
|
+
if (kept) applySavedParamValues(variantEl, params, kept);
|
|
4934
5170
|
buildParamsPanel(variantEl, params);
|
|
4935
5171
|
if (tuneOpen) {
|
|
4936
5172
|
// If already visible (variant cycled while open), refresh in place
|
|
@@ -4988,8 +5224,8 @@
|
|
|
4988
5224
|
const variantEl = getVisibleVariantEl();
|
|
4989
5225
|
const params = parseVariantParams(variantEl);
|
|
4990
5226
|
if (!variantEl || params.length === 0) return;
|
|
4991
|
-
//
|
|
4992
|
-
|
|
5227
|
+
// Rebuild the controls from the current values. Defaults are applied
|
|
5228
|
+
// when the variant is initialized, not when its Tune panel is reopened.
|
|
4993
5229
|
buildParamsPanel(variantEl, params);
|
|
4994
5230
|
tuneOpen = true;
|
|
4995
5231
|
showParamsPanel();
|
|
@@ -6264,8 +6500,8 @@
|
|
|
6264
6500
|
showToast('The previous live session no longer matches the source file, so it was discarded. Pick an element to start fresh.', 6000);
|
|
6265
6501
|
}
|
|
6266
6502
|
|
|
6267
|
-
function
|
|
6268
|
-
return /\.[cm]?[jt]sx$/i.test(String(filePath || ''));
|
|
6503
|
+
function isCompiledTemplateSourceFile(filePath) {
|
|
6504
|
+
return /\.([cm]?[jt]sx|vue|svelte)$/i.test(String(filePath || ''));
|
|
6269
6505
|
}
|
|
6270
6506
|
|
|
6271
6507
|
function sourceHasSessionWrapper(text, sessionId) {
|
|
@@ -6412,15 +6648,15 @@
|
|
|
6412
6648
|
return;
|
|
6413
6649
|
}
|
|
6414
6650
|
rememberSessionFileMeta({ file: filePath });
|
|
6415
|
-
if (
|
|
6651
|
+
if (isCompiledTemplateSourceFile(filePath)) {
|
|
6416
6652
|
const liveWrapper = findVariantsWrapper(sessionId);
|
|
6417
6653
|
if (liveWrapper && liveWrapper.querySelector('[data-impeccable-variant]:not([data-impeccable-variant="original"])')) {
|
|
6418
6654
|
completeSourceInjection(liveWrapper, sessionId, { ...opts, filePath });
|
|
6419
6655
|
return;
|
|
6420
6656
|
}
|
|
6421
|
-
// #454: never fetch/parse JSX. Missing wrap waits for
|
|
6422
|
-
// modal / other route). Insert scaffolds stay for late HMR.
|
|
6423
|
-
// scaffold with no variants after retries is a failed generation.
|
|
6657
|
+
// #454, #1279, #1282: never fetch/parse JSX, Vue or Svelte. Missing wrap waits for
|
|
6658
|
+
// mount (closed modal / other route). Insert scaffolds stay for late HMR.
|
|
6659
|
+
// A replace scaffold with no variants after retries is a failed generation.
|
|
6424
6660
|
if (opts.generationCompleted && sessionId === currentSessionId) {
|
|
6425
6661
|
const attempt = opts.attempt || 0;
|
|
6426
6662
|
if (attempt < COMPLETED_SOURCE_FALLBACK_RETRIES) {
|
|
@@ -7964,8 +8200,11 @@
|
|
|
7964
8200
|
return;
|
|
7965
8201
|
}
|
|
7966
8202
|
if (state !== 'PICKING' || !pickActive) return;
|
|
7967
|
-
|
|
7968
|
-
if (
|
|
8203
|
+
let target = document.elementFromPoint(e.clientX, e.clientY);
|
|
8204
|
+
if (own(target)) return;
|
|
8205
|
+
// Too small to pick (a bare <label>, an icon): take the nearest ancestor that is (#1297).
|
|
8206
|
+
while (target && !pickable(target)) target = target.parentElement;
|
|
8207
|
+
if (!target || target === hoveredElement) return;
|
|
7969
8208
|
hoveredElement = target;
|
|
7970
8209
|
showHighlight(target);
|
|
7971
8210
|
}
|
|
@@ -8039,7 +8278,7 @@
|
|
|
8039
8278
|
clearAnnotations();
|
|
8040
8279
|
showAnnotOverlay(selectedElement);
|
|
8041
8280
|
showBar('configure');
|
|
8042
|
-
renderEditBadge(
|
|
8281
|
+
renderEditBadge('idle');
|
|
8043
8282
|
startScrollTracking();
|
|
8044
8283
|
maybePrefetchPage();
|
|
8045
8284
|
maybeWarnConditionalAncestor(selectedElement);
|
|
@@ -8119,9 +8358,17 @@
|
|
|
8119
8358
|
sendEvent({ type: 'prefetch', pageUrl: path });
|
|
8120
8359
|
}
|
|
8121
8360
|
|
|
8361
|
+
// Delete or Backspace with no modifier, the keyboard's way to the Remove
|
|
8362
|
+
// badge. It only acts on an empty prompt, so clearing typed text never
|
|
8363
|
+
// takes the element with it.
|
|
8364
|
+
function isRemoveKey(e) {
|
|
8365
|
+
return (e.key === 'Delete' || e.key === 'Backspace')
|
|
8366
|
+
&& !e.metaKey && !e.ctrlKey && !e.altKey && !e.shiftKey && !isImeKeydown(e);
|
|
8367
|
+
}
|
|
8368
|
+
|
|
8122
8369
|
function shouldPassthroughElementNav(deepActive, e) {
|
|
8123
8370
|
if (!deepActive || !own(deepActive)) return false;
|
|
8124
|
-
if (e.key !== 'ArrowUp' && e.key !== 'ArrowDown') return false;
|
|
8371
|
+
if (e.key !== 'ArrowUp' && e.key !== 'ArrowDown' && !isRemoveKey(e)) return false;
|
|
8125
8372
|
if (!/^(INPUT|TEXTAREA)$/.test(deepActive.tagName || '')) return false;
|
|
8126
8373
|
if (deepActive.value) return false;
|
|
8127
8374
|
if (deepActive.id === PREFIX + '-input' && state === 'CONFIGURING') return true;
|
|
@@ -8192,6 +8439,13 @@
|
|
|
8192
8439
|
}
|
|
8193
8440
|
}
|
|
8194
8441
|
|
|
8442
|
+
if (isRemoveKey(e) && state === 'CONFIGURING' && selectedElement && configureKind !== 'insert') {
|
|
8443
|
+
e.preventDefault();
|
|
8444
|
+
e.stopPropagation();
|
|
8445
|
+
removeSelectedElement();
|
|
8446
|
+
return;
|
|
8447
|
+
}
|
|
8448
|
+
|
|
8195
8449
|
// Arrow/Enter nav works in PICKING (hover) and CONFIGURING (selected, input empty)
|
|
8196
8450
|
var navEl = (state === 'PICKING') ? hoveredElement : (state === 'CONFIGURING') ? selectedElement : null;
|
|
8197
8451
|
if (navEl && (e.key === 'ArrowUp' || e.key === 'ArrowDown' || (e.key === 'Enter' && state === 'PICKING'))) {
|
|
@@ -8216,7 +8470,7 @@
|
|
|
8216
8470
|
clearAnnotations();
|
|
8217
8471
|
showAnnotOverlay(selectedElement);
|
|
8218
8472
|
showBar('configure');
|
|
8219
|
-
renderEditBadge(
|
|
8473
|
+
renderEditBadge('idle');
|
|
8220
8474
|
startScrollTracking();
|
|
8221
8475
|
return;
|
|
8222
8476
|
}
|
|
@@ -8231,7 +8485,7 @@
|
|
|
8231
8485
|
showAnnotOverlay(next);
|
|
8232
8486
|
showBar('configure');
|
|
8233
8487
|
disableInlineEdit();
|
|
8234
|
-
renderEditBadge(
|
|
8488
|
+
renderEditBadge('idle');
|
|
8235
8489
|
startScrollTracking();
|
|
8236
8490
|
}
|
|
8237
8491
|
showHighlight(next);
|
|
@@ -8460,6 +8714,12 @@
|
|
|
8460
8714
|
}
|
|
8461
8715
|
return btoa(binary);
|
|
8462
8716
|
}
|
|
8717
|
+
// CSSOM keeps url() as written, and a relative source can't load inside the rasterized SVG.
|
|
8718
|
+
function absolutizeUrls(cssText, base) {
|
|
8719
|
+
return cssText.replace(/url\((?:(['"])([^'"]*)\1|([^'")\s]+))\)/g, (orig, q = '', quoted, bare) => {
|
|
8720
|
+
try { return 'url(' + q + new URL(quoted ?? bare, base).href + q + ')'; } catch { return orig; }
|
|
8721
|
+
});
|
|
8722
|
+
}
|
|
8463
8723
|
async function inlineFontUrls(cssText) {
|
|
8464
8724
|
const urlRe = /url\((['"]?)(https?:\/\/[^'")\s]+)\1\)/g;
|
|
8465
8725
|
const urls = new Set();
|
|
@@ -8491,7 +8751,7 @@
|
|
|
8491
8751
|
const rules = sheet.cssRules;
|
|
8492
8752
|
for (const rule of rules) {
|
|
8493
8753
|
if (rule.constructor.name === 'CSSFontFaceRule' || rule.cssText?.startsWith('@font-face')) {
|
|
8494
|
-
chunks.push(rule.cssText);
|
|
8754
|
+
chunks.push(absolutizeUrls(rule.cssText, sheet.href || document.baseURI));
|
|
8495
8755
|
}
|
|
8496
8756
|
}
|
|
8497
8757
|
} catch {
|
|
@@ -8501,7 +8761,7 @@
|
|
|
8501
8761
|
if (!res.ok) continue;
|
|
8502
8762
|
const text = await res.text();
|
|
8503
8763
|
let m2;
|
|
8504
|
-
while ((m2 = fontFaceRe.exec(text))) chunks.push(m2[0]);
|
|
8764
|
+
while ((m2 = fontFaceRe.exec(text))) chunks.push(absolutizeUrls(m2[0], sheet.href));
|
|
8505
8765
|
} catch { /* ignore; capture is best-effort */ }
|
|
8506
8766
|
}
|
|
8507
8767
|
}
|
|
@@ -9517,6 +9777,7 @@ void main() {
|
|
|
9517
9777
|
if (saved.previewMode) currentPreviewMode = saved.previewMode;
|
|
9518
9778
|
if (saved.paramValues && typeof saved.paramValues === 'object') {
|
|
9519
9779
|
paramsCurrentValues = { ...saved.paramValues };
|
|
9780
|
+
rememberSavedParamValues(saved);
|
|
9520
9781
|
}
|
|
9521
9782
|
if (saved.parameterState) parameterGenerationState = saved.parameterState;
|
|
9522
9783
|
sessionOrigin = saved.origin === 'agent' ? 'agent' : null;
|
|
@@ -9869,8 +10130,9 @@ void main() {
|
|
|
9869
10130
|
toastEl = null;
|
|
9870
10131
|
}
|
|
9871
10132
|
|
|
9872
|
-
function showToast(message, duration) {
|
|
10133
|
+
function showToast(message, duration, opts) {
|
|
9873
10134
|
dismissToast();
|
|
10135
|
+
const action = opts && opts.action;
|
|
9874
10136
|
// Stack the toast above the global bar (which sits at bottom:14px) so
|
|
9875
10137
|
// the two never overlap. Read the bar's actual rect - its height varies
|
|
9876
10138
|
// with hover-expanded labels - and fall back to a sensible default
|
|
@@ -9887,11 +10149,33 @@ void main() {
|
|
|
9887
10149
|
padding: '8px 16px', borderRadius: '8px',
|
|
9888
10150
|
zIndex: Z.toast, opacity: '0',
|
|
9889
10151
|
transition: 'opacity 0.25s ' + EASE + ', transform 0.25s ' + EASE,
|
|
9890
|
-
pointerEvents: 'none', maxWidth: '420px', textAlign: 'center',
|
|
10152
|
+
pointerEvents: action ? 'auto' : 'none', maxWidth: '420px', textAlign: 'center',
|
|
9891
10153
|
});
|
|
9892
10154
|
toastEl = currentToast;
|
|
9893
10155
|
currentToast.id = PREFIX + '-toast';
|
|
9894
|
-
|
|
10156
|
+
if (action) {
|
|
10157
|
+
Object.assign(currentToast.style, {
|
|
10158
|
+
display: 'inline-flex', alignItems: 'center', gap: '12px', padding: '6px 6px 6px 16px',
|
|
10159
|
+
});
|
|
10160
|
+
const label = el('span', { whiteSpace: 'nowrap' });
|
|
10161
|
+
label.textContent = message;
|
|
10162
|
+
const btn = el('button', {
|
|
10163
|
+
fontFamily: FONT, fontSize: '12px', fontWeight: '600', lineHeight: '1',
|
|
10164
|
+
color: C.ink, background: C.brand, border: 'none', borderRadius: '999px',
|
|
10165
|
+
padding: '6px 11px', cursor: 'pointer', whiteSpace: 'nowrap',
|
|
10166
|
+
});
|
|
10167
|
+
btn.type = 'button';
|
|
10168
|
+
btn.textContent = action.label;
|
|
10169
|
+
btn.addEventListener('click', (e) => {
|
|
10170
|
+
e.preventDefault();
|
|
10171
|
+
e.stopPropagation();
|
|
10172
|
+
if (toastEl === currentToast) dismissToast();
|
|
10173
|
+
action.onClick();
|
|
10174
|
+
});
|
|
10175
|
+
currentToast.append(label, btn);
|
|
10176
|
+
} else {
|
|
10177
|
+
currentToast.textContent = message;
|
|
10178
|
+
}
|
|
9895
10179
|
uiAppend(currentToast);
|
|
9896
10180
|
requestAnimationFrame(() => {
|
|
9897
10181
|
if (toastEl !== currentToast) return;
|
|
@@ -10148,10 +10432,9 @@ void main() {
|
|
|
10148
10432
|
hideShaderOverlay();
|
|
10149
10433
|
if (isInsert) finalizeInsertSession();
|
|
10150
10434
|
disableInlineEdit();
|
|
10151
|
-
// Build the params panel for the restored visible variant
|
|
10152
|
-
//
|
|
10153
|
-
//
|
|
10154
|
-
// hid. Now that state is CYCLING, re-fire.
|
|
10435
|
+
// Build the params panel for the restored visible variant, with any
|
|
10436
|
+
// Tune values saved before the reload (showVariantInDOM above may
|
|
10437
|
+
// already have refreshed; a repeat for the same variant keeps them).
|
|
10155
10438
|
refreshParamsPanel();
|
|
10156
10439
|
}
|
|
10157
10440
|
saveSession();
|
|
@@ -10592,6 +10875,11 @@ void main() {
|
|
|
10592
10875
|
return true;
|
|
10593
10876
|
}
|
|
10594
10877
|
|
|
10878
|
+
// Programmatic focus raises the soft keyboard on touch devices (#1067).
|
|
10879
|
+
function touchPrimary() {
|
|
10880
|
+
return !!window.matchMedia?.('(pointer: coarse)').matches;
|
|
10881
|
+
}
|
|
10882
|
+
|
|
10595
10883
|
function shouldSteerAutoFocus() {
|
|
10596
10884
|
return shouldFocusSteerChat()
|
|
10597
10885
|
&& !steerFocusSuspended
|
|
@@ -10800,6 +11088,7 @@ void main() {
|
|
|
10800
11088
|
|
|
10801
11089
|
function syncPageChatFocus(reason) {
|
|
10802
11090
|
steerFocusLog('syncPageChatFocus', { reason });
|
|
11091
|
+
if (touchPrimary()) return;
|
|
10803
11092
|
if (state === 'CONFIGURING') focusConfigureInput(reason);
|
|
10804
11093
|
else if (shouldSteerAutoFocus()) focusSteerChat(reason);
|
|
10805
11094
|
}
|
|
@@ -10987,7 +11276,8 @@ void main() {
|
|
|
10987
11276
|
file: opts?.file || '',
|
|
10988
11277
|
});
|
|
10989
11278
|
}
|
|
10990
|
-
if (keepExpanded)
|
|
11279
|
+
if (keepExpanded && touchPrimary()) preparePageChatInputForTyping();
|
|
11280
|
+
else if (keepExpanded) focusPageChatInput('steer-error-restore');
|
|
10991
11281
|
else syncPageChatFocus('steer-unlock');
|
|
10992
11282
|
}
|
|
10993
11283
|
|
|
@@ -11844,7 +12134,7 @@ void main() {
|
|
|
11844
12134
|
boxShadow: '0 4px 16px oklch(0% 0 0 / 0.16), 0 1px 3px oklch(0% 0 0 / 0.1)',
|
|
11845
12135
|
transition: 'filter 0.12s ease, transform 0.1s ease, box-shadow 0.18s ease',
|
|
11846
12136
|
});
|
|
11847
|
-
pendingPillEl.title = 'Apply
|
|
12137
|
+
pendingPillEl.title = 'Apply edits to source';
|
|
11848
12138
|
pendingPillSpinnerEl = el('span', {
|
|
11849
12139
|
display: 'none',
|
|
11850
12140
|
width: '12px',
|
|
@@ -11859,7 +12149,7 @@ void main() {
|
|
|
11859
12149
|
boxSizing: 'border-box',
|
|
11860
12150
|
});
|
|
11861
12151
|
pendingPillLabelEl = el('span', { lineHeight: '1', whiteSpace: 'nowrap' });
|
|
11862
|
-
pendingPillLabelEl.textContent = 'Apply
|
|
12152
|
+
pendingPillLabelEl.textContent = 'Apply edits';
|
|
11863
12153
|
pendingPillCountEl = el('span', {
|
|
11864
12154
|
display: 'inline-flex',
|
|
11865
12155
|
alignItems: 'center',
|
|
@@ -11929,10 +12219,10 @@ void main() {
|
|
|
11929
12219
|
textAlign: 'center',
|
|
11930
12220
|
transition: 'opacity 0.16s ease, transform 0.18s ' + EASE,
|
|
11931
12221
|
});
|
|
11932
|
-
pendingTrashTooltipEl.textContent = 'Discard
|
|
12222
|
+
pendingTrashTooltipEl.textContent = 'Discard edits';
|
|
11933
12223
|
pendingTrashTooltipEl.setAttribute('role', 'tooltip');
|
|
11934
12224
|
pendingTrashBtn.appendChild(pendingTrashTooltipEl);
|
|
11935
|
-
pendingTrashBtn.setAttribute('aria-label', 'Discard
|
|
12225
|
+
pendingTrashBtn.setAttribute('aria-label', 'Discard edits on this page');
|
|
11936
12226
|
const showTrashTooltip = () => {
|
|
11937
12227
|
pendingTrashBtn.style.color = P.accent;
|
|
11938
12228
|
pendingTrashBtn.style.boxShadow = '0 7px 22px oklch(0% 0 0 / 0.16), 0 2px 5px oklch(0% 0 0 / 0.1)';
|
|
@@ -11978,7 +12268,7 @@ void main() {
|
|
|
11978
12268
|
pendingKeepFixingBtn.setAttribute('aria-label', 'Ask the agent to keep fixing Apply errors');
|
|
11979
12269
|
pendingKeepFixingBtn.addEventListener('click', onPendingKeepFixingClick);
|
|
11980
12270
|
pendingRollbackBtn = makePendingDecisionBtn('Rollback', false);
|
|
11981
|
-
pendingRollbackBtn.setAttribute('aria-label', 'Rollback source and keep
|
|
12271
|
+
pendingRollbackBtn.setAttribute('aria-label', 'Rollback source and keep edits staged');
|
|
11982
12272
|
pendingRollbackBtn.addEventListener('click', onPendingRollbackClick);
|
|
11983
12273
|
|
|
11984
12274
|
pendingDockEl.appendChild(pendingPillEl);
|
|
@@ -13453,7 +13743,9 @@ void main() {
|
|
|
13453
13743
|
// Code spans
|
|
13454
13744
|
s = s.replace(/`([^`]+)`/g, (_, code) => `<code>${code}</code>`);
|
|
13455
13745
|
// Links [text](url)
|
|
13456
|
-
s = s.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, t, u) =>
|
|
13746
|
+
s = s.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, t, u) => (
|
|
13747
|
+
isSafeHref(u) ? `<a href="${u}" target="_blank" rel="noopener noreferrer">${t}</a>` : t
|
|
13748
|
+
));
|
|
13457
13749
|
// Bold
|
|
13458
13750
|
s = s.replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>');
|
|
13459
13751
|
// Italic (only single *…*, skip if inside bold already handled)
|
|
@@ -13461,6 +13753,14 @@ void main() {
|
|
|
13461
13753
|
return s;
|
|
13462
13754
|
}
|
|
13463
13755
|
|
|
13756
|
+
function isSafeHref(url) {
|
|
13757
|
+
// Browsers drop ASCII whitespace and C0 controls inside a scheme, so
|
|
13758
|
+
// "java\tscript:" still runs; strip them before reading the scheme.
|
|
13759
|
+
const probe = String(url).replace(/[\u0000-\u0020\u007f]/g, '');
|
|
13760
|
+
const scheme = probe.match(/^([a-z][a-z0-9+.-]*):/i);
|
|
13761
|
+
return !scheme || ['http', 'https', 'mailto'].includes(scheme[1].toLowerCase());
|
|
13762
|
+
}
|
|
13763
|
+
|
|
13464
13764
|
function highlightBold(text) {
|
|
13465
13765
|
return inlineMd(text);
|
|
13466
13766
|
}
|