oh-my-opencode 4.10.0 → 4.11.0
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/.agents/skills/codex-qa/SKILL.md +96 -0
- package/.agents/skills/codex-qa/references/app-server.md +63 -0
- package/.agents/skills/codex-qa/references/components-hooks.md +38 -0
- package/.agents/skills/codex-qa/references/docker-qa.md +62 -0
- package/.agents/skills/codex-qa/references/install-verify.md +57 -0
- package/.agents/skills/codex-qa/references/isolation.md +57 -0
- package/.agents/skills/codex-qa/references/logging-debug.md +60 -0
- package/.agents/skills/codex-qa/scripts/app-server-drive.sh +76 -0
- package/.agents/skills/codex-qa/scripts/hook-unit-probe.sh +69 -0
- package/.agents/skills/codex-qa/scripts/install-verify.sh +60 -0
- package/.agents/skills/codex-qa/scripts/lib/app-server-client.mjs +117 -0
- package/.agents/skills/codex-qa/scripts/lib/common.sh +180 -0
- package/.agents/skills/codex-qa/scripts/lib/mock-model.mjs +56 -0
- package/.agents/skills/codex-qa/scripts/tui-smoke.sh +71 -0
- package/.agents/skills/opencode-qa/SKILL.md +8 -1
- package/.agents/skills/opencode-qa/references/docker-qa.md +72 -0
- package/.agents/skills/tech-debt-audit/SKILL.md +14 -14
- package/.agents/skills/work-with-pr/SKILL.md +77 -53
- package/.opencode/skills/work-with-pr/SKILL.md +79 -55
- package/README.ja.md +3 -3
- package/README.ko.md +3 -3
- package/README.md +2 -2
- package/README.ru.md +3 -3
- package/README.zh-cn.md +3 -3
- package/THIRD-PARTY-NOTICES.md +205 -0
- package/dist/agents/dynamic-agent-prompt-types.d.ts +1 -1
- package/dist/agents/index.d.ts +0 -1
- package/dist/agents/prometheus/index.d.ts +0 -1
- package/dist/agents/prometheus/system-prompt.d.ts +0 -2
- package/dist/cli/config-manager/add-tui-plugin-to-tui-config.d.ts +7 -0
- package/dist/cli/doctor/checks/codex-components.d.ts +4 -4
- package/dist/cli/doctor/checks/codex-runtime-wrapper.d.ts +7 -0
- package/dist/cli/doctor/checks/codex.d.ts +1 -1
- package/dist/cli/doctor/checks/config.d.ts +1 -1
- package/dist/cli/doctor/checks/dependencies.d.ts +1 -2
- package/dist/cli/doctor/checks/index.d.ts +1 -1
- package/dist/cli/doctor/checks/model-resolution.d.ts +1 -1
- package/dist/cli/doctor/checks/system.d.ts +1 -1
- package/dist/cli/doctor/checks/team-mode.d.ts +1 -1
- package/dist/cli/doctor/checks/tools-gh.d.ts +1 -1
- package/dist/cli/doctor/checks/tools-mcp.d.ts +1 -1
- package/dist/cli/doctor/checks/tools.d.ts +2 -1
- package/dist/cli/doctor/checks/tui-plugin-config.d.ts +7 -1
- package/dist/cli/doctor/framework/constants.d.ts +32 -0
- package/dist/cli/doctor/framework/spawn-with-timeout.d.ts +8 -0
- package/dist/cli/doctor/framework/types.d.ts +147 -0
- package/dist/cli/doctor/index.d.ts +4 -4
- package/dist/cli/doctor/runner.d.ts +1 -1
- package/dist/cli/index.js +9717 -7523
- package/dist/cli/install-ast-grep-sg.d.ts +10 -0
- package/dist/cli/install-codex/codex-cache-bins.d.ts +1 -21
- package/dist/cli/install-codex/codex-cache-bundled-mcps.d.ts +1 -5
- package/dist/cli/install-codex/codex-cache-command-shim.d.ts +1 -1
- package/dist/cli/install-codex/codex-cache-fs.d.ts +1 -3
- package/dist/cli/install-codex/codex-cache-install.d.ts +1 -13
- package/dist/cli/install-codex/codex-cache-legacy-bins.d.ts +1 -3
- package/dist/cli/install-codex/codex-cache-local-dependencies.d.ts +1 -1
- package/dist/cli/install-codex/codex-cache-mcp-manifest.d.ts +1 -2
- package/dist/cli/install-codex/codex-cache-paths.d.ts +1 -2
- package/dist/cli/install-codex/codex-cache-prune.d.ts +1 -10
- package/dist/cli/install-codex/codex-cache.d.ts +1 -4
- package/dist/cli/install-codex/codex-cached-marketplace-manifest.d.ts +1 -6
- package/dist/cli/install-codex/codex-cleanup-config.d.ts +1 -6
- package/dist/cli/install-codex/codex-cleanup.d.ts +1 -25
- package/dist/cli/install-codex/codex-config-agents.d.ts +1 -3
- package/dist/cli/install-codex/codex-config-features.d.ts +1 -1
- package/dist/cli/install-codex/codex-config-marketplaces.d.ts +1 -6
- package/dist/cli/install-codex/codex-config-permissions.d.ts +1 -1
- package/dist/cli/install-codex/codex-config-plugins.d.ts +1 -9
- package/dist/cli/install-codex/codex-config-reasoning.d.ts +1 -2
- package/dist/cli/install-codex/codex-config-toml-sections.d.ts +1 -9
- package/dist/cli/install-codex/codex-config-toml.d.ts +1 -13
- package/dist/cli/install-codex/codex-hook-trust.d.ts +1 -6
- package/dist/cli/install-codex/codex-installation-detection.d.ts +1 -36
- package/dist/cli/install-codex/codex-installer-bin-dir.d.ts +1 -8
- package/dist/cli/install-codex/codex-marketplace-snapshot.d.ts +1 -15
- package/dist/cli/install-codex/codex-marketplace.d.ts +1 -9
- package/dist/cli/install-codex/codex-model-catalog.d.ts +1 -13
- package/dist/cli/install-codex/codex-multi-agent-v2-config.d.ts +1 -12
- package/dist/cli/install-codex/codex-package-layout.d.ts +1 -1
- package/dist/cli/install-codex/codex-process.d.ts +1 -7
- package/dist/cli/install-codex/codex-project-local-cleanup-best-effort.d.ts +1 -7
- package/dist/cli/install-codex/codex-project-local-cleanup.d.ts +1 -35
- package/dist/cli/install-codex/git-bash.d.ts +1 -35
- package/dist/cli/install-codex/index.d.ts +1 -11
- package/dist/cli/install-codex/install-codex.d.ts +1 -10
- package/dist/cli/install-codex/lazycodex-version-stamp.d.ts +1 -19
- package/dist/cli/install-codex/link-cached-plugin-agents.d.ts +1 -20
- package/dist/cli/install-codex/lsp-daemon-reaper.d.ts +1 -5
- package/dist/cli/install-codex/toml-section-editor.d.ts +1 -11
- package/dist/cli/install-codex/types.d.ts +1 -76
- package/dist/cli/mcp-oauth/login.d.ts +1 -1
- package/dist/cli-node/index.js +9774 -7525
- package/dist/config/index.d.ts +1 -1
- package/dist/config/schema/agent-names.d.ts +1 -1
- package/dist/config/schema/codegraph.d.ts +9 -0
- package/dist/config/schema/git-env-prefix.d.ts +1 -5
- package/dist/config/schema/hooks.d.ts +3 -0
- package/dist/config/schema/monitor.d.ts +15 -0
- package/dist/config/schema/oh-my-opencode-config.d.ts +27 -16
- package/dist/config/schema/openclaw.d.ts +5 -4
- package/dist/config/schema/team-mode.d.ts +1 -16
- package/dist/config/schema/tmux.d.ts +4 -5
- package/dist/config/schema/tui.d.ts +10 -0
- package/dist/config/schema.d.ts +2 -0
- package/dist/config/validate.d.ts +8 -0
- package/dist/create-hooks.d.ts +5 -0
- package/dist/create-managers.d.ts +7 -0
- package/dist/create-runtime-tmux-config.d.ts +1 -1
- package/dist/create-tools.d.ts +1 -1
- package/dist/features/background-agent/error-classifier.d.ts +2 -2
- package/dist/features/background-agent/manager.d.ts +29 -2
- package/dist/features/background-agent/parent-wake-dispatched-tracker.d.ts +8 -0
- package/dist/features/background-agent/parent-wake-notifier.d.ts +4 -0
- package/dist/features/background-agent/spawner/fallback-agent.d.ts +3 -2
- package/dist/features/background-agent/spawner/task-prompt-body.d.ts +5 -6
- package/dist/features/background-agent/task-snapshot.d.ts +2 -0
- package/dist/features/background-agent/types.d.ts +7 -0
- package/dist/features/builtin-commands/templates/refactor-sections/intro-and-analysis.d.ts +1 -1
- package/dist/features/builtin-commands/templates/refactor-sections/plan-and-execution.d.ts +1 -1
- package/dist/features/builtin-commands/templates/refactor-sections/team-mode-addendum.d.ts +1 -1
- package/dist/features/builtin-commands/templates/refactor-sections/verification-and-tooling.d.ts +1 -1
- package/dist/features/builtin-commands/templates/remove-ai-slops.d.ts +1 -1
- package/dist/features/builtin-skills/index.d.ts +1 -2
- package/dist/features/builtin-skills/skill-file-loader.d.ts +1 -4
- package/dist/features/builtin-skills/skills/agent-browser-skill.d.ts +1 -2
- package/dist/features/builtin-skills/skills/agent-browser-template.d.ts +1 -2
- package/dist/features/builtin-skills/skills/debugging.d.ts +1 -2
- package/dist/features/builtin-skills/skills/dev-browser.d.ts +1 -2
- package/dist/features/builtin-skills/skills/frontend.d.ts +1 -0
- package/dist/features/builtin-skills/skills/git-master-sections/commit-atomic-planning.d.ts +1 -1
- package/dist/features/builtin-skills/skills/git-master-sections/commit-context-analysis.d.ts +1 -1
- package/dist/features/builtin-skills/skills/git-master-sections/commit-execution-verification.d.ts +1 -1
- package/dist/features/builtin-skills/skills/git-master-sections/commit-workflow.d.ts +1 -1
- package/dist/features/builtin-skills/skills/git-master-sections/history-search-workflow.d.ts +1 -1
- package/dist/features/builtin-skills/skills/git-master-sections/overview.d.ts +1 -1
- package/dist/features/builtin-skills/skills/git-master-sections/quick-reference.d.ts +1 -1
- package/dist/features/builtin-skills/skills/git-master-sections/rebase-workflow.d.ts +1 -1
- package/dist/features/builtin-skills/skills/git-master-skill-metadata.d.ts +1 -2
- package/dist/features/builtin-skills/skills/git-master.d.ts +1 -2
- package/dist/features/builtin-skills/skills/index.d.ts +1 -13
- package/dist/features/builtin-skills/skills/init-deep.d.ts +1 -2
- package/dist/features/builtin-skills/skills/playwright-cli.d.ts +1 -10
- package/dist/features/builtin-skills/skills/playwright-mcp-skill.d.ts +1 -2
- package/dist/features/builtin-skills/skills/playwright.d.ts +1 -2
- package/dist/features/builtin-skills/skills/remove-ai-slops.d.ts +1 -2
- package/dist/features/builtin-skills/skills/review-work.d.ts +1 -2
- package/dist/features/builtin-skills/skills/security-research.d.ts +1 -2
- package/dist/features/builtin-skills/skills/security-review.d.ts +1 -2
- package/dist/features/builtin-skills/skills/team-mode.d.ts +1 -2
- package/dist/features/builtin-skills/skills/visual-qa.d.ts +1 -2
- package/dist/features/builtin-skills/skills.d.ts +1 -12
- package/dist/features/builtin-skills/types.d.ts +1 -15
- package/dist/features/claude-code-agent-loader/agent-definitions-loader.d.ts +1 -3
- package/dist/features/claude-code-agent-loader/claude-model-mapper.d.ts +1 -4
- package/dist/features/claude-code-agent-loader/index.d.ts +1 -5
- package/dist/features/claude-code-agent-loader/json-agent-loader.d.ts +1 -2
- package/dist/features/claude-code-agent-loader/loader.d.ts +1 -5
- package/dist/features/claude-code-agent-loader/opencode-config-agents-reader.d.ts +1 -2
- package/dist/features/claude-code-agent-loader/types.d.ts +1 -29
- package/dist/features/claude-code-command-loader/index.d.ts +1 -2
- package/dist/features/claude-code-command-loader/loader-cache.d.ts +1 -6
- package/dist/features/claude-code-command-loader/loader.d.ts +1 -8
- package/dist/features/claude-code-command-loader/types.d.ts +1 -42
- package/dist/features/claude-code-mcp-loader/configure-allowed-env-vars.d.ts +1 -5
- package/dist/features/claude-code-mcp-loader/index.d.ts +1 -11
- package/dist/features/claude-code-mcp-loader/loader.d.ts +1 -4
- package/dist/features/claude-code-mcp-loader/scope-filter.d.ts +1 -2
- package/dist/features/claude-code-mcp-loader/transformer.d.ts +1 -2
- package/dist/features/claude-code-mcp-loader/types.d.ts +1 -43
- package/dist/features/claude-code-plugin-loader/agent-loader.d.ts +1 -3
- package/dist/features/claude-code-plugin-loader/command-loader.d.ts +1 -3
- package/dist/features/claude-code-plugin-loader/discovery-core.d.ts +1 -2
- package/dist/features/claude-code-plugin-loader/discovery-paths.d.ts +1 -3
- package/dist/features/claude-code-plugin-loader/discovery.d.ts +1 -3
- package/dist/features/claude-code-plugin-loader/hook-loader.d.ts +1 -2
- package/dist/features/claude-code-plugin-loader/index.d.ts +1 -10
- package/dist/features/claude-code-plugin-loader/install-path-resolver.d.ts +1 -1
- package/dist/features/claude-code-plugin-loader/installed-plugin-database.d.ts +1 -3
- package/dist/features/claude-code-plugin-loader/loaded-plugin.d.ts +1 -2
- package/dist/features/claude-code-plugin-loader/loader.d.ts +1 -36
- package/dist/features/claude-code-plugin-loader/mcp-server-loader.d.ts +1 -3
- package/dist/features/claude-code-plugin-loader/plugin-key.d.ts +1 -1
- package/dist/features/claude-code-plugin-loader/plugin-manifest.d.ts +1 -4
- package/dist/features/claude-code-plugin-loader/plugin-path-resolver.d.ts +1 -2
- package/dist/features/claude-code-plugin-loader/plugin-settings.d.ts +1 -3
- package/dist/features/claude-code-plugin-loader/scope-filter.d.ts +1 -2
- package/dist/features/claude-code-plugin-loader/skill-loader.d.ts +1 -3
- package/dist/features/claude-code-plugin-loader/types.d.ts +1 -240
- package/dist/features/claude-tasks/types.d.ts +4 -4
- package/dist/features/hook-message-injector/sdk-message-lookup.d.ts +9 -2
- package/dist/features/mcp-oauth/callback-server.d.ts +1 -19
- package/dist/features/mcp-oauth/dcr.d.ts +1 -34
- package/dist/features/mcp-oauth/discovery.d.ts +1 -8
- package/dist/features/mcp-oauth/oauth-authorization-flow.d.ts +1 -26
- package/dist/features/mcp-oauth/provider.d.ts +1 -30
- package/dist/features/mcp-oauth/refresh-mutex.d.ts +1 -26
- package/dist/features/mcp-oauth/resource-indicator.d.ts +1 -0
- package/dist/features/mcp-oauth/schema.d.ts +1 -0
- package/dist/features/mcp-oauth/step-up.d.ts +1 -8
- package/dist/features/mcp-oauth/storage.d.ts +1 -17
- package/dist/features/monitor/batcher.d.ts +36 -0
- package/dist/features/monitor/envelope.d.ts +9 -0
- package/dist/features/monitor/filter.d.ts +10 -0
- package/dist/features/monitor/index.d.ts +2 -0
- package/dist/features/monitor/line-stream.d.ts +29 -0
- package/dist/features/monitor/manager-internals.d.ts +65 -0
- package/dist/features/monitor/manager.d.ts +35 -0
- package/dist/features/monitor/monitor-state-factory.d.ts +24 -0
- package/dist/features/monitor/output-injector-session-inspect.d.ts +9 -0
- package/dist/features/monitor/output-injector-types.d.ts +48 -0
- package/dist/features/monitor/output-injector.d.ts +21 -0
- package/dist/features/monitor/permission.d.ts +33 -0
- package/dist/features/monitor/pipeline.d.ts +26 -0
- package/dist/features/monitor/process.d.ts +21 -0
- package/dist/features/monitor/ring-buffer.d.ts +25 -0
- package/dist/features/monitor/types.d.ts +83 -0
- package/dist/features/opencode-runtime-skills/index.d.ts +1 -2
- package/dist/features/opencode-runtime-skills/runtime-skill-config.d.ts +1 -17
- package/dist/features/opencode-runtime-skills/skill-markdown.d.ts +1 -7
- package/dist/features/opencode-runtime-skills/source-server.d.ts +1 -24
- package/dist/features/opencode-skill-loader/allowed-tools-parser.d.ts +1 -1
- package/dist/features/opencode-skill-loader/config-source-discovery.d.ts +1 -7
- package/dist/features/opencode-skill-loader/git-master-template-injection.d.ts +1 -20
- package/dist/features/opencode-skill-loader/index.d.ts +1 -16
- package/dist/features/opencode-skill-loader/loaded-skill-from-path.d.ts +1 -9
- package/dist/features/opencode-skill-loader/loaded-skill-template-extractor.d.ts +1 -2
- package/dist/features/opencode-skill-loader/loader.d.ts +1 -21
- package/dist/features/opencode-skill-loader/merger/builtin-skill-converter.d.ts +1 -3
- package/dist/features/opencode-skill-loader/merger/config-skill-entry-loader.d.ts +1 -3
- package/dist/features/opencode-skill-loader/merger/scope-priority.d.ts +1 -2
- package/dist/features/opencode-skill-loader/merger/skill-definition-merger.d.ts +1 -3
- package/dist/features/opencode-skill-loader/merger/skills-config-normalizer.d.ts +1 -11
- package/dist/features/opencode-skill-loader/merger.d.ts +1 -7
- package/dist/features/opencode-skill-loader/opencode-config-skills-reader.d.ts +1 -5
- package/dist/features/opencode-skill-loader/skill-content.d.ts +1 -5
- package/dist/features/opencode-skill-loader/skill-deduplication.d.ts +1 -2
- package/dist/features/opencode-skill-loader/skill-definition-record.d.ts +1 -5
- package/dist/features/opencode-skill-loader/skill-directory-loader.d.ts +1 -8
- package/dist/features/opencode-skill-loader/skill-discovery.d.ts +1 -4
- package/dist/features/opencode-skill-loader/skill-mcp-config.d.ts +1 -3
- package/dist/features/opencode-skill-loader/skill-resolution-options.d.ts +1 -9
- package/dist/features/opencode-skill-loader/skill-template-resolver.d.ts +1 -11
- package/dist/features/opencode-skill-loader/types.d.ts +1 -34
- package/dist/features/skill-mcp-manager/cleanup.d.ts +1 -8
- package/dist/features/skill-mcp-manager/connection-type.d.ts +1 -7
- package/dist/features/skill-mcp-manager/connection.d.ts +1 -14
- package/dist/features/skill-mcp-manager/env-cleaner.d.ts +1 -2
- package/dist/features/skill-mcp-manager/error-redaction.d.ts +1 -10
- package/dist/features/skill-mcp-manager/http-client.d.ts +1 -19
- package/dist/features/skill-mcp-manager/index.d.ts +1 -2
- package/dist/features/skill-mcp-manager/manager.d.ts +1 -27
- package/dist/features/skill-mcp-manager/oauth-handler.d.ts +1 -17
- package/dist/features/skill-mcp-manager/stdio-client.d.ts +1 -16
- package/dist/features/skill-mcp-manager/types.d.ts +1 -79
- package/dist/features/team-mode/member-parser.d.ts +1 -16
- package/dist/features/team-mode/team-layout-tmux/close-team-member-pane.d.ts +1 -4
- package/dist/features/team-mode/team-layout-tmux/index.d.ts +1 -1
- package/dist/features/team-mode/team-layout-tmux/layout.d.ts +1 -37
- package/dist/features/team-mode/team-layout-tmux/rebalance-team-window.d.ts +1 -9
- package/dist/features/team-mode/team-layout-tmux/resolve-caller-tmux-session.d.ts +1 -9
- package/dist/features/team-mode/team-layout-tmux/sweep-stale-team-sessions.d.ts +1 -8
- package/dist/features/team-mode/team-mailbox/ack.d.ts +1 -2
- package/dist/features/team-mode/team-mailbox/inbox.d.ts +1 -3
- package/dist/features/team-mode/team-mailbox/index.d.ts +1 -7
- package/dist/features/team-mode/team-mailbox/pending-delivery-recovery.d.ts +1 -31
- package/dist/features/team-mode/team-mailbox/poll.d.ts +1 -10
- package/dist/features/team-mode/team-mailbox/reservation.d.ts +1 -11
- package/dist/features/team-mode/team-mailbox/send.d.ts +1 -30
- package/dist/features/team-mode/team-registry/index.d.ts +1 -3
- package/dist/features/team-mode/team-registry/loader.d.ts +1 -12
- package/dist/features/team-mode/team-registry/paths.d.ts +1 -28
- package/dist/features/team-mode/team-registry/team-spec-input-normalizer.d.ts +1 -6
- package/dist/features/team-mode/team-registry/validator.d.ts +1 -10
- package/dist/features/team-mode/team-runtime/shutdown-helpers.d.ts +1 -1
- package/dist/features/team-mode/team-state-store/active-resume.d.ts +1 -5
- package/dist/features/team-mode/team-state-store/creating-resume.d.ts +1 -4
- package/dist/features/team-mode/team-state-store/deleting-resume.d.ts +1 -4
- package/dist/features/team-mode/team-state-store/error-normalization.d.ts +1 -2
- package/dist/features/team-mode/team-state-store/index.d.ts +1 -1
- package/dist/features/team-mode/team-state-store/locks.d.ts +1 -15
- package/dist/features/team-mode/team-state-store/reservation-reconciliation.d.ts +1 -4
- package/dist/features/team-mode/team-state-store/resume-report.d.ts +1 -7
- package/dist/features/team-mode/team-state-store/resume.d.ts +1 -5
- package/dist/features/team-mode/team-state-store/runtime-cleanup.d.ts +1 -4
- package/dist/features/team-mode/team-state-store/session-liveness.d.ts +1 -9
- package/dist/features/team-mode/team-state-store/store.d.ts +1 -21
- package/dist/features/team-mode/team-state-store/worker-resume-status.d.ts +1 -9
- package/dist/features/team-mode/team-tasklist/claim.d.ts +1 -10
- package/dist/features/team-mode/team-tasklist/dependencies.d.ts +1 -2
- package/dist/features/team-mode/team-tasklist/get.d.ts +1 -3
- package/dist/features/team-mode/team-tasklist/index.d.ts +1 -6
- package/dist/features/team-mode/team-tasklist/list.d.ts +1 -8
- package/dist/features/team-mode/team-tasklist/store.d.ts +1 -3
- package/dist/features/team-mode/team-tasklist/test-support.d.ts +1 -9
- package/dist/features/team-mode/team-tasklist/update.d.ts +1 -9
- package/dist/features/team-mode/team-worktree/cleanup.d.ts +1 -3
- package/dist/features/team-mode/team-worktree/index.d.ts +1 -2
- package/dist/features/team-mode/team-worktree/manager.d.ts +1 -15
- package/dist/features/team-mode/tools/lifecycle-create-tool.d.ts +2 -2
- package/dist/features/team-mode/tools/lifecycle-inline-spec.d.ts +2 -2
- package/dist/features/team-mode/tools/lifecycle-participant.d.ts +2 -2
- package/dist/features/team-mode/tools/lifecycle-test-fixture.d.ts +8 -8
- package/dist/features/team-mode/tools/messaging-live-delivery-recipient.d.ts +2 -2
- package/dist/features/team-mode/tools/messaging-live-delivery-reservation.d.ts +1 -1
- package/dist/features/team-mode/tools/messaging-live-delivery-state.d.ts +1 -1
- package/dist/features/team-mode/tools/messaging-live-delivery.d.ts +1 -1
- package/dist/features/team-mode/tools/messaging-runtime.d.ts +2 -2
- package/dist/features/team-mode/tools/query.d.ts +3 -3
- package/dist/features/team-mode/tools/tasks.d.ts +2 -2
- package/dist/features/team-mode/types.d.ts +1 -343
- package/dist/features/tui-sidebar/compute-view.d.ts +10 -0
- package/dist/features/tui-sidebar/config-validator.d.ts +2 -0
- package/dist/features/tui-sidebar/constants.d.ts +10 -0
- package/dist/features/tui-sidebar/derivers.d.ts +10 -0
- package/dist/features/tui-sidebar/element-helpers.d.ts +9 -0
- package/dist/features/tui-sidebar/loop-reader.d.ts +2 -0
- package/dist/features/tui-sidebar/mirror-io.d.ts +3 -0
- package/dist/features/tui-sidebar/mirror-manager.d.ts +28 -0
- package/dist/features/tui-sidebar/mirror-path.d.ts +3 -0
- package/dist/features/tui-sidebar/render-view.d.ts +15 -0
- package/dist/features/tui-sidebar/roster-resolver.d.ts +2 -0
- package/dist/features/tui-sidebar/snapshot-builder.d.ts +28 -0
- package/dist/features/tui-sidebar/snapshot-schema.d.ts +41 -0
- package/dist/features/tui-sidebar/state-types.d.ts +72 -0
- package/dist/hooks/ast-grep-sg-provision/hook.d.ts +19 -0
- package/dist/hooks/ast-grep-sg-provision/index.d.ts +1 -0
- package/dist/hooks/auto-slash-command/constants.d.ts +1 -5
- package/dist/hooks/auto-slash-command/detector.d.ts +1 -15
- package/dist/hooks/auto-slash-command/processed-command-store.d.ts +1 -7
- package/dist/hooks/auto-slash-command/types.d.ts +1 -48
- package/dist/hooks/auto-update-checker/constants.d.ts +3 -3
- package/dist/hooks/codegraph-bootstrap/command-runner.d.ts +16 -0
- package/dist/hooks/codegraph-bootstrap/hook.d.ts +34 -0
- package/dist/hooks/codegraph-bootstrap/index.d.ts +1 -0
- package/dist/hooks/codegraph-bootstrap/project-root.d.ts +1 -0
- package/dist/hooks/codegraph-bootstrap/status.d.ts +11 -0
- package/dist/hooks/delegate-task-retry/guidance.d.ts +1 -2
- package/dist/hooks/delegate-task-retry/patterns.d.ts +2 -11
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/monitor-status-injector/hook.d.ts +30 -0
- package/dist/hooks/monitor-status-injector/index.d.ts +2 -0
- package/dist/hooks/runtime-fallback/auto-retry-signal.d.ts +1 -4
- package/dist/hooks/runtime-fallback/error-classifier.d.ts +7 -6
- package/dist/hooks/runtime-fallback/fallback-state.d.ts +3 -2
- package/dist/hooks/runtime-fallback/test-timeout-clock.test-support.d.ts +6 -0
- package/dist/hooks/tool-pair-validator/tool-part-ids.d.ts +2 -1
- package/dist/index.js +89513 -95172
- package/dist/interactive-bash-availability.d.ts +1 -0
- package/dist/mcp/codegraph.d.ts +16 -0
- package/dist/mcp/index.d.ts +10 -2
- package/dist/mcp/shared/ancestor-cli-resolver.d.ts +25 -0
- package/dist/mcp/types.d.ts +1 -1
- package/dist/oh-my-opencode.schema.json +139 -16
- package/dist/openclaw/config.d.ts +1 -8
- package/dist/openclaw/daemon.d.ts +1 -1
- package/dist/openclaw/dispatcher.d.ts +1 -12
- package/dist/openclaw/gateway-url-validation.d.ts +1 -1
- package/dist/openclaw/index.d.ts +1 -5
- package/dist/openclaw/reply-listener-discord.d.ts +1 -4
- package/dist/openclaw/reply-listener-injection.d.ts +1 -10
- package/dist/openclaw/reply-listener-log.d.ts +1 -2
- package/dist/openclaw/reply-listener-paths.d.ts +1 -7
- package/dist/openclaw/reply-listener-poll-loop.d.ts +1 -3
- package/dist/openclaw/reply-listener-process.d.ts +1 -4
- package/dist/openclaw/reply-listener-signature.d.ts +1 -2
- package/dist/openclaw/reply-listener-sleep.d.ts +1 -1
- package/dist/openclaw/reply-listener-spawn.d.ts +1 -5
- package/dist/openclaw/reply-listener-start.d.ts +1 -9
- package/dist/openclaw/reply-listener-startup.d.ts +1 -12
- package/dist/openclaw/reply-listener-state.d.ts +1 -29
- package/dist/openclaw/reply-listener-status.d.ts +1 -4
- package/dist/openclaw/reply-listener-stop.d.ts +1 -7
- package/dist/openclaw/reply-listener-telegram.d.ts +1 -4
- package/dist/openclaw/reply-listener.d.ts +1 -5
- package/dist/openclaw/runtime-dispatch.d.ts +1 -17
- package/dist/openclaw/session-registry-lock.d.ts +1 -2
- package/dist/openclaw/session-registry-paths.d.ts +1 -9
- package/dist/openclaw/session-registry-storage.d.ts +1 -4
- package/dist/openclaw/session-registry-types.d.ts +1 -11
- package/dist/openclaw/session-registry.d.ts +1 -8
- package/dist/openclaw/tmux.d.ts +1 -8
- package/dist/openclaw/types.d.ts +1 -42
- package/dist/plugin/event-error-utils.d.ts +2 -1
- package/dist/plugin/hooks/create-core-hooks.d.ts +5 -0
- package/dist/plugin/hooks/create-session-hooks.d.ts +3 -1
- package/dist/plugin/hooks/create-transform-hooks.d.ts +4 -1
- package/dist/plugin/messages-transform.d.ts +1 -0
- package/dist/plugin/skill-context.d.ts +2 -0
- package/dist/plugin/tool-registry-factories.d.ts +2 -1
- package/dist/plugin/tool-registry-gated-tools.d.ts +7 -0
- package/dist/plugin/tool-registry.d.ts +1 -1
- package/dist/plugin/types.d.ts +2 -9
- package/dist/plugin-handlers/prometheus-agent-config-builder.d.ts +1 -0
- package/dist/shared/archive-entry-validator.d.ts +1 -6
- package/dist/shared/bun-file-shim.d.ts +1 -8
- package/dist/shared/bun-spawn-shim.d.ts +1 -43
- package/dist/shared/bun-which-shim.d.ts +1 -1
- package/dist/shared/classify-path-environment.d.ts +1 -3
- package/dist/shared/command-executor/embedded-commands.d.ts +1 -7
- package/dist/shared/command-executor/execute-command.d.ts +1 -1
- package/dist/shared/command-executor/execute-hook-command.d.ts +1 -23
- package/dist/shared/command-executor/home-directory.d.ts +1 -1
- package/dist/shared/command-executor/resolve-commands-in-text.d.ts +1 -1
- package/dist/shared/command-executor/shell-path.d.ts +1 -2
- package/dist/shared/command-executor.d.ts +1 -4
- package/dist/shared/git-worktree/collect-git-diff-stats.d.ts +1 -2
- package/dist/shared/git-worktree/format-file-changes.d.ts +1 -2
- package/dist/shared/git-worktree/index.d.ts +1 -7
- package/dist/shared/git-worktree/parse-diff-numstat.d.ts +1 -2
- package/dist/shared/git-worktree/parse-status-porcelain-line.d.ts +1 -6
- package/dist/shared/git-worktree/parse-status-porcelain.d.ts +1 -2
- package/dist/shared/git-worktree/types.d.ts +1 -7
- package/dist/shared/internal-initiator-marker.d.ts +1 -46
- package/dist/shared/logger.d.ts +3 -11
- package/dist/shared/migration/agent-category.d.ts +1 -19
- package/dist/shared/migration/agent-names.d.ts +1 -6
- package/dist/shared/migration/config-migration.d.ts +1 -1
- package/dist/shared/migration/hook-names.d.ts +1 -6
- package/dist/shared/migration/migrations-sidecar.d.ts +1 -41
- package/dist/shared/migration/model-versions.d.ts +1 -22
- package/dist/shared/migration.d.ts +1 -5
- package/dist/shared/model-suggestion-retry.d.ts +39 -17
- package/dist/shared/plugin-identity.d.ts +8 -8
- package/dist/shared/posthog.d.ts +3 -0
- package/dist/shared/process-stream-reader.d.ts +1 -3
- package/dist/shared/prompt-async-gate/message-inspection-error.d.ts +1 -1
- package/dist/shared/prompt-async-gate/pending-tool-turn.d.ts +1 -11
- package/dist/shared/prompt-async-gate/prompt-message-state.d.ts +1 -9
- package/dist/shared/prompt-async-gate/queue.d.ts +1 -8
- package/dist/shared/prompt-async-gate/recent-dispatches.d.ts +1 -14
- package/dist/shared/prompt-async-gate/reservations.d.ts +1 -9
- package/dist/shared/prompt-async-gate/semantic-dedupe.d.ts +1 -7
- package/dist/shared/prompt-async-gate/session-idle-dispatch.d.ts +1 -16
- package/dist/shared/prompt-async-gate/timing.d.ts +1 -9
- package/dist/shared/prompt-async-gate/types.d.ts +1 -123
- package/dist/shared/prompt-async-gate.d.ts +3 -7
- package/dist/shared/prompt-failure-classifier.d.ts +1 -9
- package/dist/shared/session-idle-settle.d.ts +1 -12
- package/dist/shared/shell-env.d.ts +1 -1
- package/dist/shared/skill-path-resolver.d.ts +1 -1
- package/dist/shared/tmux/cmux-detect.d.ts +1 -8
- package/dist/shared/tmux/constants.d.ts +1 -5
- package/dist/shared/tmux/runner.d.ts +2 -13
- package/dist/shared/tmux/tmux-utils/adapter-deps.d.ts +9 -0
- package/dist/shared/tmux/tmux-utils/environment.d.ts +2 -4
- package/dist/shared/tmux/tmux-utils/layout.d.ts +4 -17
- package/dist/shared/tmux/tmux-utils/pane-close.d.ts +3 -10
- package/dist/shared/tmux/tmux-utils/pane-command.d.ts +1 -2
- package/dist/shared/tmux/tmux-utils/pane-dimensions.d.ts +2 -4
- package/dist/shared/tmux/tmux-utils/pane-replace.d.ts +1 -11
- package/dist/shared/tmux/tmux-utils/pane-spawn.d.ts +1 -13
- package/dist/shared/tmux/tmux-utils/server-health.d.ts +2 -15
- package/dist/shared/tmux/tmux-utils/session-spawn.d.ts +3 -14
- package/dist/shared/tmux/tmux-utils/spawn-process.d.ts +1 -1
- package/dist/shared/tmux/tmux-utils/stale-session-sweep.d.ts +4 -17
- package/dist/shared/tmux/tmux-utils/window-spawn.d.ts +1 -13
- package/dist/shared/tmux/types.d.ts +1 -4
- package/dist/shared/write-file-atomically.d.ts +2 -0
- package/dist/shared/zip-entry-listing/powershell-zip-entry-listing.d.ts +1 -4
- package/dist/shared/zip-entry-listing/python-zip-entry-listing.d.ts +1 -3
- package/dist/shared/zip-entry-listing/read-zip-symlink-target.d.ts +1 -1
- package/dist/shared/zip-entry-listing/tar-zip-entry-listing.d.ts +1 -3
- package/dist/shared/zip-entry-listing/zipinfo-zip-entry-listing.d.ts +1 -4
- package/dist/shared/zip-entry-listing.d.ts +1 -4
- package/dist/skills/ast-grep/LICENSE +21 -0
- package/dist/skills/ast-grep/README.md +136 -0
- package/dist/skills/ast-grep/SKILL.md +272 -0
- package/dist/skills/ast-grep/SOURCE +1 -0
- package/dist/skills/ast-grep/install.ps1 +235 -0
- package/dist/skills/ast-grep/install.sh +286 -0
- package/dist/skills/ast-grep/references/cli.md +231 -0
- package/dist/skills/ast-grep/references/install.md +166 -0
- package/dist/skills/ast-grep/references/patterns.md +147 -0
- package/dist/skills/ast-grep/references/pitfalls.md +303 -0
- package/dist/skills/ast-grep/references/recipes.md +402 -0
- package/dist/skills/ast-grep/references/sgconfig.md +248 -0
- package/dist/skills/ast-grep/references/yaml-rules.md +509 -0
- package/dist/skills/ast-grep/scripts/ast_grep_helper.py +748 -0
- package/dist/skills/ast-grep/tests/smoke.ps1 +123 -0
- package/dist/skills/ast-grep/tests/smoke.sh +212 -0
- package/dist/skills/debugging/SKILL.md +116 -0
- package/dist/skills/debugging/references/methodology/00-setup.md +108 -0
- package/dist/skills/debugging/references/methodology/02-investigate.md +130 -0
- package/dist/skills/debugging/references/methodology/04-oracle-triple.md +136 -0
- package/dist/skills/debugging/references/methodology/05-escalate.md +69 -0
- package/dist/skills/debugging/references/methodology/06-fix.md +116 -0
- package/dist/skills/debugging/references/methodology/08-qa.md +94 -0
- package/dist/skills/debugging/references/methodology/09-cleanup.md +164 -0
- package/dist/skills/debugging/references/methodology/partial-runtime-evidence.md +229 -0
- package/dist/skills/debugging/references/runtimes/bundled-js-binary.md +415 -0
- package/dist/skills/debugging/references/runtimes/go.md +252 -0
- package/dist/skills/debugging/references/runtimes/native-binary.md +484 -0
- package/dist/skills/debugging/references/runtimes/node.md +260 -0
- package/dist/skills/debugging/references/runtimes/python.md +248 -0
- package/dist/skills/debugging/references/runtimes/rust.md +234 -0
- package/dist/skills/debugging/references/tools/ghidra.md +212 -0
- package/dist/skills/debugging/references/tools/playwright-cli.md +194 -0
- package/dist/skills/debugging/references/tools/pwndbg.md +263 -0
- package/dist/skills/debugging/references/tools/pwntools.md +265 -0
- package/dist/skills/frontend/ATTRIBUTION.md +127 -0
- package/dist/skills/frontend/LICENSE-Apache-2.0.txt +201 -0
- package/dist/skills/frontend/SKILL.md +113 -0
- package/dist/skills/frontend/references/design/README.md +240 -0
- package/dist/skills/frontend/references/design/_INDEX.md +189 -0
- package/dist/skills/frontend/references/design/airbnb.md +390 -0
- package/dist/skills/frontend/references/design/airtable.md +89 -0
- package/dist/skills/frontend/references/design/apple.md +247 -0
- package/dist/skills/frontend/references/design/binance.md +345 -0
- package/dist/skills/frontend/references/design/bmw.md +180 -0
- package/dist/skills/frontend/references/design/brutalist-skill.md +92 -0
- package/dist/skills/frontend/references/design/bugatti.md +268 -0
- package/dist/skills/frontend/references/design/cal.md +259 -0
- package/dist/skills/frontend/references/design/claude.md +312 -0
- package/dist/skills/frontend/references/design/clay.md +304 -0
- package/dist/skills/frontend/references/design/clickhouse.md +281 -0
- package/dist/skills/frontend/references/design/cohere.md +266 -0
- package/dist/skills/frontend/references/design/coinbase.md +129 -0
- package/dist/skills/frontend/references/design/composio.md +307 -0
- package/dist/skills/frontend/references/design/cursor.md +309 -0
- package/dist/skills/frontend/references/design/design-system-architecture.md +217 -0
- package/dist/skills/frontend/references/design/elevenlabs.md +265 -0
- package/dist/skills/frontend/references/design/expo.md +281 -0
- package/dist/skills/frontend/references/design/ferrari.md +314 -0
- package/dist/skills/frontend/references/design/figma.md +220 -0
- package/dist/skills/frontend/references/design/framer.md +246 -0
- package/dist/skills/frontend/references/design/gpt-tasteskill.md +74 -0
- package/dist/skills/frontend/references/design/hashicorp.md +278 -0
- package/dist/skills/frontend/references/design/ibm.md +332 -0
- package/dist/skills/frontend/references/design/image-to-code-skill.md +1228 -0
- package/dist/skills/frontend/references/design/imagegen-brandkit.md +798 -0
- package/dist/skills/frontend/references/design/imagegen-frontend-mobile.md +1465 -0
- package/dist/skills/frontend/references/design/imagegen-frontend-web.md +686 -0
- package/dist/skills/frontend/references/design/intercom.md +146 -0
- package/dist/skills/frontend/references/design/kraken.md +125 -0
- package/dist/skills/frontend/references/design/lamborghini.md +288 -0
- package/dist/skills/frontend/references/design/linear.app.md +367 -0
- package/dist/skills/frontend/references/design/lovable.md +298 -0
- package/dist/skills/frontend/references/design/mastercard.md +365 -0
- package/dist/skills/frontend/references/design/meta.md +366 -0
- package/dist/skills/frontend/references/design/minimalist-skill.md +85 -0
- package/dist/skills/frontend/references/design/minimax.md +257 -0
- package/dist/skills/frontend/references/design/mintlify.md +326 -0
- package/dist/skills/frontend/references/design/miro.md +108 -0
- package/dist/skills/frontend/references/design/mistral.ai.md +261 -0
- package/dist/skills/frontend/references/design/mongodb.md +266 -0
- package/dist/skills/frontend/references/design/nike.md +363 -0
- package/dist/skills/frontend/references/design/notion.md +309 -0
- package/dist/skills/frontend/references/design/nvidia.md +293 -0
- package/dist/skills/frontend/references/design/ollama.md +267 -0
- package/dist/skills/frontend/references/design/opencode.ai.md +281 -0
- package/dist/skills/frontend/references/design/output-skill.md +49 -0
- package/dist/skills/frontend/references/design/pinterest.md +230 -0
- package/dist/skills/frontend/references/design/playstation.md +364 -0
- package/dist/skills/frontend/references/design/posthog.md +256 -0
- package/dist/skills/frontend/references/design/raycast.md +268 -0
- package/dist/skills/frontend/references/design/react-dev-tooling-skill.md +230 -0
- package/dist/skills/frontend/references/design/redesign-skill.md +178 -0
- package/dist/skills/frontend/references/design/renault.md +311 -0
- package/dist/skills/frontend/references/design/replicate.md +261 -0
- package/dist/skills/frontend/references/design/resend.md +303 -0
- package/dist/skills/frontend/references/design/revolut.md +185 -0
- package/dist/skills/frontend/references/design/runwayml.md +244 -0
- package/dist/skills/frontend/references/design/sanity.md +357 -0
- package/dist/skills/frontend/references/design/sentry.md +262 -0
- package/dist/skills/frontend/references/design/shopify.md +350 -0
- package/dist/skills/frontend/references/design/soft-skill.md +98 -0
- package/dist/skills/frontend/references/design/spacex.md +194 -0
- package/dist/skills/frontend/references/design/spotify.md +246 -0
- package/dist/skills/frontend/references/design/starbucks.md +580 -0
- package/dist/skills/frontend/references/design/stitch-skill.md +184 -0
- package/dist/skills/frontend/references/design/stripe.md +322 -0
- package/dist/skills/frontend/references/design/supabase.md +255 -0
- package/dist/skills/frontend/references/design/superhuman.md +252 -0
- package/dist/skills/frontend/references/design/taste-skill.md +226 -0
- package/dist/skills/frontend/references/design/tesla.md +286 -0
- package/dist/skills/frontend/references/design/theverge.md +339 -0
- package/dist/skills/frontend/references/design/together.ai.md +263 -0
- package/dist/skills/frontend/references/design/uber.md +295 -0
- package/dist/skills/frontend/references/design/vercel.md +310 -0
- package/dist/skills/frontend/references/design/vodafone.md +423 -0
- package/dist/skills/frontend/references/design/voltagent.md +323 -0
- package/dist/skills/frontend/references/design/warp.md +253 -0
- package/dist/skills/frontend/references/design/webflow.md +92 -0
- package/dist/skills/frontend/references/design/wired.md +278 -0
- package/dist/skills/frontend/references/design/wise.md +173 -0
- package/dist/skills/frontend/references/design/x.ai.md +257 -0
- package/dist/skills/frontend/references/design/zapier.md +328 -0
- package/dist/skills/frontend/references/perfection/README.md +160 -0
- package/dist/skills/frontend/references/perfection/react-perf-tooling.md +127 -0
- package/dist/skills/frontend/references/ui-ux-db/README.md +273 -0
- package/dist/skills/frontend/references/ui-ux-db/data/charts.csv +26 -0
- package/dist/skills/frontend/references/ui-ux-db/data/colors.csv +97 -0
- package/dist/skills/frontend/references/ui-ux-db/data/icons.csv +101 -0
- package/dist/skills/frontend/references/ui-ux-db/data/landing.csv +31 -0
- package/dist/skills/frontend/references/ui-ux-db/data/products.csv +97 -0
- package/dist/skills/frontend/references/ui-ux-db/data/react-performance.csv +45 -0
- package/dist/skills/frontend/references/ui-ux-db/data/stacks/astro.csv +54 -0
- package/dist/skills/frontend/references/ui-ux-db/data/stacks/flutter.csv +53 -0
- package/dist/skills/frontend/references/ui-ux-db/data/stacks/html-tailwind.csv +56 -0
- package/dist/skills/frontend/references/ui-ux-db/data/stacks/jetpack-compose.csv +53 -0
- package/dist/skills/frontend/references/ui-ux-db/data/stacks/nextjs.csv +53 -0
- package/dist/skills/frontend/references/ui-ux-db/data/stacks/nuxt-ui.csv +51 -0
- package/dist/skills/frontend/references/ui-ux-db/data/stacks/nuxtjs.csv +59 -0
- package/dist/skills/frontend/references/ui-ux-db/data/stacks/react-native.csv +52 -0
- package/dist/skills/frontend/references/ui-ux-db/data/stacks/react.csv +54 -0
- package/dist/skills/frontend/references/ui-ux-db/data/stacks/shadcn.csv +61 -0
- package/dist/skills/frontend/references/ui-ux-db/data/stacks/svelte.csv +54 -0
- package/dist/skills/frontend/references/ui-ux-db/data/stacks/swiftui.csv +51 -0
- package/dist/skills/frontend/references/ui-ux-db/data/stacks/vue.csv +50 -0
- package/dist/skills/frontend/references/ui-ux-db/data/styles.csv +68 -0
- package/dist/skills/frontend/references/ui-ux-db/data/typography.csv +58 -0
- package/dist/skills/frontend/references/ui-ux-db/data/ui-reasoning.csv +101 -0
- package/dist/skills/frontend/references/ui-ux-db/data/ux-guidelines.csv +100 -0
- package/dist/skills/frontend/references/ui-ux-db/data/web-interface.csv +31 -0
- package/dist/skills/frontend/references/ui-ux-db/scripts/core.py +253 -0
- package/dist/skills/frontend/references/ui-ux-db/scripts/design_system.py +1067 -0
- package/dist/skills/frontend/references/ui-ux-db/scripts/search.py +114 -0
- package/dist/skills/frontend/scripts/perfection/lighthouse-audit.py +201 -0
- package/dist/skills/git-master/SKILL.md +100 -0
- package/dist/skills/git-master/agents/openai.yaml +13 -0
- package/dist/skills/init-deep/SKILL.md +309 -0
- package/dist/skills/lcx-contribute-bug-fix/SKILL.md +242 -0
- package/dist/skills/lcx-contribute-bug-fix/agents/openai.yaml +12 -0
- package/dist/skills/lcx-contribute-bug-fix/scripts/create-pr-body.mjs +107 -0
- package/dist/skills/lcx-doctor/SKILL.md +93 -0
- package/dist/skills/lcx-doctor/agents/openai.yaml +11 -0
- package/dist/skills/lcx-report-bug/SKILL.md +237 -0
- package/dist/skills/lcx-report-bug/agents/openai.yaml +11 -0
- package/dist/skills/lsp-setup/SKILL.md +139 -0
- package/dist/skills/lsp-setup/references/bash/README.md +60 -0
- package/dist/skills/lsp-setup/references/c-cpp/README.md +61 -0
- package/dist/skills/lsp-setup/references/csharp/README.md +71 -0
- package/dist/skills/lsp-setup/references/dart/README.md +48 -0
- package/dist/skills/lsp-setup/references/elixir/README.md +51 -0
- package/dist/skills/lsp-setup/references/go/README.md +57 -0
- package/dist/skills/lsp-setup/references/haskell/README.md +57 -0
- package/dist/skills/lsp-setup/references/java/README.md +57 -0
- package/dist/skills/lsp-setup/references/julia/README.md +60 -0
- package/dist/skills/lsp-setup/references/kotlin/README.md +59 -0
- package/dist/skills/lsp-setup/references/lua/README.md +66 -0
- package/dist/skills/lsp-setup/references/php/README.md +62 -0
- package/dist/skills/lsp-setup/references/python/README.md +71 -0
- package/dist/skills/lsp-setup/references/ruby/README.md +53 -0
- package/dist/skills/lsp-setup/references/rust/README.md +59 -0
- package/dist/skills/lsp-setup/references/swift/README.md +51 -0
- package/dist/skills/lsp-setup/references/terraform/README.md +62 -0
- package/dist/skills/lsp-setup/references/typescript/README.md +77 -0
- package/dist/skills/lsp-setup/references/yaml/README.md +70 -0
- package/dist/skills/lsp-setup/references/zig/README.md +49 -0
- package/dist/skills/lsp-setup/scripts/detect-lsp.ts +210 -0
- package/dist/skills/lsp-setup/scripts/lsp-server-table.ts +177 -0
- package/dist/skills/lsp-setup/scripts/tsconfig.json +17 -0
- package/dist/skills/lsp-setup/scripts/verify-lsp.ts +147 -0
- package/dist/skills/programming/SKILL.md +463 -0
- package/dist/skills/programming/references/go/README.md +90 -0
- package/dist/skills/programming/references/go/backend-stack.md +641 -0
- package/dist/skills/programming/references/go/bootstrap.md +328 -0
- package/dist/skills/programming/references/go/bubbletea-v2.md +360 -0
- package/dist/skills/programming/references/go/cobra-stack.md +468 -0
- package/dist/skills/programming/references/go/concurrency.md +362 -0
- package/dist/skills/programming/references/go/data-modeling.md +329 -0
- package/dist/skills/programming/references/go/error-handling.md +359 -0
- package/dist/skills/programming/references/go/golangci-strict.md +236 -0
- package/dist/skills/programming/references/go/grpc-connect.md +375 -0
- package/dist/skills/programming/references/go/libraries.md +337 -0
- package/dist/skills/programming/references/go/one-liners.md +202 -0
- package/dist/skills/programming/references/go/sqlc-pgx.md +471 -0
- package/dist/skills/programming/references/go/testing.md +467 -0
- package/dist/skills/programming/references/go/type-patterns.md +298 -0
- package/dist/skills/programming/references/python/README.md +314 -0
- package/dist/skills/programming/references/python/async-anyio.md +442 -0
- package/dist/skills/programming/references/python/data-modeling.md +233 -0
- package/dist/skills/programming/references/python/data-processing.md +133 -0
- package/dist/skills/programming/references/python/error-handling.md +218 -0
- package/dist/skills/programming/references/python/fastapi-stack.md +316 -0
- package/dist/skills/programming/references/python/httpx2-optimization.md +360 -0
- package/dist/skills/programming/references/python/libraries.md +307 -0
- package/dist/skills/programming/references/python/one-liners.md +268 -0
- package/dist/skills/programming/references/python/orjson-stack.md +378 -0
- package/dist/skills/programming/references/python/pydantic-ai.md +285 -0
- package/dist/skills/programming/references/python/pyproject-strict.md +232 -0
- package/dist/skills/programming/references/python/textual-tui.md +201 -0
- package/dist/skills/programming/references/python/type-patterns.md +176 -0
- package/dist/skills/programming/references/rust/README.md +317 -0
- package/dist/skills/programming/references/rust/async-tokio.md +299 -0
- package/dist/skills/programming/references/rust/axum-stack.md +467 -0
- package/dist/skills/programming/references/rust/cargo-strict.md +317 -0
- package/dist/skills/programming/references/rust/clap-stack.md +409 -0
- package/dist/skills/programming/references/rust/concurrency.md +375 -0
- package/dist/skills/programming/references/rust/libraries.md +439 -0
- package/dist/skills/programming/references/rust/one-liners.md +291 -0
- package/dist/skills/programming/references/rust/proptest-insta.md +429 -0
- package/dist/skills/programming/references/rust/type-state.md +354 -0
- package/dist/skills/programming/references/rust/unsafe-discipline.md +250 -0
- package/dist/skills/programming/references/rust/zero-cost-safety.md +527 -0
- package/dist/skills/programming/references/rust-ub/README.md +289 -0
- package/dist/skills/programming/references/rust-ub/miri-sanitizers-loom.md +411 -0
- package/dist/skills/programming/references/rust-ub/ub-taxonomy.md +269 -0
- package/dist/skills/programming/references/typescript/README.md +195 -0
- package/dist/skills/programming/references/typescript/backend-hono.md +672 -0
- package/dist/skills/programming/references/typescript/bootstrap.md +199 -0
- package/dist/skills/programming/references/typescript/data-modeling.md +202 -0
- package/dist/skills/programming/references/typescript/error-handling.md +169 -0
- package/dist/skills/programming/references/typescript/tsconfig-strict.md +152 -0
- package/dist/skills/programming/references/typescript/type-patterns.md +196 -0
- package/dist/skills/programming/scripts/go/check-no-excuse-rules.sh +173 -0
- package/dist/skills/programming/scripts/go/new-project.py +138 -0
- package/dist/skills/programming/scripts/go/templates/.editorconfig +13 -0
- package/dist/skills/programming/scripts/go/templates/.golangci.yml +95 -0
- package/dist/skills/programming/scripts/go/templates/AGENTS.md.tmpl +24 -0
- package/dist/skills/programming/scripts/go/templates/README.md.tmpl +12 -0
- package/dist/skills/programming/scripts/go/templates/Taskfile.yml +40 -0
- package/dist/skills/programming/scripts/go/templates/ci.yml +37 -0
- package/dist/skills/programming/scripts/go/templates/config.go +24 -0
- package/dist/skills/programming/scripts/go/templates/gitignore +15 -0
- package/dist/skills/programming/scripts/go/templates/main.go.tmpl +22 -0
- package/dist/skills/programming/scripts/go/templates/run.go +15 -0
- package/dist/skills/programming/scripts/python/check-no-excuse-rules.py +687 -0
- package/dist/skills/programming/scripts/python/new-project.py +172 -0
- package/dist/skills/programming/scripts/python/new-script.py +116 -0
- package/dist/skills/programming/scripts/rust/check-no-excuse-rules.py +296 -0
- package/dist/skills/programming/scripts/rust/check-no-excuse-rules.sh +158 -0
- package/dist/skills/programming/scripts/rust/new-project.py +175 -0
- package/dist/skills/programming/scripts/typescript/check-no-excuse-rules.ts +282 -0
- package/dist/skills/programming/scripts/typescript/new-project.ts +177 -0
- package/dist/skills/refactor/SKILL.md +754 -0
- package/dist/skills/remove-ai-slops/SKILL.md +317 -0
- package/dist/skills/review-work/SKILL.md +594 -0
- package/dist/skills/start-work/SKILL.md +178 -0
- package/dist/skills/ultraresearch/SKILL.md +230 -0
- package/dist/skills/ulw-plan/SKILL.md +69 -0
- package/dist/skills/ulw-plan/agents/openai.yaml +7 -0
- package/dist/skills/ulw-plan/references/full-workflow.md +99 -0
- package/dist/skills/ulw-plan/references/intent-clear.md +44 -0
- package/dist/skills/ulw-plan/references/intent-unclear.md +44 -0
- package/dist/skills/ulw-plan/scripts/scaffold-plan.mjs +301 -0
- package/dist/skills/visual-qa/SKILL.md +235 -0
- package/dist/skills/visual-qa/references/agent-browser-setup.md +44 -0
- package/dist/skills/visual-qa/scripts/ansi.test.ts +45 -0
- package/dist/skills/visual-qa/scripts/ansi.ts +17 -0
- package/dist/skills/visual-qa/scripts/cli.test.ts +73 -0
- package/dist/skills/visual-qa/scripts/cli.ts +82 -0
- package/dist/skills/visual-qa/scripts/east-asian-width.test.ts +60 -0
- package/dist/skills/visual-qa/scripts/east-asian-width.ts +72 -0
- package/dist/skills/visual-qa/scripts/image-diff.test.ts +70 -0
- package/dist/skills/visual-qa/scripts/image-diff.ts +109 -0
- package/dist/skills/visual-qa/scripts/png-crc.ts +27 -0
- package/dist/skills/visual-qa/scripts/png-decode.test.ts +44 -0
- package/dist/skills/visual-qa/scripts/png-decode.ts +206 -0
- package/dist/skills/visual-qa/scripts/png-synth.ts +57 -0
- package/dist/skills/visual-qa/scripts/skill-prompt-contract.test.ts +127 -0
- package/dist/skills/visual-qa/scripts/tui-grid.test.ts +57 -0
- package/dist/skills/visual-qa/scripts/tui-grid.ts +88 -0
- package/dist/skills/visual-qa/scripts/types.ts +54 -0
- package/dist/tools/delegate-task/background-task-description.d.ts +2 -0
- package/dist/tools/delegate-task/constants.d.ts +13 -1
- package/dist/tools/delegate-task/model-selection.d.ts +3 -17
- package/dist/tools/delegate-task/model-string-parser.d.ts +1 -9
- package/dist/tools/delegate-task/sync-result-fetcher.d.ts +1 -0
- package/dist/tools/delegate-task/sync-session-poller.d.ts +1 -0
- package/dist/tools/delegate-task/types.d.ts +59 -2
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/monitor/create-monitor-tools.d.ts +4 -0
- package/dist/tools/monitor/index.d.ts +1 -0
- package/dist/tools/monitor/monitor-list.d.ts +7 -0
- package/dist/tools/monitor/monitor-output.d.ts +3 -0
- package/dist/tools/monitor/monitor-start.d.ts +9 -0
- package/dist/tools/monitor/monitor-stop.d.ts +16 -0
- package/dist/tools/skill/native-skills.d.ts +2 -2
- package/dist/tools/skill/scope-priority.d.ts +1 -4
- package/dist/tools/skill/skill-matcher.d.ts +1 -5
- package/dist/tools/task/types.d.ts +10 -10
- package/dist/tui.d.ts +4 -0
- package/dist/tui.js +69330 -0
- package/package.json +57 -36
- package/packages/git-bash-mcp/dist/cli.js +225 -55
- package/packages/lsp-core/package.json +41 -0
- package/packages/lsp-core/src/index.ts +28 -0
- package/packages/lsp-core/src/lsp/cleanup-errors.ts +5 -0
- package/packages/lsp-core/src/lsp/client-wrapper.ts +173 -0
- package/packages/lsp-core/src/lsp/client.ts +172 -0
- package/packages/lsp-core/src/lsp/config-loader.ts +266 -0
- package/packages/lsp-core/src/lsp/connection.ts +73 -0
- package/packages/lsp-core/src/lsp/constants.ts +11 -0
- package/packages/lsp-core/src/lsp/directory-diagnostics.ts +154 -0
- package/packages/lsp-core/src/lsp/effective-extension.ts +10 -0
- package/packages/lsp-core/src/lsp/errors.ts +63 -0
- package/packages/lsp-core/src/lsp/formatters.ts +141 -0
- package/packages/lsp-core/src/lsp/infer-extension.ts +66 -0
- package/packages/lsp-core/src/lsp/json-rpc-connection.ts +296 -0
- package/packages/lsp-core/src/lsp/language-mappings.ts +173 -0
- package/packages/lsp-core/src/lsp/manager.ts +369 -0
- package/packages/lsp-core/src/lsp/process-signal-cleanup.ts +21 -0
- package/packages/lsp-core/src/lsp/process.ts +202 -0
- package/packages/lsp-core/src/lsp/server-definitions.ts +176 -0
- package/packages/lsp-core/src/lsp/server-install-state.ts +70 -0
- package/packages/lsp-core/src/lsp/server-installation.ts +45 -0
- package/packages/lsp-core/src/lsp/server-resolution.ts +104 -0
- package/packages/lsp-core/src/lsp/startup-failure.ts +1 -0
- package/packages/lsp-core/src/lsp/transport.ts +299 -0
- package/packages/lsp-core/src/lsp/types.ts +126 -0
- package/packages/lsp-core/src/lsp/utils.test.ts +72 -0
- package/packages/lsp-core/src/lsp/utils.ts +40 -0
- package/packages/lsp-core/src/lsp/workspace-edit.ts +206 -0
- package/packages/lsp-core/src/mcp-protocol-pin.test.ts +68 -0
- package/packages/lsp-core/src/mcp.ts +95 -0
- package/packages/lsp-core/src/missing-dependency-result.ts +19 -0
- package/packages/lsp-core/src/request-context.ts +22 -0
- package/packages/lsp-core/src/tool-surface.test.ts +157 -0
- package/packages/lsp-core/src/tools/definitions.ts +141 -0
- package/packages/lsp-core/src/tools/diagnostics.ts +97 -0
- package/packages/lsp-core/src/tools/index.ts +10 -0
- package/packages/lsp-core/src/tools/install-decision.ts +39 -0
- package/packages/lsp-core/src/tools/navigation.ts +86 -0
- package/packages/lsp-core/src/tools/parameters.ts +49 -0
- package/packages/lsp-core/src/tools/rename.ts +72 -0
- package/packages/lsp-core/src/tools/result.ts +5 -0
- package/packages/lsp-core/src/tools/runtime.ts +21 -0
- package/packages/lsp-core/src/tools/schema.ts +9 -0
- package/packages/lsp-core/src/tools/status.ts +28 -0
- package/packages/lsp-core/src/tools/symbols.ts +99 -0
- package/packages/lsp-core/src/tools/types.ts +104 -0
- package/packages/lsp-core/src/tools.ts +1 -0
- package/packages/lsp-daemon/dist/cli.js +712 -527
- package/packages/lsp-daemon/dist/daemon-client.d.ts +1 -1
- package/packages/lsp-daemon/dist/daemon-server.js +1 -1
- package/packages/lsp-daemon/dist/index.d.ts +1 -1
- package/packages/lsp-daemon/dist/index.js +687 -500
- package/packages/lsp-daemon/dist/proxy.d.ts +3 -2
- package/packages/lsp-daemon/dist/proxy.js +16 -40
- package/packages/lsp-daemon/dist/request-routing.d.ts +2 -2
- package/packages/lsp-daemon/dist/request-routing.js +2 -2
- package/packages/lsp-daemon/package.json +2 -1
- package/packages/lsp-tools-mcp/dist/cli.js +3348 -15
- package/packages/lsp-tools-mcp/dist/lsp/cleanup-errors.d.ts +1 -1
- package/packages/lsp-tools-mcp/dist/lsp/client-wrapper.d.ts +1 -13
- package/packages/lsp-tools-mcp/dist/lsp/client.d.ts +1 -20
- package/packages/lsp-tools-mcp/dist/lsp/config-loader.d.ts +1 -16
- package/packages/lsp-tools-mcp/dist/lsp/connection.d.ts +1 -4
- package/packages/lsp-tools-mcp/dist/lsp/constants.d.ts +1 -10
- package/packages/lsp-tools-mcp/dist/lsp/directory-diagnostics.d.ts +1 -3
- package/packages/lsp-tools-mcp/dist/lsp/effective-extension.d.ts +1 -1
- package/packages/lsp-tools-mcp/dist/lsp/errors.d.ts +1 -35
- package/packages/lsp-tools-mcp/dist/lsp/formatters.d.ts +1 -12
- package/packages/lsp-tools-mcp/dist/lsp/infer-extension.d.ts +1 -1
- package/packages/lsp-tools-mcp/dist/lsp/json-rpc-connection.d.ts +1 -36
- package/packages/lsp-tools-mcp/dist/lsp/language-mappings.d.ts +1 -4
- package/packages/lsp-tools-mcp/dist/lsp/manager.d.ts +1 -46
- package/packages/lsp-tools-mcp/dist/lsp/manager.js +1390 -265
- package/packages/lsp-tools-mcp/dist/lsp/process-signal-cleanup.d.ts +1 -1
- package/packages/lsp-tools-mcp/dist/lsp/process.d.ts +1 -25
- package/packages/lsp-tools-mcp/dist/lsp/server-definitions.d.ts +1 -4
- package/packages/lsp-tools-mcp/dist/lsp/server-install-state.d.ts +1 -12
- package/packages/lsp-tools-mcp/dist/lsp/server-installation.d.ts +1 -1
- package/packages/lsp-tools-mcp/dist/lsp/server-resolution.d.ts +1 -11
- package/packages/lsp-tools-mcp/dist/lsp/startup-failure.d.ts +1 -3
- package/packages/lsp-tools-mcp/dist/lsp/transport.d.ts +1 -35
- package/packages/lsp-tools-mcp/dist/lsp/types.d.ts +1 -124
- package/packages/lsp-tools-mcp/dist/lsp/utils.d.ts +1 -0
- package/packages/lsp-tools-mcp/dist/lsp/workspace-edit.d.ts +1 -11
- package/packages/lsp-tools-mcp/dist/mcp.d.ts +1 -30
- package/packages/lsp-tools-mcp/dist/mcp.js +3312 -70
- package/packages/lsp-tools-mcp/dist/missing-dependency-result.d.ts +1 -2
- package/packages/lsp-tools-mcp/dist/request-context.d.ts +1 -7
- package/packages/lsp-tools-mcp/dist/request-context.js +16 -10
- package/packages/lsp-tools-mcp/dist/tools.d.ts +1 -90
- package/packages/lsp-tools-mcp/dist/tools.js +3028 -439
- package/packages/lsp-tools-mcp/package.json +3 -1
- package/packages/omo-codex/THIRD-PARTY-NOTICES.md +155 -0
- package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -1
- package/packages/omo-codex/plugin/.mcp.json +6 -5
- package/packages/omo-codex/plugin/README.md +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/dist/cli.js +1637 -1245
- package/packages/omo-codex/plugin/components/bootstrap/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/package.json +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/scripts/generate-manifests.mjs +8 -52
- package/packages/omo-codex/plugin/components/bootstrap/src/provision.ts +35 -143
- package/packages/omo-codex/plugin/components/bootstrap/src/setup.ts +11 -11
- package/packages/omo-codex/plugin/components/bootstrap/test/environment.test.ts +3 -2
- package/packages/omo-codex/plugin/components/bootstrap/test/provision.test.ts +37 -37
- package/packages/omo-codex/plugin/components/codegraph/dist/cli.js +2205 -0
- package/packages/omo-codex/plugin/components/codegraph/dist/serve.d.ts +32 -0
- package/packages/omo-codex/plugin/components/codegraph/dist/serve.js +1603 -0
- package/packages/omo-codex/plugin/components/codegraph/package.json +27 -0
- package/packages/omo-codex/plugin/components/codegraph/src/cli.ts +55 -0
- package/packages/omo-codex/plugin/components/codegraph/src/hook-types.ts +83 -0
- package/packages/omo-codex/plugin/components/codegraph/src/hook.ts +108 -0
- package/packages/omo-codex/plugin/components/codegraph/src/serve.ts +191 -0
- package/packages/omo-codex/plugin/components/codegraph/src/session-start-worker.ts +213 -0
- package/packages/omo-codex/plugin/components/codegraph/test/hook.test.ts +563 -0
- package/packages/omo-codex/plugin/components/codegraph/test/serve.test.ts +401 -0
- package/packages/omo-codex/plugin/components/codegraph/tsconfig.build.json +13 -0
- package/packages/omo-codex/plugin/components/codegraph/tsconfig.json +25 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/cli.js +610 -7
- package/packages/omo-codex/plugin/components/comment-checker/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/comment-checker/package.json +4 -3
- package/packages/omo-codex/plugin/components/comment-checker/src/apply-patch.ts +28 -156
- package/packages/omo-codex/plugin/components/comment-checker/src/core-values.ts +1 -1
- package/packages/omo-codex/plugin/components/comment-checker/src/core.ts +2 -2
- package/packages/omo-codex/plugin/components/comment-checker/src/request-extractor.ts +1 -1
- package/packages/omo-codex/plugin/components/comment-checker/src/runner.ts +6 -2
- package/packages/omo-codex/plugin/components/comment-checker/test/core.test.ts +38 -35
- package/packages/omo-codex/plugin/components/comment-checker/test/fixtures/apply-patch-mixed-requests.ts +60 -0
- package/packages/omo-codex/plugin/components/git-bash/dist/cli.js +155 -26
- package/packages/omo-codex/plugin/components/git-bash/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/git-bash/package.json +2 -1
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/biome.json +48 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/directive.md +11 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/dist/cli.js +223 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/dist/codex-hook.d.ts +2 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/dist/codex-hook.js +123 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/dist/directive.d.ts +2 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/dist/directive.js +5 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/dist/index.d.ts +4 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/dist/index.js +3 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/dist/state.d.ts +9 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/dist/state.js +45 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/dist/types.d.ts +39 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/dist/types.js +1 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/hooks/hooks.json +17 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/package.json +44 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/src/cli.ts +56 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/src/codex-hook.ts +129 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/src/directive.ts +13 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/src/index.ts +4 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/src/state.ts +62 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/src/types.ts +38 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/test/cli.test.ts +124 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/test/codex-hook.test.ts +346 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/tsconfig.build.json +12 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/tsconfig.json +27 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/vitest.config.ts +10 -0
- package/packages/omo-codex/plugin/components/lsp/dist/cli.js +3738 -28
- package/packages/omo-codex/plugin/components/lsp/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/lsp/package.json +1 -1
- package/packages/omo-codex/plugin/components/rules/bundled-rules/hephaestus.md +1 -1
- package/packages/omo-codex/plugin/components/rules/dist/cli.js +4565 -89
- package/packages/omo-codex/plugin/components/rules/hooks/hooks.json +4 -4
- package/packages/omo-codex/plugin/components/rules/package.json +4 -3
- package/packages/omo-codex/plugin/components/rules/src/cli.ts +16 -3
- package/packages/omo-codex/plugin/components/rules/src/config.ts +3 -3
- package/packages/omo-codex/plugin/components/rules/src/dynamic-target-fingerprints.ts +6 -6
- package/packages/omo-codex/plugin/components/rules/src/event-budget.ts +1 -1
- package/packages/omo-codex/plugin/components/rules/src/persistent-cache.ts +1 -1
- package/packages/omo-codex/plugin/components/rules/src/post-compact-budget.ts +1 -1
- package/packages/omo-codex/plugin/components/rules/src/rules-engine-factory.ts +9 -4
- package/packages/omo-codex/plugin/components/rules/src/static-injection.ts +3 -3
- package/packages/omo-codex/plugin/components/rules/src/transcript-rule-filter.ts +1 -1
- package/packages/omo-codex/plugin/components/rules/test/bundled-rules-priority.test.ts +4 -4
- package/packages/omo-codex/plugin/components/rules/test/bundled-rules.test.ts +1 -1
- package/packages/omo-codex/plugin/components/rules/test/dynamic-target-fingerprints.test.ts +1 -1
- package/packages/omo-codex/plugin/components/rules/test/engine.test.ts +3 -3
- package/packages/omo-codex/plugin/components/rules/test/finder.test.ts +2 -2
- package/packages/omo-codex/plugin/components/rules/test/formatter.test.ts +2 -2
- package/packages/omo-codex/plugin/components/rules/test/matcher.test.ts +2 -2
- package/packages/omo-codex/plugin/components/rules/test/parser.test.ts +1 -1
- package/packages/omo-codex/plugin/components/rules/test/post-compact-budget.test.ts +1 -1
- package/packages/omo-codex/plugin/components/rules/test/rules-engine-consumption.test.ts +92 -0
- package/packages/omo-codex/plugin/components/rules/test/scanner.test.ts +1 -1
- package/packages/omo-codex/plugin/components/rules/test/sources.test.ts +4 -4
- package/packages/omo-codex/plugin/components/rules/test/windows-git-bash-bundled-rule.test.ts +1 -1
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/cli.js +394 -37
- package/packages/omo-codex/plugin/components/start-work-continuation/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/start-work-continuation/package.json +4 -3
- package/packages/omo-codex/plugin/components/start-work-continuation/src/boulder-reader.ts +20 -147
- package/packages/omo-codex/plugin/components/start-work-continuation/src/codex-hook.ts +1 -1
- package/packages/omo-codex/plugin/components/start-work-continuation/src/index.ts +1 -1
- package/packages/omo-codex/plugin/components/start-work-continuation/test/boulder-reader.test.ts +151 -27
- package/packages/omo-codex/plugin/components/start-work-continuation/test/codex-hook.test.ts +87 -49
- package/packages/omo-codex/plugin/components/telemetry/LICENSE +21 -0
- package/packages/omo-codex/plugin/components/telemetry/NOTICE +6 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/cli.js +5869 -42
- package/packages/omo-codex/plugin/components/telemetry/dist/posthog.js +5783 -108
- package/packages/omo-codex/plugin/components/telemetry/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/telemetry/package.json +4 -5
- package/packages/omo-codex/plugin/components/telemetry/src/codex-hook.ts +3 -3
- package/packages/omo-codex/plugin/components/telemetry/src/posthog.ts +92 -142
- package/packages/omo-codex/plugin/components/telemetry/src/product-identity.ts +59 -3
- package/packages/omo-codex/plugin/components/telemetry/test/codex-hook-diagnostics.test.ts +3 -3
- package/packages/omo-codex/plugin/components/telemetry/test/diagnostics.test.ts +13 -7
- package/packages/omo-codex/plugin/components/ultrawork/AGENTS.md +2 -2
- package/packages/omo-codex/plugin/components/ultrawork/README.md +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/agents/explorer.toml +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-clone-fidelity-reviewer.toml +31 -0
- package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-code-reviewer.toml +29 -0
- package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-executor.toml +24 -0
- package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-gate-reviewer.toml +23 -0
- package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-qa-executor.toml +22 -0
- package/packages/omo-codex/plugin/components/ultrawork/agents/librarian.toml +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/agents/plan.toml +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/directive.md +104 -156
- package/packages/omo-codex/plugin/components/ultrawork/dist/cli.js +162 -37
- package/packages/omo-codex/plugin/components/ultrawork/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/package.json +4 -3
- package/packages/omo-codex/plugin/components/ultrawork/scripts/sync-directive.mjs +11 -0
- package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/SKILL.md +47 -20
- package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/references/full-workflow.md +55 -88
- package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/references/intent-clear.md +44 -0
- package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/references/intent-unclear.md +44 -0
- package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/scripts/scaffold-plan.mjs +301 -0
- package/packages/omo-codex/plugin/components/ultrawork/src/codex-hook.ts +2 -2
- package/packages/omo-codex/plugin/components/ultrawork/test/codex-hook-test-helpers.ts +101 -0
- package/packages/omo-codex/plugin/components/ultrawork/test/codex-hook-trigger-policy.test.ts +111 -0
- package/packages/omo-codex/plugin/components/ultrawork/test/codex-hook.test.ts +24 -128
- package/packages/omo-codex/plugin/components/ultrawork/test/directive-source.test.ts +16 -0
- package/packages/omo-codex/plugin/components/ultrawork/test/package-smoke.test.ts +4 -2
- package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint-reconciliation.d.ts +5 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint-reconciliation.js +79 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint.d.ts +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint.js +56 -82
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-commands.js +38 -144
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-subcommands.d.ts +10 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-subcommands.js +173 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli.js +2419 -32
- package/packages/omo-codex/plugin/components/ulw-loop/dist/codex-goal-instruction.js +13 -9
- package/packages/omo-codex/plugin/components/ulw-loop/dist/domain-types.d.ts +60 -12
- package/packages/omo-codex/plugin/components/ulw-loop/dist/evidence.d.ts +3 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/evidence.js +67 -10
- package/packages/omo-codex/plugin/components/ulw-loop/dist/goal-status.d.ts +3 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/goal-status.js +14 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/plan-crud.d.ts +2 -6
- package/packages/omo-codex/plugin/components/ulw-loop/dist/plan-crud.js +49 -39
- package/packages/omo-codex/plugin/components/ulw-loop/dist/plan-goal-factory.d.ts +8 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/plan-goal-factory.js +109 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-blockers.d.ts +5 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-blockers.js +41 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-fields.d.ts +8 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-fields.js +39 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate.d.ts +13 -6
- package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate.js +176 -105
- package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/ulw-loop/package.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/references/full-workflow.md +17 -17
- package/packages/omo-codex/plugin/components/ulw-loop/src/checkpoint-reconciliation.ts +100 -0
- package/packages/omo-codex/plugin/components/ulw-loop/src/checkpoint.ts +162 -85
- package/packages/omo-codex/plugin/components/ulw-loop/src/cli-commands.ts +62 -136
- package/packages/omo-codex/plugin/components/ulw-loop/src/cli-subcommands.ts +250 -0
- package/packages/omo-codex/plugin/components/ulw-loop/src/codex-goal-instruction.ts +18 -9
- package/packages/omo-codex/plugin/components/ulw-loop/src/domain-types.ts +67 -4
- package/packages/omo-codex/plugin/components/ulw-loop/src/evidence.ts +124 -18
- package/packages/omo-codex/plugin/components/ulw-loop/src/goal-status.ts +16 -0
- package/packages/omo-codex/plugin/components/ulw-loop/src/plan-crud.ts +131 -54
- package/packages/omo-codex/plugin/components/ulw-loop/src/plan-goal-factory.ts +124 -0
- package/packages/omo-codex/plugin/components/ulw-loop/src/quality-gate-blockers.ts +48 -0
- package/packages/omo-codex/plugin/components/ulw-loop/src/quality-gate-fields.ts +44 -0
- package/packages/omo-codex/plugin/components/ulw-loop/src/quality-gate.ts +230 -138
- package/packages/omo-codex/plugin/components/ulw-loop/test/checkpoint-final.test.ts +186 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/checkpoint-status.test.ts +85 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/checkpoint.test.ts +120 -192
- package/packages/omo-codex/plugin/components/ulw-loop/test/cli-checkpoint.test.ts +215 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/cli-commands.test.ts +1 -195
- package/packages/omo-codex/plugin/components/ulw-loop/test/cli-complete-goals.test.ts +15 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/cli-create-goals.test.ts +172 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/cli-helpers.test.ts +0 -6
- package/packages/omo-codex/plugin/components/ulw-loop/test/codex-goal-instruction.test.ts +39 -8
- package/packages/omo-codex/plugin/components/ulw-loop/test/evidence-criteria-gate.test.ts +29 -1
- package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/artifacts/browser-screenshot.txt +1 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/artifacts/cli-pass.txt +1 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/artifacts/code-review.md +1 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/artifacts/data-diff.txt +5 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/artifacts/gate-review.md +1 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/artifacts/http-dump.txt +4 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/artifacts/rejection.txt +1 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/checkpoint-builders.ts +98 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/quality-gate-builder.ts +91 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/sample-quality-gate.json +110 -8
- package/packages/omo-codex/plugin/components/ulw-loop/test/goal-status.test.ts +35 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/plan-crud.test.ts +11 -1
- package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate-blockers.test.ts +102 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate-doc.test.ts +38 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate-roles.test.ts +131 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate.test.ts +150 -176
- package/packages/omo-codex/plugin/components/ulw-loop/test/skill-contract.test.ts +12 -0
- package/packages/omo-codex/plugin/hooks/hooks.json +38 -17
- package/packages/omo-codex/plugin/package-lock.json +144 -49
- package/packages/omo-codex/plugin/package.json +4 -2
- package/packages/omo-codex/plugin/scripts/auto-update.mjs +2 -0
- package/packages/omo-codex/plugin/scripts/build-bundled-mcp-runtimes.mjs +0 -5
- package/packages/omo-codex/plugin/scripts/build-components.mjs +29 -5
- package/packages/omo-codex/plugin/scripts/hook-status-message.mjs +2 -0
- package/packages/omo-codex/plugin/scripts/migrate-omo-sot/editor.mjs +125 -0
- package/packages/omo-codex/plugin/scripts/migrate-omo-sot/jsonc.mjs +43 -0
- package/packages/omo-codex/plugin/scripts/migrate-omo-sot/scaffold.mjs +29 -0
- package/packages/omo-codex/plugin/scripts/migrate-omo-sot.mjs +121 -0
- package/packages/omo-codex/plugin/scripts/sync-skills.mjs +5 -5
- package/packages/omo-codex/plugin/shared/package.json +24 -0
- package/packages/omo-codex/plugin/shared/src/config-loader.ts +28 -0
- package/packages/omo-codex/plugin/shared/test/config-loader.test.ts +105 -0
- package/packages/omo-codex/plugin/shared/tsconfig.build.json +9 -0
- package/packages/omo-codex/plugin/shared/tsconfig.json +16 -0
- package/packages/omo-codex/plugin/skills/ast-grep/LICENSE +21 -0
- package/packages/omo-codex/plugin/skills/ast-grep/README.md +136 -0
- package/packages/omo-codex/plugin/skills/ast-grep/SKILL.md +272 -0
- package/packages/omo-codex/plugin/skills/ast-grep/SOURCE +1 -0
- package/packages/omo-codex/plugin/skills/ast-grep/install.ps1 +235 -0
- package/packages/omo-codex/plugin/skills/ast-grep/install.sh +286 -0
- package/packages/omo-codex/plugin/skills/ast-grep/references/cli.md +231 -0
- package/packages/omo-codex/plugin/skills/ast-grep/references/install.md +166 -0
- package/packages/omo-codex/plugin/skills/ast-grep/references/patterns.md +147 -0
- package/packages/omo-codex/plugin/skills/ast-grep/references/pitfalls.md +303 -0
- package/packages/omo-codex/plugin/skills/ast-grep/references/recipes.md +402 -0
- package/packages/omo-codex/plugin/skills/ast-grep/references/sgconfig.md +248 -0
- package/packages/omo-codex/plugin/skills/ast-grep/references/yaml-rules.md +509 -0
- package/packages/omo-codex/plugin/skills/ast-grep/scripts/ast_grep_helper.py +748 -0
- package/packages/omo-codex/plugin/skills/ast-grep/tests/smoke.ps1 +123 -0
- package/packages/omo-codex/plugin/skills/ast-grep/tests/smoke.sh +212 -0
- package/packages/omo-codex/plugin/skills/frontend/ATTRIBUTION.md +127 -0
- package/packages/omo-codex/plugin/skills/frontend/LICENSE-Apache-2.0.txt +201 -0
- package/packages/omo-codex/plugin/skills/frontend/SKILL.md +113 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/README.md +240 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/_INDEX.md +189 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/airbnb.md +390 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/airtable.md +89 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/apple.md +247 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/binance.md +345 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/bmw.md +180 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/brutalist-skill.md +92 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/bugatti.md +268 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/cal.md +259 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/claude.md +312 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/clay.md +304 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/clickhouse.md +281 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/cohere.md +266 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/coinbase.md +129 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/composio.md +307 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/cursor.md +309 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/design-system-architecture.md +217 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/elevenlabs.md +265 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/expo.md +281 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/ferrari.md +314 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/figma.md +220 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/framer.md +246 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/gpt-tasteskill.md +74 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/hashicorp.md +278 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/ibm.md +332 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/image-to-code-skill.md +1228 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/imagegen-brandkit.md +798 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/imagegen-frontend-mobile.md +1465 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/imagegen-frontend-web.md +686 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/intercom.md +146 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/kraken.md +125 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/lamborghini.md +288 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/linear.app.md +367 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/lovable.md +298 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/mastercard.md +365 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/meta.md +366 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/minimalist-skill.md +85 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/minimax.md +257 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/mintlify.md +326 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/miro.md +108 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/mistral.ai.md +261 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/mongodb.md +266 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/nike.md +363 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/notion.md +309 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/nvidia.md +293 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/ollama.md +267 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/opencode.ai.md +281 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/output-skill.md +49 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/pinterest.md +230 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/playstation.md +364 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/posthog.md +256 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/raycast.md +268 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/react-dev-tooling-skill.md +230 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/redesign-skill.md +178 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/renault.md +311 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/replicate.md +261 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/resend.md +303 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/revolut.md +185 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/runwayml.md +244 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/sanity.md +357 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/sentry.md +262 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/shopify.md +350 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/soft-skill.md +98 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/spacex.md +194 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/spotify.md +246 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/starbucks.md +580 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/stitch-skill.md +184 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/stripe.md +322 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/supabase.md +255 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/superhuman.md +252 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/taste-skill.md +226 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/tesla.md +286 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/theverge.md +339 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/together.ai.md +263 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/uber.md +295 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/vercel.md +310 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/vodafone.md +423 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/voltagent.md +323 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/warp.md +253 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/webflow.md +92 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/wired.md +278 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/wise.md +173 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/x.ai.md +257 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/zapier.md +328 -0
- package/packages/omo-codex/plugin/skills/frontend/references/perfection/README.md +160 -0
- package/packages/omo-codex/plugin/skills/frontend/references/perfection/react-perf-tooling.md +127 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/README.md +273 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/charts.csv +26 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/colors.csv +97 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/icons.csv +101 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/landing.csv +31 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/products.csv +97 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/react-performance.csv +45 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/stacks/astro.csv +54 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/stacks/flutter.csv +53 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/stacks/html-tailwind.csv +56 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/stacks/jetpack-compose.csv +53 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/stacks/nextjs.csv +53 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/stacks/nuxt-ui.csv +51 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/stacks/nuxtjs.csv +59 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/stacks/react-native.csv +52 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/stacks/react.csv +54 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/stacks/shadcn.csv +61 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/stacks/svelte.csv +54 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/stacks/swiftui.csv +51 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/stacks/vue.csv +50 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/styles.csv +68 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/typography.csv +58 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/ui-reasoning.csv +101 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/ux-guidelines.csv +100 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/web-interface.csv +31 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/scripts/core.py +253 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/scripts/design_system.py +1067 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/scripts/search.py +114 -0
- package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/lighthouse-audit.py +201 -0
- package/packages/omo-codex/plugin/skills/init-deep/SKILL.md +3 -3
- package/packages/omo-codex/plugin/skills/refactor/SKILL.md +14 -23
- package/packages/omo-codex/plugin/skills/remove-ai-slops/SKILL.md +2 -2
- package/packages/omo-codex/plugin/skills/review-work/SKILL.md +2 -2
- package/packages/omo-codex/plugin/skills/start-work/SKILL.md +3 -3
- package/packages/omo-codex/plugin/skills/ultraresearch/SKILL.md +2 -2
- package/packages/omo-codex/plugin/skills/ulw-loop/references/full-workflow.md +17 -17
- package/packages/omo-codex/plugin/skills/ulw-plan/SKILL.md +47 -20
- package/packages/omo-codex/plugin/skills/ulw-plan/references/full-workflow.md +55 -88
- package/packages/omo-codex/plugin/skills/ulw-plan/references/intent-clear.md +44 -0
- package/packages/omo-codex/plugin/skills/ulw-plan/references/intent-unclear.md +44 -0
- package/packages/omo-codex/plugin/skills/ulw-plan/scripts/scaffold-plan.mjs +301 -0
- package/packages/omo-codex/plugin/skills/visual-qa/SKILL.md +19 -3
- package/packages/omo-codex/plugin/skills/visual-qa/references/agent-browser-setup.md +44 -0
- package/packages/omo-codex/plugin/test/aggregate-agents.test.mjs +119 -11
- package/packages/omo-codex/plugin/test/aggregate-build.test.mjs +2 -4
- package/packages/omo-codex/plugin/test/aggregate-hooks.test.mjs +29 -2
- package/packages/omo-codex/plugin/test/aggregate-manifest.test.mjs +2 -0
- package/packages/omo-codex/plugin/test/aggregate-mcp.test.mjs +12 -12
- package/packages/omo-codex/plugin/test/auto-update.test.mjs +26 -0
- package/packages/omo-codex/plugin/test/component-bundled-cli.test.mjs +287 -0
- package/packages/omo-codex/plugin/test/component-hook-contract-cases.mjs +199 -0
- package/packages/omo-codex/plugin/test/hook-status-message.test.mjs +38 -2
- package/packages/omo-codex/plugin/test/index.js +13 -0
- package/packages/omo-codex/plugin/test/install-time-build-runtime.test.mjs +4 -5
- package/packages/omo-codex/plugin/test/mcp-research-servers.test.mjs +5 -3
- package/packages/omo-codex/plugin/test/migrate-omo-sot.test.mjs +179 -0
- package/packages/omo-codex/plugin/test/payload-equivalence.test.mjs +109 -0
- package/packages/omo-codex/plugin/test/scaffold-plan.test.mjs +165 -0
- package/packages/omo-codex/plugin/test/sync-skills-orchestration.test.mjs +6 -6
- package/packages/omo-codex/plugin/test/sync-skills-test-support.mjs +2 -3
- package/packages/omo-codex/plugin/test/sync-skills.test.mjs +37 -1
- package/packages/omo-codex/scripts/install-bin-links.test.mjs +3 -3
- package/packages/omo-codex/scripts/install-cache-copy.test.mjs +1 -1
- package/packages/omo-codex/scripts/install-cli-args.test.mjs +1 -1
- package/packages/omo-codex/scripts/install-config-autonomous-features.test.mjs +1 -1
- package/packages/omo-codex/scripts/install-config-autonomous.test.mjs +1 -1
- package/packages/omo-codex/scripts/install-config-git-bash.test.mjs +1 -1
- package/packages/omo-codex/scripts/install-config-preservation.test.mjs +1 -1
- package/packages/omo-codex/scripts/install-config-reasoning.test.mjs +1 -2
- package/packages/omo-codex/scripts/install-config.test.mjs +8 -6
- package/packages/omo-codex/scripts/install-delegated-command.test.mjs +1 -1
- package/packages/omo-codex/scripts/install-dist/install-local.mjs +13377 -0
- package/packages/omo-codex/scripts/install-generated-bundle.test.mjs +55 -0
- package/packages/omo-codex/scripts/install-git-bash-mcp-env.test.mjs +3 -4
- package/packages/omo-codex/scripts/install-hook-targets.test.mjs +1 -1
- package/packages/omo-codex/scripts/install-local.mjs +54 -237
- package/packages/omo-codex/scripts/install-local.test.mjs +8 -1
- package/packages/omo-codex/scripts/install-marketplace-cache.test.mjs +3 -3
- package/packages/omo-codex/scripts/install-mcp-runtime.test.mjs +34 -77
- package/packages/omo-codex/scripts/install-packaged-local.test.mjs +8 -4
- package/packages/omo-codex/scripts/install-project-local-cleanup.test.mjs +1 -1
- package/packages/shared-skills/package.json +6 -1
- package/packages/shared-skills/skills/ast-grep/LICENSE +21 -0
- package/packages/shared-skills/skills/ast-grep/README.md +136 -0
- package/packages/shared-skills/skills/ast-grep/SKILL.md +272 -0
- package/packages/shared-skills/skills/ast-grep/SOURCE +1 -0
- package/packages/shared-skills/skills/ast-grep/install.ps1 +235 -0
- package/packages/shared-skills/skills/ast-grep/install.sh +286 -0
- package/packages/shared-skills/skills/ast-grep/references/cli.md +231 -0
- package/packages/shared-skills/skills/ast-grep/references/install.md +166 -0
- package/packages/shared-skills/skills/ast-grep/references/patterns.md +147 -0
- package/packages/shared-skills/skills/ast-grep/references/pitfalls.md +303 -0
- package/packages/shared-skills/skills/ast-grep/references/recipes.md +402 -0
- package/packages/shared-skills/skills/ast-grep/references/sgconfig.md +248 -0
- package/packages/shared-skills/skills/ast-grep/references/yaml-rules.md +509 -0
- package/packages/shared-skills/skills/ast-grep/scripts/ast_grep_helper.py +748 -0
- package/packages/shared-skills/skills/ast-grep/tests/smoke.ps1 +123 -0
- package/packages/shared-skills/skills/ast-grep/tests/smoke.sh +212 -0
- package/packages/shared-skills/skills/frontend/ATTRIBUTION.md +127 -0
- package/packages/shared-skills/skills/frontend/LICENSE-Apache-2.0.txt +201 -0
- package/packages/shared-skills/skills/frontend/SKILL.md +113 -0
- package/packages/shared-skills/skills/frontend/references/design/README.md +240 -0
- package/packages/shared-skills/skills/frontend/references/design/_INDEX.md +189 -0
- package/packages/shared-skills/skills/frontend/references/design/airbnb.md +390 -0
- package/packages/shared-skills/skills/frontend/references/design/airtable.md +89 -0
- package/packages/shared-skills/skills/frontend/references/design/apple.md +247 -0
- package/packages/shared-skills/skills/frontend/references/design/binance.md +345 -0
- package/packages/shared-skills/skills/frontend/references/design/bmw.md +180 -0
- package/packages/shared-skills/skills/frontend/references/design/brutalist-skill.md +92 -0
- package/packages/shared-skills/skills/frontend/references/design/bugatti.md +268 -0
- package/packages/shared-skills/skills/frontend/references/design/cal.md +259 -0
- package/packages/shared-skills/skills/frontend/references/design/claude.md +312 -0
- package/packages/shared-skills/skills/frontend/references/design/clay.md +304 -0
- package/packages/shared-skills/skills/frontend/references/design/clickhouse.md +281 -0
- package/packages/shared-skills/skills/frontend/references/design/cohere.md +266 -0
- package/packages/shared-skills/skills/frontend/references/design/coinbase.md +129 -0
- package/packages/shared-skills/skills/frontend/references/design/composio.md +307 -0
- package/packages/shared-skills/skills/frontend/references/design/cursor.md +309 -0
- package/packages/shared-skills/skills/frontend/references/design/design-system-architecture.md +217 -0
- package/packages/shared-skills/skills/frontend/references/design/elevenlabs.md +265 -0
- package/packages/shared-skills/skills/frontend/references/design/expo.md +281 -0
- package/packages/shared-skills/skills/frontend/references/design/ferrari.md +314 -0
- package/packages/shared-skills/skills/frontend/references/design/figma.md +220 -0
- package/packages/shared-skills/skills/frontend/references/design/framer.md +246 -0
- package/packages/shared-skills/skills/frontend/references/design/gpt-tasteskill.md +74 -0
- package/packages/shared-skills/skills/frontend/references/design/hashicorp.md +278 -0
- package/packages/shared-skills/skills/frontend/references/design/ibm.md +332 -0
- package/packages/shared-skills/skills/frontend/references/design/image-to-code-skill.md +1228 -0
- package/packages/shared-skills/skills/frontend/references/design/imagegen-brandkit.md +798 -0
- package/packages/shared-skills/skills/frontend/references/design/imagegen-frontend-mobile.md +1465 -0
- package/packages/shared-skills/skills/frontend/references/design/imagegen-frontend-web.md +686 -0
- package/packages/shared-skills/skills/frontend/references/design/intercom.md +146 -0
- package/packages/shared-skills/skills/frontend/references/design/kraken.md +125 -0
- package/packages/shared-skills/skills/frontend/references/design/lamborghini.md +288 -0
- package/packages/shared-skills/skills/frontend/references/design/linear.app.md +367 -0
- package/packages/shared-skills/skills/frontend/references/design/lovable.md +298 -0
- package/packages/shared-skills/skills/frontend/references/design/mastercard.md +365 -0
- package/packages/shared-skills/skills/frontend/references/design/meta.md +366 -0
- package/packages/shared-skills/skills/frontend/references/design/minimalist-skill.md +85 -0
- package/packages/shared-skills/skills/frontend/references/design/minimax.md +257 -0
- package/packages/shared-skills/skills/frontend/references/design/mintlify.md +326 -0
- package/packages/shared-skills/skills/frontend/references/design/miro.md +108 -0
- package/packages/shared-skills/skills/frontend/references/design/mistral.ai.md +261 -0
- package/packages/shared-skills/skills/frontend/references/design/mongodb.md +266 -0
- package/packages/shared-skills/skills/frontend/references/design/nike.md +363 -0
- package/packages/shared-skills/skills/frontend/references/design/notion.md +309 -0
- package/packages/shared-skills/skills/frontend/references/design/nvidia.md +293 -0
- package/packages/shared-skills/skills/frontend/references/design/ollama.md +267 -0
- package/packages/shared-skills/skills/frontend/references/design/opencode.ai.md +281 -0
- package/packages/shared-skills/skills/frontend/references/design/output-skill.md +49 -0
- package/packages/shared-skills/skills/frontend/references/design/pinterest.md +230 -0
- package/packages/shared-skills/skills/frontend/references/design/playstation.md +364 -0
- package/packages/shared-skills/skills/frontend/references/design/posthog.md +256 -0
- package/packages/shared-skills/skills/frontend/references/design/raycast.md +268 -0
- package/packages/shared-skills/skills/frontend/references/design/react-dev-tooling-skill.md +230 -0
- package/packages/shared-skills/skills/frontend/references/design/redesign-skill.md +178 -0
- package/packages/shared-skills/skills/frontend/references/design/renault.md +311 -0
- package/packages/shared-skills/skills/frontend/references/design/replicate.md +261 -0
- package/packages/shared-skills/skills/frontend/references/design/resend.md +303 -0
- package/packages/shared-skills/skills/frontend/references/design/revolut.md +185 -0
- package/packages/shared-skills/skills/frontend/references/design/runwayml.md +244 -0
- package/packages/shared-skills/skills/frontend/references/design/sanity.md +357 -0
- package/packages/shared-skills/skills/frontend/references/design/sentry.md +262 -0
- package/packages/shared-skills/skills/frontend/references/design/shopify.md +350 -0
- package/packages/shared-skills/skills/frontend/references/design/soft-skill.md +98 -0
- package/packages/shared-skills/skills/frontend/references/design/spacex.md +194 -0
- package/packages/shared-skills/skills/frontend/references/design/spotify.md +246 -0
- package/packages/shared-skills/skills/frontend/references/design/starbucks.md +580 -0
- package/packages/shared-skills/skills/frontend/references/design/stitch-skill.md +184 -0
- package/packages/shared-skills/skills/frontend/references/design/stripe.md +322 -0
- package/packages/shared-skills/skills/frontend/references/design/supabase.md +255 -0
- package/packages/shared-skills/skills/frontend/references/design/superhuman.md +252 -0
- package/packages/shared-skills/skills/frontend/references/design/taste-skill.md +226 -0
- package/packages/shared-skills/skills/frontend/references/design/tesla.md +286 -0
- package/packages/shared-skills/skills/frontend/references/design/theverge.md +339 -0
- package/packages/shared-skills/skills/frontend/references/design/together.ai.md +263 -0
- package/packages/shared-skills/skills/frontend/references/design/uber.md +295 -0
- package/packages/shared-skills/skills/frontend/references/design/vercel.md +310 -0
- package/packages/shared-skills/skills/frontend/references/design/vodafone.md +423 -0
- package/packages/shared-skills/skills/frontend/references/design/voltagent.md +323 -0
- package/packages/shared-skills/skills/frontend/references/design/warp.md +253 -0
- package/packages/shared-skills/skills/frontend/references/design/webflow.md +92 -0
- package/packages/shared-skills/skills/frontend/references/design/wired.md +278 -0
- package/packages/shared-skills/skills/frontend/references/design/wise.md +173 -0
- package/packages/shared-skills/skills/frontend/references/design/x.ai.md +257 -0
- package/packages/shared-skills/skills/frontend/references/design/zapier.md +328 -0
- package/packages/shared-skills/skills/frontend/references/perfection/README.md +160 -0
- package/packages/shared-skills/skills/frontend/references/perfection/react-perf-tooling.md +127 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/README.md +273 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/charts.csv +26 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/colors.csv +97 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/icons.csv +101 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/landing.csv +31 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/products.csv +97 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/react-performance.csv +45 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/stacks/astro.csv +54 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/stacks/flutter.csv +53 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/stacks/html-tailwind.csv +56 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/stacks/jetpack-compose.csv +53 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/stacks/nextjs.csv +53 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/stacks/nuxt-ui.csv +51 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/stacks/nuxtjs.csv +59 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/stacks/react-native.csv +52 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/stacks/react.csv +54 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/stacks/shadcn.csv +61 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/stacks/svelte.csv +54 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/stacks/swiftui.csv +51 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/stacks/vue.csv +50 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/styles.csv +68 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/typography.csv +58 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/ui-reasoning.csv +101 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/ux-guidelines.csv +100 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/web-interface.csv +31 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/scripts/core.py +253 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/scripts/design_system.py +1067 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/scripts/search.py +114 -0
- package/packages/shared-skills/skills/frontend/scripts/perfection/lighthouse-audit.py +201 -0
- package/packages/shared-skills/skills/init-deep/SKILL.md +1 -1
- package/packages/shared-skills/skills/refactor/SKILL.md +12 -21
- package/packages/shared-skills/skills/review-work/SKILL.md +11 -9
- package/packages/shared-skills/skills/start-work/SKILL.md +5 -4
- package/packages/shared-skills/skills/ultraresearch/SKILL.md +9 -8
- package/packages/shared-skills/skills/ulw-plan/SKILL.md +69 -0
- package/packages/shared-skills/skills/ulw-plan/agents/openai.yaml +7 -0
- package/packages/shared-skills/skills/ulw-plan/references/full-workflow.md +99 -0
- package/packages/shared-skills/skills/ulw-plan/references/intent-clear.md +44 -0
- package/packages/shared-skills/skills/ulw-plan/references/intent-unclear.md +44 -0
- package/packages/shared-skills/skills/ulw-plan/scripts/scaffold-plan.mjs +301 -0
- package/packages/shared-skills/skills/visual-qa/SKILL.md +17 -1
- package/packages/shared-skills/skills/visual-qa/references/agent-browser-setup.md +44 -0
- package/packages/shared-skills/skills/visual-qa/scripts/skill-prompt-contract.test.ts +48 -4
- package/dist/cli/doctor/constants.d.ts +0 -32
- package/dist/cli/doctor/spawn-with-timeout.d.ts +0 -8
- package/dist/cli/doctor/types.d.ts +0 -148
- package/dist/features/builtin-skills/skills/frontend-ui-ux.d.ts +0 -2
- package/dist/mcp/ast-grep.d.ts +0 -11
- package/packages/ast-grep-mcp/dist/cli.js +0 -1159
- package/packages/lsp-tools-mcp/dist/lsp/cleanup-errors.js +0 -6
- package/packages/lsp-tools-mcp/dist/lsp/client-wrapper.js +0 -132
- package/packages/lsp-tools-mcp/dist/lsp/client.js +0 -131
- package/packages/lsp-tools-mcp/dist/lsp/config-loader.js +0 -220
- package/packages/lsp-tools-mcp/dist/lsp/connection.js +0 -66
- package/packages/lsp-tools-mcp/dist/lsp/constants.js +0 -10
- package/packages/lsp-tools-mcp/dist/lsp/directory-diagnostics.js +0 -125
- package/packages/lsp-tools-mcp/dist/lsp/effective-extension.js +0 -8
- package/packages/lsp-tools-mcp/dist/lsp/errors.js +0 -56
- package/packages/lsp-tools-mcp/dist/lsp/formatters.js +0 -106
- package/packages/lsp-tools-mcp/dist/lsp/infer-extension.js +0 -59
- package/packages/lsp-tools-mcp/dist/lsp/json-rpc-connection.js +0 -247
- package/packages/lsp-tools-mcp/dist/lsp/language-mappings.js +0 -170
- package/packages/lsp-tools-mcp/dist/lsp/process-signal-cleanup.js +0 -17
- package/packages/lsp-tools-mcp/dist/lsp/process.js +0 -153
- package/packages/lsp-tools-mcp/dist/lsp/server-definitions.js +0 -170
- package/packages/lsp-tools-mcp/dist/lsp/server-install-state.js +0 -51
- package/packages/lsp-tools-mcp/dist/lsp/server-installation.js +0 -40
- package/packages/lsp-tools-mcp/dist/lsp/server-resolution.js +0 -86
- package/packages/lsp-tools-mcp/dist/lsp/startup-failure.js +0 -35
- package/packages/lsp-tools-mcp/dist/lsp/transport.js +0 -241
- package/packages/lsp-tools-mcp/dist/lsp/types.js +0 -1
- package/packages/lsp-tools-mcp/dist/lsp/workspace-edit.js +0 -175
- package/packages/lsp-tools-mcp/dist/missing-dependency-result.js +0 -14
- package/packages/omo-codex/plugin/components/bootstrap/manifests/ast-grep.json +0 -22
- package/packages/omo-codex/plugin/components/comment-checker/dist/apply-patch.d.ts +0 -7
- package/packages/omo-codex/plugin/components/comment-checker/dist/apply-patch.js +0 -173
- package/packages/omo-codex/plugin/components/comment-checker/dist/codex-hook.d.ts +0 -22
- package/packages/omo-codex/plugin/components/comment-checker/dist/codex-hook.js +0 -165
- package/packages/omo-codex/plugin/components/comment-checker/dist/core-values.d.ts +0 -1
- package/packages/omo-codex/plugin/components/comment-checker/dist/core-values.js +0 -1
- package/packages/omo-codex/plugin/components/comment-checker/dist/core.d.ts +0 -5
- package/packages/omo-codex/plugin/components/comment-checker/dist/core.js +0 -4
- package/packages/omo-codex/plugin/components/comment-checker/dist/hook-input.d.ts +0 -6
- package/packages/omo-codex/plugin/components/comment-checker/dist/hook-input.js +0 -10
- package/packages/omo-codex/plugin/components/comment-checker/dist/record.d.ts +0 -2
- package/packages/omo-codex/plugin/components/comment-checker/dist/record.js +0 -11
- package/packages/omo-codex/plugin/components/comment-checker/dist/request-extractor.d.ts +0 -3
- package/packages/omo-codex/plugin/components/comment-checker/dist/request-extractor.js +0 -104
- package/packages/omo-codex/plugin/components/comment-checker/dist/runner.d.ts +0 -26
- package/packages/omo-codex/plugin/components/comment-checker/dist/runner.js +0 -144
- package/packages/omo-codex/plugin/components/comment-checker/dist/types.d.ts +0 -43
- package/packages/omo-codex/plugin/components/comment-checker/dist/types.js +0 -1
- package/packages/omo-codex/plugin/components/comment-checker/src/record.ts +0 -11
- package/packages/omo-codex/plugin/components/rules/dist/codex-hook-options.d.ts +0 -5
- package/packages/omo-codex/plugin/components/rules/dist/codex-hook-options.js +0 -1
- package/packages/omo-codex/plugin/components/rules/dist/codex-hook.d.ts +0 -47
- package/packages/omo-codex/plugin/components/rules/dist/codex-hook.js +0 -127
- package/packages/omo-codex/plugin/components/rules/dist/config.d.ts +0 -2
- package/packages/omo-codex/plugin/components/rules/dist/config.js +0 -100
- package/packages/omo-codex/plugin/components/rules/dist/context-pressure.d.ts +0 -2
- package/packages/omo-codex/plugin/components/rules/dist/context-pressure.js +0 -26
- package/packages/omo-codex/plugin/components/rules/dist/debug-log.d.ts +0 -8
- package/packages/omo-codex/plugin/components/rules/dist/debug-log.js +0 -36
- package/packages/omo-codex/plugin/components/rules/dist/dynamic-target-fingerprints.d.ts +0 -7
- package/packages/omo-codex/plugin/components/rules/dist/dynamic-target-fingerprints.js +0 -65
- package/packages/omo-codex/plugin/components/rules/dist/event-budget.d.ts +0 -3
- package/packages/omo-codex/plugin/components/rules/dist/event-budget.js +0 -14
- package/packages/omo-codex/plugin/components/rules/dist/hook-output.d.ts +0 -2
- package/packages/omo-codex/plugin/components/rules/dist/hook-output.js +0 -24
- package/packages/omo-codex/plugin/components/rules/dist/path-utils.d.ts +0 -4
- package/packages/omo-codex/plugin/components/rules/dist/path-utils.js +0 -24
- package/packages/omo-codex/plugin/components/rules/dist/persistent-cache.d.ts +0 -13
- package/packages/omo-codex/plugin/components/rules/dist/persistent-cache.js +0 -172
- package/packages/omo-codex/plugin/components/rules/dist/post-compact-budget.d.ts +0 -6
- package/packages/omo-codex/plugin/components/rules/dist/post-compact-budget.js +0 -74
- package/packages/omo-codex/plugin/components/rules/dist/post-compact-claim.d.ts +0 -4
- package/packages/omo-codex/plugin/components/rules/dist/post-compact-claim.js +0 -6
- package/packages/omo-codex/plugin/components/rules/dist/post-compact-directive.d.ts +0 -1
- package/packages/omo-codex/plugin/components/rules/dist/post-compact-directive.js +0 -32
- package/packages/omo-codex/plugin/components/rules/dist/post-compact-state.d.ts +0 -13
- package/packages/omo-codex/plugin/components/rules/dist/post-compact-state.js +0 -29
- package/packages/omo-codex/plugin/components/rules/dist/rules/cache.d.ts +0 -9
- package/packages/omo-codex/plugin/components/rules/dist/rules/cache.js +0 -51
- package/packages/omo-codex/plugin/components/rules/dist/rules/constants.d.ts +0 -70
- package/packages/omo-codex/plugin/components/rules/dist/rules/constants.js +0 -101
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-dynamic-cache.d.ts +0 -5
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-dynamic-cache.js +0 -60
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-dynamic-loader.d.ts +0 -6
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-dynamic-loader.js +0 -61
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-loader.d.ts +0 -7
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-loader.js +0 -60
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-paths.d.ts +0 -11
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-paths.js +0 -75
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-static-loader.d.ts +0 -6
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-static-loader.js +0 -29
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-types.d.ts +0 -44
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-types.js +0 -1
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine.d.ts +0 -5
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine.js +0 -85
- package/packages/omo-codex/plugin/components/rules/dist/rules/errors.d.ts +0 -6
- package/packages/omo-codex/plugin/components/rules/dist/rules/errors.js +0 -12
- package/packages/omo-codex/plugin/components/rules/dist/rules/finder-cache.d.ts +0 -14
- package/packages/omo-codex/plugin/components/rules/dist/rules/finder-cache.js +0 -51
- package/packages/omo-codex/plugin/components/rules/dist/rules/finder-paths.d.ts +0 -6
- package/packages/omo-codex/plugin/components/rules/dist/rules/finder-paths.js +0 -33
- package/packages/omo-codex/plugin/components/rules/dist/rules/finder-sources.d.ts +0 -5
- package/packages/omo-codex/plugin/components/rules/dist/rules/finder-sources.js +0 -40
- package/packages/omo-codex/plugin/components/rules/dist/rules/finder.d.ts +0 -28
- package/packages/omo-codex/plugin/components/rules/dist/rules/finder.js +0 -146
- package/packages/omo-codex/plugin/components/rules/dist/rules/formatter.d.ts +0 -7
- package/packages/omo-codex/plugin/components/rules/dist/rules/formatter.js +0 -112
- package/packages/omo-codex/plugin/components/rules/dist/rules/matcher.d.ts +0 -18
- package/packages/omo-codex/plugin/components/rules/dist/rules/matcher.js +0 -93
- package/packages/omo-codex/plugin/components/rules/dist/rules/ordering.d.ts +0 -3
- package/packages/omo-codex/plugin/components/rules/dist/rules/ordering.js +0 -27
- package/packages/omo-codex/plugin/components/rules/dist/rules/parser-frontmatter.d.ts +0 -7
- package/packages/omo-codex/plugin/components/rules/dist/rules/parser-frontmatter.js +0 -30
- package/packages/omo-codex/plugin/components/rules/dist/rules/parser-yaml.d.ts +0 -2
- package/packages/omo-codex/plugin/components/rules/dist/rules/parser-yaml.js +0 -237
- package/packages/omo-codex/plugin/components/rules/dist/rules/parser.d.ts +0 -3
- package/packages/omo-codex/plugin/components/rules/dist/rules/parser.js +0 -31
- package/packages/omo-codex/plugin/components/rules/dist/rules/plugin-root.d.ts +0 -1
- package/packages/omo-codex/plugin/components/rules/dist/rules/plugin-root.js +0 -48
- package/packages/omo-codex/plugin/components/rules/dist/rules/project-root.d.ts +0 -1
- package/packages/omo-codex/plugin/components/rules/dist/rules/project-root.js +0 -23
- package/packages/omo-codex/plugin/components/rules/dist/rules/scanner.d.ts +0 -14
- package/packages/omo-codex/plugin/components/rules/dist/rules/scanner.js +0 -111
- package/packages/omo-codex/plugin/components/rules/dist/rules/sources.d.ts +0 -3
- package/packages/omo-codex/plugin/components/rules/dist/rules/sources.js +0 -9
- package/packages/omo-codex/plugin/components/rules/dist/rules/truncator.d.ts +0 -18
- package/packages/omo-codex/plugin/components/rules/dist/rules/truncator.js +0 -59
- package/packages/omo-codex/plugin/components/rules/dist/rules/types.d.ts +0 -126
- package/packages/omo-codex/plugin/components/rules/dist/rules/types.js +0 -8
- package/packages/omo-codex/plugin/components/rules/dist/rules-engine-factory.d.ts +0 -6
- package/packages/omo-codex/plugin/components/rules/dist/rules-engine-factory.js +0 -20
- package/packages/omo-codex/plugin/components/rules/dist/session-state-lock.d.ts +0 -3
- package/packages/omo-codex/plugin/components/rules/dist/session-state-lock.js +0 -41
- package/packages/omo-codex/plugin/components/rules/dist/sparkshell-awareness.d.ts +0 -10
- package/packages/omo-codex/plugin/components/rules/dist/sparkshell-awareness.js +0 -90
- package/packages/omo-codex/plugin/components/rules/dist/static-injection.d.ts +0 -3
- package/packages/omo-codex/plugin/components/rules/dist/static-injection.js +0 -128
- package/packages/omo-codex/plugin/components/rules/dist/tool-paths.d.ts +0 -6
- package/packages/omo-codex/plugin/components/rules/dist/tool-paths.js +0 -168
- package/packages/omo-codex/plugin/components/rules/dist/transcript-rule-filter.d.ts +0 -4
- package/packages/omo-codex/plugin/components/rules/dist/transcript-rule-filter.js +0 -49
- package/packages/omo-codex/plugin/components/rules/dist/transcript-search.d.ts +0 -4
- package/packages/omo-codex/plugin/components/rules/dist/transcript-search.js +0 -91
- package/packages/omo-codex/plugin/components/rules/src/rules/cache.ts +0 -64
- package/packages/omo-codex/plugin/components/rules/src/rules/constants.ts +0 -122
- package/packages/omo-codex/plugin/components/rules/src/rules/engine-dynamic-cache.ts +0 -87
- package/packages/omo-codex/plugin/components/rules/src/rules/engine-dynamic-loader.ts +0 -94
- package/packages/omo-codex/plugin/components/rules/src/rules/engine-loader.ts +0 -84
- package/packages/omo-codex/plugin/components/rules/src/rules/engine-paths.ts +0 -103
- package/packages/omo-codex/plugin/components/rules/src/rules/engine-static-loader.ts +0 -43
- package/packages/omo-codex/plugin/components/rules/src/rules/engine-types.ts +0 -45
- package/packages/omo-codex/plugin/components/rules/src/rules/engine.ts +0 -123
- package/packages/omo-codex/plugin/components/rules/src/rules/errors.ts +0 -13
- package/packages/omo-codex/plugin/components/rules/src/rules/finder-cache.ts +0 -73
- package/packages/omo-codex/plugin/components/rules/src/rules/finder-paths.ts +0 -47
- package/packages/omo-codex/plugin/components/rules/src/rules/finder-sources.ts +0 -45
- package/packages/omo-codex/plugin/components/rules/src/rules/finder.ts +0 -220
- package/packages/omo-codex/plugin/components/rules/src/rules/formatter.ts +0 -149
- package/packages/omo-codex/plugin/components/rules/src/rules/matcher.ts +0 -142
- package/packages/omo-codex/plugin/components/rules/src/rules/ordering.ts +0 -33
- package/packages/omo-codex/plugin/components/rules/src/rules/parser-frontmatter.ts +0 -39
- package/packages/omo-codex/plugin/components/rules/src/rules/parser-yaml.ts +0 -271
- package/packages/omo-codex/plugin/components/rules/src/rules/parser.ts +0 -35
- package/packages/omo-codex/plugin/components/rules/src/rules/plugin-root.ts +0 -55
- package/packages/omo-codex/plugin/components/rules/src/rules/project-root.ts +0 -30
- package/packages/omo-codex/plugin/components/rules/src/rules/scanner.ts +0 -162
- package/packages/omo-codex/plugin/components/rules/src/rules/sources.ts +0 -13
- package/packages/omo-codex/plugin/components/rules/src/rules/truncator.ts +0 -84
- package/packages/omo-codex/plugin/components/rules/src/rules/types.ts +0 -141
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/boulder-reader.d.ts +0 -16
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/boulder-reader.js +0 -146
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/cli.d.ts +0 -2
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/codex-hook.d.ts +0 -2
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/codex-hook.js +0 -80
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/directive.d.ts +0 -1
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/directive.js +0 -2
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/index.d.ts +0 -5
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/index.js +0 -3
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/types.d.ts +0 -20
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/types.js +0 -1
- package/packages/omo-codex/plugin/components/telemetry/dist/atomic-write.d.ts +0 -1
- package/packages/omo-codex/plugin/components/telemetry/dist/atomic-write.js +0 -18
- package/packages/omo-codex/plugin/components/telemetry/dist/cli.d.ts +0 -2
- package/packages/omo-codex/plugin/components/telemetry/dist/codex-hook.d.ts +0 -15
- package/packages/omo-codex/plugin/components/telemetry/dist/codex-hook.js +0 -42
- package/packages/omo-codex/plugin/components/telemetry/dist/data-path.d.ts +0 -10
- package/packages/omo-codex/plugin/components/telemetry/dist/data-path.js +0 -35
- package/packages/omo-codex/plugin/components/telemetry/dist/diagnostics.d.ts +0 -12
- package/packages/omo-codex/plugin/components/telemetry/dist/diagnostics.js +0 -108
- package/packages/omo-codex/plugin/components/telemetry/dist/env-flags.d.ts +0 -4
- package/packages/omo-codex/plugin/components/telemetry/dist/env-flags.js +0 -31
- package/packages/omo-codex/plugin/components/telemetry/dist/posthog-activity-state.d.ts +0 -8
- package/packages/omo-codex/plugin/components/telemetry/dist/posthog-activity-state.js +0 -68
- package/packages/omo-codex/plugin/components/telemetry/dist/posthog.d.ts +0 -21
- package/packages/omo-codex/plugin/components/telemetry/dist/product-identity.d.ts +0 -8
- package/packages/omo-codex/plugin/components/telemetry/dist/product-identity.js +0 -29
- package/packages/omo-codex/plugin/components/telemetry/src/atomic-write.ts +0 -22
- package/packages/omo-codex/plugin/components/telemetry/src/data-path.ts +0 -45
- package/packages/omo-codex/plugin/components/telemetry/src/diagnostics.ts +0 -154
- package/packages/omo-codex/plugin/components/telemetry/src/env-flags.ts +0 -43
- package/packages/omo-codex/plugin/components/telemetry/src/posthog-activity-state.ts +0 -97
- package/packages/omo-codex/plugin/components/ultrawork/agents/codex-ultrawork-reviewer.toml +0 -21
- package/packages/omo-codex/plugin/components/ultrawork/dist/cli.d.ts +0 -2
- package/packages/omo-codex/plugin/components/ultrawork/dist/codex-hook.d.ts +0 -7
- package/packages/omo-codex/plugin/components/ultrawork/dist/codex-hook.js +0 -122
- package/packages/omo-codex/plugin/components/ultrawork/dist/directive.d.ts +0 -1
- package/packages/omo-codex/plugin/components/ultrawork/dist/directive.js +0 -2
- package/packages/omo-codex/plugin/skills/frontend-ui-ux/SKILL.md +0 -77
- package/packages/omo-codex/plugin/test/start-work-skill.test.mjs +0 -85
- package/packages/omo-codex/plugin/test/ulw-plan-skill.test.mjs +0 -89
- package/packages/omo-codex/scripts/atomic-write.test.mjs +0 -82
- package/packages/omo-codex/scripts/install/agent-source-roots.mjs +0 -13
- package/packages/omo-codex/scripts/install/agents.d.mts +0 -18
- package/packages/omo-codex/scripts/install/agents.mjs +0 -227
- package/packages/omo-codex/scripts/install/atomic-write.mjs +0 -59
- package/packages/omo-codex/scripts/install/bin-dir.d.mts +0 -7
- package/packages/omo-codex/scripts/install/bin-dir.mjs +0 -20
- package/packages/omo-codex/scripts/install/bin-links.d.mts +0 -18
- package/packages/omo-codex/scripts/install/bin-links.mjs +0 -276
- package/packages/omo-codex/scripts/install/cache.mjs +0 -295
- package/packages/omo-codex/scripts/install/cached-marketplace-manifest.mjs +0 -21
- package/packages/omo-codex/scripts/install/cli-args.mjs +0 -149
- package/packages/omo-codex/scripts/install/command-shim.mjs +0 -1
- package/packages/omo-codex/scripts/install/config.d.mts +0 -35
- package/packages/omo-codex/scripts/install/config.mjs +0 -267
- package/packages/omo-codex/scripts/install/delegated-command.mjs +0 -29
- package/packages/omo-codex/scripts/install/git-bash-mcp-env.d.mts +0 -5
- package/packages/omo-codex/scripts/install/git-bash-mcp-env.mjs +0 -28
- package/packages/omo-codex/scripts/install/git-bash.d.mts +0 -23
- package/packages/omo-codex/scripts/install/git-bash.mjs +0 -107
- package/packages/omo-codex/scripts/install/git-bash.test.mjs +0 -209
- package/packages/omo-codex/scripts/install/hook-targets.mjs +0 -46
- package/packages/omo-codex/scripts/install/hook-trust.d.mts +0 -10
- package/packages/omo-codex/scripts/install/hook-trust.mjs +0 -84
- package/packages/omo-codex/scripts/install/lazycodex-version-stamp.mjs +0 -102
- package/packages/omo-codex/scripts/install/legacy-bins.mjs +0 -66
- package/packages/omo-codex/scripts/install/marketplace.mjs +0 -104
- package/packages/omo-codex/scripts/install/mcp-runtime-cache.mjs +0 -81
- package/packages/omo-codex/scripts/install/model-catalog.mjs +0 -74
- package/packages/omo-codex/scripts/install/multi-agent-v2-config.mjs +0 -50
- package/packages/omo-codex/scripts/install/permissions.d.mts +0 -1
- package/packages/omo-codex/scripts/install/permissions.mjs +0 -37
- package/packages/omo-codex/scripts/install/process.mjs +0 -22
- package/packages/omo-codex/scripts/install/project-local-cleanup.mjs +0 -228
- package/packages/omo-codex/scripts/install/reasoning-config.mjs +0 -72
- package/packages/omo-codex/scripts/install/snapshot.mjs +0 -53
- package/packages/omo-codex/scripts/install/source-package-build.mjs +0 -20
- package/packages/omo-codex/scripts/install/toml-editor.mjs +0 -64
- package/packages/omo-codex/scripts/install/utils.mjs +0 -15
- package/packages/omo-codex/scripts/sync-telemetry-component.mjs +0 -116
- package/packages/omo-codex/scripts/sync-telemetry-component.test.mjs +0 -94
- package/packages/shared-skills/skills/frontend-ui-ux/SKILL.md +0 -77
- /package/dist/cli/doctor/{doctor-target.d.ts → framework/doctor-target.d.ts} +0 -0
- /package/dist/cli/doctor/{format-default.d.ts → framework/format-default.d.ts} +0 -0
- /package/dist/cli/doctor/{format-shared.d.ts → framework/format-shared.d.ts} +0 -0
- /package/dist/cli/doctor/{format-status.d.ts → framework/format-status.d.ts} +0 -0
- /package/dist/cli/doctor/{format-verbose.d.ts → framework/format-verbose.d.ts} +0 -0
- /package/dist/cli/doctor/{formatter.d.ts → framework/formatter.d.ts} +0 -0
- /package/packages/omo-codex/plugin/components/{comment-checker → codegraph}/dist/cli.d.ts +0 -0
- /package/packages/omo-codex/plugin/components/{rules → lazycodex-executor-verify}/dist/cli.d.ts +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
// src/cli.ts
|
|
3
|
+
// components/bootstrap/src/cli.ts
|
|
4
4
|
import { realpathSync } from "node:fs";
|
|
5
5
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
6
6
|
|
|
7
|
-
// src/download.ts
|
|
7
|
+
// components/bootstrap/src/download.ts
|
|
8
8
|
import { createHash, randomUUID } from "node:crypto";
|
|
9
9
|
import { createWriteStream } from "node:fs";
|
|
10
10
|
import { mkdir, readFile, rename, rm } from "node:fs/promises";
|
|
@@ -12,44 +12,42 @@ import { basename, dirname, join } from "node:path";
|
|
|
12
12
|
import { Readable } from "node:stream";
|
|
13
13
|
import { pipeline } from "node:stream/promises";
|
|
14
14
|
import { fileURLToPath } from "node:url";
|
|
15
|
-
|
|
15
|
+
|
|
16
|
+
class DownloadError extends Error {
|
|
16
17
|
code;
|
|
17
18
|
constructor(code, message) {
|
|
18
19
|
super(message);
|
|
19
20
|
this.name = "DownloadError";
|
|
20
21
|
this.code = code;
|
|
21
22
|
}
|
|
22
|
-
}
|
|
23
|
-
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
class ChecksumMismatchError extends DownloadError {
|
|
24
26
|
expectedSha256;
|
|
25
27
|
actualSha256;
|
|
26
28
|
constructor(options) {
|
|
27
|
-
super(
|
|
28
|
-
"checksum-mismatch",
|
|
29
|
-
`Checksum mismatch for ${options.url}: expected sha256 ${options.expectedSha256} but downloaded sha256 ${options.actualSha256}; deleted the partial download.`
|
|
30
|
-
);
|
|
29
|
+
super("checksum-mismatch", `Checksum mismatch for ${options.url}: expected sha256 ${options.expectedSha256} but downloaded sha256 ${options.actualSha256}; deleted the partial download.`);
|
|
31
30
|
this.name = "ChecksumMismatchError";
|
|
32
31
|
this.expectedSha256 = options.expectedSha256;
|
|
33
32
|
this.actualSha256 = options.actualSha256;
|
|
34
33
|
}
|
|
35
|
-
}
|
|
36
|
-
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
class UnsupportedPlatformError extends DownloadError {
|
|
37
37
|
manifestName;
|
|
38
38
|
platformKey;
|
|
39
39
|
constructor(options) {
|
|
40
|
-
super(
|
|
41
|
-
"unsupported-platform",
|
|
42
|
-
`Manifest "${options.manifestName}" has no asset for unsupported platform "${options.platformKey}" (available: ${options.availablePlatforms.join(", ")}).`
|
|
43
|
-
);
|
|
40
|
+
super("unsupported-platform", `Manifest "${options.manifestName}" has no asset for unsupported platform "${options.platformKey}" (available: ${options.availablePlatforms.join(", ")}).`);
|
|
44
41
|
this.name = "UnsupportedPlatformError";
|
|
45
42
|
this.manifestName = options.manifestName;
|
|
46
43
|
this.platformKey = options.platformKey;
|
|
47
44
|
}
|
|
48
|
-
}
|
|
45
|
+
}
|
|
49
46
|
var PROXY_ENV_KEYS = ["HTTPS_PROXY", "https_proxy", "HTTP_PROXY", "http_proxy"];
|
|
50
47
|
function proxyLimitationNote(env) {
|
|
51
48
|
const configuredKey = PROXY_ENV_KEYS.find((key) => (env[key] ?? "").trim().length > 0);
|
|
52
|
-
if (configuredKey ===
|
|
49
|
+
if (configuredKey === undefined)
|
|
50
|
+
return "";
|
|
53
51
|
return ` Note: ${configuredKey} is set, but the bootstrap downloader does not tunnel through HTTP(S) proxies in v1; the download was attempted directly.`;
|
|
54
52
|
}
|
|
55
53
|
function describeFailure(error) {
|
|
@@ -61,17 +59,13 @@ async function writeBodyToFile(body, tempPath) {
|
|
|
61
59
|
await pipeline(Readable.from([]), createWriteStream(tempPath));
|
|
62
60
|
return hash.digest("hex");
|
|
63
61
|
}
|
|
64
|
-
await pipeline(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
createWriteStream(tempPath)
|
|
74
|
-
);
|
|
62
|
+
await pipeline(Readable.fromWeb(body), async function* hashChunks(source) {
|
|
63
|
+
for await (const chunk of source) {
|
|
64
|
+
const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
65
|
+
hash.update(buffer);
|
|
66
|
+
yield buffer;
|
|
67
|
+
}
|
|
68
|
+
}, createWriteStream(tempPath));
|
|
75
69
|
return hash.digest("hex");
|
|
76
70
|
}
|
|
77
71
|
async function downloadChecksummedAsset(options) {
|
|
@@ -84,26 +78,17 @@ async function downloadChecksummedAsset(options) {
|
|
|
84
78
|
try {
|
|
85
79
|
response = await fetchImpl(options.url);
|
|
86
80
|
} catch (error) {
|
|
87
|
-
throw new DownloadError(
|
|
88
|
-
"download-failed",
|
|
89
|
-
`Download failed for ${options.url}: ${describeFailure(error)}.${proxyLimitationNote(env)}`
|
|
90
|
-
);
|
|
81
|
+
throw new DownloadError("download-failed", `Download failed for ${options.url}: ${describeFailure(error)}.${proxyLimitationNote(env)}`);
|
|
91
82
|
}
|
|
92
83
|
if (!response.ok) {
|
|
93
|
-
throw new DownloadError(
|
|
94
|
-
"download-failed",
|
|
95
|
-
`Download failed for ${options.url}: HTTP ${response.status}.${proxyLimitationNote(env)}`
|
|
96
|
-
);
|
|
84
|
+
throw new DownloadError("download-failed", `Download failed for ${options.url}: HTTP ${response.status}.${proxyLimitationNote(env)}`);
|
|
97
85
|
}
|
|
98
86
|
let actualSha256;
|
|
99
87
|
try {
|
|
100
88
|
actualSha256 = await writeBodyToFile(response.body, tempPath);
|
|
101
89
|
} catch (error) {
|
|
102
90
|
await rm(tempPath, { force: true });
|
|
103
|
-
throw new DownloadError(
|
|
104
|
-
"download-failed",
|
|
105
|
-
`Download failed for ${options.url} while writing the response body: ${describeFailure(error)}.${proxyLimitationNote(env)}`
|
|
106
|
-
);
|
|
91
|
+
throw new DownloadError("download-failed", `Download failed for ${options.url} while writing the response body: ${describeFailure(error)}.${proxyLimitationNote(env)}`);
|
|
107
92
|
}
|
|
108
93
|
if (actualSha256 !== expectedSha256) {
|
|
109
94
|
await rm(tempPath, { force: true });
|
|
@@ -143,7 +128,7 @@ async function loadAssetManifest(manifestName, manifestsDir) {
|
|
|
143
128
|
async function downloadFromManifest(options) {
|
|
144
129
|
const manifest = await loadAssetManifest(options.manifestName, options.manifestsDir);
|
|
145
130
|
const asset = manifest.platforms[options.platformKey];
|
|
146
|
-
if (asset ===
|
|
131
|
+
if (asset === undefined) {
|
|
147
132
|
throw new UnsupportedPlatformError({
|
|
148
133
|
availablePlatforms: Object.keys(manifest.platforms),
|
|
149
134
|
manifestName: options.manifestName,
|
|
@@ -155,28 +140,30 @@ async function downloadFromManifest(options) {
|
|
|
155
140
|
destination,
|
|
156
141
|
sha256: asset.sha256,
|
|
157
142
|
url: asset.url,
|
|
158
|
-
...options.fetchImpl ===
|
|
159
|
-
...options.env ===
|
|
143
|
+
...options.fetchImpl === undefined ? {} : { fetchImpl: options.fetchImpl },
|
|
144
|
+
...options.env === undefined ? {} : { env: options.env }
|
|
160
145
|
});
|
|
161
146
|
}
|
|
162
147
|
|
|
163
|
-
// src/hook.ts
|
|
164
|
-
import { spawn } from "node:child_process";
|
|
148
|
+
// components/bootstrap/src/hook.ts
|
|
149
|
+
import { spawn as spawn2 } from "node:child_process";
|
|
165
150
|
import { stat as stat5 } from "node:fs/promises";
|
|
166
151
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
167
152
|
|
|
168
|
-
//
|
|
153
|
+
// scripts/auto-update-state.mjs
|
|
169
154
|
import { appendFile, mkdir as mkdir2, open, readFile as readFile2, rm as rm2, stat, writeFile } from "node:fs/promises";
|
|
170
155
|
import { homedir } from "node:os";
|
|
171
156
|
import { dirname as dirname2, join as join2 } from "node:path";
|
|
172
|
-
var DEFAULT_LOCK_STALE_MS = 10 * 60 *
|
|
157
|
+
var DEFAULT_LOCK_STALE_MS = 10 * 60 * 1000;
|
|
173
158
|
function resolveStatePath(env) {
|
|
174
|
-
if (env.LAZYCODEX_AUTO_UPDATE_STATE_PATH?.trim())
|
|
159
|
+
if (env.LAZYCODEX_AUTO_UPDATE_STATE_PATH?.trim())
|
|
160
|
+
return env.LAZYCODEX_AUTO_UPDATE_STATE_PATH;
|
|
175
161
|
const dataRoot = env.PLUGIN_DATA?.trim() || join2(homedir(), ".local", "share", "lazycodex");
|
|
176
162
|
return join2(dataRoot, "auto-update.json");
|
|
177
163
|
}
|
|
178
164
|
function resolveLockPath(env, statePath) {
|
|
179
|
-
if (env.LAZYCODEX_AUTO_UPDATE_LOCK_PATH?.trim())
|
|
165
|
+
if (env.LAZYCODEX_AUTO_UPDATE_LOCK_PATH?.trim())
|
|
166
|
+
return env.LAZYCODEX_AUTO_UPDATE_LOCK_PATH;
|
|
180
167
|
return `${statePath}.lock`;
|
|
181
168
|
}
|
|
182
169
|
async function acquireLock(lockPath, now, staleMs = DEFAULT_LOCK_STALE_MS) {
|
|
@@ -190,8 +177,10 @@ async function acquireLock(lockPath, now, staleMs = DEFAULT_LOCK_STALE_MS) {
|
|
|
190
177
|
release: () => rm2(lockPath, { force: true })
|
|
191
178
|
};
|
|
192
179
|
} catch (error) {
|
|
193
|
-
if (!(error instanceof Error && "code" in error && error.code === "EEXIST"))
|
|
194
|
-
|
|
180
|
+
if (!(error instanceof Error && ("code" in error) && error.code === "EEXIST"))
|
|
181
|
+
throw error;
|
|
182
|
+
if (!await removeStaleLock(lockPath, now, staleMs))
|
|
183
|
+
return null;
|
|
195
184
|
return acquireLock(lockPath, now, 0);
|
|
196
185
|
}
|
|
197
186
|
}
|
|
@@ -201,7 +190,8 @@ async function readState(statePath) {
|
|
|
201
190
|
const parsed = JSON.parse(raw);
|
|
202
191
|
return typeof parsed === "object" && parsed !== null ? parsed : {};
|
|
203
192
|
} catch (error) {
|
|
204
|
-
if (error instanceof Error && "code" in error && error.code === "ENOENT")
|
|
193
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT")
|
|
194
|
+
return {};
|
|
205
195
|
return {};
|
|
206
196
|
}
|
|
207
197
|
}
|
|
@@ -211,19 +201,22 @@ async function writeState(statePath, state) {
|
|
|
211
201
|
`);
|
|
212
202
|
}
|
|
213
203
|
async function removeStaleLock(lockPath, now, staleMs) {
|
|
214
|
-
if (staleMs <= 0)
|
|
204
|
+
if (staleMs <= 0)
|
|
205
|
+
return false;
|
|
215
206
|
try {
|
|
216
207
|
const lockStat = await stat(lockPath);
|
|
217
|
-
if (now - lockStat.mtimeMs < staleMs)
|
|
208
|
+
if (now - lockStat.mtimeMs < staleMs)
|
|
209
|
+
return false;
|
|
218
210
|
await rm2(lockPath, { force: true });
|
|
219
211
|
return true;
|
|
220
212
|
} catch (error) {
|
|
221
|
-
if (error instanceof Error && "code" in error && error.code === "ENOENT")
|
|
213
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT")
|
|
214
|
+
return true;
|
|
222
215
|
throw error;
|
|
223
216
|
}
|
|
224
217
|
}
|
|
225
218
|
|
|
226
|
-
// src/environment.ts
|
|
219
|
+
// components/bootstrap/src/environment.ts
|
|
227
220
|
import { stat as stat2 } from "node:fs/promises";
|
|
228
221
|
import { readFile as readFile3 } from "node:fs/promises";
|
|
229
222
|
import { homedir as homedir2 } from "node:os";
|
|
@@ -236,11 +229,11 @@ async function detectInstallFlowDetailed(options) {
|
|
|
236
229
|
const snapshotPresent = await isFile(join3(options.pluginRoot, INSTALL_SNAPSHOT_FILENAME));
|
|
237
230
|
const snapshotSignal = snapshotPresent ? "npx-local" : "marketplace";
|
|
238
231
|
const snapshotReason = snapshotPresent ? `${INSTALL_SNAPSHOT_FILENAME} present at plugin root (written only by the npx installer)` : `${INSTALL_SNAPSHOT_FILENAME} absent from plugin root`;
|
|
239
|
-
const scan = options.configToml ===
|
|
232
|
+
const scan = options.configToml === undefined ? { kind: "absent" } : scanMarketplaceSource(options.configToml, marketplaceName);
|
|
240
233
|
if (scan.kind === "absent") {
|
|
241
234
|
return {
|
|
242
|
-
configSignal:
|
|
243
|
-
configSource:
|
|
235
|
+
configSignal: undefined,
|
|
236
|
+
configSource: undefined,
|
|
244
237
|
flow: snapshotSignal,
|
|
245
238
|
reason: `${snapshotReason}; no [marketplaces.${marketplaceName}] source to cross-check`,
|
|
246
239
|
snapshotPresent
|
|
@@ -249,7 +242,7 @@ async function detectInstallFlowDetailed(options) {
|
|
|
249
242
|
if (scan.kind === "unparsable") {
|
|
250
243
|
return {
|
|
251
244
|
configSignal: "unparsable",
|
|
252
|
-
configSource:
|
|
245
|
+
configSource: undefined,
|
|
253
246
|
flow: "unknown",
|
|
254
247
|
reason: `${snapshotReason}; [marketplaces.${marketplaceName}] source value is unparsable`,
|
|
255
248
|
snapshotPresent
|
|
@@ -290,25 +283,26 @@ async function detectInstallFlowFromEnvironment(options) {
|
|
|
290
283
|
const configToml = await readOptionalFile(join3(home.path, "config.toml"));
|
|
291
284
|
return detectInstallFlowDetailed({
|
|
292
285
|
pluginRoot: options.pluginRoot,
|
|
293
|
-
...configToml ===
|
|
294
|
-
...options.marketplaceName ===
|
|
286
|
+
...configToml === undefined ? {} : { configToml },
|
|
287
|
+
...options.marketplaceName === undefined ? {} : { marketplaceName: options.marketplaceName }
|
|
295
288
|
});
|
|
296
289
|
}
|
|
297
290
|
async function detectInstallFlowForTest(pluginRoot) {
|
|
298
291
|
const home = await resolveCodexHome({ env: {}, pluginRoot });
|
|
299
|
-
const configToml = home.source === "walk-up" ? await readOptionalFile(join3(home.path, "config.toml")) :
|
|
300
|
-
return detectInstallFlow({ pluginRoot, ...configToml ===
|
|
292
|
+
const configToml = home.source === "walk-up" ? await readOptionalFile(join3(home.path, "config.toml")) : undefined;
|
|
293
|
+
return detectInstallFlow({ pluginRoot, ...configToml === undefined ? {} : { configToml } });
|
|
301
294
|
}
|
|
302
295
|
async function resolveCodexHome(options) {
|
|
303
296
|
const envHome = options.env["CODEX_HOME"]?.trim();
|
|
304
|
-
if (envHome !==
|
|
297
|
+
if (envHome !== undefined && envHome.length > 0) {
|
|
305
298
|
return { path: resolve(envHome), source: "env" };
|
|
306
299
|
}
|
|
307
|
-
if (options.pluginRoot !==
|
|
300
|
+
if (options.pluginRoot !== undefined) {
|
|
308
301
|
let current = resolve(options.pluginRoot);
|
|
309
|
-
for (let level = 0;
|
|
302
|
+
for (let level = 0;level < MAX_CODEX_HOME_WALK_UP_LEVELS; level += 1) {
|
|
310
303
|
const parent = dirname3(current);
|
|
311
|
-
if (parent === current)
|
|
304
|
+
if (parent === current)
|
|
305
|
+
break;
|
|
312
306
|
current = parent;
|
|
313
307
|
if (await isFile(join3(current, "config.toml"))) {
|
|
314
308
|
return { path: current, source: "walk-up" };
|
|
@@ -330,7 +324,8 @@ async function bootstrapLocks(options) {
|
|
|
330
324
|
const bootstrapLockPath = resolveBootstrapLockPath(options.pluginData);
|
|
331
325
|
const autoUpdateLockPath = resolveLockPath(options.env, resolveStatePath(options.env));
|
|
332
326
|
const bootstrapLock = await acquireLock(bootstrapLockPath, now, staleMs);
|
|
333
|
-
if (bootstrapLock === null)
|
|
327
|
+
if (bootstrapLock === null)
|
|
328
|
+
return null;
|
|
334
329
|
if (autoUpdateLockPath === bootstrapLockPath) {
|
|
335
330
|
return { autoUpdateLockPath, bootstrapLockPath, release: () => bootstrapLock.release(), statePath };
|
|
336
331
|
}
|
|
@@ -350,26 +345,31 @@ async function bootstrapLocks(options) {
|
|
|
350
345
|
};
|
|
351
346
|
}
|
|
352
347
|
function scanMarketplaceSource(configToml, marketplaceName) {
|
|
353
|
-
const expectedHeaders =
|
|
348
|
+
const expectedHeaders = new Set([`marketplaces.${marketplaceName}`, `marketplaces.${JSON.stringify(marketplaceName)}`]);
|
|
354
349
|
let inMarketplaceSection = false;
|
|
355
|
-
for (const line of configToml.split(
|
|
350
|
+
for (const line of configToml.split(`
|
|
351
|
+
`)) {
|
|
356
352
|
const header = parseTomlHeader(line);
|
|
357
353
|
if (header !== null) {
|
|
358
354
|
inMarketplaceSection = expectedHeaders.has(header);
|
|
359
355
|
continue;
|
|
360
356
|
}
|
|
361
|
-
if (!inMarketplaceSection)
|
|
357
|
+
if (!inMarketplaceSection)
|
|
358
|
+
continue;
|
|
362
359
|
const valueText = parseSourceAssignment(line);
|
|
363
|
-
if (valueText === null)
|
|
360
|
+
if (valueText === null)
|
|
361
|
+
continue;
|
|
364
362
|
const source = parseTomlStringValue(valueText);
|
|
365
|
-
return source ===
|
|
363
|
+
return source === undefined ? { kind: "unparsable" } : { kind: "source", source };
|
|
366
364
|
}
|
|
367
365
|
return { kind: "absent" };
|
|
368
366
|
}
|
|
369
367
|
function parseTomlHeader(line) {
|
|
370
368
|
const trimmed = line.trim();
|
|
371
|
-
if (!trimmed.startsWith("[") || !trimmed.endsWith("]"))
|
|
372
|
-
|
|
369
|
+
if (!trimmed.startsWith("[") || !trimmed.endsWith("]"))
|
|
370
|
+
return null;
|
|
371
|
+
if (trimmed.startsWith("[["))
|
|
372
|
+
return null;
|
|
373
373
|
return trimmed.slice(1, -1).trim();
|
|
374
374
|
}
|
|
375
375
|
function parseSourceAssignment(line) {
|
|
@@ -378,16 +378,17 @@ function parseSourceAssignment(line) {
|
|
|
378
378
|
}
|
|
379
379
|
function parseTomlStringValue(valueText) {
|
|
380
380
|
const trimmed = valueText.trim();
|
|
381
|
-
if (trimmed.startsWith('"'))
|
|
381
|
+
if (trimmed.startsWith('"'))
|
|
382
|
+
return parseLeadingJsonString(trimmed);
|
|
382
383
|
if (trimmed.startsWith("'")) {
|
|
383
384
|
const closingIndex = trimmed.indexOf("'", 1);
|
|
384
|
-
return closingIndex === -1 ?
|
|
385
|
+
return closingIndex === -1 ? undefined : trimmed.slice(1, closingIndex);
|
|
385
386
|
}
|
|
386
|
-
return
|
|
387
|
+
return;
|
|
387
388
|
}
|
|
388
389
|
function parseLeadingJsonString(value) {
|
|
389
390
|
let escaped = false;
|
|
390
|
-
for (let index = 1;
|
|
391
|
+
for (let index = 1;index < value.length; index += 1) {
|
|
391
392
|
if (escaped) {
|
|
392
393
|
escaped = false;
|
|
393
394
|
continue;
|
|
@@ -400,22 +401,25 @@ function parseLeadingJsonString(value) {
|
|
|
400
401
|
if (char === '"') {
|
|
401
402
|
try {
|
|
402
403
|
const parsed = JSON.parse(value.slice(0, index + 1));
|
|
403
|
-
return typeof parsed === "string" ? parsed :
|
|
404
|
+
return typeof parsed === "string" ? parsed : undefined;
|
|
404
405
|
} catch {
|
|
405
|
-
return
|
|
406
|
+
return;
|
|
406
407
|
}
|
|
407
408
|
}
|
|
408
409
|
}
|
|
409
|
-
return
|
|
410
|
+
return;
|
|
410
411
|
}
|
|
411
412
|
function classifyMarketplaceSource(source) {
|
|
412
413
|
const trimmed = source.trim();
|
|
413
|
-
if (trimmed.length === 0)
|
|
414
|
-
|
|
414
|
+
if (trimmed.length === 0)
|
|
415
|
+
return "unparsable";
|
|
416
|
+
if (/^(https?|ssh|git):\/\//i.test(trimmed) || trimmed.startsWith("git@"))
|
|
417
|
+
return "marketplace";
|
|
415
418
|
if (trimmed.startsWith("/") || trimmed.startsWith("~") || trimmed.startsWith("\\\\") || /^[A-Za-z]:[\\/]/.test(trimmed)) {
|
|
416
419
|
return "npx-local";
|
|
417
420
|
}
|
|
418
|
-
if (trimmed.toLowerCase().endsWith(".git"))
|
|
421
|
+
if (trimmed.toLowerCase().endsWith(".git"))
|
|
422
|
+
return "marketplace";
|
|
419
423
|
return "unparsable";
|
|
420
424
|
}
|
|
421
425
|
async function isFile(path) {
|
|
@@ -429,165 +433,362 @@ async function readOptionalFile(path) {
|
|
|
429
433
|
try {
|
|
430
434
|
return await readFile3(path, "utf8");
|
|
431
435
|
} catch {
|
|
432
|
-
return
|
|
436
|
+
return;
|
|
433
437
|
}
|
|
434
438
|
}
|
|
435
439
|
|
|
436
|
-
// src/worker.ts
|
|
440
|
+
// components/bootstrap/src/worker.ts
|
|
437
441
|
import { appendFile as appendFile2, mkdir as mkdir8, readFile as readFile12 } from "node:fs/promises";
|
|
438
442
|
import { homedir as homedir4 } from "node:os";
|
|
439
|
-
import { dirname as
|
|
443
|
+
import { dirname as dirname7, join as join19, resolve as resolve6 } from "node:path";
|
|
440
444
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
441
445
|
|
|
442
|
-
// src/provision.ts
|
|
446
|
+
// components/bootstrap/src/provision.ts
|
|
443
447
|
import { execFile } from "node:child_process";
|
|
444
|
-
import {
|
|
445
|
-
import {
|
|
446
|
-
import { basename as basename2, dirname as dirname5, join as join5 } from "node:path";
|
|
448
|
+
import { rm as rm4 } from "node:fs/promises";
|
|
449
|
+
import { dirname as dirname4, join as join7 } from "node:path";
|
|
447
450
|
import { promisify } from "node:util";
|
|
451
|
+
|
|
452
|
+
// ../../utils/src/ast-grep/sg-manifest.ts
|
|
453
|
+
var SG_PINNED_VERSION = "0.43.0";
|
|
454
|
+
var SG_RELEASE_ASSETS = {
|
|
455
|
+
"darwin-arm64": {
|
|
456
|
+
sha256: "8c847d0a29aa4b3101b3361e0b3ee7fb53c7e497adc9ed1afc9615538cd40782",
|
|
457
|
+
url: "https://github.com/ast-grep/ast-grep/releases/download/0.43.0/app-aarch64-apple-darwin.zip"
|
|
458
|
+
},
|
|
459
|
+
"darwin-x64": {
|
|
460
|
+
sha256: "6d703090b106747b2f56086b6ccc7e798fe78bcae70257aa20519b220153555b",
|
|
461
|
+
url: "https://github.com/ast-grep/ast-grep/releases/download/0.43.0/app-x86_64-apple-darwin.zip"
|
|
462
|
+
},
|
|
463
|
+
"linux-arm64": {
|
|
464
|
+
sha256: "e706846148493967f3ab8011334817edd86ce5acbec10718b2a7b40799c640ff",
|
|
465
|
+
url: "https://github.com/ast-grep/ast-grep/releases/download/0.43.0/app-aarch64-unknown-linux-gnu.zip"
|
|
466
|
+
},
|
|
467
|
+
"linux-x64": {
|
|
468
|
+
sha256: "a26253a9c821d935f7e383e40f0de7c2ca62a4121de1f73a6d81ec32eae631e0",
|
|
469
|
+
url: "https://github.com/ast-grep/ast-grep/releases/download/0.43.0/app-x86_64-unknown-linux-gnu.zip"
|
|
470
|
+
},
|
|
471
|
+
"win32-arm64": {
|
|
472
|
+
sha256: "a519fdd90324bf6858fde2d3feb2b862d67b834dc11af8f5b6c2c8143ab6a6c5",
|
|
473
|
+
url: "https://github.com/ast-grep/ast-grep/releases/download/0.43.0/app-aarch64-pc-windows-msvc.zip"
|
|
474
|
+
},
|
|
475
|
+
"win32-x64": {
|
|
476
|
+
sha256: "a4febbc8c48671e5729d85e29e4ebe5a051b7250d19545bca18e725ccf40ef61",
|
|
477
|
+
url: "https://github.com/ast-grep/ast-grep/releases/download/0.43.0/app-x86_64-pc-windows-msvc.zip"
|
|
478
|
+
}
|
|
479
|
+
};
|
|
480
|
+
function normalizeRuntimePlatform(platform = process.platform) {
|
|
481
|
+
if (platform === "darwin" || platform === "linux" || platform === "win32")
|
|
482
|
+
return platform;
|
|
483
|
+
return "linux";
|
|
484
|
+
}
|
|
485
|
+
function normalizeRuntimeArch(arch = process.arch) {
|
|
486
|
+
if (arch === "arm64" || arch === "aarch64")
|
|
487
|
+
return "arm64";
|
|
488
|
+
return "x64";
|
|
489
|
+
}
|
|
490
|
+
function runtimeSlug(platform = process.platform, arch = process.arch) {
|
|
491
|
+
return `${normalizeRuntimePlatform(platform)}-${normalizeRuntimeArch(arch)}`;
|
|
492
|
+
}
|
|
493
|
+
function sgBinaryName(platform = process.platform) {
|
|
494
|
+
return normalizeRuntimePlatform(platform) === "win32" ? "sg.exe" : "sg";
|
|
495
|
+
}
|
|
496
|
+
// ../../utils/src/ast-grep/sg-provisioner.ts
|
|
497
|
+
import { createHash as createHash2, randomUUID as randomUUID2 } from "node:crypto";
|
|
498
|
+
import { chmod, mkdir as mkdir3, rename as rename2, rm as rm3, writeFile as writeFile2 } from "node:fs/promises";
|
|
499
|
+
import { basename as basename2, isAbsolute, join as join4, relative, resolve as resolve2 } from "node:path";
|
|
448
500
|
import { inflateRawSync } from "node:zlib";
|
|
501
|
+
var DEFAULT_DOWNLOAD_TIMEOUT_MS = 60000;
|
|
502
|
+
var EOCD_SIGNATURE = 101010256;
|
|
503
|
+
var CENTRAL_SIGNATURE = 33639248;
|
|
504
|
+
var LOCAL_SIGNATURE = 67324752;
|
|
505
|
+
var ZIP64_SENTINEL = 4294967295;
|
|
449
506
|
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
var WINDOWS_EXECUTABLE_EXTENSIONS = [".exe", ".cmd", ".bat"];
|
|
457
|
-
function isValidBinary(filePath) {
|
|
458
|
-
try {
|
|
459
|
-
const stats = statSync(filePath);
|
|
460
|
-
if (!stats.isFile()) {
|
|
461
|
-
return false;
|
|
462
|
-
}
|
|
463
|
-
const size = stats.size;
|
|
464
|
-
const lowerPath = filePath.toLowerCase();
|
|
465
|
-
if (lowerPath.endsWith(".cmd") || lowerPath.endsWith(".bat")) {
|
|
466
|
-
return size > 0;
|
|
467
|
-
}
|
|
468
|
-
return size > 1e4;
|
|
469
|
-
} catch {
|
|
470
|
-
return false;
|
|
507
|
+
class SgProvisionError extends Error {
|
|
508
|
+
code;
|
|
509
|
+
constructor(code, message, options = {}) {
|
|
510
|
+
super(message, options);
|
|
511
|
+
this.name = "SgProvisionError";
|
|
512
|
+
this.code = code;
|
|
471
513
|
}
|
|
472
514
|
}
|
|
473
|
-
function
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
515
|
+
function describeFailure2(error) {
|
|
516
|
+
return error instanceof Error ? error.message : String(error);
|
|
517
|
+
}
|
|
518
|
+
function sha256(bytes) {
|
|
519
|
+
return createHash2("sha256").update(bytes).digest("hex");
|
|
520
|
+
}
|
|
521
|
+
function timeoutSignal(signal) {
|
|
522
|
+
const timeout = AbortSignal.timeout(DEFAULT_DOWNLOAD_TIMEOUT_MS);
|
|
523
|
+
return signal === undefined ? timeout : AbortSignal.any([signal, timeout]);
|
|
524
|
+
}
|
|
525
|
+
async function downloadAsset(url, fetchImpl, signal) {
|
|
526
|
+
const activeFetch = fetchImpl ?? globalThis.fetch;
|
|
527
|
+
let response;
|
|
528
|
+
try {
|
|
529
|
+
response = await activeFetch(url, { signal });
|
|
530
|
+
} catch (error) {
|
|
531
|
+
throw new SgProvisionError("download_failed", `failed to download ast-grep ${SG_PINNED_VERSION} from ${url}: ${describeFailure2(error)}`, { cause: error });
|
|
479
532
|
}
|
|
480
|
-
|
|
481
|
-
|
|
533
|
+
if (!response.ok) {
|
|
534
|
+
throw new SgProvisionError("download_failed", `failed to download ast-grep ${SG_PINNED_VERSION} from ${url}: HTTP ${response.status}`);
|
|
482
535
|
}
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
if (existsSync(candidate) && isValidBinary(candidate)) {
|
|
488
|
-
return candidate;
|
|
489
|
-
}
|
|
536
|
+
try {
|
|
537
|
+
return Buffer.from(await response.arrayBuffer());
|
|
538
|
+
} catch (error) {
|
|
539
|
+
throw new SgProvisionError("download_failed", `failed to read ast-grep ${SG_PINNED_VERSION} download from ${url}: ${describeFailure2(error)}`, { cause: error });
|
|
490
540
|
}
|
|
491
|
-
return null;
|
|
492
541
|
}
|
|
493
|
-
function
|
|
494
|
-
const
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
}
|
|
503
|
-
|
|
542
|
+
function zipEntryBaseName(entryName) {
|
|
543
|
+
const segments = entryName.split("/");
|
|
544
|
+
return segments[segments.length - 1] ?? entryName;
|
|
545
|
+
}
|
|
546
|
+
function findEndOfCentralDirectory(zip) {
|
|
547
|
+
const lowestOffset = Math.max(0, zip.length - 22 - 65535);
|
|
548
|
+
for (let offset = zip.length - 22;offset >= lowestOffset; offset -= 1) {
|
|
549
|
+
if (zip.readUInt32LE(offset) === EOCD_SIGNATURE)
|
|
550
|
+
return offset;
|
|
551
|
+
}
|
|
552
|
+
throw new SgProvisionError("extract_failed", "downloaded ast-grep asset is not a zip archive");
|
|
504
553
|
}
|
|
505
|
-
function
|
|
506
|
-
|
|
554
|
+
function listZipEntries(zip) {
|
|
555
|
+
const eocdOffset = findEndOfCentralDirectory(zip);
|
|
556
|
+
const entryCount = zip.readUInt16LE(eocdOffset + 10);
|
|
557
|
+
let cursor = zip.readUInt32LE(eocdOffset + 16);
|
|
558
|
+
const entries = [];
|
|
559
|
+
for (let index = 0;index < entryCount; index += 1) {
|
|
560
|
+
if (cursor + 46 > zip.length || zip.readUInt32LE(cursor) !== CENTRAL_SIGNATURE) {
|
|
561
|
+
throw new SgProvisionError("extract_failed", "downloaded ast-grep zip central directory is corrupt");
|
|
562
|
+
}
|
|
563
|
+
const nameLength = zip.readUInt16LE(cursor + 28);
|
|
564
|
+
const extraLength = zip.readUInt16LE(cursor + 30);
|
|
565
|
+
const commentLength = zip.readUInt16LE(cursor + 32);
|
|
566
|
+
entries.push({
|
|
567
|
+
compressedSize: zip.readUInt32LE(cursor + 20),
|
|
568
|
+
localHeaderOffset: zip.readUInt32LE(cursor + 42),
|
|
569
|
+
method: zip.readUInt16LE(cursor + 10),
|
|
570
|
+
name: zip.subarray(cursor + 46, cursor + 46 + nameLength).toString("utf8"),
|
|
571
|
+
uncompressedSize: zip.readUInt32LE(cursor + 24)
|
|
572
|
+
});
|
|
573
|
+
cursor += 46 + nameLength + extraLength + commentLength;
|
|
574
|
+
}
|
|
575
|
+
return entries;
|
|
507
576
|
}
|
|
508
|
-
function
|
|
509
|
-
|
|
510
|
-
|
|
577
|
+
function decompressZipEntry(raw, entry) {
|
|
578
|
+
if (entry.method === 0)
|
|
579
|
+
return Buffer.from(raw);
|
|
580
|
+
if (entry.method === 8)
|
|
581
|
+
return inflateRawSync(raw);
|
|
582
|
+
throw new SgProvisionError("extract_failed", `ast-grep zip entry ${entry.name} uses unsupported compression method ${entry.method}`);
|
|
511
583
|
}
|
|
512
|
-
function
|
|
513
|
-
if (
|
|
514
|
-
|
|
515
|
-
|
|
584
|
+
function readZipEntryBytes(zip, entry) {
|
|
585
|
+
if (entry.compressedSize === ZIP64_SENTINEL || entry.uncompressedSize === ZIP64_SENTINEL || entry.localHeaderOffset === ZIP64_SENTINEL) {
|
|
586
|
+
throw new SgProvisionError("extract_failed", `ast-grep zip entry ${entry.name} uses unsupported zip64 extensions`);
|
|
587
|
+
}
|
|
588
|
+
if (zip.readUInt32LE(entry.localHeaderOffset) !== LOCAL_SIGNATURE) {
|
|
589
|
+
throw new SgProvisionError("extract_failed", `ast-grep zip entry ${entry.name} has a corrupt local header`);
|
|
590
|
+
}
|
|
591
|
+
const nameLength = zip.readUInt16LE(entry.localHeaderOffset + 26);
|
|
592
|
+
const extraLength = zip.readUInt16LE(entry.localHeaderOffset + 28);
|
|
593
|
+
const dataStart = entry.localHeaderOffset + 30 + nameLength + extraLength;
|
|
594
|
+
const bytes = decompressZipEntry(zip.subarray(dataStart, dataStart + entry.compressedSize), entry);
|
|
595
|
+
if (bytes.length !== entry.uncompressedSize) {
|
|
596
|
+
throw new SgProvisionError("extract_failed", `ast-grep zip entry ${entry.name} inflated to ${bytes.length} bytes, expected ${entry.uncompressedSize}`);
|
|
597
|
+
}
|
|
598
|
+
return bytes;
|
|
516
599
|
}
|
|
517
|
-
function
|
|
518
|
-
const
|
|
519
|
-
|
|
520
|
-
|
|
600
|
+
function extractStandaloneSgBinary(zip, platform) {
|
|
601
|
+
const suffix = platform === "win32" ? ".exe" : "";
|
|
602
|
+
const entries = listZipEntries(zip);
|
|
603
|
+
const preferredNames = [`ast-grep${suffix}`, `sg${suffix}`];
|
|
604
|
+
for (const preferred of preferredNames) {
|
|
605
|
+
const entry = entries.find((candidate) => zipEntryBaseName(candidate.name) === preferred);
|
|
606
|
+
if (entry !== undefined)
|
|
607
|
+
return readZipEntryBytes(zip, entry);
|
|
608
|
+
}
|
|
609
|
+
throw new SgProvisionError("extract_failed", `ast-grep release zip has no standalone ${preferredNames.join(" or ")} binary`);
|
|
521
610
|
}
|
|
522
|
-
function
|
|
523
|
-
const
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
611
|
+
function assertInsideTarget(targetDir, filePath) {
|
|
612
|
+
const relativePath = relative(targetDir, filePath);
|
|
613
|
+
if (relativePath.startsWith("..") || isAbsolute(relativePath)) {
|
|
614
|
+
throw new SgProvisionError("write_failed", `refusing to write ast-grep binary outside targetDir: ${filePath}`);
|
|
615
|
+
}
|
|
527
616
|
}
|
|
528
|
-
function
|
|
529
|
-
const env = options.env ?? process.env;
|
|
617
|
+
async function provisionSgBinary(options) {
|
|
530
618
|
const platform = options.platform ?? process.platform;
|
|
531
|
-
const
|
|
532
|
-
const
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
const
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
}
|
|
542
|
-
const binaryName = "sg";
|
|
619
|
+
const slug = runtimeSlug(platform, options.arch ?? process.arch);
|
|
620
|
+
const asset = options.releaseAssets?.[slug] ?? SG_RELEASE_ASSETS[slug];
|
|
621
|
+
if (asset === undefined) {
|
|
622
|
+
throw new SgProvisionError("unsupported_platform", `ast-grep ${SG_PINNED_VERSION} has no asset for ${slug}`);
|
|
623
|
+
}
|
|
624
|
+
const targetDir = resolve2(options.targetDir);
|
|
625
|
+
const destination = join4(targetDir, sgBinaryName(platform));
|
|
626
|
+
const tempPath = join4(targetDir, `.sg-${randomUUID2().slice(0, 8)}.partial`);
|
|
627
|
+
assertInsideTarget(targetDir, destination);
|
|
628
|
+
assertInsideTarget(targetDir, tempPath);
|
|
543
629
|
try {
|
|
544
|
-
|
|
545
|
-
const
|
|
546
|
-
const
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
return validSgPath;
|
|
630
|
+
await mkdir3(targetDir, { recursive: true });
|
|
631
|
+
const archive = await downloadAsset(asset.url, options.fetchImpl, timeoutSignal(options.signal));
|
|
632
|
+
const actualSha256 = sha256(archive);
|
|
633
|
+
if (actualSha256 !== asset.sha256) {
|
|
634
|
+
throw new SgProvisionError("bad_checksum", `checksum mismatch for ${basename2(asset.url)}: expected ${asset.sha256}, got ${actualSha256}`);
|
|
550
635
|
}
|
|
636
|
+
await writeFile2(tempPath, extractStandaloneSgBinary(archive, platform));
|
|
637
|
+
await chmod(tempPath, 493);
|
|
638
|
+
await rename2(tempPath, destination);
|
|
639
|
+
return destination;
|
|
551
640
|
} catch (error) {
|
|
552
|
-
|
|
641
|
+
await rm3(tempPath, { force: true });
|
|
642
|
+
if (error instanceof SgProvisionError)
|
|
553
643
|
throw error;
|
|
554
|
-
}
|
|
644
|
+
throw new SgProvisionError("write_failed", `failed to provision ast-grep ${SG_PINNED_VERSION} into ${targetDir}: ${describeFailure2(error)}`, { cause: error });
|
|
555
645
|
}
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
646
|
+
}
|
|
647
|
+
// ../../utils/src/ast-grep/sg-resolver.ts
|
|
648
|
+
import { execFileSync } from "node:child_process";
|
|
649
|
+
import { existsSync, statSync } from "node:fs";
|
|
650
|
+
import { join as join6 } from "node:path";
|
|
651
|
+
|
|
652
|
+
// ../../utils/src/runtime/which.ts
|
|
653
|
+
import { accessSync, constants } from "node:fs";
|
|
654
|
+
import { delimiter, join as join5 } from "node:path";
|
|
655
|
+
var runtime = globalThis;
|
|
656
|
+
function isUnsafeCommandName(commandName) {
|
|
657
|
+
if (commandName.includes("/") || commandName.includes("\\"))
|
|
658
|
+
return true;
|
|
659
|
+
if (commandName === "." || commandName === ".." || commandName.includes(".."))
|
|
660
|
+
return true;
|
|
661
|
+
if (/^[a-zA-Z]:/.test(commandName))
|
|
662
|
+
return true;
|
|
663
|
+
if (commandName.includes("\x00"))
|
|
664
|
+
return true;
|
|
665
|
+
return false;
|
|
666
|
+
}
|
|
667
|
+
function isExecutable(filePath) {
|
|
668
|
+
try {
|
|
669
|
+
accessSync(filePath, process.platform === "win32" ? constants.F_OK : constants.X_OK);
|
|
670
|
+
return true;
|
|
671
|
+
} catch (error) {
|
|
672
|
+
if (!(error instanceof Error) && Object.prototype.toString.call(error) !== "[object Error]") {
|
|
673
|
+
throw error;
|
|
571
674
|
}
|
|
675
|
+
return false;
|
|
572
676
|
}
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
677
|
+
}
|
|
678
|
+
function resolvePathValue() {
|
|
679
|
+
if (process.platform === "win32")
|
|
680
|
+
return process.env["Path"] ?? process.env["PATH"];
|
|
681
|
+
return process.env["PATH"];
|
|
682
|
+
}
|
|
683
|
+
function getWindowsCandidates(commandName) {
|
|
684
|
+
if (process.platform !== "win32")
|
|
685
|
+
return [commandName];
|
|
686
|
+
if (/\.[^\\/]+$/.test(commandName))
|
|
687
|
+
return [commandName];
|
|
688
|
+
return [commandName, `${commandName}.exe`, `${commandName}.cmd`, `${commandName}.bat`, `${commandName}.com`];
|
|
689
|
+
}
|
|
690
|
+
function bunWhich(commandName) {
|
|
691
|
+
if (!commandName)
|
|
692
|
+
return null;
|
|
693
|
+
if (isUnsafeCommandName(commandName))
|
|
694
|
+
return null;
|
|
695
|
+
const candidateNames = getWindowsCandidates(commandName);
|
|
696
|
+
for (const candidateName of candidateNames) {
|
|
697
|
+
const resolvedPath = runtime.Bun?.which(candidateName) ?? null;
|
|
698
|
+
if (resolvedPath !== null)
|
|
699
|
+
return resolvedPath;
|
|
700
|
+
}
|
|
701
|
+
const pathValue = resolvePathValue();
|
|
702
|
+
if (!pathValue)
|
|
703
|
+
return null;
|
|
704
|
+
const pathEntries = pathValue.split(delimiter).filter((pathEntry) => pathEntry.length > 0);
|
|
705
|
+
if (pathEntries.length === 0)
|
|
706
|
+
return null;
|
|
707
|
+
for (const pathEntry of pathEntries) {
|
|
708
|
+
for (const candidateName of candidateNames) {
|
|
709
|
+
const candidatePath = join5(pathEntry, candidateName);
|
|
710
|
+
if (isExecutable(candidatePath))
|
|
711
|
+
return candidatePath;
|
|
579
712
|
}
|
|
580
713
|
}
|
|
581
714
|
return null;
|
|
582
715
|
}
|
|
583
716
|
|
|
584
|
-
// src/
|
|
717
|
+
// ../../utils/src/ast-grep/types.ts
|
|
718
|
+
var SG_PATH_ENV_KEY = "OMO_AST_GREP_SG_PATH";
|
|
719
|
+
|
|
720
|
+
// ../../utils/src/ast-grep/sg-resolver.ts
|
|
721
|
+
function nonEmptyValue(value) {
|
|
722
|
+
const trimmed = value?.trim();
|
|
723
|
+
return trimmed === undefined || trimmed.length === 0 ? null : trimmed;
|
|
724
|
+
}
|
|
725
|
+
function defaultFileExists(filePath) {
|
|
726
|
+
if (!existsSync(filePath))
|
|
727
|
+
return false;
|
|
728
|
+
try {
|
|
729
|
+
const stats = statSync(filePath);
|
|
730
|
+
return stats.isFile() && stats.size > 0;
|
|
731
|
+
} catch (error) {
|
|
732
|
+
if (error instanceof Error)
|
|
733
|
+
return false;
|
|
734
|
+
return false;
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
function defaultVersionProbe(binaryPath) {
|
|
738
|
+
return String(execFileSync(binaryPath, ["--version"], { encoding: "utf8", timeout: 5000 }));
|
|
739
|
+
}
|
|
740
|
+
function isAstGrepVersionOutput(output) {
|
|
741
|
+
return output.toLowerCase().includes("ast-grep");
|
|
742
|
+
}
|
|
743
|
+
function hasAstGrepVersion(binaryPath, runVersionProbeSync) {
|
|
744
|
+
try {
|
|
745
|
+
return isAstGrepVersionOutput(runVersionProbeSync(binaryPath));
|
|
746
|
+
} catch (error) {
|
|
747
|
+
if (error instanceof Error)
|
|
748
|
+
return false;
|
|
749
|
+
return false;
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
function pathCommandCandidates(platform) {
|
|
753
|
+
return platform === "linux" ? ["ast-grep", "sg"] : ["sg", "ast-grep"];
|
|
754
|
+
}
|
|
755
|
+
function findSgBinarySync(options = {}) {
|
|
756
|
+
const env = options.env ?? process.env;
|
|
757
|
+
const platform = options.platform ?? process.platform;
|
|
758
|
+
const fileExists = options.fileExists ?? defaultFileExists;
|
|
759
|
+
const runVersionProbeSync = options.runVersionProbeSync ?? defaultVersionProbe;
|
|
760
|
+
const which = options.which ?? bunWhich;
|
|
761
|
+
try {
|
|
762
|
+
const envOverride = nonEmptyValue(env[SG_PATH_ENV_KEY]);
|
|
763
|
+
if (envOverride !== null && fileExists(envOverride))
|
|
764
|
+
return envOverride;
|
|
765
|
+
if (options.runtimeDir !== undefined) {
|
|
766
|
+
const runtimeCandidate = join6(options.runtimeDir, sgBinaryName(platform));
|
|
767
|
+
if (fileExists(runtimeCandidate))
|
|
768
|
+
return runtimeCandidate;
|
|
769
|
+
}
|
|
770
|
+
for (const commandName of pathCommandCandidates(platform)) {
|
|
771
|
+
const pathCandidate = which(commandName);
|
|
772
|
+
if (pathCandidate === null || !fileExists(pathCandidate))
|
|
773
|
+
continue;
|
|
774
|
+
if (commandName !== "sg" || hasAstGrepVersion(pathCandidate, runVersionProbeSync))
|
|
775
|
+
return pathCandidate;
|
|
776
|
+
}
|
|
777
|
+
return null;
|
|
778
|
+
} catch (error) {
|
|
779
|
+
if (error instanceof Error)
|
|
780
|
+
return null;
|
|
781
|
+
return null;
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
// components/bootstrap/src/provision.ts
|
|
585
785
|
var SG_PROVISION_COMPONENT = "ast_grep";
|
|
586
786
|
var SG_FORCE_PROVISION_ENV_KEY = "OMO_BOOTSTRAP_FORCE_PROVISION";
|
|
587
|
-
var SG_MANIFEST_NAME = "ast-grep";
|
|
588
787
|
function sgProvisionDestination(context, arch) {
|
|
589
|
-
|
|
590
|
-
|
|
788
|
+
return join7(sgRuntimeDir(context.codexHome, context.platform, arch), sgBinaryName(context.platform));
|
|
789
|
+
}
|
|
790
|
+
function sgRuntimeDir(codexHome, platform, arch) {
|
|
791
|
+
return join7(codexHome, "runtime", "ast-grep", runtimeSlug(platform, arch));
|
|
591
792
|
}
|
|
592
793
|
async function runSgProvision(context, seams = {}) {
|
|
593
794
|
const arch = seams.arch ?? process.arch;
|
|
@@ -604,9 +805,8 @@ async function runSgProvision(context, seams = {}) {
|
|
|
604
805
|
return { degraded: [] };
|
|
605
806
|
}
|
|
606
807
|
}
|
|
607
|
-
const stagingDir = join5(dirname5(destination), `.staging-${randomUUID2().slice(0, 8)}`);
|
|
608
808
|
try {
|
|
609
|
-
const version = await
|
|
809
|
+
const version = await provisionFromSharedManifest(context, seams, { arch, destination });
|
|
610
810
|
await appendBootstrapLog(context.pluginData, context.now, "sg-provision", {
|
|
611
811
|
sg: `provisioned:${destination}`,
|
|
612
812
|
version
|
|
@@ -616,239 +816,213 @@ async function runSgProvision(context, seams = {}) {
|
|
|
616
816
|
const reason = error instanceof Error ? error.message : String(error);
|
|
617
817
|
await appendBootstrapLog(context.pluginData, context.now, "sg-provision-failed", { reason });
|
|
618
818
|
return { degraded: [{ component: SG_PROVISION_COMPONENT, hint: BOOTSTRAP_DOCTOR_HINT, reason }] };
|
|
619
|
-
}
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
throw new Error(
|
|
629
|
-
`ast-grep ${manifest.version} has no asset for unsupported platform "${platformKey}" (available: ${Object.keys(manifest.platforms).join(", ")}).`
|
|
630
|
-
);
|
|
631
|
-
}
|
|
632
|
-
await mkdir3(layout.stagingDir, { recursive: true });
|
|
633
|
-
const archivePath = await downloadChecksummedAsset({
|
|
634
|
-
destination: join5(layout.stagingDir, basename2(new URL(asset.url).pathname)),
|
|
635
|
-
env: context.env,
|
|
636
|
-
sha256: asset.sha256,
|
|
637
|
-
url: asset.url,
|
|
638
|
-
...seams.fetchImpl === void 0 ? {} : { fetchImpl: seams.fetchImpl }
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
async function provisionFromSharedManifest(context, seams, layout) {
|
|
822
|
+
const provisionedPath = await provisionSgBinary({
|
|
823
|
+
arch: layout.arch,
|
|
824
|
+
platform: context.platform,
|
|
825
|
+
targetDir: dirname4(layout.destination),
|
|
826
|
+
...seams.fetchImpl === undefined ? {} : { fetchImpl: seams.fetchImpl },
|
|
827
|
+
...seams.releaseAssets === undefined ? {} : { releaseAssets: seams.releaseAssets }
|
|
639
828
|
});
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
await
|
|
645
|
-
|
|
646
|
-
return manifest.version;
|
|
829
|
+
if (provisionedPath !== layout.destination) {
|
|
830
|
+
await rm4(provisionedPath, { force: true });
|
|
831
|
+
throw new Error(`provisioned sg at ${provisionedPath} but expected ${layout.destination}; removed the binary.`);
|
|
832
|
+
}
|
|
833
|
+
await verifyProvisionedVersion(layout.destination, SG_PINNED_VERSION, seams);
|
|
834
|
+
return SG_PINNED_VERSION;
|
|
647
835
|
}
|
|
648
836
|
async function verifyProvisionedVersion(destination, pinnedVersion, seams) {
|
|
649
837
|
let reported;
|
|
650
838
|
try {
|
|
651
|
-
reported = (await (seams.runVersionProbe ??
|
|
839
|
+
reported = (await (seams.runVersionProbe ?? defaultVersionProbe2)(destination)).trim();
|
|
652
840
|
} catch (error) {
|
|
653
|
-
await
|
|
654
|
-
throw new Error(
|
|
655
|
-
`provisioned sg at ${destination} failed its --version probe: ${error instanceof Error ? error.message : String(error)}`
|
|
656
|
-
);
|
|
841
|
+
await rm4(destination, { force: true });
|
|
842
|
+
throw new Error(`provisioned sg at ${destination} failed its --version probe: ${error instanceof Error ? error.message : String(error)}`);
|
|
657
843
|
}
|
|
658
844
|
if (!reported.includes(pinnedVersion)) {
|
|
659
|
-
await
|
|
660
|
-
throw new Error(
|
|
661
|
-
`provisioned sg at ${destination} reported "${reported}" but the manifest pins version ${pinnedVersion}; removed the binary.`
|
|
662
|
-
);
|
|
845
|
+
await rm4(destination, { force: true });
|
|
846
|
+
throw new Error(`provisioned sg at ${destination} reported "${reported}" but the manifest pins version ${pinnedVersion}; removed the binary.`);
|
|
663
847
|
}
|
|
664
848
|
}
|
|
665
849
|
function defaultResolvePreexistingSg(options) {
|
|
666
|
-
return
|
|
850
|
+
return findSgBinarySync({
|
|
667
851
|
arch: options.arch,
|
|
668
852
|
env: { ...options.env, CODEX_HOME: options.codexHome },
|
|
669
|
-
platform: options.platform
|
|
853
|
+
platform: options.platform,
|
|
854
|
+
runtimeDir: sgRuntimeDir(options.codexHome, options.platform, options.arch)
|
|
670
855
|
});
|
|
671
856
|
}
|
|
672
857
|
var execFileAsync = promisify(execFile);
|
|
673
|
-
async function
|
|
858
|
+
async function defaultVersionProbe2(binaryPath) {
|
|
674
859
|
const { stdout } = await execFileAsync(binaryPath, ["--version"]);
|
|
675
860
|
return String(stdout);
|
|
676
861
|
}
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
862
|
+
|
|
863
|
+
// components/bootstrap/src/setup.ts
|
|
864
|
+
import { execFile as execFile2 } from "node:child_process";
|
|
865
|
+
import { copyFile as copyFile2, mkdir as mkdir7, readdir as readdir3, rm as rm9, stat as stat4 } from "node:fs/promises";
|
|
866
|
+
import { join as join18 } from "node:path";
|
|
867
|
+
import { promisify as promisify2 } from "node:util";
|
|
868
|
+
|
|
869
|
+
// ../src/install/link-cached-plugin-agents.ts
|
|
870
|
+
import { copyFile, lstat as lstat2, mkdir as mkdir4, readFile as readFile5, readdir, rm as rm6, writeFile as writeFile3 } from "node:fs/promises";
|
|
871
|
+
import { basename as basename3, join as join9 } from "node:path";
|
|
872
|
+
|
|
873
|
+
// ../src/install/retired-managed-agent-purge.ts
|
|
874
|
+
import { lstat, readFile as readFile4, rm as rm5 } from "node:fs/promises";
|
|
875
|
+
import { join as join8 } from "node:path";
|
|
876
|
+
var RETIRED_MANAGED_AGENT_FILES = [
|
|
877
|
+
{
|
|
878
|
+
fileName: "codex-ultrawork-reviewer.toml",
|
|
879
|
+
requiredMarkers: [
|
|
880
|
+
'name = "codex-ultrawork-reviewer"',
|
|
881
|
+
'description = "Strict ultrawork verification reviewer.',
|
|
882
|
+
'developer_instructions = """You are the ultrawork verification reviewer.'
|
|
883
|
+
]
|
|
684
884
|
}
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
);
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
const
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
const entries = [];
|
|
702
|
-
for (let index = 0; index < entryCount; index += 1) {
|
|
703
|
-
if (cursor + 46 > zip.length || zip.readUInt32LE(cursor) !== CENTRAL_SIGNATURE) {
|
|
704
|
-
throw new Error("zip central directory is corrupt (bad entry signature)");
|
|
705
|
-
}
|
|
706
|
-
const nameLength = zip.readUInt16LE(cursor + 28);
|
|
707
|
-
const extraLength = zip.readUInt16LE(cursor + 30);
|
|
708
|
-
const commentLength = zip.readUInt16LE(cursor + 32);
|
|
709
|
-
entries.push({
|
|
710
|
-
compressedSize: zip.readUInt32LE(cursor + 20),
|
|
711
|
-
localHeaderOffset: zip.readUInt32LE(cursor + 42),
|
|
712
|
-
method: zip.readUInt16LE(cursor + 10),
|
|
713
|
-
name: zip.subarray(cursor + 46, cursor + 46 + nameLength).toString("utf8"),
|
|
714
|
-
uncompressedSize: zip.readUInt32LE(cursor + 24)
|
|
715
|
-
});
|
|
716
|
-
cursor += 46 + nameLength + extraLength + commentLength;
|
|
885
|
+
];
|
|
886
|
+
async function purgeRetiredManagedAgentFiles(input) {
|
|
887
|
+
const agentsDir = join8(input.codexHome, "agents");
|
|
888
|
+
if (!await exists(agentsDir))
|
|
889
|
+
return;
|
|
890
|
+
for (const retiredAgent of RETIRED_MANAGED_AGENT_FILES) {
|
|
891
|
+
const agentPath = join8(agentsDir, retiredAgent.fileName);
|
|
892
|
+
if (!await exists(agentPath))
|
|
893
|
+
continue;
|
|
894
|
+
const agentStat = await lstat(agentPath);
|
|
895
|
+
if (agentStat.isDirectory() && !agentStat.isSymbolicLink())
|
|
896
|
+
continue;
|
|
897
|
+
const content = await readTextIfExists(agentPath);
|
|
898
|
+
if (content === null || !hasRequiredMarkers(content, retiredAgent.requiredMarkers))
|
|
899
|
+
continue;
|
|
900
|
+
await rm5(agentPath, { force: true });
|
|
717
901
|
}
|
|
718
|
-
return entries;
|
|
719
902
|
}
|
|
720
|
-
function
|
|
721
|
-
|
|
722
|
-
for (let offset = zip.length - 22; offset >= lowestOffset; offset -= 1) {
|
|
723
|
-
if (zip.readUInt32LE(offset) === EOCD_SIGNATURE) return offset;
|
|
724
|
-
}
|
|
725
|
-
throw new Error("downloaded asset is not a zip archive (end-of-central-directory record missing)");
|
|
903
|
+
function hasRequiredMarkers(content, markers) {
|
|
904
|
+
return markers.every((marker) => content.includes(marker));
|
|
726
905
|
}
|
|
727
|
-
function
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
}
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
const nameLength = zip.readUInt16LE(entry.localHeaderOffset + 26);
|
|
735
|
-
const extraLength = zip.readUInt16LE(entry.localHeaderOffset + 28);
|
|
736
|
-
const dataStart = entry.localHeaderOffset + 30 + nameLength + extraLength;
|
|
737
|
-
const raw = zip.subarray(dataStart, dataStart + entry.compressedSize);
|
|
738
|
-
const bytes = decompressZipEntry(raw, entry);
|
|
739
|
-
if (bytes.length !== entry.uncompressedSize) {
|
|
740
|
-
throw new Error(
|
|
741
|
-
`zip entry ${entry.name} inflated to ${bytes.length} bytes but the archive declares ${entry.uncompressedSize}`
|
|
742
|
-
);
|
|
906
|
+
async function readTextIfExists(path) {
|
|
907
|
+
try {
|
|
908
|
+
return await readFile4(path, "utf8");
|
|
909
|
+
} catch (error) {
|
|
910
|
+
if (nodeErrorCode(error) === "ENOENT")
|
|
911
|
+
return null;
|
|
912
|
+
throw error;
|
|
743
913
|
}
|
|
744
|
-
return bytes;
|
|
745
|
-
}
|
|
746
|
-
function decompressZipEntry(raw, entry) {
|
|
747
|
-
if (entry.method === 0) return Buffer.from(raw);
|
|
748
|
-
if (entry.method === 8) return inflateRawSync(raw);
|
|
749
|
-
throw new Error(`zip entry ${entry.name} uses unsupported compression method ${entry.method}`);
|
|
750
914
|
}
|
|
751
|
-
|
|
752
|
-
// src/setup.ts
|
|
753
|
-
import { execFile as execFile2 } from "node:child_process";
|
|
754
|
-
import { copyFile as copyFile2, mkdir as mkdir7, readdir as readdir3, rm as rm7, stat as stat4 } from "node:fs/promises";
|
|
755
|
-
import { join as join14 } from "node:path";
|
|
756
|
-
import { promisify as promisify2 } from "node:util";
|
|
757
|
-
|
|
758
|
-
// ../../../scripts/install/agents.mjs
|
|
759
|
-
import { basename as basename3, join as join6 } from "node:path";
|
|
760
|
-
import { copyFile, lstat, mkdir as mkdir4, readFile as readFile5, readdir, rm as rm4, writeFile as writeFile3 } from "node:fs/promises";
|
|
761
|
-
|
|
762
|
-
// ../../../scripts/install/utils.mjs
|
|
763
|
-
import { constants as fsConstants } from "node:fs";
|
|
764
|
-
import { access } from "node:fs/promises";
|
|
765
915
|
async function exists(path) {
|
|
766
916
|
try {
|
|
767
|
-
await
|
|
917
|
+
await lstat(path);
|
|
768
918
|
return true;
|
|
769
|
-
} catch {
|
|
919
|
+
} catch (error) {
|
|
920
|
+
if (nodeErrorCode(error) !== "ENOENT")
|
|
921
|
+
throw error;
|
|
770
922
|
return false;
|
|
771
923
|
}
|
|
772
924
|
}
|
|
773
|
-
function
|
|
774
|
-
|
|
925
|
+
function nodeErrorCode(error) {
|
|
926
|
+
if (!(error instanceof Error) || !("code" in error))
|
|
927
|
+
return null;
|
|
928
|
+
return typeof error.code === "string" ? error.code : null;
|
|
775
929
|
}
|
|
776
930
|
|
|
777
|
-
//
|
|
931
|
+
// ../src/install/link-cached-plugin-agents.ts
|
|
778
932
|
var MANIFEST_FILE = ".installed-agents.json";
|
|
779
|
-
async function capturePreservedAgentReasoning(
|
|
780
|
-
const agentsDir =
|
|
781
|
-
if (!await
|
|
782
|
-
|
|
933
|
+
async function capturePreservedAgentReasoning(input) {
|
|
934
|
+
const agentsDir = join9(input.codexHome, "agents");
|
|
935
|
+
if (!await exists2(agentsDir))
|
|
936
|
+
return new Map;
|
|
937
|
+
const preserved = new Map;
|
|
783
938
|
const agentEntries = await readdir(agentsDir, { withFileTypes: true });
|
|
784
939
|
for (const entry of agentEntries) {
|
|
785
|
-
if (!entry.name.endsWith(".toml"))
|
|
786
|
-
|
|
787
|
-
|
|
940
|
+
if (!entry.name.endsWith(".toml"))
|
|
941
|
+
continue;
|
|
942
|
+
const content = await readTextIfExists2(join9(agentsDir, entry.name));
|
|
943
|
+
if (content === null)
|
|
944
|
+
continue;
|
|
788
945
|
const effort = extractReasoningEffort(content);
|
|
789
|
-
if (effort !== null)
|
|
946
|
+
if (effort !== null)
|
|
947
|
+
preserved.set(agentNameFromToml(entry.name), effort);
|
|
790
948
|
}
|
|
791
949
|
return preserved;
|
|
792
950
|
}
|
|
793
|
-
async function capturePreservedAgentServiceTier(
|
|
794
|
-
const agentsDir =
|
|
795
|
-
if (!await
|
|
796
|
-
|
|
951
|
+
async function capturePreservedAgentServiceTier(input) {
|
|
952
|
+
const agentsDir = join9(input.codexHome, "agents");
|
|
953
|
+
if (!await exists2(agentsDir))
|
|
954
|
+
return new Map;
|
|
955
|
+
const preserved = new Map;
|
|
797
956
|
const agentEntries = await readdir(agentsDir, { withFileTypes: true });
|
|
798
957
|
for (const entry of agentEntries) {
|
|
799
|
-
if (!entry.name.endsWith(".toml"))
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
958
|
+
if (!entry.name.endsWith(".toml"))
|
|
959
|
+
continue;
|
|
960
|
+
const content = await readTextIfExists2(join9(agentsDir, entry.name));
|
|
961
|
+
if (content === null)
|
|
962
|
+
continue;
|
|
963
|
+
preserved.set(agentNameFromToml(entry.name), extractServiceTier(content));
|
|
803
964
|
}
|
|
804
965
|
return preserved;
|
|
805
966
|
}
|
|
806
|
-
async function linkCachedPluginAgents(
|
|
807
|
-
const bundledAgents = await discoverBundledAgents(pluginRoot);
|
|
967
|
+
async function linkCachedPluginAgents(input) {
|
|
968
|
+
const bundledAgents = await discoverBundledAgents(input.pluginRoot);
|
|
969
|
+
await purgeRetiredManagedAgentFiles({ codexHome: input.codexHome });
|
|
808
970
|
if (bundledAgents.length === 0) {
|
|
809
|
-
await writeManifest(pluginRoot, []);
|
|
971
|
+
await writeManifest(input.pluginRoot, []);
|
|
810
972
|
return [];
|
|
811
973
|
}
|
|
812
|
-
const agentsDir =
|
|
974
|
+
const agentsDir = join9(input.codexHome, "agents");
|
|
813
975
|
await mkdir4(agentsDir, { recursive: true });
|
|
814
976
|
const linked = [];
|
|
815
977
|
for (const agentPath of bundledAgents) {
|
|
816
978
|
const agentFileName = basename3(agentPath);
|
|
817
979
|
const agentName = agentNameFromToml(agentFileName);
|
|
818
|
-
const linkPath =
|
|
980
|
+
const linkPath = join9(agentsDir, agentFileName);
|
|
819
981
|
await replaceWithCopy(linkPath, agentPath);
|
|
820
|
-
await restorePreservedReasoning({
|
|
982
|
+
await restorePreservedReasoning({
|
|
983
|
+
agentName,
|
|
984
|
+
linkPath,
|
|
985
|
+
target: agentPath,
|
|
986
|
+
value: input.preservedReasoning?.get(agentName)
|
|
987
|
+
});
|
|
821
988
|
await restorePreservedServiceTier({
|
|
822
989
|
linkPath,
|
|
823
|
-
preserved: preservedServiceTier
|
|
824
|
-
value: preservedServiceTier
|
|
990
|
+
preserved: input.preservedServiceTier?.has(agentName) ?? false,
|
|
991
|
+
value: input.preservedServiceTier?.get(agentName) ?? null
|
|
825
992
|
});
|
|
826
993
|
linked.push({ name: agentFileName, path: linkPath, target: agentPath });
|
|
827
994
|
}
|
|
828
|
-
await writeManifest(pluginRoot, linked.map((entry) => entry.path));
|
|
995
|
+
await writeManifest(input.pluginRoot, linked.map((entry) => entry.path));
|
|
829
996
|
return linked;
|
|
830
997
|
}
|
|
831
|
-
async function restorePreservedServiceTier(
|
|
832
|
-
if (!preserved)
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
998
|
+
async function restorePreservedServiceTier(input) {
|
|
999
|
+
if (!input.preserved)
|
|
1000
|
+
return;
|
|
1001
|
+
const content = await readFile5(input.linkPath, "utf8");
|
|
1002
|
+
if (extractServiceTier(content) === input.value)
|
|
1003
|
+
return;
|
|
1004
|
+
const replacement = replaceServiceTier(content, input.value);
|
|
1005
|
+
if (!replacement.replaced)
|
|
1006
|
+
return;
|
|
1007
|
+
await writeFile3(input.linkPath, replacement.content);
|
|
838
1008
|
}
|
|
839
1009
|
async function discoverBundledAgents(pluginRoot) {
|
|
840
|
-
const componentsRoot =
|
|
841
|
-
if (!await
|
|
1010
|
+
const componentsRoot = join9(pluginRoot, "components");
|
|
1011
|
+
if (!await exists2(componentsRoot))
|
|
1012
|
+
return [];
|
|
842
1013
|
const componentEntries = await readdir(componentsRoot, { withFileTypes: true });
|
|
843
1014
|
const agents = [];
|
|
844
1015
|
for (const entry of componentEntries) {
|
|
845
|
-
if (!entry.isDirectory())
|
|
846
|
-
|
|
847
|
-
|
|
1016
|
+
if (!entry.isDirectory())
|
|
1017
|
+
continue;
|
|
1018
|
+
const agentsRoot = join9(componentsRoot, entry.name, "agents");
|
|
1019
|
+
if (!await exists2(agentsRoot))
|
|
1020
|
+
continue;
|
|
848
1021
|
const agentEntries = await readdir(agentsRoot, { withFileTypes: true });
|
|
849
1022
|
for (const file of agentEntries) {
|
|
850
|
-
if (!file.isFile() || !file.name.endsWith(".toml"))
|
|
851
|
-
|
|
1023
|
+
if (!file.isFile() || !file.name.endsWith(".toml"))
|
|
1024
|
+
continue;
|
|
1025
|
+
agents.push(join9(agentsRoot, file.name));
|
|
852
1026
|
}
|
|
853
1027
|
}
|
|
854
1028
|
agents.sort();
|
|
@@ -859,35 +1033,38 @@ async function replaceWithCopy(linkPath, target) {
|
|
|
859
1033
|
await copyFile(target, linkPath);
|
|
860
1034
|
}
|
|
861
1035
|
async function prepareReplacement(linkPath) {
|
|
862
|
-
if (!await
|
|
863
|
-
|
|
1036
|
+
if (!await exists2(linkPath))
|
|
1037
|
+
return;
|
|
1038
|
+
const entryStat = await lstat2(linkPath);
|
|
864
1039
|
if (entryStat.isDirectory() && !entryStat.isSymbolicLink()) {
|
|
865
1040
|
throw new Error(`${linkPath} already exists and is a directory; refusing to replace`);
|
|
866
1041
|
}
|
|
867
|
-
await
|
|
1042
|
+
await rm6(linkPath, { force: true });
|
|
868
1043
|
}
|
|
869
1044
|
async function writeManifest(pluginRoot, agentPaths) {
|
|
870
|
-
const manifestPath =
|
|
1045
|
+
const manifestPath = join9(pluginRoot, MANIFEST_FILE);
|
|
871
1046
|
const payload = { agents: [...agentPaths].sort() };
|
|
872
|
-
await writeFile3(manifestPath, `${JSON.stringify(payload, null, "
|
|
1047
|
+
await writeFile3(manifestPath, `${JSON.stringify(payload, null, "\t")}
|
|
873
1048
|
`);
|
|
874
1049
|
}
|
|
875
|
-
async function restorePreservedReasoning(
|
|
876
|
-
if (value ===
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
const
|
|
880
|
-
if (
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
1050
|
+
async function restorePreservedReasoning(input) {
|
|
1051
|
+
if (input.value === undefined)
|
|
1052
|
+
return;
|
|
1053
|
+
const content = await readFile5(input.target, "utf8");
|
|
1054
|
+
const bundledEffort = extractReasoningEffort(content);
|
|
1055
|
+
if (bundledEffort === input.value)
|
|
1056
|
+
return;
|
|
1057
|
+
const replacement = replaceReasoningEffort(content, input.value);
|
|
1058
|
+
if (!replacement.replaced)
|
|
1059
|
+
return;
|
|
1060
|
+
await writeFile3(input.linkPath, replacement.content);
|
|
885
1061
|
}
|
|
886
|
-
async function
|
|
1062
|
+
async function readTextIfExists2(path) {
|
|
887
1063
|
try {
|
|
888
1064
|
return await readFile5(path, "utf8");
|
|
889
1065
|
} catch (error) {
|
|
890
|
-
if (
|
|
1066
|
+
if (nodeErrorCode2(error) === "ENOENT")
|
|
1067
|
+
return null;
|
|
891
1068
|
throw error;
|
|
892
1069
|
}
|
|
893
1070
|
}
|
|
@@ -899,10 +1076,14 @@ function extractServiceTier(content) {
|
|
|
899
1076
|
}
|
|
900
1077
|
function extractTopLevelStringSetting(content, key) {
|
|
901
1078
|
for (const line of content.split(/\n/)) {
|
|
902
|
-
if (isSectionHeader(line))
|
|
1079
|
+
if (isSectionHeader(line))
|
|
1080
|
+
return null;
|
|
903
1081
|
const rawValue = topLevelStringSettingRawValue(line, key);
|
|
904
|
-
if (rawValue ===
|
|
905
|
-
|
|
1082
|
+
if (rawValue === undefined)
|
|
1083
|
+
continue;
|
|
1084
|
+
const parsed = parseJsonString(rawValue);
|
|
1085
|
+
if (parsed !== null)
|
|
1086
|
+
return parsed;
|
|
906
1087
|
}
|
|
907
1088
|
return null;
|
|
908
1089
|
}
|
|
@@ -913,33 +1094,36 @@ function replaceServiceTier(content, value) {
|
|
|
913
1094
|
return replaceTopLevelStringSetting(content, "service_tier", value, { insertIfMissing: true });
|
|
914
1095
|
}
|
|
915
1096
|
function replaceTopLevelStringSetting(content, key, value, options) {
|
|
916
|
-
let replaced = false;
|
|
917
1097
|
const lines = content.split(/\n/);
|
|
918
|
-
for (let index = 0;
|
|
1098
|
+
for (let index = 0;index < lines.length; index += 1) {
|
|
919
1099
|
const line = lines[index];
|
|
920
|
-
if (isSectionHeader(line))
|
|
921
|
-
|
|
1100
|
+
if (line === undefined || isSectionHeader(line))
|
|
1101
|
+
break;
|
|
1102
|
+
if (topLevelStringSettingRawValue(line, key) === undefined)
|
|
1103
|
+
continue;
|
|
922
1104
|
if (value === null) {
|
|
923
1105
|
lines.splice(index, 1);
|
|
924
|
-
|
|
925
|
-
|
|
1106
|
+
return { content: lines.join(`
|
|
1107
|
+
`), replaced: true };
|
|
926
1108
|
}
|
|
927
1109
|
lines[index] = line.replace(/=\s*"(?:[^"\\]|\\.)*"/, `= ${JSON.stringify(value)}`);
|
|
928
|
-
|
|
929
|
-
|
|
1110
|
+
return { content: lines.join(`
|
|
1111
|
+
`), replaced: true };
|
|
930
1112
|
}
|
|
931
|
-
if (
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
1113
|
+
if (value === null || !options.insertIfMissing)
|
|
1114
|
+
return { content, replaced: false };
|
|
1115
|
+
lines.splice(topLevelInsertionIndex(lines), 0, `${key} = ${JSON.stringify(value)}`);
|
|
1116
|
+
return { content: lines.join(`
|
|
1117
|
+
`), replaced: true };
|
|
936
1118
|
}
|
|
937
1119
|
function topLevelStringSettingRawValue(line, key) {
|
|
938
1120
|
const match = line.match(/^\s*([A-Za-z0-9_]+)\s*=\s*("(?:[^"\\]|\\.)*")/);
|
|
939
|
-
if (match === null)
|
|
1121
|
+
if (match === null)
|
|
1122
|
+
return;
|
|
940
1123
|
const settingKey = match[1];
|
|
941
1124
|
const rawValue = match[2];
|
|
942
|
-
if (settingKey !== key || rawValue ===
|
|
1125
|
+
if (settingKey !== key || rawValue === undefined)
|
|
1126
|
+
return;
|
|
943
1127
|
return rawValue;
|
|
944
1128
|
}
|
|
945
1129
|
function topLevelInsertionIndex(lines) {
|
|
@@ -958,49 +1142,61 @@ function isSectionHeader(line) {
|
|
|
958
1142
|
function agentNameFromToml(fileName) {
|
|
959
1143
|
return fileName.endsWith(".toml") ? fileName.slice(0, -".toml".length) : fileName;
|
|
960
1144
|
}
|
|
961
|
-
|
|
1145
|
+
function parseJsonString(value) {
|
|
962
1146
|
try {
|
|
963
|
-
|
|
1147
|
+
const parsed = JSON.parse(value);
|
|
1148
|
+
return typeof parsed === "string" ? parsed : null;
|
|
1149
|
+
} catch (error) {
|
|
1150
|
+
if (error instanceof Error)
|
|
1151
|
+
return null;
|
|
1152
|
+
return null;
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
async function exists2(path) {
|
|
1156
|
+
try {
|
|
1157
|
+
await lstat2(path);
|
|
964
1158
|
return true;
|
|
965
1159
|
} catch (error) {
|
|
966
|
-
if (error
|
|
967
|
-
|
|
1160
|
+
if (nodeErrorCode2(error) !== "ENOENT")
|
|
1161
|
+
throw error;
|
|
1162
|
+
return false;
|
|
968
1163
|
}
|
|
969
1164
|
}
|
|
970
|
-
function
|
|
971
|
-
if (!(error instanceof Error) || !("code" in error))
|
|
1165
|
+
function nodeErrorCode2(error) {
|
|
1166
|
+
if (!(error instanceof Error) || !("code" in error))
|
|
1167
|
+
return null;
|
|
972
1168
|
return typeof error.code === "string" ? error.code : null;
|
|
973
1169
|
}
|
|
974
1170
|
|
|
975
|
-
//
|
|
976
|
-
import {
|
|
977
|
-
import { join as
|
|
978
|
-
function resolveCodexInstallerBinDir(options = {}) {
|
|
979
|
-
const homeDir = resolve2(options.homeDir ?? homedir3());
|
|
980
|
-
const env = options.env ?? process.env;
|
|
981
|
-
const explicitBinDir = nonEmptyEnvValue(env, "CODEX_LOCAL_BIN_DIR");
|
|
982
|
-
if (explicitBinDir !== void 0) return explicitBinDir;
|
|
983
|
-
const codexHome = resolve2(options.codexHome ?? nonEmptyEnvValue(env, "CODEX_HOME") ?? join7(homeDir, ".codex"));
|
|
984
|
-
const defaultCodexHome = resolve2(join7(homeDir, ".codex"));
|
|
985
|
-
return codexHome === defaultCodexHome ? join7(homeDir, ".local", "bin") : join7(codexHome, "bin");
|
|
986
|
-
}
|
|
987
|
-
function nonEmptyEnvValue(env, key) {
|
|
988
|
-
const value = env[key];
|
|
989
|
-
if (typeof value !== "string") return void 0;
|
|
990
|
-
const trimmed = value.trim();
|
|
991
|
-
return trimmed.length === 0 ? void 0 : trimmed;
|
|
992
|
-
}
|
|
993
|
-
|
|
994
|
-
// ../../../scripts/install/bin-links.mjs
|
|
995
|
-
import { chmod as chmod2, lstat as lstat3, mkdir as mkdir5, readFile as readFile7, readdir as readdir2, readlink as readlink2, rm as rm6, stat as stat3, symlink, writeFile as writeFile4 } from "node:fs/promises";
|
|
996
|
-
import { basename as basename4, join as join9, relative, resolve as resolve3 } from "node:path";
|
|
1171
|
+
// ../src/install/codex-cache-bins.ts
|
|
1172
|
+
import { chmod as chmod2, lstat as lstat5, mkdir as mkdir5, readFile as readFile7, readdir as readdir2, readlink as readlink2, rm as rm8, stat as stat3, symlink, writeFile as writeFile4 } from "node:fs/promises";
|
|
1173
|
+
import { basename as basename4, isAbsolute as isAbsolute2, join as join12, relative as relative2, resolve as resolve3, sep } from "node:path";
|
|
997
1174
|
|
|
998
|
-
//
|
|
1175
|
+
// ../src/install/codex-cache-command-shim.ts
|
|
999
1176
|
var COMMAND_SHIM_MARKER = ":: generated by oh-my-openagent Codex installer";
|
|
1000
1177
|
|
|
1001
|
-
//
|
|
1002
|
-
import { lstat as
|
|
1003
|
-
|
|
1178
|
+
// ../src/install/codex-cache-fs.ts
|
|
1179
|
+
import { lstat as lstat3 } from "node:fs/promises";
|
|
1180
|
+
async function fileExistsStrict(path) {
|
|
1181
|
+
try {
|
|
1182
|
+
await lstat3(path);
|
|
1183
|
+
return true;
|
|
1184
|
+
} catch (error) {
|
|
1185
|
+
if (isNodeErrorWithCode(error) && error.code === "ENOENT")
|
|
1186
|
+
return false;
|
|
1187
|
+
throw error;
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
function isPlainRecord(value) {
|
|
1191
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1192
|
+
}
|
|
1193
|
+
function isNodeErrorWithCode(error) {
|
|
1194
|
+
return typeof error === "object" && error !== null && "code" in error;
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
// ../src/install/codex-cache-legacy-bins.ts
|
|
1198
|
+
import { lstat as lstat4, readFile as readFile6, readlink, rm as rm7 } from "node:fs/promises";
|
|
1199
|
+
import { join as join10 } from "node:path";
|
|
1004
1200
|
var LEGACY_CODEX_COMPONENT_BINS = [
|
|
1005
1201
|
{ name: "omo", component: "ulw-loop" },
|
|
1006
1202
|
{ name: "codex-comment-checker", component: "comment-checker" },
|
|
@@ -1012,24 +1208,29 @@ var LEGACY_CODEX_COMPONENT_BINS = [
|
|
|
1012
1208
|
];
|
|
1013
1209
|
async function removeLegacyCodexComponentBins(binDir, platform) {
|
|
1014
1210
|
for (const entry of LEGACY_CODEX_COMPONENT_BINS) {
|
|
1015
|
-
const linkPath =
|
|
1211
|
+
const linkPath = join10(binDir, platform === "win32" ? `${entry.name}.cmd` : entry.name);
|
|
1016
1212
|
await removeLegacyCodexComponentBin(linkPath, entry.component, platform);
|
|
1017
1213
|
}
|
|
1018
1214
|
}
|
|
1019
1215
|
async function removeLegacyCodexComponentBin(linkPath, component, platform) {
|
|
1020
1216
|
try {
|
|
1021
|
-
const
|
|
1217
|
+
const stat3 = await lstat4(linkPath);
|
|
1022
1218
|
if (platform !== "win32") {
|
|
1023
|
-
if (!
|
|
1219
|
+
if (!stat3.isSymbolicLink())
|
|
1220
|
+
return;
|
|
1024
1221
|
const target = await readlink(linkPath);
|
|
1025
|
-
if (isManagedLegacyComponentTarget(target, component))
|
|
1222
|
+
if (isManagedLegacyComponentTarget(target, component))
|
|
1223
|
+
await rm7(linkPath, { force: true });
|
|
1026
1224
|
return;
|
|
1027
1225
|
}
|
|
1028
|
-
if (!
|
|
1226
|
+
if (!stat3.isFile())
|
|
1227
|
+
return;
|
|
1029
1228
|
const content = await readFile6(linkPath, "utf8");
|
|
1030
|
-
if (content.includes(COMMAND_SHIM_MARKER))
|
|
1229
|
+
if (content.includes(COMMAND_SHIM_MARKER))
|
|
1230
|
+
await rm7(linkPath, { force: true });
|
|
1031
1231
|
} catch (error) {
|
|
1032
|
-
if (error
|
|
1232
|
+
if (isNodeErrorWithCode2(error) && error.code === "ENOENT")
|
|
1233
|
+
return;
|
|
1033
1234
|
throw error;
|
|
1034
1235
|
}
|
|
1035
1236
|
}
|
|
@@ -1040,54 +1241,152 @@ function isManagedLegacyComponentTarget(target, component) {
|
|
|
1040
1241
|
return suffix[0] === "components" && suffix[1] === component && suffix[2] === "dist" && suffix[3] === "cli.js" && (hasPluginCachePrefix(parts, suffixStart) || hasOmoCodexPluginPrefix(parts, suffixStart));
|
|
1041
1242
|
}
|
|
1042
1243
|
function hasPluginCachePrefix(parts, endExclusive) {
|
|
1043
|
-
for (let index = 0;
|
|
1044
|
-
if (parts[index] === "plugins" && parts[index + 1] === "cache")
|
|
1244
|
+
for (let index = 0;index < endExclusive - 1; index += 1) {
|
|
1245
|
+
if (parts[index] === "plugins" && parts[index + 1] === "cache")
|
|
1246
|
+
return true;
|
|
1045
1247
|
}
|
|
1046
1248
|
return false;
|
|
1047
1249
|
}
|
|
1048
1250
|
function hasOmoCodexPluginPrefix(parts, endExclusive) {
|
|
1049
|
-
for (let index = 0;
|
|
1050
|
-
if (parts[index] === "packages" && parts[index + 1] === "omo-codex" && parts[index + 2] === "plugin")
|
|
1251
|
+
for (let index = 0;index <= endExclusive - 3; index += 1) {
|
|
1252
|
+
if (parts[index] === "packages" && parts[index + 1] === "omo-codex" && parts[index + 2] === "plugin")
|
|
1253
|
+
return true;
|
|
1051
1254
|
}
|
|
1052
1255
|
return false;
|
|
1053
1256
|
}
|
|
1257
|
+
function isNodeErrorWithCode2(error) {
|
|
1258
|
+
return typeof error === "object" && error !== null && "code" in error;
|
|
1259
|
+
}
|
|
1054
1260
|
|
|
1055
|
-
//
|
|
1056
|
-
|
|
1261
|
+
// ../src/install/codex-cache-runtime-wrapper.ts
|
|
1262
|
+
import { join as join11 } from "node:path";
|
|
1057
1263
|
var RUNTIME_WRAPPER_MARKER = "OMO_GENERATED_RUNTIME_WRAPPER";
|
|
1058
|
-
|
|
1059
|
-
const
|
|
1060
|
-
|
|
1061
|
-
|
|
1264
|
+
function posixRuntimeWrapper(cliPath, codexHome, binDir, nodeCliPath) {
|
|
1265
|
+
const ulwLoopBin = toPosixPath(join11(binDir, "omo-ulw-loop"));
|
|
1266
|
+
const nodeCli = escapePosixDoubleQuoted(toPosixPath(nodeCliPath));
|
|
1267
|
+
const escapedCliPath = escapePosixDoubleQuoted(toPosixPath(cliPath));
|
|
1268
|
+
const escapedCodexHome = escapePosixDoubleQuoted(toPosixPath(codexHome));
|
|
1269
|
+
const escapedUlwLoopBin = escapePosixDoubleQuoted(ulwLoopBin);
|
|
1270
|
+
return [
|
|
1271
|
+
"#!/bin/sh",
|
|
1272
|
+
`# ${RUNTIME_WRAPPER_MARKER}`,
|
|
1273
|
+
`export CODEX_HOME="\${CODEX_HOME:-${escapedCodexHome}}"`,
|
|
1274
|
+
'export OMO_SPARKSHELL_APP_SERVER_SOCKET="${OMO_SPARKSHELL_APP_SERVER_SOCKET:-$CODEX_HOME/app-server-control/app-server-control.sock}"',
|
|
1275
|
+
'if [ "$1" = "ulw-loop" ] && [ -x "' + escapedUlwLoopBin + '" ]; then',
|
|
1276
|
+
" shift",
|
|
1277
|
+
' exec "' + escapedUlwLoopBin + '" "$@"',
|
|
1278
|
+
"fi",
|
|
1279
|
+
`if [ "\${OMO_RUNTIME:-}" = "node" ] && [ -f "${nodeCli}" ]; then`,
|
|
1280
|
+
` exec node "${nodeCli}" "$@"`,
|
|
1281
|
+
"fi",
|
|
1282
|
+
'BUN_BINARY="${BUN_BINARY:-}"',
|
|
1283
|
+
'if [ -z "$BUN_BINARY" ] && command -v bun >/dev/null 2>&1; then',
|
|
1284
|
+
" BUN_BINARY=bun",
|
|
1285
|
+
"fi",
|
|
1286
|
+
'if [ -z "$BUN_BINARY" ]; then',
|
|
1287
|
+
' for omo_bun_candidate in "$HOME/.bun/bin/bun" /opt/homebrew/bin/bun /usr/local/bin/bun; do',
|
|
1288
|
+
' if [ -x "$omo_bun_candidate" ]; then',
|
|
1289
|
+
' BUN_BINARY="$omo_bun_candidate"',
|
|
1290
|
+
" break",
|
|
1291
|
+
" fi",
|
|
1292
|
+
" done",
|
|
1293
|
+
"fi",
|
|
1294
|
+
'if [ -z "$BUN_BINARY" ]; then',
|
|
1295
|
+
` if [ -f "${nodeCli}" ] && command -v node >/dev/null 2>&1; then`,
|
|
1296
|
+
` exec node "${nodeCli}" "$@"`,
|
|
1297
|
+
" fi",
|
|
1298
|
+
` echo "omo: bun runtime not found (checked PATH, ~/.bun/bin, /opt/homebrew/bin, /usr/local/bin) and the node fallback CLI is missing at ${nodeCli}; install bun from https://bun.sh, or reinstall omo and force the fallback with OMO_RUNTIME=node" >&2`,
|
|
1299
|
+
" exit 127",
|
|
1300
|
+
"fi",
|
|
1301
|
+
`if [ ! -f "${escapedCliPath}" ]; then`,
|
|
1302
|
+
` echo "omo: runtime target missing at ${escapedCliPath}; reinstall with: npx --yes lazycodex-ai@latest install --no-tui" >&2`,
|
|
1303
|
+
" exit 1",
|
|
1304
|
+
"fi",
|
|
1305
|
+
`exec "$BUN_BINARY" "${escapedCliPath}" "$@"`,
|
|
1306
|
+
""
|
|
1307
|
+
].join(`
|
|
1308
|
+
`);
|
|
1309
|
+
}
|
|
1310
|
+
function windowsRuntimeWrapper(cliPath, codexHome, binDir, nodeCliPath) {
|
|
1311
|
+
const ulwLoopBin = join11(binDir, "omo-ulw-loop.cmd");
|
|
1312
|
+
return [
|
|
1313
|
+
"@echo off",
|
|
1314
|
+
`rem ${RUNTIME_WRAPPER_MARKER}`,
|
|
1315
|
+
`if not defined CODEX_HOME set "CODEX_HOME=${codexHome}"`,
|
|
1316
|
+
'if not defined OMO_SPARKSHELL_APP_SERVER_SOCKET set "OMO_SPARKSHELL_APP_SERVER_SOCKET=%CODEX_HOME%\\app-server-control\\app-server-control.sock"',
|
|
1317
|
+
`if "%~1"=="ulw-loop" if exist "${ulwLoopBin}" (`,
|
|
1318
|
+
" shift /1",
|
|
1319
|
+
` "${ulwLoopBin}" %*`,
|
|
1320
|
+
" exit /b %ERRORLEVEL%",
|
|
1321
|
+
")",
|
|
1322
|
+
`if "%OMO_RUNTIME%"=="node" if exist "${nodeCliPath}" (`,
|
|
1323
|
+
` node "${nodeCliPath}" %*`,
|
|
1324
|
+
" exit /b %ERRORLEVEL%",
|
|
1325
|
+
")",
|
|
1326
|
+
'if not defined BUN_BINARY where bun >nul 2>nul && set "BUN_BINARY=bun"',
|
|
1327
|
+
'if not defined BUN_BINARY if exist "%USERPROFILE%\\.bun\\bin\\bun.exe" set "BUN_BINARY=%USERPROFILE%\\.bun\\bin\\bun.exe"',
|
|
1328
|
+
"if not defined BUN_BINARY (",
|
|
1329
|
+
` if exist "${nodeCliPath}" (`,
|
|
1330
|
+
` node "${nodeCliPath}" %*`,
|
|
1331
|
+
" exit /b %ERRORLEVEL%",
|
|
1332
|
+
" )",
|
|
1333
|
+
` echo omo: bun runtime not found and the node fallback CLI is missing at ${nodeCliPath}; install bun from https://bun.sh or reinstall omo and force OMO_RUNTIME=node 1>&2`,
|
|
1334
|
+
" exit /b 127",
|
|
1335
|
+
")",
|
|
1336
|
+
`if not exist "${cliPath}" (`,
|
|
1337
|
+
` echo omo: runtime target missing at ${cliPath}; reinstall with: npx --yes lazycodex-ai@latest install --no-tui 1>&2`,
|
|
1338
|
+
" exit /b 1",
|
|
1339
|
+
")",
|
|
1340
|
+
`"%BUN_BINARY%" "${cliPath}" %*`,
|
|
1341
|
+
""
|
|
1342
|
+
].join(`\r
|
|
1343
|
+
`);
|
|
1344
|
+
}
|
|
1345
|
+
function toPosixPath(path) {
|
|
1346
|
+
return path.replaceAll("\\", "/");
|
|
1347
|
+
}
|
|
1348
|
+
function escapePosixDoubleQuoted(value) {
|
|
1349
|
+
return value.replaceAll("\\", "\\\\").replaceAll('"', "\\\"").replaceAll("$", "\\$").replaceAll("`", "\\`");
|
|
1350
|
+
}
|
|
1351
|
+
|
|
1352
|
+
// ../src/install/codex-cache-bins.ts
|
|
1353
|
+
var RESERVED_NESTED_BIN_NAMES = new Set(["omo", "lazycodex", "lazycodex-ai", "oh-my-opencode", "oh-my-openagent"]);
|
|
1354
|
+
async function linkCachedPluginBins(input) {
|
|
1355
|
+
const binLinks = await discoverPackageBins(input.pluginRoot);
|
|
1356
|
+
const platform = input.platform ?? process.platform;
|
|
1357
|
+
await mkdir5(input.binDir, { recursive: true });
|
|
1358
|
+
await removeLegacyCodexComponentBins(input.binDir, platform);
|
|
1062
1359
|
const linked = [];
|
|
1063
1360
|
for (const link of binLinks) {
|
|
1064
|
-
const linkPath = await linkCachedPluginBin(binDir, link, platform);
|
|
1361
|
+
const linkPath = await linkCachedPluginBin(input.binDir, link, platform);
|
|
1065
1362
|
linked.push({ name: link.name, path: linkPath, target: link.target });
|
|
1066
1363
|
}
|
|
1067
1364
|
return linked;
|
|
1068
1365
|
}
|
|
1069
|
-
async function linkRootRuntimeBin(
|
|
1070
|
-
const cliPath =
|
|
1071
|
-
if (!await isFile2(cliPath))
|
|
1072
|
-
|
|
1073
|
-
|
|
1366
|
+
async function linkRootRuntimeBin(input) {
|
|
1367
|
+
const cliPath = join12(input.repoRoot, "dist", "cli", "index.js");
|
|
1368
|
+
if (!await isFile2(cliPath))
|
|
1369
|
+
return null;
|
|
1370
|
+
const nodeCliPath = join12(input.repoRoot, "dist", "cli-node", "index.js");
|
|
1371
|
+
const platform = input.platform ?? process.platform;
|
|
1372
|
+
await mkdir5(input.binDir, { recursive: true });
|
|
1074
1373
|
if (platform === "win32") {
|
|
1075
|
-
const linkPath2 =
|
|
1076
|
-
await replaceRuntimeWrapper(linkPath2, windowsRuntimeWrapper(cliPath, codexHome, binDir, nodeCliPath));
|
|
1374
|
+
const linkPath2 = join12(input.binDir, "omo.cmd");
|
|
1375
|
+
await replaceRuntimeWrapper(linkPath2, windowsRuntimeWrapper(cliPath, input.codexHome, input.binDir, nodeCliPath));
|
|
1077
1376
|
return { name: "omo", path: linkPath2, target: cliPath };
|
|
1078
1377
|
}
|
|
1079
|
-
const linkPath =
|
|
1080
|
-
await replaceRuntimeWrapper(linkPath, posixRuntimeWrapper(cliPath, codexHome, binDir, nodeCliPath));
|
|
1378
|
+
const linkPath = join12(input.binDir, "omo");
|
|
1379
|
+
await replaceRuntimeWrapper(linkPath, posixRuntimeWrapper(cliPath, input.codexHome, input.binDir, nodeCliPath));
|
|
1081
1380
|
await chmod2(linkPath, 493);
|
|
1082
1381
|
return { name: "omo", path: linkPath, target: cliPath };
|
|
1083
1382
|
}
|
|
1084
1383
|
async function linkCachedPluginBin(binDir, link, platform) {
|
|
1085
1384
|
if (platform === "win32") {
|
|
1086
|
-
const linkPath2 =
|
|
1385
|
+
const linkPath2 = join12(binDir, `${link.name}.cmd`);
|
|
1087
1386
|
await replaceCommandShim(linkPath2, link.target);
|
|
1088
1387
|
return linkPath2;
|
|
1089
1388
|
}
|
|
1090
|
-
const linkPath =
|
|
1389
|
+
const linkPath = join12(binDir, link.name);
|
|
1091
1390
|
await replaceSymlink(linkPath, link.target);
|
|
1092
1391
|
return linkPath;
|
|
1093
1392
|
}
|
|
@@ -1095,7 +1394,8 @@ async function isFile2(path) {
|
|
|
1095
1394
|
try {
|
|
1096
1395
|
return (await stat3(path)).isFile();
|
|
1097
1396
|
} catch (error) {
|
|
1098
|
-
if (error
|
|
1397
|
+
if (isNodeErrorWithCode(error) && error.code === "ENOENT")
|
|
1398
|
+
return false;
|
|
1099
1399
|
throw error;
|
|
1100
1400
|
}
|
|
1101
1401
|
}
|
|
@@ -1106,272 +1406,152 @@ async function discoverPackageBins(root) {
|
|
|
1106
1406
|
}
|
|
1107
1407
|
async function collectPackageBins(directory, root, links) {
|
|
1108
1408
|
const entries = await readdir2(directory, { withFileTypes: true });
|
|
1109
|
-
const packageJsonPath = join9(directory, "package.json");
|
|
1110
1409
|
if (entries.some((entry) => entry.isFile() && entry.name === "package.json")) {
|
|
1111
|
-
await appendPackageBinLinks(
|
|
1410
|
+
await appendPackageBinLinks(join12(directory, "package.json"), directory, root, links);
|
|
1112
1411
|
}
|
|
1113
1412
|
for (const entry of entries) {
|
|
1114
|
-
if (!entry.isDirectory())
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1413
|
+
if (!entry.isDirectory())
|
|
1414
|
+
continue;
|
|
1415
|
+
if (entry.name === "node_modules" || entry.name === ".git" || entry.name === "dist")
|
|
1416
|
+
continue;
|
|
1417
|
+
const childPath = join12(directory, entry.name);
|
|
1418
|
+
if (!childPath.startsWith(root))
|
|
1419
|
+
continue;
|
|
1118
1420
|
await collectPackageBins(childPath, root, links);
|
|
1119
1421
|
}
|
|
1120
1422
|
}
|
|
1121
1423
|
async function appendPackageBinLinks(packageJsonPath, packageRoot, root, links) {
|
|
1122
1424
|
const packageJson = JSON.parse(await readFile7(packageJsonPath, "utf8"));
|
|
1123
|
-
if (!
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1425
|
+
if (!isPlainRecord(packageJson))
|
|
1426
|
+
return;
|
|
1427
|
+
const packageName = packageJson.name;
|
|
1428
|
+
const packageBin = packageJson.bin;
|
|
1429
|
+
if (typeof packageBin === "string" && typeof packageName === "string") {
|
|
1430
|
+
const name = assertSafeCommandName(basename4(packageName));
|
|
1127
1431
|
if (!isReservedNestedBinName(name, packageRoot, root)) {
|
|
1128
|
-
links.push(
|
|
1432
|
+
links.push({ name, target: resolvePackageBinTarget(packageRoot, packageBin) });
|
|
1129
1433
|
}
|
|
1130
1434
|
return;
|
|
1131
1435
|
}
|
|
1132
|
-
if (!
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
if (
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
if (target.includes("\0")) {
|
|
1142
|
-
throw new Error(`package bin target for ${name} contains a NUL byte`);
|
|
1143
|
-
}
|
|
1144
|
-
const resolvedTarget = resolve3(packageRoot, target);
|
|
1145
|
-
if (!isPathInside(resolvedTarget, packageRoot)) {
|
|
1146
|
-
throw new Error(`package bin target for ${name} escapes package root`);
|
|
1436
|
+
if (!isPlainRecord(packageBin))
|
|
1437
|
+
return;
|
|
1438
|
+
for (const [name, target] of Object.entries(packageBin)) {
|
|
1439
|
+
if (typeof target !== "string")
|
|
1440
|
+
continue;
|
|
1441
|
+
const commandName = assertSafeCommandName(name);
|
|
1442
|
+
if (isReservedNestedBinName(commandName, packageRoot, root))
|
|
1443
|
+
continue;
|
|
1444
|
+
links.push({ name: commandName, target: resolvePackageBinTarget(packageRoot, target) });
|
|
1147
1445
|
}
|
|
1148
|
-
return { name, target: resolvedTarget };
|
|
1149
1446
|
}
|
|
1150
|
-
function
|
|
1151
|
-
if (name.length === 0 || name === "." || name === ".." || name.includes("
|
|
1152
|
-
throw new Error(`
|
|
1447
|
+
function assertSafeCommandName(name) {
|
|
1448
|
+
if (name.length === 0 || name === "." || name === ".." || name.includes("/") || name.includes("\\") || name.includes("\x00")) {
|
|
1449
|
+
throw new Error(`Invalid package bin command name: ${name}`);
|
|
1153
1450
|
}
|
|
1451
|
+
return name;
|
|
1154
1452
|
}
|
|
1155
1453
|
function isReservedNestedBinName(name, packageRoot, root) {
|
|
1156
1454
|
return packageRoot !== root && RESERVED_NESTED_BIN_NAMES.has(name);
|
|
1157
1455
|
}
|
|
1456
|
+
function resolvePackageBinTarget(packageRoot, target) {
|
|
1457
|
+
if (target.includes("\x00"))
|
|
1458
|
+
throw new Error("Package bin target must stay inside package root");
|
|
1459
|
+
const root = resolve3(packageRoot);
|
|
1460
|
+
const resolvedTarget = resolve3(root, target);
|
|
1461
|
+
const relativeTarget = relative2(root, resolvedTarget);
|
|
1462
|
+
if (relativeTarget === "" || relativeTarget !== ".." && !relativeTarget.startsWith(`..${sep}`) && !isAbsolute2(relativeTarget)) {
|
|
1463
|
+
return resolvedTarget;
|
|
1464
|
+
}
|
|
1465
|
+
throw new Error("Package bin target must stay inside package root");
|
|
1466
|
+
}
|
|
1158
1467
|
async function replaceSymlink(linkPath, targetPath) {
|
|
1159
|
-
if (await existingNonSymlink(linkPath))
|
|
1468
|
+
if (await existingNonSymlink(linkPath))
|
|
1160
1469
|
throw new Error(`${linkPath} already exists and is not a symlink`);
|
|
1161
|
-
}
|
|
1162
|
-
await rm6(linkPath, { force: true });
|
|
1470
|
+
await rm8(linkPath, { force: true });
|
|
1163
1471
|
await symlink(targetPath, linkPath);
|
|
1164
1472
|
}
|
|
1165
1473
|
async function replaceCommandShim(linkPath, targetPath) {
|
|
1166
|
-
if (await existingNonShim(linkPath))
|
|
1474
|
+
if (await existingNonShim(linkPath))
|
|
1167
1475
|
throw new Error(`${linkPath} already exists and is not a command shim`);
|
|
1168
|
-
}
|
|
1169
1476
|
await writeFile4(linkPath, `@echo off\r
|
|
1170
1477
|
${COMMAND_SHIM_MARKER}\r
|
|
1171
1478
|
node "${targetPath}" %*\r
|
|
1172
1479
|
`);
|
|
1173
1480
|
}
|
|
1174
1481
|
async function replaceRuntimeWrapper(linkPath, content) {
|
|
1175
|
-
if (await existingNonRuntimeWrapper(linkPath))
|
|
1482
|
+
if (await existingNonRuntimeWrapper(linkPath))
|
|
1176
1483
|
throw new Error(`${linkPath} already exists and is not a generated OMO runtime wrapper`);
|
|
1177
|
-
}
|
|
1178
|
-
await rm6(linkPath, { force: true });
|
|
1484
|
+
await rm8(linkPath, { force: true });
|
|
1179
1485
|
await writeFile4(linkPath, content);
|
|
1180
1486
|
}
|
|
1181
1487
|
async function existingNonRuntimeWrapper(path) {
|
|
1182
1488
|
try {
|
|
1183
|
-
const
|
|
1184
|
-
if (
|
|
1185
|
-
|
|
1489
|
+
const stat4 = await lstat5(path);
|
|
1490
|
+
if (stat4.isSymbolicLink())
|
|
1491
|
+
return false;
|
|
1492
|
+
if (!stat4.isFile())
|
|
1493
|
+
return true;
|
|
1186
1494
|
const content = await readFile7(path, "utf8");
|
|
1187
1495
|
return !content.includes(RUNTIME_WRAPPER_MARKER);
|
|
1188
1496
|
} catch (error) {
|
|
1189
|
-
if (error
|
|
1497
|
+
if (isNodeErrorWithCode(error) && error.code === "ENOENT")
|
|
1498
|
+
return false;
|
|
1190
1499
|
throw error;
|
|
1191
1500
|
}
|
|
1192
1501
|
}
|
|
1193
|
-
function posixRuntimeWrapper(cliPath, codexHome, binDir, nodeCliPath) {
|
|
1194
|
-
const ulwLoopBin = join9(binDir, "omo-ulw-loop");
|
|
1195
|
-
const nodeCli = escapePosixDoubleQuoted(nodeCliPath);
|
|
1196
|
-
return [
|
|
1197
|
-
"#!/bin/sh",
|
|
1198
|
-
`# ${RUNTIME_WRAPPER_MARKER}`,
|
|
1199
|
-
`export CODEX_HOME="\${CODEX_HOME:-${escapePosixDoubleQuoted(codexHome)}}"`,
|
|
1200
|
-
'export OMO_SPARKSHELL_APP_SERVER_SOCKET="${OMO_SPARKSHELL_APP_SERVER_SOCKET:-$CODEX_HOME/app-server-control/app-server-control.sock}"',
|
|
1201
|
-
'if [ "$1" = "ulw-loop" ] && [ -x "' + escapePosixDoubleQuoted(ulwLoopBin) + '" ]; then',
|
|
1202
|
-
" shift",
|
|
1203
|
-
' exec "' + escapePosixDoubleQuoted(ulwLoopBin) + '" "$@"',
|
|
1204
|
-
"fi",
|
|
1205
|
-
`if [ "\${OMO_RUNTIME:-}" = "node" ] && [ -f "${nodeCli}" ]; then`,
|
|
1206
|
-
` exec node "${nodeCli}" "$@"`,
|
|
1207
|
-
"fi",
|
|
1208
|
-
'BUN_BINARY="${BUN_BINARY:-}"',
|
|
1209
|
-
'if [ -z "$BUN_BINARY" ] && command -v bun >/dev/null 2>&1; then',
|
|
1210
|
-
" BUN_BINARY=bun",
|
|
1211
|
-
"fi",
|
|
1212
|
-
'if [ -z "$BUN_BINARY" ]; then',
|
|
1213
|
-
' for omo_bun_candidate in "$HOME/.bun/bin/bun" /opt/homebrew/bin/bun /usr/local/bin/bun; do',
|
|
1214
|
-
' if [ -x "$omo_bun_candidate" ]; then',
|
|
1215
|
-
' BUN_BINARY="$omo_bun_candidate"',
|
|
1216
|
-
" break",
|
|
1217
|
-
" fi",
|
|
1218
|
-
" done",
|
|
1219
|
-
"fi",
|
|
1220
|
-
'if [ -z "$BUN_BINARY" ]; then',
|
|
1221
|
-
` if [ -f "${nodeCli}" ] && command -v node >/dev/null 2>&1; then`,
|
|
1222
|
-
` exec node "${nodeCli}" "$@"`,
|
|
1223
|
-
" fi",
|
|
1224
|
-
` echo "omo: bun runtime not found (checked PATH, ~/.bun/bin, /opt/homebrew/bin, /usr/local/bin) and the node fallback CLI is missing at ${nodeCli}; install bun from https://bun.sh, or reinstall omo and force the fallback with OMO_RUNTIME=node" >&2`,
|
|
1225
|
-
" exit 127",
|
|
1226
|
-
"fi",
|
|
1227
|
-
`exec "$BUN_BINARY" "${escapePosixDoubleQuoted(cliPath)}" "$@"`,
|
|
1228
|
-
""
|
|
1229
|
-
].join("\n");
|
|
1230
|
-
}
|
|
1231
|
-
function windowsRuntimeWrapper(cliPath, codexHome, binDir, nodeCliPath) {
|
|
1232
|
-
const ulwLoopBin = join9(binDir, "omo-ulw-loop.cmd");
|
|
1233
|
-
return [
|
|
1234
|
-
"@echo off",
|
|
1235
|
-
`rem ${RUNTIME_WRAPPER_MARKER}`,
|
|
1236
|
-
`if not defined CODEX_HOME set "CODEX_HOME=${codexHome}"`,
|
|
1237
|
-
'if not defined OMO_SPARKSHELL_APP_SERVER_SOCKET set "OMO_SPARKSHELL_APP_SERVER_SOCKET=%CODEX_HOME%\\app-server-control\\app-server-control.sock"',
|
|
1238
|
-
`if "%~1"=="ulw-loop" if exist "${ulwLoopBin}" (`,
|
|
1239
|
-
" shift /1",
|
|
1240
|
-
` "${ulwLoopBin}" %*`,
|
|
1241
|
-
" exit /b %ERRORLEVEL%",
|
|
1242
|
-
")",
|
|
1243
|
-
`if "%OMO_RUNTIME%"=="node" if exist "${nodeCliPath}" (`,
|
|
1244
|
-
` node "${nodeCliPath}" %*`,
|
|
1245
|
-
" exit /b %ERRORLEVEL%",
|
|
1246
|
-
")",
|
|
1247
|
-
'if not defined BUN_BINARY where bun >nul 2>nul && set "BUN_BINARY=bun"',
|
|
1248
|
-
'if not defined BUN_BINARY if exist "%USERPROFILE%\\.bun\\bin\\bun.exe" set "BUN_BINARY=%USERPROFILE%\\.bun\\bin\\bun.exe"',
|
|
1249
|
-
"if not defined BUN_BINARY (",
|
|
1250
|
-
` if exist "${nodeCliPath}" (`,
|
|
1251
|
-
` node "${nodeCliPath}" %*`,
|
|
1252
|
-
" exit /b %ERRORLEVEL%",
|
|
1253
|
-
" )",
|
|
1254
|
-
` echo omo: bun runtime not found and the node fallback CLI is missing at ${nodeCliPath}; install bun from https://bun.sh or reinstall omo and force OMO_RUNTIME=node 1>&2`,
|
|
1255
|
-
" exit /b 127",
|
|
1256
|
-
")",
|
|
1257
|
-
`"%BUN_BINARY%" "${cliPath}" %*`,
|
|
1258
|
-
""
|
|
1259
|
-
].join("\r\n");
|
|
1260
|
-
}
|
|
1261
|
-
function escapePosixDoubleQuoted(value) {
|
|
1262
|
-
return value.replaceAll("\\", "\\\\").replaceAll('"', '\\"').replaceAll("$", "\\$").replaceAll("`", "\\`");
|
|
1263
|
-
}
|
|
1264
1502
|
async function existingNonShim(path) {
|
|
1265
1503
|
try {
|
|
1266
|
-
const
|
|
1267
|
-
if (!
|
|
1504
|
+
const stat4 = await lstat5(path);
|
|
1505
|
+
if (!stat4.isFile())
|
|
1506
|
+
return true;
|
|
1268
1507
|
const content = await readFile7(path, "utf8");
|
|
1269
|
-
if (content.includes(COMMAND_SHIM_MARKER))
|
|
1508
|
+
if (content.includes(COMMAND_SHIM_MARKER))
|
|
1509
|
+
return false;
|
|
1270
1510
|
throw new Error(`${path} already exists and is not a generated command shim`);
|
|
1271
1511
|
} catch (error) {
|
|
1272
|
-
if (error
|
|
1512
|
+
if (isNodeErrorWithCode(error) && error.code === "ENOENT")
|
|
1513
|
+
return false;
|
|
1273
1514
|
throw error;
|
|
1274
1515
|
}
|
|
1275
1516
|
}
|
|
1276
1517
|
async function existingNonSymlink(path) {
|
|
1277
1518
|
try {
|
|
1278
|
-
const
|
|
1279
|
-
if (!
|
|
1519
|
+
const stat4 = await lstat5(path);
|
|
1520
|
+
if (!stat4.isSymbolicLink())
|
|
1521
|
+
return true;
|
|
1280
1522
|
await readlink2(path);
|
|
1281
1523
|
return false;
|
|
1282
1524
|
} catch (error) {
|
|
1283
|
-
if (error
|
|
1525
|
+
if (isNodeErrorWithCode(error) && error.code === "ENOENT")
|
|
1526
|
+
return false;
|
|
1284
1527
|
throw error;
|
|
1285
1528
|
}
|
|
1286
1529
|
}
|
|
1287
|
-
function isRecord3(value) {
|
|
1288
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1289
|
-
}
|
|
1290
|
-
function isPathInside(candidatePath, rootPath) {
|
|
1291
|
-
const pathFromRoot = relative(rootPath, candidatePath);
|
|
1292
|
-
return pathFromRoot === "" || !pathFromRoot.startsWith("..") && !pathFromRoot.startsWith(`..\\`) && !isDriveRelative(pathFromRoot);
|
|
1293
|
-
}
|
|
1294
|
-
function isDriveRelative(path) {
|
|
1295
|
-
return /^[a-zA-Z]:/.test(path);
|
|
1296
|
-
}
|
|
1297
1530
|
|
|
1298
|
-
//
|
|
1531
|
+
// ../src/install/codex-config-toml.ts
|
|
1299
1532
|
import { mkdir as mkdir6, readFile as readFile9 } from "node:fs/promises";
|
|
1300
|
-
import { dirname as
|
|
1301
|
-
|
|
1302
|
-
// ../../../scripts/install/atomic-write.mjs
|
|
1303
|
-
import { lstat as lstat4, readlink as readlink3, realpath, rename as rename3, unlink, writeFile as writeFile5 } from "node:fs/promises";
|
|
1304
|
-
import { basename as basename5, dirname as dirname6, isAbsolute, join as join10, resolve as resolve4 } from "node:path";
|
|
1305
|
-
var RENAME_RETRY_DELAYS_MS = [10, 25, 50];
|
|
1306
|
-
var RETRIABLE_RENAME_CODES = /* @__PURE__ */ new Set(["EPERM", "EBUSY"]);
|
|
1307
|
-
function isRetriableRenameError(error) {
|
|
1308
|
-
if (!(error instanceof Error)) return false;
|
|
1309
|
-
return RETRIABLE_RENAME_CODES.has(Reflect.get(error, "code"));
|
|
1310
|
-
}
|
|
1311
|
-
async function writeFileAtomic(targetPath, data) {
|
|
1312
|
-
const writeTarget = await resolveSymlinkTarget(targetPath);
|
|
1313
|
-
const temporaryPath = join10(
|
|
1314
|
-
dirname6(writeTarget),
|
|
1315
|
-
`.tmp-${basename5(writeTarget)}-${process.pid}-${Date.now()}`
|
|
1316
|
-
);
|
|
1317
|
-
await writeFile5(temporaryPath, data);
|
|
1318
|
-
try {
|
|
1319
|
-
await renameWithRetry(temporaryPath, writeTarget);
|
|
1320
|
-
} catch (renameError) {
|
|
1321
|
-
await unlink(temporaryPath).catch(() => {
|
|
1322
|
-
});
|
|
1323
|
-
throw renameError;
|
|
1324
|
-
}
|
|
1325
|
-
}
|
|
1326
|
-
async function resolveSymlinkTarget(targetPath) {
|
|
1327
|
-
let linkStats;
|
|
1328
|
-
try {
|
|
1329
|
-
linkStats = await lstat4(targetPath);
|
|
1330
|
-
} catch {
|
|
1331
|
-
return targetPath;
|
|
1332
|
-
}
|
|
1333
|
-
if (!linkStats.isSymbolicLink()) return targetPath;
|
|
1334
|
-
try {
|
|
1335
|
-
return await realpath(targetPath);
|
|
1336
|
-
} catch {
|
|
1337
|
-
const linkValue = await readlink3(targetPath);
|
|
1338
|
-
return isAbsolute(linkValue) ? linkValue : resolve4(dirname6(targetPath), linkValue);
|
|
1339
|
-
}
|
|
1340
|
-
}
|
|
1341
|
-
async function renameWithRetry(fromPath, toPath) {
|
|
1342
|
-
for (let attempt = 0; ; attempt += 1) {
|
|
1343
|
-
try {
|
|
1344
|
-
await rename3(fromPath, toPath);
|
|
1345
|
-
return;
|
|
1346
|
-
} catch (renameError) {
|
|
1347
|
-
if (!isRetriableRenameError(renameError) || attempt >= RENAME_RETRY_DELAYS_MS.length) {
|
|
1348
|
-
throw renameError;
|
|
1349
|
-
}
|
|
1350
|
-
await delay(RENAME_RETRY_DELAYS_MS[attempt]);
|
|
1351
|
-
}
|
|
1352
|
-
}
|
|
1353
|
-
}
|
|
1354
|
-
function delay(milliseconds) {
|
|
1355
|
-
return new Promise((resolve6) => setTimeout(resolve6, milliseconds));
|
|
1356
|
-
}
|
|
1533
|
+
import { dirname as dirname6 } from "node:path";
|
|
1357
1534
|
|
|
1358
|
-
//
|
|
1535
|
+
// ../src/install/toml-section-editor.ts
|
|
1359
1536
|
function findTomlSection(config, header) {
|
|
1360
1537
|
const headerLine = `[${header}]`;
|
|
1361
1538
|
const lines = config.match(/[^\n]*\n?|$/g) ?? [];
|
|
1362
1539
|
let offset = 0;
|
|
1363
1540
|
let start = -1;
|
|
1364
1541
|
for (const line of lines) {
|
|
1365
|
-
if (line.length === 0)
|
|
1542
|
+
if (line.length === 0)
|
|
1543
|
+
break;
|
|
1366
1544
|
const trimmed = line.trim();
|
|
1367
1545
|
if (start === -1) {
|
|
1368
|
-
if (trimmed === headerLine)
|
|
1546
|
+
if (trimmed === headerLine)
|
|
1547
|
+
start = offset;
|
|
1369
1548
|
} else if (trimmed.startsWith("[") && trimmed.endsWith("]")) {
|
|
1370
1549
|
return { start, end: offset, text: config.slice(start, offset) };
|
|
1371
1550
|
}
|
|
1372
1551
|
offset += line.length;
|
|
1373
1552
|
}
|
|
1374
|
-
if (start === -1)
|
|
1553
|
+
if (start === -1)
|
|
1554
|
+
return null;
|
|
1375
1555
|
return { start, end: config.length, text: config.slice(start) };
|
|
1376
1556
|
}
|
|
1377
1557
|
function replaceOrInsertSetting(config, section, key, value) {
|
|
@@ -1389,16 +1569,20 @@ function replaceOrInsertRootSetting(config, key, value) {
|
|
|
1389
1569
|
const root = config.slice(0, sectionStart);
|
|
1390
1570
|
const suffix = config.slice(sectionStart);
|
|
1391
1571
|
const linePattern = new RegExp(`^${escapeRegExp(key)}\\s*=.*$`, "m");
|
|
1392
|
-
const replacement = linePattern.test(root) ? root.replace(linePattern, `${key} = ${value}`) : `${root.trimEnd()}${root.trimEnd().length > 0 ?
|
|
1572
|
+
const replacement = linePattern.test(root) ? root.replace(linePattern, `${key} = ${value}`) : `${root.trimEnd()}${root.trimEnd().length > 0 ? `
|
|
1573
|
+
` : ""}${key} = ${value}
|
|
1393
1574
|
`;
|
|
1394
|
-
if (suffix.length === 0)
|
|
1575
|
+
if (suffix.length === 0)
|
|
1576
|
+
return replacement;
|
|
1395
1577
|
return `${replacement.trimEnd()}
|
|
1396
1578
|
|
|
1397
1579
|
${suffix.trimStart()}`;
|
|
1398
1580
|
}
|
|
1399
1581
|
function appendBlock(config, block) {
|
|
1400
1582
|
const prefix = config.trimEnd();
|
|
1401
|
-
return `${prefix}${prefix.length > 0 ?
|
|
1583
|
+
return `${prefix}${prefix.length > 0 ? `
|
|
1584
|
+
|
|
1585
|
+
` : ""}${block.trimEnd()}
|
|
1402
1586
|
`;
|
|
1403
1587
|
}
|
|
1404
1588
|
function findFirstTableStart(config) {
|
|
@@ -1406,475 +1590,712 @@ function findFirstTableStart(config) {
|
|
|
1406
1590
|
return match?.index ?? config.length;
|
|
1407
1591
|
}
|
|
1408
1592
|
function insertSetting(sectionText, key, value) {
|
|
1409
|
-
const lines = sectionText.split(
|
|
1593
|
+
const lines = sectionText.split(`
|
|
1594
|
+
`);
|
|
1410
1595
|
lines.splice(1, 0, `${key} = ${value}`);
|
|
1411
|
-
return lines.join(
|
|
1596
|
+
return lines.join(`
|
|
1597
|
+
`);
|
|
1412
1598
|
}
|
|
1413
1599
|
function escapeRegExp(value) {
|
|
1414
1600
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1415
1601
|
}
|
|
1416
1602
|
|
|
1417
|
-
//
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
const section = findTomlSection(normalizedConfig, CODEX_MULTI_AGENT_V2_HEADER);
|
|
1423
|
-
const maxThreadsValue = CODEX_MULTI_AGENT_V2_MAX_CONCURRENT_THREADS_PER_SESSION.toString();
|
|
1424
|
-
if (!section) {
|
|
1425
|
-
return appendBlock(
|
|
1426
|
-
normalizedConfig,
|
|
1427
|
-
`[${CODEX_MULTI_AGENT_V2_HEADER}]
|
|
1428
|
-
max_concurrent_threads_per_session = ${maxThreadsValue}
|
|
1429
|
-
hide_spawn_agent_metadata = false
|
|
1430
|
-
`
|
|
1431
|
-
);
|
|
1432
|
-
}
|
|
1433
|
-
const withMaxThreads = replaceOrInsertSetting(
|
|
1434
|
-
normalizedConfig,
|
|
1435
|
-
section,
|
|
1436
|
-
"max_concurrent_threads_per_session",
|
|
1437
|
-
maxThreadsValue
|
|
1438
|
-
);
|
|
1439
|
-
const updatedSection = findTomlSection(withMaxThreads, CODEX_MULTI_AGENT_V2_HEADER);
|
|
1440
|
-
return replaceOrInsertSetting(withMaxThreads, updatedSection, "hide_spawn_agent_metadata", "false");
|
|
1603
|
+
// ../src/install/codex-config-toml-sections.ts
|
|
1604
|
+
function removeTomlSections(config, shouldRemove) {
|
|
1605
|
+
return splitTomlSections(config).filter((section) => section.header === null || !shouldRemove(section.header)).map((section) => section.text).join("").replace(/\n{3,}/g, `
|
|
1606
|
+
|
|
1607
|
+
`);
|
|
1441
1608
|
}
|
|
1442
|
-
function
|
|
1443
|
-
const
|
|
1444
|
-
|
|
1445
|
-
|
|
1609
|
+
function splitTomlSections(config) {
|
|
1610
|
+
const lines = config.match(/[^\n]*\n?|$/g) ?? [];
|
|
1611
|
+
const sections = [];
|
|
1612
|
+
let current = { header: null, text: "" };
|
|
1613
|
+
for (const line of lines) {
|
|
1614
|
+
if (line.length === 0)
|
|
1615
|
+
break;
|
|
1616
|
+
const header = parseTomlHeader2(line);
|
|
1617
|
+
if (header !== null) {
|
|
1618
|
+
if (current.text.length > 0)
|
|
1619
|
+
sections.push(current);
|
|
1620
|
+
current = { header, text: line };
|
|
1621
|
+
} else {
|
|
1622
|
+
current = { ...current, text: current.text + line };
|
|
1623
|
+
}
|
|
1624
|
+
}
|
|
1625
|
+
if (current.text.length > 0)
|
|
1626
|
+
sections.push(current);
|
|
1627
|
+
return sections;
|
|
1446
1628
|
}
|
|
1447
|
-
function
|
|
1448
|
-
const
|
|
1449
|
-
if (!
|
|
1450
|
-
|
|
1629
|
+
function parsePluginHeaderKey(header) {
|
|
1630
|
+
const prefix = "plugins.";
|
|
1631
|
+
if (!header.startsWith(prefix))
|
|
1632
|
+
return null;
|
|
1633
|
+
return parseLeadingJsonString2(header.slice(prefix.length));
|
|
1451
1634
|
}
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
modelReasoningEffort: "high",
|
|
1461
|
-
planModeReasoningEffort: "xhigh"
|
|
1462
|
-
},
|
|
1463
|
-
managedProfiles: [
|
|
1464
|
-
{
|
|
1465
|
-
model: "gpt-5.5",
|
|
1466
|
-
modelContextWindow: 1e6,
|
|
1467
|
-
modelReasoningEffort: "high",
|
|
1468
|
-
planModeReasoningEffort: "xhigh"
|
|
1469
|
-
},
|
|
1470
|
-
{ model: "gpt-5.5", modelContextWindow: 272e3 }
|
|
1471
|
-
]
|
|
1472
|
-
};
|
|
1473
|
-
async function readCodexModelCatalog(codexPackageRoot) {
|
|
1635
|
+
function parseAgentHeaderName(header) {
|
|
1636
|
+
const prefix = "agents.";
|
|
1637
|
+
if (!header.startsWith(prefix))
|
|
1638
|
+
return null;
|
|
1639
|
+
const key = header.slice(prefix.length);
|
|
1640
|
+
return key.startsWith('"') ? parseLeadingJsonString2(key) : key;
|
|
1641
|
+
}
|
|
1642
|
+
function parseJsonString2(value) {
|
|
1474
1643
|
try {
|
|
1475
|
-
const parsed = JSON.parse(
|
|
1476
|
-
return
|
|
1644
|
+
const parsed = JSON.parse(value);
|
|
1645
|
+
return typeof parsed === "string" ? parsed : null;
|
|
1477
1646
|
} catch (error) {
|
|
1478
|
-
if (
|
|
1479
|
-
|
|
1647
|
+
if (error instanceof Error)
|
|
1648
|
+
return null;
|
|
1649
|
+
return null;
|
|
1480
1650
|
}
|
|
1481
1651
|
}
|
|
1482
|
-
function
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
if (typeof current.model !== "string" || typeof current.model_context_window !== "number" || typeof current.model_reasoning_effort !== "string" || typeof current.plan_mode_reasoning_effort !== "string") {
|
|
1652
|
+
function parseTomlHeader2(line) {
|
|
1653
|
+
const trimmed = line.trim();
|
|
1654
|
+
if (!trimmed.startsWith("[") || !trimmed.endsWith("]") || trimmed.startsWith("[["))
|
|
1486
1655
|
return null;
|
|
1656
|
+
return trimmed.slice(1, -1);
|
|
1657
|
+
}
|
|
1658
|
+
function parseLeadingJsonString2(value) {
|
|
1659
|
+
if (!value.startsWith('"'))
|
|
1660
|
+
return parseJsonString2(value);
|
|
1661
|
+
let escaped = false;
|
|
1662
|
+
for (let index = 1;index < value.length; index += 1) {
|
|
1663
|
+
const char = value[index];
|
|
1664
|
+
if (escaped) {
|
|
1665
|
+
escaped = false;
|
|
1666
|
+
continue;
|
|
1667
|
+
}
|
|
1668
|
+
if (char === "\\") {
|
|
1669
|
+
escaped = true;
|
|
1670
|
+
continue;
|
|
1671
|
+
}
|
|
1672
|
+
if (char === '"')
|
|
1673
|
+
return parseJsonString2(value.slice(0, index + 1));
|
|
1487
1674
|
}
|
|
1488
|
-
|
|
1489
|
-
for (const profile of value.managedProfiles) {
|
|
1490
|
-
if (!isRecord4(profile) || !isRecord4(profile.match)) return null;
|
|
1491
|
-
managedProfiles.push(parseProfileMatch(profile.match));
|
|
1492
|
-
}
|
|
1493
|
-
return {
|
|
1494
|
-
current: {
|
|
1495
|
-
model: current.model,
|
|
1496
|
-
modelContextWindow: current.model_context_window,
|
|
1497
|
-
modelReasoningEffort: current.model_reasoning_effort,
|
|
1498
|
-
planModeReasoningEffort: current.plan_mode_reasoning_effort
|
|
1499
|
-
},
|
|
1500
|
-
managedProfiles
|
|
1501
|
-
};
|
|
1675
|
+
return null;
|
|
1502
1676
|
}
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1677
|
+
|
|
1678
|
+
// ../src/install/codex-config-agents.ts
|
|
1679
|
+
var LEGACY_MANAGED_CODEX_AGENT_NAMES_TO_PURGE = ["codex-ultrawork-reviewer"];
|
|
1680
|
+
var CURRENT_MANAGED_CODEX_AGENT_NAMES = [
|
|
1681
|
+
"explorer",
|
|
1682
|
+
"librarian",
|
|
1683
|
+
"metis",
|
|
1684
|
+
"momus",
|
|
1685
|
+
"plan"
|
|
1686
|
+
];
|
|
1687
|
+
var MANAGED_CODEX_AGENT_NAMES = [
|
|
1688
|
+
...LEGACY_MANAGED_CODEX_AGENT_NAMES_TO_PURGE,
|
|
1689
|
+
...CURRENT_MANAGED_CODEX_AGENT_NAMES
|
|
1690
|
+
];
|
|
1691
|
+
function removeStaleManagedAgentBlocks(config, keepAgentNames) {
|
|
1692
|
+
const managedAgentNames = new Set(MANAGED_CODEX_AGENT_NAMES);
|
|
1693
|
+
return splitTomlSections(config).filter((section) => {
|
|
1694
|
+
if (section.header === null)
|
|
1695
|
+
return true;
|
|
1696
|
+
const agentName = parseAgentHeaderName(section.header);
|
|
1697
|
+
if (agentName === null || !managedAgentNames.has(agentName) || keepAgentNames.has(agentName))
|
|
1698
|
+
return true;
|
|
1699
|
+
return !section.text.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`);
|
|
1700
|
+
}).map((section) => section.text).join("").replace(/\n{3,}/g, `
|
|
1701
|
+
|
|
1702
|
+
`);
|
|
1510
1703
|
}
|
|
1511
|
-
function
|
|
1512
|
-
|
|
1704
|
+
function ensureAgentConfig(config, agentConfig) {
|
|
1705
|
+
const header = `agents.${tomlKeySegment(agentConfig.name)}`;
|
|
1706
|
+
const section = findTomlSection(config, header);
|
|
1707
|
+
const configFile = JSON.stringify(agentConfig.configFile);
|
|
1708
|
+
if (!section)
|
|
1709
|
+
return appendBlock(config, `[${header}]
|
|
1710
|
+
config_file = ${configFile}
|
|
1711
|
+
`);
|
|
1712
|
+
return replaceOrInsertSetting(config, section, "config_file", configFile);
|
|
1713
|
+
}
|
|
1714
|
+
function tomlKeySegment(value) {
|
|
1715
|
+
return /^[A-Za-z0-9_-]+$/.test(value) ? value : JSON.stringify(value);
|
|
1513
1716
|
}
|
|
1514
1717
|
|
|
1515
|
-
//
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1718
|
+
// ../src/install/codex-config-atomic-write.ts
|
|
1719
|
+
import { lstat as lstat6, readlink as readlink3, realpath, rename as rename3, unlink, writeFile as writeFile5 } from "node:fs/promises";
|
|
1720
|
+
import { basename as basename5, dirname as dirname5, isAbsolute as isAbsolute3, join as join13, resolve as resolve4 } from "node:path";
|
|
1721
|
+
var RENAME_RETRY_DELAYS_MS = [10, 25, 50];
|
|
1722
|
+
var RETRIABLE_RENAME_CODES = new Set(["EPERM", "EBUSY"]);
|
|
1723
|
+
async function writeFileAtomic(targetPath, data) {
|
|
1724
|
+
const writeTarget = await resolveSymlinkTarget(targetPath);
|
|
1725
|
+
const temporaryPath = join13(dirname5(writeTarget), `.tmp-${basename5(writeTarget)}-${process.pid}-${Date.now()}`);
|
|
1726
|
+
await writeFile5(temporaryPath, data);
|
|
1727
|
+
try {
|
|
1728
|
+
await renameWithRetry(temporaryPath, writeTarget);
|
|
1729
|
+
} catch (error) {
|
|
1730
|
+
await unlink(temporaryPath).catch((unlinkError) => {
|
|
1731
|
+
if (unlinkError instanceof Error)
|
|
1732
|
+
return;
|
|
1733
|
+
return;
|
|
1734
|
+
});
|
|
1735
|
+
throw error;
|
|
1521
1736
|
}
|
|
1522
|
-
let next = replaceOrInsertRootSetting(config, "model", JSON.stringify(catalog.current.model));
|
|
1523
|
-
next = replaceOrInsertRootSetting(next, "model_context_window", catalog.current.modelContextWindow.toString());
|
|
1524
|
-
next = replaceOrInsertRootSetting(
|
|
1525
|
-
next,
|
|
1526
|
-
"model_reasoning_effort",
|
|
1527
|
-
JSON.stringify(catalog.current.modelReasoningEffort)
|
|
1528
|
-
);
|
|
1529
|
-
next = replaceOrInsertRootSetting(next, "plan_mode_reasoning_effort", JSON.stringify(catalog.current.planModeReasoningEffort));
|
|
1530
|
-
return next;
|
|
1531
1737
|
}
|
|
1532
|
-
function
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
if (
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
if (key === "model_reasoning_effort" && typeof value === "string") settings.modelReasoningEffort = value;
|
|
1542
|
-
if (key === "plan_mode_reasoning_effort" && typeof value === "string") settings.planModeReasoningEffort = value;
|
|
1543
|
-
}
|
|
1738
|
+
async function resolveSymlinkTarget(targetPath) {
|
|
1739
|
+
try {
|
|
1740
|
+
const linkStats = await lstat6(targetPath);
|
|
1741
|
+
if (!linkStats.isSymbolicLink())
|
|
1742
|
+
return targetPath;
|
|
1743
|
+
} catch (error) {
|
|
1744
|
+
if (error instanceof Error)
|
|
1745
|
+
return targetPath;
|
|
1746
|
+
return targetPath;
|
|
1544
1747
|
}
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1748
|
+
try {
|
|
1749
|
+
return await realpath(targetPath);
|
|
1750
|
+
} catch (error) {
|
|
1751
|
+
if (!(error instanceof Error))
|
|
1752
|
+
throw error;
|
|
1753
|
+
const linkValue = await readlink3(targetPath);
|
|
1754
|
+
return isAbsolute3(linkValue) ? linkValue : resolve4(dirname5(targetPath), linkValue);
|
|
1550
1755
|
}
|
|
1551
|
-
return true;
|
|
1552
1756
|
}
|
|
1553
|
-
function
|
|
1554
|
-
|
|
1555
|
-
if (trimmed.startsWith('"') && trimmed.endsWith('"')) {
|
|
1757
|
+
async function renameWithRetry(fromPath, toPath) {
|
|
1758
|
+
for (let attempt = 0;; attempt += 1) {
|
|
1556
1759
|
try {
|
|
1557
|
-
|
|
1760
|
+
await rename3(fromPath, toPath);
|
|
1761
|
+
return;
|
|
1558
1762
|
} catch (error) {
|
|
1559
|
-
if (error
|
|
1560
|
-
|
|
1763
|
+
if (!isRetriableRenameError(error) || attempt >= RENAME_RETRY_DELAYS_MS.length) {
|
|
1764
|
+
throw error;
|
|
1765
|
+
}
|
|
1766
|
+
await delay(RENAME_RETRY_DELAYS_MS[attempt] ?? 0);
|
|
1561
1767
|
}
|
|
1562
1768
|
}
|
|
1563
|
-
const numeric = Number(trimmed);
|
|
1564
|
-
return Number.isFinite(numeric) ? numeric : void 0;
|
|
1565
1769
|
}
|
|
1566
|
-
function
|
|
1567
|
-
|
|
1568
|
-
|
|
1770
|
+
function isRetriableRenameError(error) {
|
|
1771
|
+
if (!(error instanceof Error) || !("code" in error))
|
|
1772
|
+
return false;
|
|
1773
|
+
return typeof error.code === "string" && RETRIABLE_RENAME_CODES.has(error.code);
|
|
1569
1774
|
}
|
|
1570
|
-
function
|
|
1571
|
-
|
|
1572
|
-
if (trimmed.startsWith("#") || trimmed.startsWith("[")) return false;
|
|
1573
|
-
const match = trimmed.match(/^([A-Za-z_][A-Za-z0-9_]*)\s*=/);
|
|
1574
|
-
return match?.[1] === key;
|
|
1775
|
+
function delay(milliseconds) {
|
|
1776
|
+
return new Promise((resolveDelay) => setTimeout(resolveDelay, milliseconds));
|
|
1575
1777
|
}
|
|
1576
1778
|
|
|
1577
|
-
//
|
|
1578
|
-
|
|
1579
|
-
function ensureAutonomousPermissions(config) {
|
|
1580
|
-
let next = replaceOrInsertRootSetting(config, "approval_policy", JSON.stringify("never"));
|
|
1581
|
-
next = replaceOrInsertRootSetting(next, "sandbox_mode", JSON.stringify("danger-full-access"));
|
|
1582
|
-
next = replaceOrInsertRootSetting(next, "network_access", JSON.stringify("enabled"));
|
|
1583
|
-
for (const featureName of AUTONOMOUS_FEATURES) {
|
|
1584
|
-
next = ensureFeatureEnabled(next, featureName);
|
|
1585
|
-
}
|
|
1586
|
-
next = removeWindowsSandboxSetting(next);
|
|
1587
|
-
next = ensureNoticeEnabled(next, "hide_full_access_warning");
|
|
1588
|
-
return ensureNoticeEnabled(next, "hide_world_writable_warning");
|
|
1589
|
-
}
|
|
1590
|
-
function removeWindowsSandboxSetting(config) {
|
|
1591
|
-
const section = findTomlSection(config, "windows");
|
|
1592
|
-
if (!section) return config;
|
|
1593
|
-
return removeSetting(config, section, "sandbox");
|
|
1594
|
-
}
|
|
1595
|
-
function ensureNoticeEnabled(config, key) {
|
|
1596
|
-
const section = findTomlSection(config, "notice");
|
|
1597
|
-
if (!section) return appendNoticeBlock(config, key);
|
|
1598
|
-
return replaceOrInsertSetting(config, section, key, "true");
|
|
1599
|
-
}
|
|
1600
|
-
function ensureFeatureEnabled(config, key) {
|
|
1779
|
+
// ../src/install/codex-config-features.ts
|
|
1780
|
+
function ensureFeatureEnabled(config, featureName) {
|
|
1601
1781
|
const section = findTomlSection(config, "features");
|
|
1602
|
-
if (!section)
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
return replaceOrInsertSetting(config, section, key, "true");
|
|
1606
|
-
}
|
|
1607
|
-
function appendNoticeBlock(config, key) {
|
|
1608
|
-
return appendBlock(config, `[notice]
|
|
1609
|
-
${key} = true
|
|
1782
|
+
if (!section)
|
|
1783
|
+
return appendBlock(config, `[features]
|
|
1784
|
+
${featureName} = true
|
|
1610
1785
|
`);
|
|
1786
|
+
return replaceOrInsertSetting(config, section, featureName, "true");
|
|
1611
1787
|
}
|
|
1612
1788
|
|
|
1613
|
-
//
|
|
1614
|
-
var
|
|
1615
|
-
var SISYPHUS_LEGACY_MARKETPLACES = ["lazycodex", LEGACY_CODEX_PLUGIN_MARKETPLACE];
|
|
1616
|
-
var MANAGED_CODEX_AGENT_NAMES = [
|
|
1617
|
-
"codex-ultrawork-reviewer",
|
|
1618
|
-
"explorer",
|
|
1619
|
-
"librarian",
|
|
1620
|
-
"metis",
|
|
1621
|
-
"momus",
|
|
1622
|
-
"plan"
|
|
1623
|
-
];
|
|
1624
|
-
async function updateCodexConfig({
|
|
1625
|
-
configPath,
|
|
1626
|
-
repoRoot,
|
|
1627
|
-
marketplaceName,
|
|
1628
|
-
marketplaceSource = defaultMarketplaceSource(repoRoot),
|
|
1629
|
-
preserveMarketplaceSource = false,
|
|
1630
|
-
pluginNames,
|
|
1631
|
-
platform = process.platform,
|
|
1632
|
-
trustedHookStates = [],
|
|
1633
|
-
agentConfigs = [],
|
|
1634
|
-
autonomousPermissions = false,
|
|
1635
|
-
gitBashEnabled = false
|
|
1636
|
-
}) {
|
|
1637
|
-
await mkdir6(dirname7(configPath), { recursive: true });
|
|
1638
|
-
let config = "";
|
|
1639
|
-
if (await exists(configPath)) config = await readFile9(configPath, "utf8");
|
|
1640
|
-
for (const legacyMarketplaceName of legacyMarketplaceNames(marketplaceName)) {
|
|
1641
|
-
config = removeMarketplaceBlock(config, legacyMarketplaceName);
|
|
1642
|
-
config = removeStaleMarketplacePluginBlocks(config, legacyMarketplaceName, /* @__PURE__ */ new Set());
|
|
1643
|
-
config = removeStaleMarketplaceHookStateBlocks(config, legacyMarketplaceName, /* @__PURE__ */ new Set());
|
|
1644
|
-
}
|
|
1645
|
-
config = removeStaleMarketplacePluginBlocks(config, marketplaceName, new Set(pluginNames));
|
|
1646
|
-
config = removeStaleMarketplaceHookStateBlocks(config, marketplaceName, new Set(pluginNames));
|
|
1647
|
-
config = removeStaleManagedAgentBlocks(config, new Set(agentConfigs.map((agentConfig) => agentConfig.name)));
|
|
1648
|
-
config = ensureFeatureEnabled2(config, "plugins");
|
|
1649
|
-
config = ensureFeatureEnabled2(config, "plugin_hooks");
|
|
1650
|
-
config = ensureFeatureEnabled2(config, "multi_agent");
|
|
1651
|
-
config = ensureFeatureEnabled2(config, "child_agents_md");
|
|
1652
|
-
config = ensureCodexReasoningConfig(config, await readCodexModelCatalog(repoRoot));
|
|
1653
|
-
config = ensureCodexMultiAgentV2Config(config);
|
|
1654
|
-
if (autonomousPermissions === true) config = ensureAutonomousPermissions(config);
|
|
1655
|
-
if (preserveMarketplaceSource !== true) {
|
|
1656
|
-
config = ensureMarketplaceBlock(config, marketplaceName, marketplaceSource);
|
|
1657
|
-
}
|
|
1658
|
-
for (const pluginName of pluginNames) {
|
|
1659
|
-
config = ensurePluginEnabled(config, `${pluginName}@${marketplaceName}`);
|
|
1660
|
-
}
|
|
1661
|
-
config = ensureOmoBuiltinMcpPolicies(config, { marketplaceName, pluginNames, platform, gitBashEnabled });
|
|
1662
|
-
for (const state of trustedHookStates) {
|
|
1663
|
-
config = ensureHookTrusted(config, state.key, state.trustedHash);
|
|
1664
|
-
}
|
|
1665
|
-
for (const agentConfig of agentConfigs) {
|
|
1666
|
-
config = ensureAgentConfig(config, agentConfig);
|
|
1667
|
-
}
|
|
1668
|
-
await writeFileAtomic(configPath, config.trimEnd() + "\n");
|
|
1669
|
-
}
|
|
1789
|
+
// ../src/install/codex-config-marketplaces.ts
|
|
1790
|
+
var SISYPHUS_LEGACY_MARKETPLACES = ["lazycodex", "code-yeongyu-codex-plugins"];
|
|
1670
1791
|
function legacyMarketplaceNames(marketplaceName) {
|
|
1671
1792
|
return marketplaceName === "sisyphuslabs" ? SISYPHUS_LEGACY_MARKETPLACES : [];
|
|
1672
1793
|
}
|
|
1673
1794
|
function removeMarketplaceBlock(config, marketplaceName) {
|
|
1674
1795
|
return removeTomlSections(config, (header) => header === `marketplaces.${marketplaceName}`);
|
|
1675
1796
|
}
|
|
1676
|
-
function
|
|
1677
|
-
return {
|
|
1678
|
-
sourceType: "local",
|
|
1679
|
-
source: repoRoot
|
|
1680
|
-
};
|
|
1797
|
+
function hasMarketplaceBlock(config, marketplaceName) {
|
|
1798
|
+
return findTomlSection(config, `marketplaces.${marketplaceName}`) !== null;
|
|
1681
1799
|
}
|
|
1682
1800
|
function removeStaleMarketplacePluginBlocks(config, marketplaceName, keepPluginNames) {
|
|
1683
1801
|
return removeTomlSections(config, (header) => {
|
|
1684
1802
|
const pluginKey = parsePluginHeaderKey(header);
|
|
1685
|
-
if (pluginKey === null)
|
|
1803
|
+
if (pluginKey === null)
|
|
1804
|
+
return false;
|
|
1686
1805
|
const suffix = `@${marketplaceName}`;
|
|
1687
|
-
if (!pluginKey.endsWith(suffix))
|
|
1806
|
+
if (!pluginKey.endsWith(suffix))
|
|
1807
|
+
return false;
|
|
1688
1808
|
return !keepPluginNames.has(pluginKey.slice(0, -suffix.length));
|
|
1689
1809
|
});
|
|
1690
1810
|
}
|
|
1691
1811
|
function removeStaleMarketplaceHookStateBlocks(config, marketplaceName, keepPluginNames) {
|
|
1692
1812
|
return removeTomlSections(config, (header) => {
|
|
1693
1813
|
const prefix = "hooks.state.";
|
|
1694
|
-
if (!header.startsWith(prefix))
|
|
1695
|
-
|
|
1696
|
-
|
|
1814
|
+
if (!header.startsWith(prefix))
|
|
1815
|
+
return false;
|
|
1816
|
+
const hookKey = parseJsonString2(header.slice(prefix.length));
|
|
1817
|
+
if (hookKey === null)
|
|
1818
|
+
return false;
|
|
1697
1819
|
const separator = hookKey.indexOf(":");
|
|
1698
|
-
if (separator === -1)
|
|
1820
|
+
if (separator === -1)
|
|
1821
|
+
return false;
|
|
1699
1822
|
const pluginKey = hookKey.slice(0, separator);
|
|
1700
1823
|
const suffix = `@${marketplaceName}`;
|
|
1701
|
-
if (!pluginKey.endsWith(suffix))
|
|
1824
|
+
if (!pluginKey.endsWith(suffix))
|
|
1825
|
+
return false;
|
|
1702
1826
|
return !keepPluginNames.has(pluginKey.slice(0, -suffix.length));
|
|
1703
1827
|
});
|
|
1704
1828
|
}
|
|
1705
|
-
function removeStaleManagedAgentBlocks(config, keepAgentNames) {
|
|
1706
|
-
const managedAgentNames = new Set(MANAGED_CODEX_AGENT_NAMES);
|
|
1707
|
-
return splitTomlSections(config).filter((section) => {
|
|
1708
|
-
if (section.header === null) return true;
|
|
1709
|
-
const agentName = parseAgentHeaderName(section.header);
|
|
1710
|
-
if (agentName === null || !managedAgentNames.has(agentName) || keepAgentNames.has(agentName)) return true;
|
|
1711
|
-
return !section.text.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`);
|
|
1712
|
-
}).map((section) => section.text).join("").replace(/\n{3,}/g, "\n\n");
|
|
1713
|
-
}
|
|
1714
|
-
function ensureFeatureEnabled2(config, featureName) {
|
|
1715
|
-
const section = findTomlSection(config, "features");
|
|
1716
|
-
if (!section) return appendBlock(config, `[features]
|
|
1717
|
-
${featureName} = true
|
|
1718
|
-
`);
|
|
1719
|
-
return replaceOrInsertSetting(config, section, featureName, "true");
|
|
1720
|
-
}
|
|
1721
1829
|
function ensureMarketplaceBlock(config, marketplaceName, source) {
|
|
1722
1830
|
const header = `marketplaces.${marketplaceName}`;
|
|
1723
|
-
const
|
|
1831
|
+
const lines = [
|
|
1724
1832
|
`[${header}]`,
|
|
1725
|
-
`last_updated = "${
|
|
1833
|
+
`last_updated = "${new Date().toISOString().replace(/\.\d{3}Z$/, "Z")}"`,
|
|
1726
1834
|
`source_type = ${JSON.stringify(source.sourceType)}`,
|
|
1727
|
-
`source = ${JSON.stringify(source.source)}
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1835
|
+
`source = ${JSON.stringify(source.source)}`
|
|
1836
|
+
];
|
|
1837
|
+
if (source.sourceType === "git") {
|
|
1838
|
+
lines.push(`ref = ${JSON.stringify(source.ref)}`);
|
|
1839
|
+
}
|
|
1840
|
+
lines.push("");
|
|
1841
|
+
const block = lines.join(`
|
|
1842
|
+
`);
|
|
1731
1843
|
const section = findTomlSection(config, header);
|
|
1732
|
-
if (section)
|
|
1844
|
+
if (section)
|
|
1845
|
+
return config.slice(0, section.start) + block + config.slice(section.end);
|
|
1733
1846
|
return appendBlock(config, block);
|
|
1734
1847
|
}
|
|
1848
|
+
|
|
1849
|
+
// ../src/install/codex-config-permissions.ts
|
|
1850
|
+
var AUTONOMOUS_FEATURES = ["multi_agent", "child_agents_md", "unified_exec", "goals"];
|
|
1851
|
+
function ensureAutonomousPermissions(config) {
|
|
1852
|
+
let next = replaceOrInsertRootSetting(config, "approval_policy", JSON.stringify("never"));
|
|
1853
|
+
next = replaceOrInsertRootSetting(next, "sandbox_mode", JSON.stringify("danger-full-access"));
|
|
1854
|
+
next = replaceOrInsertRootSetting(next, "network_access", JSON.stringify("enabled"));
|
|
1855
|
+
for (const featureName of AUTONOMOUS_FEATURES) {
|
|
1856
|
+
next = ensureFeatureEnabled2(next, featureName);
|
|
1857
|
+
}
|
|
1858
|
+
next = removeWindowsSandboxSetting(next);
|
|
1859
|
+
next = ensureNoticeEnabled(next, "hide_full_access_warning");
|
|
1860
|
+
return ensureNoticeEnabled(next, "hide_world_writable_warning");
|
|
1861
|
+
}
|
|
1862
|
+
function removeWindowsSandboxSetting(config) {
|
|
1863
|
+
const section = findTomlSection(config, "windows");
|
|
1864
|
+
if (section === null)
|
|
1865
|
+
return config;
|
|
1866
|
+
return removeSetting(config, section, "sandbox");
|
|
1867
|
+
}
|
|
1868
|
+
function ensureNoticeEnabled(config, key) {
|
|
1869
|
+
const section = findTomlSection(config, "notice");
|
|
1870
|
+
if (section === null)
|
|
1871
|
+
return appendNoticeBlock(config, key);
|
|
1872
|
+
return replaceOrInsertSetting(config, section, key, "true");
|
|
1873
|
+
}
|
|
1874
|
+
function ensureFeatureEnabled2(config, key) {
|
|
1875
|
+
const section = findTomlSection(config, "features");
|
|
1876
|
+
if (section === null)
|
|
1877
|
+
return appendBlock(config, `[features]
|
|
1878
|
+
${key} = true
|
|
1879
|
+
`);
|
|
1880
|
+
return replaceOrInsertSetting(config, section, key, "true");
|
|
1881
|
+
}
|
|
1882
|
+
function appendNoticeBlock(config, key) {
|
|
1883
|
+
return appendBlock(config, `[notice]
|
|
1884
|
+
${key} = true
|
|
1885
|
+
`);
|
|
1886
|
+
}
|
|
1887
|
+
|
|
1888
|
+
// ../src/install/codex-config-plugins.ts
|
|
1735
1889
|
function ensurePluginEnabled(config, pluginKey) {
|
|
1736
1890
|
const header = `plugins.${JSON.stringify(pluginKey)}`;
|
|
1737
1891
|
const section = findTomlSection(config, header);
|
|
1738
|
-
if (!section)
|
|
1892
|
+
if (!section)
|
|
1893
|
+
return appendBlock(config, `[${header}]
|
|
1739
1894
|
enabled = true
|
|
1740
1895
|
`);
|
|
1741
1896
|
return replaceOrInsertSetting(config, section, "enabled", "true");
|
|
1742
1897
|
}
|
|
1743
|
-
function
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
const
|
|
1747
|
-
if (!section) return appendBlock(config, `[${header}]
|
|
1748
|
-
enabled = ${enabledValue}
|
|
1749
|
-
`);
|
|
1750
|
-
return replaceOrInsertSetting(config, section, "enabled", enabledValue);
|
|
1751
|
-
}
|
|
1752
|
-
function ensureOmoBuiltinMcpPolicies(config, { marketplaceName, pluginNames, platform, gitBashEnabled }) {
|
|
1753
|
-
if (marketplaceName !== "sisyphuslabs" || !pluginNames.includes("omo")) return config;
|
|
1898
|
+
function ensureOmoBuiltinMcpPolicies(config, input) {
|
|
1899
|
+
if (input.marketplaceName !== "sisyphuslabs" || !input.pluginNames.includes("omo"))
|
|
1900
|
+
return config;
|
|
1901
|
+
const gitBashEnabled = (input.platform ?? process.platform) === "win32" && input.gitBashEnabled === true;
|
|
1754
1902
|
let nextConfig = ensurePluginMcpEnabled(config, "omo@sisyphuslabs", "context7", true);
|
|
1755
|
-
nextConfig = ensurePluginMcpEnabled(nextConfig, "omo@sisyphuslabs", "
|
|
1903
|
+
nextConfig = ensurePluginMcpEnabled(nextConfig, "omo@sisyphuslabs", "codegraph", true);
|
|
1904
|
+
nextConfig = ensurePluginMcpEnabled(nextConfig, "omo@sisyphuslabs", "git_bash", gitBashEnabled);
|
|
1756
1905
|
return nextConfig;
|
|
1757
1906
|
}
|
|
1758
|
-
function ensureHookTrusted(config,
|
|
1759
|
-
const header = `hooks.state.${JSON.stringify(key)}`;
|
|
1907
|
+
function ensureHookTrusted(config, state) {
|
|
1908
|
+
const header = `hooks.state.${JSON.stringify(state.key)}`;
|
|
1760
1909
|
const section = findTomlSection(config, header);
|
|
1761
|
-
if (!section)
|
|
1762
|
-
|
|
1910
|
+
if (!section)
|
|
1911
|
+
return appendBlock(config, `[${header}]
|
|
1912
|
+
trusted_hash = ${JSON.stringify(state.trustedHash)}
|
|
1763
1913
|
`);
|
|
1764
|
-
return replaceOrInsertSetting(config, section, "trusted_hash", JSON.stringify(trustedHash));
|
|
1914
|
+
return replaceOrInsertSetting(config, section, "trusted_hash", JSON.stringify(state.trustedHash));
|
|
1765
1915
|
}
|
|
1766
|
-
function
|
|
1767
|
-
const header = `
|
|
1916
|
+
function ensurePluginMcpEnabled(config, pluginKey, serverName, enabled) {
|
|
1917
|
+
const header = `plugins.${JSON.stringify(pluginKey)}.mcp_servers.${serverName}`;
|
|
1768
1918
|
const section = findTomlSection(config, header);
|
|
1769
|
-
const
|
|
1770
|
-
if (!section)
|
|
1771
|
-
|
|
1919
|
+
const enabledValue = enabled ? "true" : "false";
|
|
1920
|
+
if (!section)
|
|
1921
|
+
return appendBlock(config, `[${header}]
|
|
1922
|
+
enabled = ${enabledValue}
|
|
1772
1923
|
`);
|
|
1773
|
-
return replaceOrInsertSetting(config, section, "
|
|
1924
|
+
return replaceOrInsertSetting(config, section, "enabled", enabledValue);
|
|
1774
1925
|
}
|
|
1775
|
-
|
|
1776
|
-
|
|
1926
|
+
|
|
1927
|
+
// ../src/install/codex-config-reasoning.ts
|
|
1928
|
+
var MANAGED_KEYS = ["model", "model_context_window", "model_reasoning_effort", "plan_mode_reasoning_effort"];
|
|
1929
|
+
function ensureCodexReasoningConfig(config, catalog) {
|
|
1930
|
+
const current = readRootReasoningSettings(config);
|
|
1931
|
+
if (Object.keys(current).length > 0 && !matchesProfile(current, catalog.current) && !catalog.managedProfiles.some((profile) => matchesProfile(current, profile))) {
|
|
1932
|
+
return config;
|
|
1933
|
+
}
|
|
1934
|
+
let next = replaceOrInsertRootSetting(config, "model", JSON.stringify(catalog.current.model));
|
|
1935
|
+
next = replaceOrInsertRootSetting(next, "model_context_window", catalog.current.modelContextWindow.toString());
|
|
1936
|
+
next = replaceOrInsertRootSetting(next, "model_reasoning_effort", JSON.stringify(catalog.current.modelReasoningEffort));
|
|
1937
|
+
next = replaceOrInsertRootSetting(next, "plan_mode_reasoning_effort", JSON.stringify(catalog.current.planModeReasoningEffort));
|
|
1938
|
+
return next;
|
|
1777
1939
|
}
|
|
1778
|
-
function
|
|
1779
|
-
|
|
1940
|
+
function readRootReasoningSettings(config) {
|
|
1941
|
+
const settings = {};
|
|
1942
|
+
for (const line of config.split(/\n/)) {
|
|
1943
|
+
if (isSectionHeader2(line))
|
|
1944
|
+
break;
|
|
1945
|
+
for (const key of MANAGED_KEYS) {
|
|
1946
|
+
if (!isRootSetting(line, key))
|
|
1947
|
+
continue;
|
|
1948
|
+
const value = parseTomlScalar(line.slice(line.indexOf("=") + 1));
|
|
1949
|
+
if (key === "model" && typeof value === "string")
|
|
1950
|
+
settings.model = value;
|
|
1951
|
+
if (key === "model_context_window" && typeof value === "number")
|
|
1952
|
+
settings.modelContextWindow = value;
|
|
1953
|
+
if (key === "model_reasoning_effort" && typeof value === "string")
|
|
1954
|
+
settings.modelReasoningEffort = value;
|
|
1955
|
+
if (key === "plan_mode_reasoning_effort" && typeof value === "string")
|
|
1956
|
+
settings.planModeReasoningEffort = value;
|
|
1957
|
+
}
|
|
1958
|
+
}
|
|
1959
|
+
return settings;
|
|
1780
1960
|
}
|
|
1781
|
-
function
|
|
1782
|
-
const
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1961
|
+
function matchesProfile(current, profile) {
|
|
1962
|
+
for (const [key, value] of Object.entries(profile)) {
|
|
1963
|
+
if (current[key] !== value)
|
|
1964
|
+
return false;
|
|
1965
|
+
}
|
|
1966
|
+
return true;
|
|
1967
|
+
}
|
|
1968
|
+
function parseTomlScalar(value) {
|
|
1969
|
+
const trimmed = value.trim();
|
|
1970
|
+
if (trimmed.startsWith('"') && trimmed.endsWith('"')) {
|
|
1971
|
+
try {
|
|
1972
|
+
return JSON.parse(trimmed);
|
|
1973
|
+
} catch (error) {
|
|
1974
|
+
if (error instanceof SyntaxError)
|
|
1975
|
+
return;
|
|
1976
|
+
throw error;
|
|
1793
1977
|
}
|
|
1794
1978
|
}
|
|
1795
|
-
|
|
1796
|
-
return
|
|
1979
|
+
const numeric = Number(trimmed);
|
|
1980
|
+
return Number.isFinite(numeric) ? numeric : undefined;
|
|
1797
1981
|
}
|
|
1798
|
-
function
|
|
1982
|
+
function isSectionHeader2(line) {
|
|
1799
1983
|
const trimmed = line.trim();
|
|
1800
|
-
|
|
1801
|
-
if (trimmed.startsWith("[[")) return null;
|
|
1802
|
-
return trimmed.slice(1, -1);
|
|
1984
|
+
return trimmed.startsWith("[") && trimmed.endsWith("]");
|
|
1803
1985
|
}
|
|
1804
|
-
function
|
|
1805
|
-
const
|
|
1806
|
-
if (
|
|
1807
|
-
|
|
1986
|
+
function isRootSetting(line, key) {
|
|
1987
|
+
const trimmed = line.trimStart();
|
|
1988
|
+
if (trimmed.startsWith("#") || trimmed.startsWith("["))
|
|
1989
|
+
return false;
|
|
1990
|
+
const match = trimmed.match(/^([A-Za-z_][A-Za-z0-9_]*)\s*=/);
|
|
1991
|
+
return match?.[1] === key;
|
|
1992
|
+
}
|
|
1993
|
+
|
|
1994
|
+
// ../src/install/codex-model-catalog.ts
|
|
1995
|
+
import { readFile as readFile8 } from "node:fs/promises";
|
|
1996
|
+
import { join as join14 } from "node:path";
|
|
1997
|
+
var FALLBACK_CODEX_MODEL_CATALOG = {
|
|
1998
|
+
current: {
|
|
1999
|
+
model: "gpt-5.5",
|
|
2000
|
+
modelContextWindow: 400000,
|
|
2001
|
+
modelReasoningEffort: "high",
|
|
2002
|
+
planModeReasoningEffort: "xhigh"
|
|
2003
|
+
},
|
|
2004
|
+
managedProfiles: [
|
|
2005
|
+
{
|
|
2006
|
+
model: "gpt-5.5",
|
|
2007
|
+
modelContextWindow: 1e6,
|
|
2008
|
+
modelReasoningEffort: "high",
|
|
2009
|
+
planModeReasoningEffort: "xhigh"
|
|
2010
|
+
},
|
|
2011
|
+
{ model: "gpt-5.5", modelContextWindow: 272000 }
|
|
2012
|
+
]
|
|
2013
|
+
};
|
|
2014
|
+
async function readCodexModelCatalog(codexPackageRoot) {
|
|
2015
|
+
const catalogPath = join14(codexPackageRoot, "plugin", "model-catalog.json");
|
|
2016
|
+
try {
|
|
2017
|
+
const parsed = JSON.parse(await readFile8(catalogPath, "utf8"));
|
|
2018
|
+
return parseCodexModelCatalog(parsed) ?? FALLBACK_CODEX_MODEL_CATALOG;
|
|
2019
|
+
} catch (error) {
|
|
2020
|
+
if (error instanceof Error)
|
|
2021
|
+
return FALLBACK_CODEX_MODEL_CATALOG;
|
|
2022
|
+
throw error;
|
|
2023
|
+
}
|
|
2024
|
+
}
|
|
2025
|
+
function parseCodexModelCatalog(value) {
|
|
2026
|
+
if (!isPlainRecord(value))
|
|
2027
|
+
return null;
|
|
2028
|
+
const current = value["current"];
|
|
2029
|
+
const managedProfiles = value["managedProfiles"];
|
|
2030
|
+
if (!isPlainRecord(current) || !Array.isArray(managedProfiles))
|
|
2031
|
+
return null;
|
|
2032
|
+
const model = current["model"];
|
|
2033
|
+
const modelContextWindow = current["model_context_window"];
|
|
2034
|
+
const modelReasoningEffort = current["model_reasoning_effort"];
|
|
2035
|
+
const planModeReasoningEffort = current["plan_mode_reasoning_effort"];
|
|
2036
|
+
if (typeof model !== "string" || typeof modelContextWindow !== "number" || typeof modelReasoningEffort !== "string" || typeof planModeReasoningEffort !== "string") {
|
|
2037
|
+
return null;
|
|
2038
|
+
}
|
|
2039
|
+
const parsedManagedProfiles = [];
|
|
2040
|
+
for (const profile of managedProfiles) {
|
|
2041
|
+
if (!isPlainRecord(profile))
|
|
2042
|
+
return null;
|
|
2043
|
+
const match = profile["match"];
|
|
2044
|
+
if (!isPlainRecord(match))
|
|
2045
|
+
return null;
|
|
2046
|
+
parsedManagedProfiles.push(parseProfileMatch(match));
|
|
2047
|
+
}
|
|
2048
|
+
return {
|
|
2049
|
+
current: { model, modelContextWindow, modelReasoningEffort, planModeReasoningEffort },
|
|
2050
|
+
managedProfiles: parsedManagedProfiles
|
|
2051
|
+
};
|
|
2052
|
+
}
|
|
2053
|
+
function parseProfileMatch(match) {
|
|
2054
|
+
const profile = {};
|
|
2055
|
+
if (typeof match["model"] === "string")
|
|
2056
|
+
profile.model = match["model"];
|
|
2057
|
+
if (typeof match["model_context_window"] === "number")
|
|
2058
|
+
profile.modelContextWindow = match["model_context_window"];
|
|
2059
|
+
if (typeof match["model_reasoning_effort"] === "string")
|
|
2060
|
+
profile.modelReasoningEffort = match["model_reasoning_effort"];
|
|
2061
|
+
if (typeof match["plan_mode_reasoning_effort"] === "string")
|
|
2062
|
+
profile.planModeReasoningEffort = match["plan_mode_reasoning_effort"];
|
|
2063
|
+
return profile;
|
|
2064
|
+
}
|
|
2065
|
+
|
|
2066
|
+
// ../src/install/codex-multi-agent-v2-config.ts
|
|
2067
|
+
var CODEX_MULTI_AGENT_V2_HEADER = "features.multi_agent_v2";
|
|
2068
|
+
var CODEX_MULTI_AGENT_V2_MAX_CONCURRENT_THREADS_PER_SESSION = 1e4;
|
|
2069
|
+
function ensureCodexMultiAgentV2Config(config) {
|
|
2070
|
+
const normalizedConfig = removeLegacyAgentsMaxThreadsSetting(removeFeatureFlagSetting(config, "multi_agent_v2"));
|
|
2071
|
+
const section = findTomlSection(normalizedConfig, CODEX_MULTI_AGENT_V2_HEADER);
|
|
2072
|
+
const maxThreadsValue = CODEX_MULTI_AGENT_V2_MAX_CONCURRENT_THREADS_PER_SESSION.toString();
|
|
2073
|
+
if (!section) {
|
|
2074
|
+
return appendBlock(normalizedConfig, `[${CODEX_MULTI_AGENT_V2_HEADER}]
|
|
2075
|
+
max_concurrent_threads_per_session = ${maxThreadsValue}
|
|
2076
|
+
`);
|
|
2077
|
+
}
|
|
2078
|
+
return replaceOrInsertSetting(normalizedConfig, section, "max_concurrent_threads_per_session", maxThreadsValue);
|
|
1808
2079
|
}
|
|
1809
|
-
function
|
|
1810
|
-
const
|
|
1811
|
-
if (!
|
|
1812
|
-
|
|
1813
|
-
return
|
|
2080
|
+
function removeFeatureFlagSetting(config, featureName) {
|
|
2081
|
+
const section = findTomlSection(config, "features");
|
|
2082
|
+
if (!section)
|
|
2083
|
+
return config;
|
|
2084
|
+
return removeSetting(config, section, featureName);
|
|
1814
2085
|
}
|
|
1815
|
-
function
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
2086
|
+
function removeLegacyAgentsMaxThreadsSetting(config) {
|
|
2087
|
+
const section = findTomlSection(config, "agents");
|
|
2088
|
+
if (!section)
|
|
2089
|
+
return config;
|
|
2090
|
+
return removeSetting(config, section, "max_threads");
|
|
2091
|
+
}
|
|
2092
|
+
|
|
2093
|
+
// ../src/install/codex-config-toml.ts
|
|
2094
|
+
async function updateCodexConfig(input) {
|
|
2095
|
+
await mkdir6(dirname6(input.configPath), { recursive: true });
|
|
2096
|
+
let config = "";
|
|
2097
|
+
if (await exists3(input.configPath))
|
|
2098
|
+
config = await readFile9(input.configPath, "utf8");
|
|
2099
|
+
const pluginSet = new Set(input.pluginNames);
|
|
2100
|
+
for (const legacyMarketplaceName of legacyMarketplaceNames(input.marketplaceName)) {
|
|
2101
|
+
config = removeMarketplaceBlock(config, legacyMarketplaceName);
|
|
2102
|
+
config = removeStaleMarketplacePluginBlocks(config, legacyMarketplaceName, new Set);
|
|
2103
|
+
config = removeStaleMarketplaceHookStateBlocks(config, legacyMarketplaceName, new Set);
|
|
2104
|
+
}
|
|
2105
|
+
config = removeStaleMarketplacePluginBlocks(config, input.marketplaceName, pluginSet);
|
|
2106
|
+
config = removeStaleMarketplaceHookStateBlocks(config, input.marketplaceName, pluginSet);
|
|
2107
|
+
config = removeStaleManagedAgentBlocks(config, new Set((input.agentConfigs ?? []).map((agentConfig) => agentConfig.name)));
|
|
2108
|
+
config = ensureFeatureEnabled(config, "plugins");
|
|
2109
|
+
config = ensureFeatureEnabled(config, "plugin_hooks");
|
|
2110
|
+
config = ensureFeatureEnabled(config, "multi_agent");
|
|
2111
|
+
config = ensureFeatureEnabled(config, "child_agents_md");
|
|
2112
|
+
config = ensureCodexReasoningConfig(config, await readCodexModelCatalog(input.repoRoot));
|
|
2113
|
+
config = ensureCodexMultiAgentV2Config(config);
|
|
2114
|
+
if (input.autonomousPermissions === true)
|
|
2115
|
+
config = ensureAutonomousPermissions(config);
|
|
2116
|
+
if (!(input.preserveMarketplaceSource === true && hasMarketplaceBlock(config, input.marketplaceName))) {
|
|
2117
|
+
config = ensureMarketplaceBlock(config, input.marketplaceName, input.marketplaceSource);
|
|
1829
2118
|
}
|
|
1830
|
-
|
|
2119
|
+
for (const pluginName of input.pluginNames) {
|
|
2120
|
+
config = ensurePluginEnabled(config, `${pluginName}@${input.marketplaceName}`);
|
|
2121
|
+
}
|
|
2122
|
+
config = ensureOmoBuiltinMcpPolicies(config, input);
|
|
2123
|
+
for (const state of input.trustedHookStates ?? []) {
|
|
2124
|
+
config = ensureHookTrusted(config, state);
|
|
2125
|
+
}
|
|
2126
|
+
for (const agentConfig of input.agentConfigs ?? []) {
|
|
2127
|
+
config = ensureAgentConfig(config, agentConfig);
|
|
2128
|
+
}
|
|
2129
|
+
await writeFileAtomic(input.configPath, `${config.trimEnd()}
|
|
2130
|
+
`);
|
|
1831
2131
|
}
|
|
1832
|
-
function
|
|
2132
|
+
async function exists3(path) {
|
|
1833
2133
|
try {
|
|
1834
|
-
|
|
1835
|
-
return
|
|
2134
|
+
await readFile9(path, "utf8");
|
|
2135
|
+
return true;
|
|
1836
2136
|
} catch (error) {
|
|
1837
|
-
if (error instanceof Error)
|
|
1838
|
-
|
|
2137
|
+
if (error instanceof Error)
|
|
2138
|
+
return false;
|
|
2139
|
+
return false;
|
|
1839
2140
|
}
|
|
1840
2141
|
}
|
|
1841
2142
|
|
|
1842
|
-
//
|
|
2143
|
+
// ../src/install/codex-git-bash-mcp-env.ts
|
|
1843
2144
|
import { readFile as readFile10, writeFile as writeFile6 } from "node:fs/promises";
|
|
1844
|
-
import { join as
|
|
2145
|
+
import { join as join15 } from "node:path";
|
|
1845
2146
|
var GIT_BASH_ENV_KEY = "OMO_CODEX_GIT_BASH_PATH";
|
|
1846
|
-
async function stampGitBashMcpEnv(
|
|
1847
|
-
if (platform !== "win32")
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
const
|
|
1851
|
-
if (
|
|
2147
|
+
async function stampGitBashMcpEnv(input) {
|
|
2148
|
+
if (input.platform !== "win32")
|
|
2149
|
+
return false;
|
|
2150
|
+
const rawOverride = input.env?.[GIT_BASH_ENV_KEY];
|
|
2151
|
+
const override = typeof rawOverride === "string" ? rawOverride.trim() : "";
|
|
2152
|
+
if (override === "")
|
|
2153
|
+
return false;
|
|
2154
|
+
const manifestPath = join15(input.pluginRoot, ".mcp.json");
|
|
2155
|
+
if (!await fileExistsStrict(manifestPath))
|
|
2156
|
+
return false;
|
|
1852
2157
|
const parsed = JSON.parse(await readFile10(manifestPath, "utf8"));
|
|
1853
|
-
if (!
|
|
1854
|
-
|
|
1855
|
-
const
|
|
1856
|
-
if (
|
|
1857
|
-
|
|
1858
|
-
|
|
2158
|
+
if (!isPlainRecord(parsed) || !isPlainRecord(parsed["mcpServers"]))
|
|
2159
|
+
return false;
|
|
2160
|
+
const gitBashServer = parsed["mcpServers"]["git_bash"];
|
|
2161
|
+
if (!isPlainRecord(gitBashServer))
|
|
2162
|
+
return false;
|
|
2163
|
+
const serverEnv = isPlainRecord(gitBashServer["env"]) ? gitBashServer["env"] : {};
|
|
2164
|
+
if (serverEnv[GIT_BASH_ENV_KEY] === override)
|
|
2165
|
+
return false;
|
|
2166
|
+
gitBashServer["env"] = { ...serverEnv, [GIT_BASH_ENV_KEY]: override };
|
|
2167
|
+
await writeFile6(manifestPath, `${JSON.stringify(parsed, null, "\t")}
|
|
1859
2168
|
`);
|
|
1860
2169
|
return true;
|
|
1861
2170
|
}
|
|
1862
2171
|
|
|
1863
|
-
//
|
|
1864
|
-
import {
|
|
2172
|
+
// ../src/install/codex-hook-trust.ts
|
|
2173
|
+
import { createHash as createHash3 } from "node:crypto";
|
|
2174
|
+
import { readFile as readFile11 } from "node:fs/promises";
|
|
2175
|
+
import { join as join16 } from "node:path";
|
|
2176
|
+
var EVENT_LABELS = new Map([
|
|
2177
|
+
["PreToolUse", "pre_tool_use"],
|
|
2178
|
+
["PermissionRequest", "permission_request"],
|
|
2179
|
+
["PostToolUse", "post_tool_use"],
|
|
2180
|
+
["PreCompact", "pre_compact"],
|
|
2181
|
+
["PostCompact", "post_compact"],
|
|
2182
|
+
["SessionStart", "session_start"],
|
|
2183
|
+
["UserPromptSubmit", "user_prompt_submit"],
|
|
2184
|
+
["SubagentStart", "subagent_start"],
|
|
2185
|
+
["SubagentStop", "subagent_stop"],
|
|
2186
|
+
["Stop", "stop"]
|
|
2187
|
+
]);
|
|
2188
|
+
async function trustedHookStatesForPlugin(input) {
|
|
2189
|
+
const manifestPath = join16(input.pluginRoot, ".codex-plugin", "plugin.json");
|
|
2190
|
+
if (!await exists4(manifestPath))
|
|
2191
|
+
return [];
|
|
2192
|
+
const manifest = JSON.parse(await readFile11(manifestPath, "utf8"));
|
|
2193
|
+
if (!isPlainRecord(manifest) || typeof manifest.hooks !== "string")
|
|
2194
|
+
return [];
|
|
2195
|
+
const hooksPath = join16(input.pluginRoot, manifest.hooks);
|
|
2196
|
+
if (!await exists4(hooksPath))
|
|
2197
|
+
return [];
|
|
2198
|
+
const parsed = JSON.parse(await readFile11(hooksPath, "utf8"));
|
|
2199
|
+
if (!isPlainRecord(parsed) || !isPlainRecord(parsed.hooks))
|
|
2200
|
+
return [];
|
|
2201
|
+
const keySource = `${input.pluginName}@${input.marketplaceName}:${stripDotSlash(manifest.hooks)}`;
|
|
2202
|
+
const states = [];
|
|
2203
|
+
for (const [eventName, groups] of Object.entries(parsed.hooks)) {
|
|
2204
|
+
if (!Array.isArray(groups))
|
|
2205
|
+
continue;
|
|
2206
|
+
const eventLabel = EVENT_LABELS.get(eventName);
|
|
2207
|
+
if (eventLabel === undefined)
|
|
2208
|
+
continue;
|
|
2209
|
+
for (const [groupIndex, group] of groups.entries()) {
|
|
2210
|
+
if (!isPlainRecord(group) || !Array.isArray(group.hooks))
|
|
2211
|
+
continue;
|
|
2212
|
+
for (const [handlerIndex, handler] of group.hooks.entries()) {
|
|
2213
|
+
if (!isPlainRecord(handler) || handler.type !== "command")
|
|
2214
|
+
continue;
|
|
2215
|
+
if (handler.async === true)
|
|
2216
|
+
continue;
|
|
2217
|
+
if (typeof handler.command !== "string" || handler.command.trim() === "")
|
|
2218
|
+
continue;
|
|
2219
|
+
const key = `${keySource}:${eventLabel}:${groupIndex}:${handlerIndex}`;
|
|
2220
|
+
states.push({ key, trustedHash: commandHookHash(eventLabel, group.matcher, handler) });
|
|
2221
|
+
}
|
|
2222
|
+
}
|
|
2223
|
+
}
|
|
2224
|
+
return states;
|
|
2225
|
+
}
|
|
2226
|
+
function commandHookHash(eventName, matcher, handler) {
|
|
2227
|
+
const timeout = Math.max(Number(handler.timeout ?? 600), 1);
|
|
2228
|
+
const normalizedHandler = {
|
|
2229
|
+
type: "command",
|
|
2230
|
+
command: handler.command,
|
|
2231
|
+
timeout,
|
|
2232
|
+
async: false
|
|
2233
|
+
};
|
|
2234
|
+
if (typeof handler.statusMessage === "string")
|
|
2235
|
+
normalizedHandler.statusMessage = handler.statusMessage;
|
|
2236
|
+
const identity = { event_name: eventName, hooks: [normalizedHandler] };
|
|
2237
|
+
if (typeof matcher === "string")
|
|
2238
|
+
identity.matcher = matcher;
|
|
2239
|
+
const canonical = JSON.stringify(canonicalJson(identity));
|
|
2240
|
+
return `sha256:${createHash3("sha256").update(canonical).digest("hex")}`;
|
|
2241
|
+
}
|
|
2242
|
+
function canonicalJson(value) {
|
|
2243
|
+
if (Array.isArray(value))
|
|
2244
|
+
return value.map(canonicalJson);
|
|
2245
|
+
if (!isPlainRecord(value))
|
|
2246
|
+
return value;
|
|
2247
|
+
const result = {};
|
|
2248
|
+
for (const key of Object.keys(value).sort()) {
|
|
2249
|
+
result[key] = canonicalJson(value[key]);
|
|
2250
|
+
}
|
|
2251
|
+
return result;
|
|
2252
|
+
}
|
|
2253
|
+
function stripDotSlash(value) {
|
|
2254
|
+
return value.startsWith("./") ? value.slice(2) : value;
|
|
2255
|
+
}
|
|
2256
|
+
async function exists4(path) {
|
|
2257
|
+
try {
|
|
2258
|
+
await readFile11(path, "utf8");
|
|
2259
|
+
return true;
|
|
2260
|
+
} catch (error) {
|
|
2261
|
+
if (error instanceof Error)
|
|
2262
|
+
return false;
|
|
2263
|
+
return false;
|
|
2264
|
+
}
|
|
2265
|
+
}
|
|
2266
|
+
|
|
2267
|
+
// ../src/install/codex-installer-bin-dir.ts
|
|
2268
|
+
import { homedir as homedir3 } from "node:os";
|
|
2269
|
+
import { join as join17, resolve as resolve5 } from "node:path";
|
|
2270
|
+
function resolveCodexInstallerBinDir(input) {
|
|
2271
|
+
const explicitBinDir = input.binDir ?? input.env?.CODEX_LOCAL_BIN_DIR;
|
|
2272
|
+
if (explicitBinDir !== undefined && explicitBinDir.trim().length > 0)
|
|
2273
|
+
return resolve5(explicitBinDir.trim());
|
|
2274
|
+
const homeDir = input.homeDir ?? homedir3();
|
|
2275
|
+
const defaultCodexHome = resolve5(homeDir, ".codex");
|
|
2276
|
+
const resolvedCodexHome = resolve5(input.codexHome);
|
|
2277
|
+
if (resolvedCodexHome !== defaultCodexHome)
|
|
2278
|
+
return join17(resolvedCodexHome, "bin");
|
|
2279
|
+
return resolve5(homeDir, ".local", "bin");
|
|
2280
|
+
}
|
|
2281
|
+
// ../../utils/src/runtime/git-bash.ts
|
|
2282
|
+
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
1865
2283
|
import { existsSync as existsSync2 } from "node:fs";
|
|
1866
2284
|
var GIT_BASH_ENV_KEY2 = "OMO_CODEX_GIT_BASH_PATH";
|
|
1867
|
-
var
|
|
2285
|
+
var WINGET_INSTALL_ARGS = ["install", "--id", "Git.Git", "-e", "--source", "winget"];
|
|
1868
2286
|
var PROGRAM_FILES_GIT_BASH = "C:\\Program Files\\Git\\bin\\bash.exe";
|
|
1869
2287
|
var PROGRAM_FILES_X86_GIT_BASH = "C:\\Program Files (x86)\\Git\\bin\\bash.exe";
|
|
1870
|
-
var
|
|
1871
|
-
function resolveGitBash(
|
|
1872
|
-
if (platform !== "win32")
|
|
2288
|
+
var NON_GIT_BASH_LAUNCHER_DIR_SEGMENTS = ["\\windows\\system32\\", "\\microsoft\\windowsapps\\"];
|
|
2289
|
+
function resolveGitBash(input) {
|
|
2290
|
+
if (input.platform !== "win32")
|
|
2291
|
+
return { found: true, path: null, source: "not-required", checkedPaths: [] };
|
|
1873
2292
|
const checkedPaths = [];
|
|
1874
|
-
const envPath =
|
|
1875
|
-
if (envPath !==
|
|
2293
|
+
const envPath = nonEmptyEnvValue(input.env, GIT_BASH_ENV_KEY2);
|
|
2294
|
+
if (envPath !== undefined) {
|
|
1876
2295
|
checkedPaths.push(envPath);
|
|
1877
|
-
if (isBashExePath(envPath) &&
|
|
2296
|
+
if (isBashExePath(envPath) && input.exists(envPath)) {
|
|
2297
|
+
return { found: true, path: envPath, source: "env", checkedPaths };
|
|
2298
|
+
}
|
|
1878
2299
|
return missingGitBash(checkedPaths);
|
|
1879
2300
|
}
|
|
1880
2301
|
for (const candidate of [
|
|
@@ -1882,151 +2303,106 @@ function resolveGitBash({ platform, env, exists: exists2, where }) {
|
|
|
1882
2303
|
{ path: PROGRAM_FILES_X86_GIT_BASH, source: "program-files-x86" }
|
|
1883
2304
|
]) {
|
|
1884
2305
|
checkedPaths.push(candidate.path);
|
|
1885
|
-
if (
|
|
2306
|
+
if (input.exists(candidate.path))
|
|
2307
|
+
return { found: true, path: candidate.path, source: candidate.source, checkedPaths };
|
|
1886
2308
|
}
|
|
1887
|
-
for (const pathCandidate of where("bash")) {
|
|
2309
|
+
for (const pathCandidate of input.where("bash")) {
|
|
1888
2310
|
const candidate = pathCandidate.trim();
|
|
1889
|
-
if (candidate.length === 0)
|
|
2311
|
+
if (candidate.length === 0)
|
|
2312
|
+
continue;
|
|
1890
2313
|
checkedPaths.push(candidate);
|
|
1891
|
-
if (isKnownNonGitBashLauncher(candidate))
|
|
1892
|
-
|
|
2314
|
+
if (isKnownNonGitBashLauncher(candidate))
|
|
2315
|
+
continue;
|
|
2316
|
+
if (isBashExePath(candidate) && input.exists(candidate))
|
|
2317
|
+
return { found: true, path: candidate, source: "path", checkedPaths };
|
|
1893
2318
|
}
|
|
1894
2319
|
return missingGitBash(checkedPaths);
|
|
1895
2320
|
}
|
|
1896
|
-
|
|
2321
|
+
var resolveGitBashForCurrentProcess = (input = {}) => {
|
|
1897
2322
|
return resolveGitBash({
|
|
1898
|
-
platform:
|
|
1899
|
-
env:
|
|
2323
|
+
platform: input.platform ?? process.platform,
|
|
2324
|
+
env: input.env ?? process.env,
|
|
1900
2325
|
exists: existsSync2,
|
|
1901
2326
|
where: whereCommand
|
|
1902
2327
|
});
|
|
1903
|
-
}
|
|
1904
|
-
async function prepareGitBashForInstall(options) {
|
|
1905
|
-
const resolveGitBashWithDefaults = options.resolveGitBash ?? (() => resolveGitBashForCurrentProcess({ platform: options.platform, env: options.env }));
|
|
1906
|
-
const initialResolution = resolveGitBashWithDefaults();
|
|
1907
|
-
if (options.platform !== "win32" || initialResolution.found) return initialResolution;
|
|
1908
|
-
if (options.env[SKIP_GIT_BASH_AUTO_INSTALL_ENV_KEY] === "1") return initialResolution;
|
|
1909
|
-
try {
|
|
1910
|
-
await options.runCommand("winget", WINGET_INSTALL_ARGS, { cwd: options.cwd });
|
|
1911
|
-
} catch (error) {
|
|
1912
|
-
if (!(error instanceof Error)) throw error;
|
|
1913
|
-
return initialResolution;
|
|
1914
|
-
}
|
|
1915
|
-
return resolveGitBashWithDefaults();
|
|
1916
|
-
}
|
|
2328
|
+
};
|
|
1917
2329
|
function missingGitBash(checkedPaths) {
|
|
1918
2330
|
return {
|
|
1919
2331
|
found: false,
|
|
1920
2332
|
checkedPaths,
|
|
1921
2333
|
installHint: [
|
|
1922
|
-
"Git Bash is required
|
|
2334
|
+
"Git Bash is required on native Windows.",
|
|
1923
2335
|
"Install it with: winget install --id Git.Git -e --source winget",
|
|
1924
|
-
`For a custom install, set ${GIT_BASH_ENV_KEY2}=C:\\path\\to\\bash.exe
|
|
1925
|
-
|
|
1926
|
-
|
|
2336
|
+
`For a custom install, set ${GIT_BASH_ENV_KEY2}=C:\\path\\to\\bash.exe`
|
|
2337
|
+
].join(`
|
|
2338
|
+
`)
|
|
1927
2339
|
};
|
|
1928
2340
|
}
|
|
1929
|
-
function
|
|
2341
|
+
function nonEmptyEnvValue(env, key) {
|
|
1930
2342
|
const value = env[key];
|
|
1931
|
-
if (
|
|
2343
|
+
if (value === undefined)
|
|
2344
|
+
return;
|
|
1932
2345
|
const trimmed = value.trim();
|
|
1933
|
-
return trimmed.length === 0 ?
|
|
2346
|
+
return trimmed.length === 0 ? undefined : trimmed;
|
|
1934
2347
|
}
|
|
1935
2348
|
function isBashExePath(path) {
|
|
1936
2349
|
return path.toLowerCase().endsWith("bash.exe");
|
|
1937
2350
|
}
|
|
1938
|
-
var NON_GIT_BASH_LAUNCHER_DIR_SEGMENTS = ["\\windows\\system32\\", "\\microsoft\\windowsapps\\"];
|
|
1939
2351
|
function isKnownNonGitBashLauncher(path) {
|
|
1940
2352
|
const normalized = path.replaceAll("/", "\\").toLowerCase();
|
|
1941
2353
|
return NON_GIT_BASH_LAUNCHER_DIR_SEGMENTS.some((segment) => normalized.includes(segment));
|
|
1942
2354
|
}
|
|
1943
2355
|
function whereCommand(command) {
|
|
1944
2356
|
try {
|
|
1945
|
-
return
|
|
2357
|
+
return execFileSync2("where", [command], { encoding: "utf8" }).split(/\r?\n/).map((line) => line.trim()).filter((line) => line.length > 0);
|
|
1946
2358
|
} catch (error) {
|
|
1947
|
-
if (error instanceof Error)
|
|
2359
|
+
if (error instanceof Error)
|
|
2360
|
+
return [];
|
|
1948
2361
|
throw error;
|
|
1949
2362
|
}
|
|
1950
2363
|
}
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
[
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
const manifestPath = join13(pluginRoot, ".codex-plugin", "plugin.json");
|
|
1970
|
-
if (!await exists(manifestPath)) return [];
|
|
1971
|
-
const manifest = JSON.parse(await readFile11(manifestPath, "utf8"));
|
|
1972
|
-
if (!isRecord2(manifest) || typeof manifest.hooks !== "string") return [];
|
|
1973
|
-
const hooksPath = join13(pluginRoot, manifest.hooks);
|
|
1974
|
-
if (!await exists(hooksPath)) return [];
|
|
1975
|
-
const parsed = JSON.parse(await readFile11(hooksPath, "utf8"));
|
|
1976
|
-
if (!isRecord2(parsed) || !isRecord2(parsed.hooks)) return [];
|
|
1977
|
-
const keySource = `${pluginName}@${marketplaceName}:${stripDotSlash(manifest.hooks)}`;
|
|
1978
|
-
const states = [];
|
|
1979
|
-
for (const [eventName, groups] of Object.entries(parsed.hooks)) {
|
|
1980
|
-
if (!Array.isArray(groups)) continue;
|
|
1981
|
-
const eventLabel = EVENT_LABELS.get(eventName);
|
|
1982
|
-
if (eventLabel === void 0) continue;
|
|
1983
|
-
for (const [groupIndex, group] of groups.entries()) {
|
|
1984
|
-
if (!isRecord2(group) || !Array.isArray(group.hooks)) continue;
|
|
1985
|
-
for (const [handlerIndex, handler] of group.hooks.entries()) {
|
|
1986
|
-
if (!isRecord2(handler) || handler.type !== "command") continue;
|
|
1987
|
-
if (handler.async === true) continue;
|
|
1988
|
-
if (typeof handler.command !== "string" || handler.command.trim() === "") continue;
|
|
1989
|
-
const key = `${keySource}:${eventLabel}:${groupIndex}:${handlerIndex}`;
|
|
1990
|
-
states.push({
|
|
1991
|
-
key,
|
|
1992
|
-
trustedHash: commandHookHash(eventLabel, group.matcher, handler)
|
|
1993
|
-
});
|
|
1994
|
-
}
|
|
1995
|
-
}
|
|
2364
|
+
// ../src/install/git-bash.ts
|
|
2365
|
+
var SKIP_GIT_BASH_AUTO_INSTALL_ENV_KEY = "OMO_CODEX_SKIP_GIT_BASH_AUTO_INSTALL";
|
|
2366
|
+
var resolveGitBashForCurrentProcess2 = (input = {}) => {
|
|
2367
|
+
return toCodexResolution(resolveGitBashForCurrentProcess(input));
|
|
2368
|
+
};
|
|
2369
|
+
async function prepareGitBashForInstall(input) {
|
|
2370
|
+
const resolve6 = input.resolveGitBash ?? (() => resolveGitBashForCurrentProcess2({ platform: input.platform, env: input.env }));
|
|
2371
|
+
const initialResolution = resolve6();
|
|
2372
|
+
if (input.platform !== "win32" || initialResolution.found)
|
|
2373
|
+
return initialResolution;
|
|
2374
|
+
if (input.env[SKIP_GIT_BASH_AUTO_INSTALL_ENV_KEY] === "1")
|
|
2375
|
+
return initialResolution;
|
|
2376
|
+
try {
|
|
2377
|
+
await input.runCommand("winget", WINGET_INSTALL_ARGS, { cwd: input.cwd });
|
|
2378
|
+
} catch (error) {
|
|
2379
|
+
if (!(error instanceof Error))
|
|
2380
|
+
throw error;
|
|
2381
|
+
return initialResolution;
|
|
1996
2382
|
}
|
|
1997
|
-
return
|
|
1998
|
-
}
|
|
1999
|
-
function commandHookHash(eventName, matcher, handler) {
|
|
2000
|
-
const command = handler.command;
|
|
2001
|
-
const timeout = Math.max(Number(handler.timeout ?? 600), 1);
|
|
2002
|
-
const normalizedHandler = {
|
|
2003
|
-
type: "command",
|
|
2004
|
-
command,
|
|
2005
|
-
timeout,
|
|
2006
|
-
async: false
|
|
2007
|
-
};
|
|
2008
|
-
if (typeof handler.statusMessage === "string") normalizedHandler.statusMessage = handler.statusMessage;
|
|
2009
|
-
const identity = {
|
|
2010
|
-
event_name: eventName,
|
|
2011
|
-
hooks: [normalizedHandler]
|
|
2012
|
-
};
|
|
2013
|
-
if (typeof matcher === "string") identity.matcher = matcher;
|
|
2014
|
-
return `sha256:${createHash2("sha256").update(JSON.stringify(canonicalJson(identity))).digest("hex")}`;
|
|
2383
|
+
return resolve6();
|
|
2015
2384
|
}
|
|
2016
|
-
function
|
|
2017
|
-
if (
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2385
|
+
function toCodexResolution(resolution) {
|
|
2386
|
+
if (resolution.found) {
|
|
2387
|
+
return {
|
|
2388
|
+
found: true,
|
|
2389
|
+
path: resolution.path,
|
|
2390
|
+
source: resolution.source
|
|
2391
|
+
};
|
|
2022
2392
|
}
|
|
2023
|
-
return
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2393
|
+
return {
|
|
2394
|
+
...resolution,
|
|
2395
|
+
installHint: [
|
|
2396
|
+
"Git Bash is required for native Windows Codex profile installs.",
|
|
2397
|
+
"Install it with: winget install --id Git.Git -e --source winget",
|
|
2398
|
+
`For a custom install, set ${GIT_BASH_ENV_KEY2}=C:\\path\\to\\bash.exe`,
|
|
2399
|
+
"Then rerun `npx lazycodex-ai install`."
|
|
2400
|
+
].join(`
|
|
2401
|
+
`)
|
|
2402
|
+
};
|
|
2027
2403
|
}
|
|
2028
2404
|
|
|
2029
|
-
// src/setup.ts
|
|
2405
|
+
// components/bootstrap/src/setup.ts
|
|
2030
2406
|
var SETUP_MARKETPLACE_NAME = "sisyphuslabs";
|
|
2031
2407
|
var SETUP_PLUGIN_NAME = "omo";
|
|
2032
2408
|
var GIT_BASH_INSTALL_HINT = "winget install --id Git.Git -e --source winget";
|
|
@@ -2041,16 +2417,18 @@ async function runWorkerSetup(options) {
|
|
|
2041
2417
|
return { degraded };
|
|
2042
2418
|
}
|
|
2043
2419
|
async function resolveGitBashStep(options, degraded) {
|
|
2044
|
-
if (options.platform !== "win32")
|
|
2420
|
+
if (options.platform !== "win32")
|
|
2421
|
+
return false;
|
|
2045
2422
|
try {
|
|
2046
2423
|
const resolution = await prepareGitBashForInstall({
|
|
2047
2424
|
cwd: options.pluginRoot,
|
|
2048
2425
|
env: options.env,
|
|
2049
2426
|
platform: options.platform,
|
|
2050
2427
|
runCommand: options.runCommand ?? defaultRunCommand,
|
|
2051
|
-
...options.resolveGitBash ===
|
|
2428
|
+
...options.resolveGitBash === undefined ? {} : { resolveGitBash: options.resolveGitBash }
|
|
2052
2429
|
});
|
|
2053
|
-
if (resolution.found)
|
|
2430
|
+
if (resolution.found)
|
|
2431
|
+
return true;
|
|
2054
2432
|
degraded.push({
|
|
2055
2433
|
component: "git-bash",
|
|
2056
2434
|
hint: GIT_BASH_INSTALL_HINT,
|
|
@@ -2066,9 +2444,9 @@ async function resolveGitBashStep(options, degraded) {
|
|
|
2066
2444
|
return false;
|
|
2067
2445
|
}
|
|
2068
2446
|
async function linkBundledAgentsStep(options) {
|
|
2069
|
-
const agentsTarget =
|
|
2447
|
+
const agentsTarget = join18(options.codexHome, "agents");
|
|
2070
2448
|
try {
|
|
2071
|
-
const stageRoot =
|
|
2449
|
+
const stageRoot = join18(options.pluginData, "bootstrap", "agents-stage");
|
|
2072
2450
|
await stageBundledAgents(options.pluginRoot, stageRoot);
|
|
2073
2451
|
const preservedReasoning = await capturePreservedAgentReasoning({ codexHome: options.codexHome });
|
|
2074
2452
|
const preservedServiceTier = await capturePreservedAgentServiceTier({ codexHome: options.codexHome });
|
|
@@ -2094,22 +2472,23 @@ async function linkBundledAgentsStep(options) {
|
|
|
2094
2472
|
}
|
|
2095
2473
|
}
|
|
2096
2474
|
async function stageBundledAgents(pluginRoot, stageRoot) {
|
|
2097
|
-
await
|
|
2475
|
+
await rm9(stageRoot, { force: true, recursive: true });
|
|
2098
2476
|
await mkdir7(stageRoot, { recursive: true });
|
|
2099
|
-
const componentsRoot =
|
|
2477
|
+
const componentsRoot = join18(pluginRoot, "components");
|
|
2100
2478
|
for (const componentName of await directoryNames(componentsRoot)) {
|
|
2101
|
-
const agentsDir =
|
|
2479
|
+
const agentsDir = join18(componentsRoot, componentName, "agents");
|
|
2102
2480
|
const agentFiles = (await fileNames(agentsDir)).filter((name) => name.endsWith(".toml"));
|
|
2103
|
-
if (agentFiles.length === 0)
|
|
2104
|
-
|
|
2481
|
+
if (agentFiles.length === 0)
|
|
2482
|
+
continue;
|
|
2483
|
+
const stagedAgentsDir = join18(stageRoot, "components", componentName, "agents");
|
|
2105
2484
|
await mkdir7(stagedAgentsDir, { recursive: true });
|
|
2106
2485
|
for (const agentFile of agentFiles) {
|
|
2107
|
-
await copyFile2(
|
|
2486
|
+
await copyFile2(join18(agentsDir, agentFile), join18(stagedAgentsDir, agentFile));
|
|
2108
2487
|
}
|
|
2109
2488
|
}
|
|
2110
2489
|
}
|
|
2111
2490
|
async function updateConfigStep(options, inputs, degraded) {
|
|
2112
|
-
const configPath =
|
|
2491
|
+
const configPath = join18(options.codexHome, "config.toml");
|
|
2113
2492
|
try {
|
|
2114
2493
|
await assertWritableConfigIfPresent(configPath);
|
|
2115
2494
|
const trustedHookStates = await trustedHookStatesForPlugin({
|
|
@@ -2119,18 +2498,14 @@ async function updateConfigStep(options, inputs, degraded) {
|
|
|
2119
2498
|
});
|
|
2120
2499
|
await updateCodexConfig({
|
|
2121
2500
|
agentConfigs: inputs.agentConfigs,
|
|
2122
|
-
// Hard invariant: the bootstrap worker NEVER writes permission keys
|
|
2123
|
-
// (approval/sandbox/network policies stay installer-flag-only).
|
|
2124
2501
|
autonomousPermissions: false,
|
|
2125
2502
|
configPath,
|
|
2126
2503
|
gitBashEnabled: inputs.gitBashEnabled,
|
|
2127
2504
|
marketplaceName: SETUP_MARKETPLACE_NAME,
|
|
2505
|
+
marketplaceSource: { sourceType: "local", source: options.pluginRoot },
|
|
2128
2506
|
platform: options.platform,
|
|
2129
2507
|
pluginNames: [SETUP_PLUGIN_NAME],
|
|
2130
2508
|
preserveMarketplaceSource: true,
|
|
2131
|
-
// The marketplace plugin tree has no <root>/plugin/model-catalog.json,
|
|
2132
|
-
// so updateCodexConfig falls back to the catalog bundled into this
|
|
2133
|
-
// dist; bootstrap-setup.test.mjs guards against drift between the two.
|
|
2134
2509
|
repoRoot: options.pluginRoot,
|
|
2135
2510
|
trustedHookStates
|
|
2136
2511
|
});
|
|
@@ -2144,14 +2519,16 @@ async function updateConfigStep(options, inputs, degraded) {
|
|
|
2144
2519
|
}
|
|
2145
2520
|
async function assertWritableConfigIfPresent(configPath) {
|
|
2146
2521
|
try {
|
|
2147
|
-
if (((await stat4(configPath)).mode & 146) === 0)
|
|
2522
|
+
if (((await stat4(configPath)).mode & 146) === 0)
|
|
2523
|
+
throw new Error(`${configPath} has no write permission bits set`);
|
|
2148
2524
|
} catch (error) {
|
|
2149
|
-
if (errorCode(error) === "ENOENT")
|
|
2525
|
+
if (errorCode(error) === "ENOENT")
|
|
2526
|
+
return;
|
|
2150
2527
|
throw error;
|
|
2151
2528
|
}
|
|
2152
2529
|
}
|
|
2153
2530
|
function errorCode(error) {
|
|
2154
|
-
return error instanceof Error && "code" in error && typeof error.code === "string" ? error.code :
|
|
2531
|
+
return error instanceof Error && "code" in error && typeof error.code === "string" ? error.code : undefined;
|
|
2155
2532
|
}
|
|
2156
2533
|
async function linkComponentBinsStep(options, degraded) {
|
|
2157
2534
|
const binDir = resolveCodexInstallerBinDir({ codexHome: options.codexHome, env: options.env });
|
|
@@ -2167,7 +2544,7 @@ async function linkComponentBinsStep(options, degraded) {
|
|
|
2167
2544
|
await linkRuntimeWrapperStep(options, binDir, degraded);
|
|
2168
2545
|
}
|
|
2169
2546
|
async function linkRuntimeWrapperStep(options, binDir, degraded) {
|
|
2170
|
-
const cliPath =
|
|
2547
|
+
const cliPath = join18(options.pluginRoot, "dist", "cli", "index.js");
|
|
2171
2548
|
try {
|
|
2172
2549
|
const linked = await linkRootRuntimeBin({
|
|
2173
2550
|
binDir,
|
|
@@ -2175,7 +2552,8 @@ async function linkRuntimeWrapperStep(options, binDir, degraded) {
|
|
|
2175
2552
|
platform: options.platform,
|
|
2176
2553
|
repoRoot: options.pluginRoot
|
|
2177
2554
|
});
|
|
2178
|
-
if (linked !== null)
|
|
2555
|
+
if (linked !== null)
|
|
2556
|
+
return;
|
|
2179
2557
|
degraded.push({
|
|
2180
2558
|
component: "omo-cli",
|
|
2181
2559
|
hint: "use npx lazycodex-ai for the omo CLI",
|
|
@@ -2199,7 +2577,7 @@ async function stampGitBashEnvStep(options, degraded) {
|
|
|
2199
2577
|
degraded.push({
|
|
2200
2578
|
component: "git-bash-env",
|
|
2201
2579
|
hint: BOOTSTRAP_DOCTOR_HINT,
|
|
2202
|
-
reason: `failed to stamp ${
|
|
2580
|
+
reason: `failed to stamp ${join18(options.pluginRoot, ".mcp.json")}: ${errorMessage(error)}`
|
|
2203
2581
|
});
|
|
2204
2582
|
}
|
|
2205
2583
|
}
|
|
@@ -2218,7 +2596,8 @@ async function entryNames(root, keep) {
|
|
|
2218
2596
|
const entries = await readdir3(root, { withFileTypes: true });
|
|
2219
2597
|
return entries.filter((entry) => keep(entry)).map((entry) => entry.name).sort();
|
|
2220
2598
|
} catch (error) {
|
|
2221
|
-
if (error instanceof Error && "code" in error && error.code === "ENOENT")
|
|
2599
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT")
|
|
2600
|
+
return [];
|
|
2222
2601
|
throw error;
|
|
2223
2602
|
}
|
|
2224
2603
|
}
|
|
@@ -2229,14 +2608,14 @@ function errorMessage(error) {
|
|
|
2229
2608
|
return error instanceof Error ? error.message : String(error);
|
|
2230
2609
|
}
|
|
2231
2610
|
|
|
2232
|
-
// src/worker.ts
|
|
2611
|
+
// components/bootstrap/src/worker.ts
|
|
2233
2612
|
var BOOTSTRAP_DOCTOR_HINT = "npx lazycodex-ai doctor";
|
|
2234
2613
|
function parseWorkerFlags(argv) {
|
|
2235
2614
|
let codexHome;
|
|
2236
2615
|
let manifestDir;
|
|
2237
2616
|
let once = false;
|
|
2238
2617
|
let only;
|
|
2239
|
-
for (let index = 0;
|
|
2618
|
+
for (let index = 0;index < argv.length; index += 1) {
|
|
2240
2619
|
const flag = argv[index];
|
|
2241
2620
|
if (flag === "--once") {
|
|
2242
2621
|
once = true;
|
|
@@ -2261,41 +2640,44 @@ function parseWorkerFlags(argv) {
|
|
|
2261
2640
|
}
|
|
2262
2641
|
return {
|
|
2263
2642
|
once,
|
|
2264
|
-
...codexHome ===
|
|
2265
|
-
...manifestDir ===
|
|
2266
|
-
...only ===
|
|
2643
|
+
...codexHome === undefined ? {} : { codexHome },
|
|
2644
|
+
...manifestDir === undefined ? {} : { manifestDir },
|
|
2645
|
+
...only === undefined ? {} : { only }
|
|
2267
2646
|
};
|
|
2268
2647
|
}
|
|
2269
2648
|
function resolvePluginDataRoot(env) {
|
|
2270
2649
|
const fromEnv = env["PLUGIN_DATA"]?.trim();
|
|
2271
|
-
if (fromEnv !==
|
|
2272
|
-
|
|
2650
|
+
if (fromEnv !== undefined && fromEnv.length > 0)
|
|
2651
|
+
return fromEnv;
|
|
2652
|
+
return join19(homedir4(), ".local", "share", "lazycodex");
|
|
2273
2653
|
}
|
|
2274
2654
|
async function readPluginVersion(pluginRoot) {
|
|
2275
2655
|
try {
|
|
2276
|
-
const parsed = JSON.parse(await readFile12(
|
|
2277
|
-
if (typeof parsed !== "object" || parsed === null)
|
|
2656
|
+
const parsed = JSON.parse(await readFile12(join19(pluginRoot, ".codex-plugin", "plugin.json"), "utf8"));
|
|
2657
|
+
if (typeof parsed !== "object" || parsed === null)
|
|
2658
|
+
return;
|
|
2278
2659
|
const version = parsed["version"];
|
|
2279
|
-
if (typeof version !== "string")
|
|
2660
|
+
if (typeof version !== "string")
|
|
2661
|
+
return;
|
|
2280
2662
|
const trimmed = version.trim();
|
|
2281
|
-
return trimmed.length > 0 ? trimmed :
|
|
2663
|
+
return trimmed.length > 0 ? trimmed : undefined;
|
|
2282
2664
|
} catch {
|
|
2283
|
-
return
|
|
2665
|
+
return;
|
|
2284
2666
|
}
|
|
2285
2667
|
}
|
|
2286
2668
|
async function readBootstrapState(statePath) {
|
|
2287
2669
|
return parseBootstrapState(await readState(statePath));
|
|
2288
2670
|
}
|
|
2289
2671
|
function parseBootstrapState(raw) {
|
|
2290
|
-
const completedForVersion = typeof raw["completedForVersion"] === "string" ? raw["completedForVersion"] :
|
|
2291
|
-
const lastAttemptAt = typeof raw["lastAttemptAt"] === "number" ? raw["lastAttemptAt"] :
|
|
2292
|
-
const lastStatus = raw["lastStatus"] === "success" || raw["lastStatus"] === "degraded" ? raw["lastStatus"] :
|
|
2672
|
+
const completedForVersion = typeof raw["completedForVersion"] === "string" ? raw["completedForVersion"] : undefined;
|
|
2673
|
+
const lastAttemptAt = typeof raw["lastAttemptAt"] === "number" ? raw["lastAttemptAt"] : undefined;
|
|
2674
|
+
const lastStatus = raw["lastStatus"] === "success" || raw["lastStatus"] === "degraded" ? raw["lastStatus"] : undefined;
|
|
2293
2675
|
const degraded = parseDegradedEntries(raw["degraded"]);
|
|
2294
2676
|
return {
|
|
2295
|
-
...completedForVersion ===
|
|
2296
|
-
...lastAttemptAt ===
|
|
2297
|
-
...lastStatus ===
|
|
2298
|
-
...degraded ===
|
|
2677
|
+
...completedForVersion === undefined ? {} : { completedForVersion },
|
|
2678
|
+
...lastAttemptAt === undefined ? {} : { lastAttemptAt },
|
|
2679
|
+
...lastStatus === undefined ? {} : { lastStatus },
|
|
2680
|
+
...degraded === undefined ? {} : { degraded }
|
|
2299
2681
|
};
|
|
2300
2682
|
}
|
|
2301
2683
|
function defaultWorkerSteps(seams = {}) {
|
|
@@ -2321,11 +2703,12 @@ async function runBootstrapWorker(options = {}) {
|
|
|
2321
2703
|
const statePath = resolveBootstrapStatePath(pluginData);
|
|
2322
2704
|
const lockEnv = { ...env, PLUGIN_DATA: pluginData };
|
|
2323
2705
|
const locks = await bootstrapLocks({ env: lockEnv, now, pluginData });
|
|
2324
|
-
if (locks === null)
|
|
2706
|
+
if (locks === null)
|
|
2707
|
+
return { ran: false, reason: "locked" };
|
|
2325
2708
|
try {
|
|
2326
2709
|
const pluginVersion = await readPluginVersion(pluginRoot);
|
|
2327
2710
|
const marker = await readBootstrapState(statePath);
|
|
2328
|
-
if (!flags.once && pluginVersion !==
|
|
2711
|
+
if (!flags.once && pluginVersion !== undefined && marker.completedForVersion === pluginVersion) {
|
|
2329
2712
|
await appendBootstrapLog(pluginData, now, "worker-skipped", { reason: "already-completed", version: pluginVersion });
|
|
2330
2713
|
return { ran: false, reason: "already-completed" };
|
|
2331
2714
|
}
|
|
@@ -2333,20 +2716,21 @@ async function runBootstrapWorker(options = {}) {
|
|
|
2333
2716
|
const context = { codexHome, env, flags, now, platform, pluginData, pluginRoot, pluginVersion };
|
|
2334
2717
|
await appendBootstrapLog(pluginData, now, "worker-started", { version: pluginVersion ?? "unknown" });
|
|
2335
2718
|
const degraded = [];
|
|
2336
|
-
if (pluginVersion ===
|
|
2719
|
+
if (pluginVersion === undefined) {
|
|
2337
2720
|
degraded.push({
|
|
2338
2721
|
component: "bootstrap",
|
|
2339
2722
|
hint: BOOTSTRAP_DOCTOR_HINT,
|
|
2340
|
-
reason: `plugin version unresolved from ${
|
|
2723
|
+
reason: `plugin version unresolved from ${join19(pluginRoot, ".codex-plugin", "plugin.json")}`
|
|
2341
2724
|
});
|
|
2342
2725
|
}
|
|
2343
2726
|
for (const step of steps) {
|
|
2344
|
-
if (flags.only !==
|
|
2727
|
+
if (flags.only !== undefined && step.name !== flags.only)
|
|
2728
|
+
continue;
|
|
2345
2729
|
degraded.push(...await runStep(step, context));
|
|
2346
2730
|
}
|
|
2347
2731
|
const status = degraded.length === 0 ? "success" : "degraded";
|
|
2348
2732
|
const state = {
|
|
2349
|
-
...pluginVersion ===
|
|
2733
|
+
...pluginVersion === undefined ? {} : { completedForVersion: pluginVersion },
|
|
2350
2734
|
degraded,
|
|
2351
2735
|
lastAttemptAt: now,
|
|
2352
2736
|
lastStatus: status
|
|
@@ -2373,25 +2757,28 @@ async function runStep(step, context) {
|
|
|
2373
2757
|
}
|
|
2374
2758
|
function resolvePluginRoot(env) {
|
|
2375
2759
|
const fromEnv = env["PLUGIN_ROOT"]?.trim();
|
|
2376
|
-
if (fromEnv !==
|
|
2377
|
-
|
|
2760
|
+
if (fromEnv !== undefined && fromEnv.length > 0)
|
|
2761
|
+
return fromEnv;
|
|
2762
|
+
return resolve6(dirname7(fileURLToPath2(import.meta.url)), "..", "..", "..");
|
|
2378
2763
|
}
|
|
2379
2764
|
async function appendBootstrapLog(pluginData, now, event, details) {
|
|
2380
2765
|
try {
|
|
2381
|
-
const logPath =
|
|
2382
|
-
await mkdir8(
|
|
2766
|
+
const logPath = join19(pluginData, "bootstrap", "bootstrap.log");
|
|
2767
|
+
await mkdir8(dirname7(logPath), { recursive: true });
|
|
2383
2768
|
await appendFile2(logPath, `${JSON.stringify({ timestamp: new Date(now).toISOString(), event, ...details })}
|
|
2384
2769
|
`);
|
|
2385
|
-
} catch {
|
|
2386
|
-
}
|
|
2770
|
+
} catch {}
|
|
2387
2771
|
}
|
|
2388
2772
|
function parseDegradedEntries(raw) {
|
|
2389
|
-
if (!Array.isArray(raw))
|
|
2773
|
+
if (!Array.isArray(raw))
|
|
2774
|
+
return;
|
|
2390
2775
|
const entries = [];
|
|
2391
2776
|
for (const candidate of raw) {
|
|
2392
|
-
if (typeof candidate !== "object" || candidate === null)
|
|
2777
|
+
if (typeof candidate !== "object" || candidate === null)
|
|
2778
|
+
continue;
|
|
2393
2779
|
const record = candidate;
|
|
2394
|
-
if (typeof record["component"] !== "string" || typeof record["reason"] !== "string")
|
|
2780
|
+
if (typeof record["component"] !== "string" || typeof record["reason"] !== "string")
|
|
2781
|
+
continue;
|
|
2395
2782
|
entries.push({
|
|
2396
2783
|
component: record["component"],
|
|
2397
2784
|
reason: record["reason"],
|
|
@@ -2402,30 +2789,34 @@ function parseDegradedEntries(raw) {
|
|
|
2402
2789
|
}
|
|
2403
2790
|
function requireFlagValue(argv, index, flag) {
|
|
2404
2791
|
const value = argv[index + 1];
|
|
2405
|
-
if (value ===
|
|
2792
|
+
if (value === undefined || value.startsWith("--")) {
|
|
2406
2793
|
throw new Error(`${flag} requires a value`);
|
|
2407
2794
|
}
|
|
2408
2795
|
return value;
|
|
2409
2796
|
}
|
|
2410
2797
|
|
|
2411
|
-
// src/hook.ts
|
|
2412
|
-
var BOOTSTRAP_RESTART_NOTICE = "LazyCodex bootstrap running in background
|
|
2798
|
+
// components/bootstrap/src/hook.ts
|
|
2799
|
+
var BOOTSTRAP_RESTART_NOTICE = "LazyCodex bootstrap running in background — restart the session when it completes";
|
|
2413
2800
|
async function runSessionStartHook(options) {
|
|
2414
2801
|
return (await executeSessionStartHook(options)).exitCode;
|
|
2415
2802
|
}
|
|
2416
2803
|
async function executeSessionStartHook(options) {
|
|
2417
|
-
if (options.stdin !==
|
|
2804
|
+
if (options.stdin !== undefined)
|
|
2805
|
+
await drainStdin(options.stdin);
|
|
2418
2806
|
const now = options.now ?? Date.now();
|
|
2419
2807
|
const pluginRoot = options.env["PLUGIN_ROOT"]?.trim();
|
|
2420
2808
|
const pluginData = options.env["PLUGIN_DATA"]?.trim();
|
|
2421
|
-
if (pluginRoot ===
|
|
2809
|
+
if (pluginRoot === undefined || pluginRoot.length === 0 || pluginData === undefined || pluginData.length === 0) {
|
|
2422
2810
|
return { action: "skip-missing-env", exitCode: 0 };
|
|
2423
2811
|
}
|
|
2424
2812
|
const pluginVersion = await readPluginVersion(pluginRoot);
|
|
2425
|
-
if (pluginVersion ===
|
|
2813
|
+
if (pluginVersion === undefined)
|
|
2814
|
+
return { action: "skip-version-unresolved", exitCode: 0 };
|
|
2426
2815
|
const state = await readBootstrapState(resolveBootstrapStatePath(pluginData));
|
|
2427
|
-
if (state.completedForVersion === pluginVersion)
|
|
2428
|
-
|
|
2816
|
+
if (state.completedForVersion === pluginVersion)
|
|
2817
|
+
return { action: "skip-completed", exitCode: 0 };
|
|
2818
|
+
if (await isLockFresh(resolveBootstrapLockPath(pluginData), now))
|
|
2819
|
+
return { action: "skip-locked", exitCode: 0 };
|
|
2429
2820
|
const spawnWorker = options.spawnWorker ?? spawnDetachedWorker;
|
|
2430
2821
|
spawnWorker({
|
|
2431
2822
|
args: [options.workerCliPath ?? defaultWorkerCliPath(), "worker"],
|
|
@@ -2434,18 +2825,16 @@ async function executeSessionStartHook(options) {
|
|
|
2434
2825
|
});
|
|
2435
2826
|
const writeNotice = options.writeNotice ?? ((line) => process.stdout.write(`${line}
|
|
2436
2827
|
`));
|
|
2437
|
-
writeNotice(
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
})
|
|
2444
|
-
);
|
|
2828
|
+
writeNotice(JSON.stringify({
|
|
2829
|
+
hookSpecificOutput: {
|
|
2830
|
+
hookEventName: "SessionStart",
|
|
2831
|
+
additionalContext: BOOTSTRAP_RESTART_NOTICE
|
|
2832
|
+
}
|
|
2833
|
+
}));
|
|
2445
2834
|
return { action: "spawned", exitCode: 0 };
|
|
2446
2835
|
}
|
|
2447
2836
|
function spawnDetachedWorker(invocation) {
|
|
2448
|
-
const child =
|
|
2837
|
+
const child = spawn2(invocation.command, [...invocation.args], {
|
|
2449
2838
|
detached: true,
|
|
2450
2839
|
env: invocation.env,
|
|
2451
2840
|
stdio: "ignore"
|
|
@@ -2464,17 +2853,21 @@ async function isLockFresh(lockPath, now) {
|
|
|
2464
2853
|
}
|
|
2465
2854
|
}
|
|
2466
2855
|
async function drainStdin(stdin) {
|
|
2467
|
-
if (stdin.isTTY === true)
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
}
|
|
2856
|
+
if (stdin.isTTY === true)
|
|
2857
|
+
return;
|
|
2858
|
+
for await (const chunk of stdin) {}
|
|
2471
2859
|
}
|
|
2472
2860
|
|
|
2473
|
-
// src/cli.ts
|
|
2474
|
-
var TOP_LEVEL_HELP =
|
|
2861
|
+
// components/bootstrap/src/cli.ts
|
|
2862
|
+
var TOP_LEVEL_HELP = `Usage:
|
|
2863
|
+
omo-bootstrap hook session-start
|
|
2864
|
+
omo-bootstrap worker [--codex-home <dir>] [--once] [--only <step>] [--manifest-dir <dir>]
|
|
2865
|
+
omo-bootstrap download <manifest> <platform> <destination-dir>
|
|
2866
|
+
omo-bootstrap help | --help | -h
|
|
2867
|
+
`;
|
|
2475
2868
|
async function runDownloadCommand(args) {
|
|
2476
2869
|
const [manifestName, platformKey, destinationDir] = args;
|
|
2477
|
-
if (manifestName ===
|
|
2870
|
+
if (manifestName === undefined || platformKey === undefined || destinationDir === undefined) {
|
|
2478
2871
|
process.stderr.write(`[omo-bootstrap] download requires <manifest> <platform> <destination-dir>
|
|
2479
2872
|
${TOP_LEVEL_HELP}`);
|
|
2480
2873
|
return 1;
|
|
@@ -2505,17 +2898,15 @@ ${TOP_LEVEL_HELP}`);
|
|
|
2505
2898
|
`);
|
|
2506
2899
|
return 0;
|
|
2507
2900
|
}
|
|
2508
|
-
process.stdout.write(
|
|
2509
|
-
result.ran ? `[omo-bootstrap] worker finished: ${result.status}
|
|
2901
|
+
process.stdout.write(result.ran ? `[omo-bootstrap] worker finished: ${result.status}
|
|
2510
2902
|
` : `[omo-bootstrap] worker skipped: ${result.reason}
|
|
2511
|
-
`
|
|
2512
|
-
);
|
|
2903
|
+
`);
|
|
2513
2904
|
return 0;
|
|
2514
2905
|
}
|
|
2515
2906
|
async function main() {
|
|
2516
2907
|
const argv = process.argv.slice(2);
|
|
2517
2908
|
const command = argv[0];
|
|
2518
|
-
if (command ===
|
|
2909
|
+
if (command === undefined || command === "help" || command === "--help" || command === "-h") {
|
|
2519
2910
|
process.stdout.write(TOP_LEVEL_HELP);
|
|
2520
2911
|
return 0;
|
|
2521
2912
|
}
|
|
@@ -2534,7 +2925,8 @@ ${TOP_LEVEL_HELP}`);
|
|
|
2534
2925
|
}
|
|
2535
2926
|
function isProcessEntry() {
|
|
2536
2927
|
const entry = process.argv[1];
|
|
2537
|
-
if (entry ===
|
|
2928
|
+
if (entry === undefined)
|
|
2929
|
+
return false;
|
|
2538
2930
|
try {
|
|
2539
2931
|
return realpathSync(entry) === realpathSync(fileURLToPath4(import.meta.url));
|
|
2540
2932
|
} catch {
|
|
@@ -2551,33 +2943,33 @@ if (isProcessEntry()) {
|
|
|
2551
2943
|
});
|
|
2552
2944
|
}
|
|
2553
2945
|
export {
|
|
2554
|
-
|
|
2555
|
-
BOOTSTRAP_RESTART_NOTICE,
|
|
2556
|
-
GIT_BASH_INSTALL_HINT,
|
|
2557
|
-
INSTALL_SNAPSHOT_FILENAME,
|
|
2558
|
-
SETUP_MARKETPLACE_NAME,
|
|
2559
|
-
SETUP_PLUGIN_NAME,
|
|
2560
|
-
SG_FORCE_PROVISION_ENV_KEY,
|
|
2561
|
-
SG_PROVISION_COMPONENT,
|
|
2562
|
-
appendBootstrapLog,
|
|
2563
|
-
bootstrapLocks,
|
|
2564
|
-
defaultWorkerSteps,
|
|
2565
|
-
detectInstallFlow,
|
|
2566
|
-
detectInstallFlowDetailed,
|
|
2567
|
-
detectInstallFlowForTest,
|
|
2568
|
-
detectInstallFlowFromEnvironment,
|
|
2569
|
-
executeSessionStartHook,
|
|
2570
|
-
parseBootstrapState,
|
|
2571
|
-
parseWorkerFlags,
|
|
2572
|
-
readBootstrapState,
|
|
2573
|
-
readPluginVersion,
|
|
2574
|
-
resolveBootstrapLockPath,
|
|
2575
|
-
resolveBootstrapStatePath,
|
|
2576
|
-
resolveCodexHome,
|
|
2577
|
-
resolvePluginDataRoot,
|
|
2578
|
-
runBootstrapWorker,
|
|
2579
|
-
runSessionStartHook,
|
|
2580
|
-
runSgProvision,
|
|
2946
|
+
sgProvisionDestination,
|
|
2581
2947
|
runWorkerSetup,
|
|
2582
|
-
|
|
2948
|
+
runSgProvision,
|
|
2949
|
+
runSessionStartHook,
|
|
2950
|
+
runBootstrapWorker,
|
|
2951
|
+
resolvePluginDataRoot,
|
|
2952
|
+
resolveCodexHome,
|
|
2953
|
+
resolveBootstrapStatePath,
|
|
2954
|
+
resolveBootstrapLockPath,
|
|
2955
|
+
readPluginVersion,
|
|
2956
|
+
readBootstrapState,
|
|
2957
|
+
parseWorkerFlags,
|
|
2958
|
+
parseBootstrapState,
|
|
2959
|
+
executeSessionStartHook,
|
|
2960
|
+
detectInstallFlowFromEnvironment,
|
|
2961
|
+
detectInstallFlowForTest,
|
|
2962
|
+
detectInstallFlowDetailed,
|
|
2963
|
+
detectInstallFlow,
|
|
2964
|
+
defaultWorkerSteps,
|
|
2965
|
+
bootstrapLocks,
|
|
2966
|
+
appendBootstrapLog,
|
|
2967
|
+
SG_PROVISION_COMPONENT,
|
|
2968
|
+
SG_FORCE_PROVISION_ENV_KEY,
|
|
2969
|
+
SETUP_PLUGIN_NAME,
|
|
2970
|
+
SETUP_MARKETPLACE_NAME,
|
|
2971
|
+
INSTALL_SNAPSHOT_FILENAME,
|
|
2972
|
+
GIT_BASH_INSTALL_HINT,
|
|
2973
|
+
BOOTSTRAP_RESTART_NOTICE,
|
|
2974
|
+
BOOTSTRAP_DOCTOR_HINT
|
|
2583
2975
|
};
|