oh-my-opencode 5.1.62 → 5.1.64
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/dist/cli/index.js +1598 -284
- package/dist/cli/service-auth/closed-device-login.fixture.d.ts +1 -0
- package/dist/cli/service-auth/credential-lock.d.ts +8 -2
- package/dist/cli/service-auth/keychain-helper/access.d.ts +27 -0
- package/dist/cli/service-auth/keychain-helper/approval-cache.d.ts +51 -0
- package/dist/cli/service-auth/keychain-helper/client.d.ts +68 -0
- package/dist/cli/service-auth/keychain-helper/creator-handoff.d.ts +31 -0
- package/dist/cli/service-auth/keychain-helper/darwin-backend.d.ts +75 -0
- package/dist/cli/service-auth/keychain-helper/darwin-read.d.ts +46 -0
- package/dist/cli/service-auth/keychain-helper/darwin-store.d.ts +28 -0
- package/dist/cli/service-auth/keychain-helper/fake-keychain.test-support.d.ts +85 -0
- package/dist/cli/service-auth/keychain-helper/location.d.ts +28 -0
- package/dist/cli/service-auth/keychain-helper/migration.d.ts +20 -0
- package/dist/cli/service-auth/keychain-helper/owner-marker.d.ts +7 -0
- package/dist/cli/service-auth/keychain-helper/pin.d.ts +20 -0
- package/dist/cli/service-auth/keychain-helper/process-copy.test-support.d.ts +3 -0
- package/dist/cli/service-auth/keychain-helper/process-state.d.ts +19 -0
- package/dist/cli/service-auth/keychain-helper/prompt-lock.d.ts +14 -0
- package/dist/cli/service-auth/keychain-helper/recovery.d.ts +34 -0
- package/dist/cli/service-auth/keychain-helper/runtime-capabilities.d.ts +13 -0
- package/dist/cli/service-auth/keychain-helper/secrets-gate.d.ts +4 -0
- package/dist/cli/service-auth/keychain-helper/signature.d.ts +17 -0
- package/dist/cli/service-auth/keychain-helper/store-binding.d.ts +46 -0
- package/dist/cli/service-auth/keystore.d.ts +18 -3
- package/dist/cli/service-auth/session.d.ts +2 -2
- package/dist/cli-node/index.js +1598 -284
- 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/index.js +479 -376
- package/dist/skills/ast-grep/AGENTS.md +2 -2
- package/dist/skills/ast-grep/README.md +4 -4
- package/dist/skills/ast-grep/SKILL.md +10 -8
- package/dist/skills/ast-grep/references/cli.md +4 -3
- package/dist/skills/ast-grep/references/patterns.md +5 -5
- package/dist/skills/ast-grep/references/pitfalls.md +3 -3
- package/dist/skills/ast-grep/references/recipes.md +6 -4
- package/dist/skills/ast-grep/references/yaml-rules.md +3 -3
- package/dist/skills/ast-grep/scripts/ast_grep_helper.py +3 -3
- package/dist/skills/browser/SKILL.md +2 -3
- package/dist/skills/browser/runtime/omowright/manifest.json +1 -1
- package/dist/skills/coding-agent-sessions/AGENTS.md +1 -1
- package/dist/skills/coding-agent-sessions/SKILL.md +2 -1
- package/dist/skills/data-scientist/SKILL.md +8 -6
- package/dist/skills/data-scientist/references/placement.md +9 -5
- package/dist/skills/data-scientist/references/uv-setup.md +3 -3
- package/dist/skills/data-scientist/references/visualization.md +19 -4
- package/dist/skills/debugging/SKILL.md +5 -5
- package/dist/skills/debugging/references/methodology/02-investigate.md +2 -2
- package/dist/skills/debugging/references/methodology/06-fix.md +2 -0
- package/dist/skills/debugging/references/methodology/09-cleanup.md +2 -2
- package/dist/skills/debugging/references/methodology/partial-runtime-evidence.md +1 -1
- package/dist/skills/debugging/references/runtimes/bundled-js-binary.md +1 -1
- package/dist/skills/debugging/references/runtimes/native-binary.md +1 -1
- package/dist/skills/debugging/references/tools/browser-qa.md +1 -2
- package/dist/skills/frontend/SKILL.md +2 -2
- package/dist/skills/frontend/references/design/design-system-architecture.md +1 -1
- package/dist/skills/frontend/references/design/print-paged-media.md +1 -1
- package/dist/skills/frontend/references/perfection/README.md +0 -1
- package/dist/skills/frontend/references/perfection/react-perf-tooling.md +27 -8
- package/dist/skills/frontend/scripts/perfection/lighthouse-audit.py +0 -1
- package/dist/skills/git-master/SKILL.md +12 -2
- package/dist/skills/init-deep/SKILL.md +1 -1
- package/dist/skills/lsp-setup/SKILL.md +24 -15
- package/dist/skills/lsp-setup/references/bash/README.md +3 -3
- package/dist/skills/lsp-setup/references/c-cpp/README.md +2 -2
- package/dist/skills/lsp-setup/references/csharp/README.md +2 -2
- package/dist/skills/lsp-setup/references/dart/README.md +2 -2
- package/dist/skills/lsp-setup/references/elixir/README.md +2 -2
- package/dist/skills/lsp-setup/references/go/README.md +2 -2
- package/dist/skills/lsp-setup/references/haskell/README.md +2 -2
- package/dist/skills/lsp-setup/references/java/README.md +3 -3
- package/dist/skills/lsp-setup/references/julia/README.md +3 -3
- package/dist/skills/lsp-setup/references/kotlin/README.md +4 -4
- package/dist/skills/lsp-setup/references/lua/README.md +2 -2
- package/dist/skills/lsp-setup/references/php/README.md +3 -3
- package/dist/skills/lsp-setup/references/python/README.md +13 -12
- package/dist/skills/lsp-setup/references/ruby/README.md +2 -2
- package/dist/skills/lsp-setup/references/rust/README.md +2 -2
- package/dist/skills/lsp-setup/references/swift/README.md +4 -4
- package/dist/skills/lsp-setup/references/terraform/README.md +2 -2
- package/dist/skills/lsp-setup/references/typescript/README.md +3 -3
- package/dist/skills/lsp-setup/references/yaml/README.md +2 -2
- package/dist/skills/lsp-setup/references/zig/README.md +2 -2
- package/dist/skills/lsp-setup/scripts/detect-lsp.ts +1 -1
- package/dist/skills/lsp-setup/scripts/lsp-server-table.ts +3 -2
- package/dist/skills/programming/SKILL.md +5 -5
- package/dist/skills/programming/references/code-smells.md +2 -2
- package/dist/skills/programming/references/go/README.md +3 -3
- package/dist/skills/programming/references/python/README.md +8 -8
- package/dist/skills/programming/references/python/data-processing.md +9 -9
- package/dist/skills/programming/references/rust-ub/README.md +3 -3
- package/dist/skills/programming/references/typescript/README.md +5 -5
- package/dist/skills/programming/scripts/typescript/new-project.ts +1 -1
- package/dist/skills/refactor/SKILL.md +35 -35
- package/dist/skills/remove-ai-slops/SKILL.md +6 -6
- package/dist/skills/review-work/SKILL.md +2 -2
- package/dist/skills/ultimate-browsing/SKILL.md +10 -7
- package/dist/skills/ultimate-browsing/engine/AGENTS.md +4 -4
- package/dist/skills/ultimate-browsing/references/agent-reach/README.md +2 -2
- package/dist/skills/ultimate-browsing/references/agent-reach/career.md +1 -1
- package/dist/skills/ultimate-browsing/references/agent-reach/social.md +1 -1
- package/dist/skills/ultimate-browsing/references/agent-reach/web.md +4 -4
- package/dist/skills/ultimate-browsing/references/chrome-stealth.md +2 -1
- package/dist/skills/ultimate-browsing/references/insane-search/README.md +16 -17
- package/dist/skills/ultimate-browsing/references/insane-search/fallback.md +10 -6
- package/dist/skills/ultimate-browsing/references/insane-search/jina.md +12 -12
- package/dist/skills/ultimate-browsing/references/insane-search/naver.md +3 -3
- package/dist/skills/ultimate-browsing/references/insane-search/playwright.md +1 -1
- package/dist/skills/ultimate-browsing/references/insane-search/rss.md +1 -1
- package/dist/skills/ultimate-browsing/references/insane-search/tls-impersonate.md +12 -7
- package/dist/skills/ulw-execute/SKILL.md +9 -6
- package/dist/skills/ulw-plan/references/full-workflow.md +1 -1
- package/dist/skills/ulw-plan/references/intent-unclear.md +2 -2
- package/dist/skills/ulw-research/SKILL.md +3 -3
- package/dist/skills/ulw-research/references/deliverable-phase.md +5 -5
- package/dist/skills/ulw-research/references/report-visualization.md +2 -2
- package/dist/skills/ulw-research/references/research-collection.md +2 -2
- package/dist/skills/ulw-research/references/unit-rules.md +2 -2
- package/dist/skills/visual-qa/AGENTS.md +1 -1
- package/dist/skills/visual-qa/SKILL.md +5 -5
- package/dist/skills/visual-qa/references/browser-setup.md +4 -2
- package/dist/tui.js +13 -13
- package/package.json +13 -13
- package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -1
- 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/comment-checker/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/comment-checker/package.json +1 -1
- package/packages/omo-codex/plugin/components/git-bash/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/git-bash/package.json +1 -1
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/package.json +1 -1
- package/packages/omo-codex/plugin/components/lsp/dist/.omo-runtime-manifest.json +2 -2
- 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/hooks/hooks.json +4 -4
- package/packages/omo-codex/plugin/components/rules/package.json +1 -1
- package/packages/omo-codex/plugin/components/teammode/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/teammode/package.json +1 -1
- package/packages/omo-codex/plugin/components/telemetry/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/telemetry/package.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/dist/cli.js +2 -0
- package/packages/omo-codex/plugin/components/ultrawork/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/package.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/references/full-workflow.md +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/references/intent-unclear.md +2 -2
- package/packages/omo-codex/plugin/components/ultrawork/src/directive-content.ts +1 -1
- package/packages/omo-codex/plugin/components/ulw-execute-continuation/directive.md +1 -1
- package/packages/omo-codex/plugin/components/ulw-execute-continuation/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-execute-continuation/package.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/directive.md +2 -0
- package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +5 -5
- package/packages/omo-codex/plugin/components/ulw-loop/package.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/SKILL.md +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/references/define-goal.md +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/references/full-workflow.md +10 -10
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-git-bash-mcp-reminder.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-lsp-diagnostics-cache.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-project-rule-cache.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-comments.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-lsp-diagnostics.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-thread-title-hygiene.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-matching-project-rules.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-recording-spawn-admission.json +1 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-enforcing-unlimited-goal-budget.json +1 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-guarding-ulw-loop-spawns.json +1 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-recommending-git-bash-mcp.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-checking-auto-update.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-checking-bootstrap-provisioning.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-loading-project-rules.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-recording-session-telemetry.json +1 -1
- package/packages/omo-codex/plugin/hooks/stop-checking-ulw-execute-continuation.json +1 -1
- package/packages/omo-codex/plugin/hooks/stop-checking-ulw-loop-resume.json +1 -1
- package/packages/omo-codex/plugin/hooks/subagent-stop-verifying-lazycodex-executor-evidence.json +1 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ultrawork-trigger.json +1 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ulw-loop-steering.json +1 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-loading-project-rules.json +1 -1
- package/packages/omo-codex/plugin/package-lock.json +12 -12
- package/packages/omo-codex/plugin/package.json +1 -1
- package/packages/omo-codex/plugin/scripts/sync-skills.mjs +6 -3
- package/packages/omo-codex/plugin/skills/ast-grep/AGENTS.md +2 -2
- package/packages/omo-codex/plugin/skills/ast-grep/README.md +4 -4
- package/packages/omo-codex/plugin/skills/ast-grep/SKILL.md +10 -8
- package/packages/omo-codex/plugin/skills/ast-grep/references/cli.md +4 -3
- package/packages/omo-codex/plugin/skills/ast-grep/references/patterns.md +5 -5
- package/packages/omo-codex/plugin/skills/ast-grep/references/pitfalls.md +3 -3
- package/packages/omo-codex/plugin/skills/ast-grep/references/recipes.md +6 -4
- package/packages/omo-codex/plugin/skills/ast-grep/references/yaml-rules.md +3 -3
- package/packages/omo-codex/plugin/skills/ast-grep/scripts/ast_grep_helper.py +3 -3
- package/packages/omo-codex/plugin/skills/browser/SKILL.md +2 -3
- package/packages/omo-codex/plugin/skills/browser/runtime/omowright/manifest.json +1 -1
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/AGENTS.md +1 -1
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/SKILL.md +2 -1
- package/packages/omo-codex/plugin/skills/data-scientist/SKILL.md +8 -6
- package/packages/omo-codex/plugin/skills/data-scientist/references/placement.md +9 -5
- package/packages/omo-codex/plugin/skills/data-scientist/references/uv-setup.md +3 -3
- package/packages/omo-codex/plugin/skills/data-scientist/references/visualization.md +19 -4
- package/packages/omo-codex/plugin/skills/debugging/SKILL.md +5 -5
- package/packages/omo-codex/plugin/skills/debugging/references/methodology/02-investigate.md +2 -2
- package/packages/omo-codex/plugin/skills/debugging/references/methodology/06-fix.md +2 -0
- package/packages/omo-codex/plugin/skills/debugging/references/methodology/09-cleanup.md +2 -2
- package/packages/omo-codex/plugin/skills/debugging/references/methodology/partial-runtime-evidence.md +1 -1
- package/packages/omo-codex/plugin/skills/debugging/references/runtimes/bundled-js-binary.md +1 -1
- package/packages/omo-codex/plugin/skills/debugging/references/runtimes/native-binary.md +1 -1
- package/packages/omo-codex/plugin/skills/debugging/references/tools/browser-qa.md +1 -2
- package/packages/omo-codex/plugin/skills/frontend/SKILL.md +2 -2
- package/packages/omo-codex/plugin/skills/frontend/references/design/design-system-architecture.md +1 -1
- package/packages/omo-codex/plugin/skills/frontend/references/design/print-paged-media.md +1 -1
- package/packages/omo-codex/plugin/skills/frontend/references/perfection/README.md +0 -1
- package/packages/omo-codex/plugin/skills/frontend/references/perfection/react-perf-tooling.md +27 -8
- package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/lighthouse-audit.py +0 -1
- package/packages/omo-codex/plugin/skills/git-master/SKILL.md +12 -2
- package/packages/omo-codex/plugin/skills/init-deep/SKILL.md +1 -1
- package/packages/omo-codex/plugin/skills/lsp-setup/SKILL.md +24 -15
- package/packages/omo-codex/plugin/skills/lsp-setup/references/bash/README.md +3 -3
- package/packages/omo-codex/plugin/skills/lsp-setup/references/c-cpp/README.md +2 -2
- package/packages/omo-codex/plugin/skills/lsp-setup/references/csharp/README.md +2 -2
- package/packages/omo-codex/plugin/skills/lsp-setup/references/dart/README.md +2 -2
- package/packages/omo-codex/plugin/skills/lsp-setup/references/elixir/README.md +2 -2
- package/packages/omo-codex/plugin/skills/lsp-setup/references/go/README.md +2 -2
- package/packages/omo-codex/plugin/skills/lsp-setup/references/haskell/README.md +2 -2
- package/packages/omo-codex/plugin/skills/lsp-setup/references/java/README.md +3 -3
- package/packages/omo-codex/plugin/skills/lsp-setup/references/julia/README.md +3 -3
- package/packages/omo-codex/plugin/skills/lsp-setup/references/kotlin/README.md +4 -4
- package/packages/omo-codex/plugin/skills/lsp-setup/references/lua/README.md +2 -2
- package/packages/omo-codex/plugin/skills/lsp-setup/references/php/README.md +3 -3
- package/packages/omo-codex/plugin/skills/lsp-setup/references/python/README.md +13 -12
- package/packages/omo-codex/plugin/skills/lsp-setup/references/ruby/README.md +2 -2
- package/packages/omo-codex/plugin/skills/lsp-setup/references/rust/README.md +2 -2
- package/packages/omo-codex/plugin/skills/lsp-setup/references/swift/README.md +4 -4
- package/packages/omo-codex/plugin/skills/lsp-setup/references/terraform/README.md +2 -2
- package/packages/omo-codex/plugin/skills/lsp-setup/references/typescript/README.md +3 -3
- package/packages/omo-codex/plugin/skills/lsp-setup/references/yaml/README.md +2 -2
- package/packages/omo-codex/plugin/skills/lsp-setup/references/zig/README.md +2 -2
- package/packages/omo-codex/plugin/skills/lsp-setup/scripts/detect-lsp.ts +1 -1
- package/packages/omo-codex/plugin/skills/lsp-setup/scripts/lsp-server-table.ts +3 -2
- package/packages/omo-codex/plugin/skills/programming/SKILL.md +5 -5
- package/packages/omo-codex/plugin/skills/programming/references/code-smells.md +2 -2
- package/packages/omo-codex/plugin/skills/programming/references/go/README.md +3 -3
- package/packages/omo-codex/plugin/skills/programming/references/python/README.md +8 -8
- package/packages/omo-codex/plugin/skills/programming/references/python/data-processing.md +9 -9
- package/packages/omo-codex/plugin/skills/programming/references/rust-ub/README.md +3 -3
- package/packages/omo-codex/plugin/skills/programming/references/typescript/README.md +5 -5
- package/packages/omo-codex/plugin/skills/programming/scripts/typescript/new-project.ts +1 -1
- package/packages/omo-codex/plugin/skills/refactor/SKILL.md +35 -35
- package/packages/omo-codex/plugin/skills/remove-ai-slops/SKILL.md +6 -6
- package/packages/omo-codex/plugin/skills/review-work/SKILL.md +2 -2
- package/packages/omo-codex/plugin/skills/ultimate-browsing/SKILL.md +10 -7
- package/packages/omo-codex/plugin/skills/ultimate-browsing/engine/AGENTS.md +4 -4
- package/packages/omo-codex/plugin/skills/ultimate-browsing/references/agent-reach/README.md +2 -2
- package/packages/omo-codex/plugin/skills/ultimate-browsing/references/agent-reach/career.md +1 -1
- package/packages/omo-codex/plugin/skills/ultimate-browsing/references/agent-reach/social.md +1 -1
- package/packages/omo-codex/plugin/skills/ultimate-browsing/references/agent-reach/web.md +4 -4
- package/packages/omo-codex/plugin/skills/ultimate-browsing/references/chrome-stealth.md +2 -1
- package/packages/omo-codex/plugin/skills/ultimate-browsing/references/insane-search/README.md +16 -17
- package/packages/omo-codex/plugin/skills/ultimate-browsing/references/insane-search/fallback.md +10 -6
- package/packages/omo-codex/plugin/skills/ultimate-browsing/references/insane-search/jina.md +12 -12
- package/packages/omo-codex/plugin/skills/ultimate-browsing/references/insane-search/naver.md +3 -3
- package/packages/omo-codex/plugin/skills/ultimate-browsing/references/insane-search/playwright.md +1 -1
- package/packages/omo-codex/plugin/skills/ultimate-browsing/references/insane-search/rss.md +1 -1
- package/packages/omo-codex/plugin/skills/ultimate-browsing/references/insane-search/tls-impersonate.md +12 -7
- package/packages/omo-codex/plugin/skills/ultrawork/SKILL.md +2 -0
- package/packages/omo-codex/plugin/skills/ulw-execute/SKILL.md +9 -6
- package/packages/omo-codex/plugin/skills/ulw-loop/SKILL.md +1 -1
- package/packages/omo-codex/plugin/skills/ulw-loop/references/define-goal.md +1 -1
- package/packages/omo-codex/plugin/skills/ulw-loop/references/full-workflow.md +10 -10
- package/packages/omo-codex/plugin/skills/ulw-plan/references/full-workflow.md +1 -1
- package/packages/omo-codex/plugin/skills/ulw-plan/references/intent-unclear.md +2 -2
- package/packages/omo-codex/plugin/skills/ulw-research/SKILL.md +2 -2
- package/packages/omo-codex/plugin/skills/ulw-research/references/deliverable-phase.md +5 -5
- package/packages/omo-codex/plugin/skills/ulw-research/references/report-visualization.md +2 -2
- package/packages/omo-codex/plugin/skills/ulw-research/references/research-collection.md +2 -2
- package/packages/omo-codex/plugin/skills/ulw-research/references/unit-rules.md +2 -2
- package/packages/omo-codex/plugin/skills/visual-qa/AGENTS.md +1 -1
- package/packages/omo-codex/plugin/skills/visual-qa/SKILL.md +5 -5
- package/packages/omo-codex/plugin/skills/visual-qa/references/browser-setup.md +4 -2
- package/packages/omo-codex/plugin/test/sync-skills-codex-compatibility.test.mjs +2 -0
- package/packages/omo-codex/plugin/test/sync-skills-test-support.mjs +7 -3
- package/packages/omo-codex/scripts/install-dist/install-local.mjs +2 -2
- package/packages/prompts-core/prompts/ultrawork/codex.md +2 -0
- package/packages/shared-skills/skills/ast-grep/AGENTS.md +2 -2
- package/packages/shared-skills/skills/ast-grep/README.md +4 -4
- package/packages/shared-skills/skills/ast-grep/SKILL.md +10 -8
- package/packages/shared-skills/skills/ast-grep/references/cli.md +4 -3
- package/packages/shared-skills/skills/ast-grep/references/patterns.md +5 -5
- package/packages/shared-skills/skills/ast-grep/references/pitfalls.md +3 -3
- package/packages/shared-skills/skills/ast-grep/references/recipes.md +6 -4
- package/packages/shared-skills/skills/ast-grep/references/yaml-rules.md +3 -3
- package/packages/shared-skills/skills/ast-grep/scripts/ast_grep_helper.py +3 -3
- package/packages/shared-skills/skills/browser/SKILL.md +2 -3
- package/packages/shared-skills/skills/browser/runtime/omowright/manifest.json +1 -1
- package/packages/shared-skills/skills/coding-agent-sessions/AGENTS.md +1 -1
- package/packages/shared-skills/skills/coding-agent-sessions/SKILL.md +2 -1
- package/packages/shared-skills/skills/data-scientist/SKILL.md +8 -6
- package/packages/shared-skills/skills/data-scientist/references/placement.md +9 -5
- package/packages/shared-skills/skills/data-scientist/references/uv-setup.md +3 -3
- package/packages/shared-skills/skills/data-scientist/references/visualization.md +19 -4
- package/packages/shared-skills/skills/debugging/SKILL.md +5 -5
- package/packages/shared-skills/skills/debugging/references/methodology/02-investigate.md +2 -2
- package/packages/shared-skills/skills/debugging/references/methodology/06-fix.md +2 -0
- package/packages/shared-skills/skills/debugging/references/methodology/09-cleanup.md +2 -2
- package/packages/shared-skills/skills/debugging/references/methodology/partial-runtime-evidence.md +1 -1
- package/packages/shared-skills/skills/debugging/references/runtimes/bundled-js-binary.md +1 -1
- package/packages/shared-skills/skills/debugging/references/runtimes/native-binary.md +1 -1
- package/packages/shared-skills/skills/debugging/references/tools/browser-qa.md +1 -2
- package/packages/shared-skills/skills/frontend/SKILL.md +2 -2
- package/packages/shared-skills/skills/frontend/references/design/design-system-architecture.md +1 -1
- package/packages/shared-skills/skills/frontend/references/design/print-paged-media.md +1 -1
- package/packages/shared-skills/skills/frontend/references/perfection/README.md +0 -1
- package/packages/shared-skills/skills/frontend/references/perfection/react-perf-tooling.md +27 -8
- package/packages/shared-skills/skills/frontend/scripts/perfection/lighthouse-audit.py +0 -1
- package/packages/shared-skills/skills/git-master/SKILL.md +12 -2
- package/packages/shared-skills/skills/init-deep/SKILL.md +1 -1
- package/packages/shared-skills/skills/lsp-setup/SKILL.md +24 -15
- package/packages/shared-skills/skills/lsp-setup/references/bash/README.md +3 -3
- package/packages/shared-skills/skills/lsp-setup/references/c-cpp/README.md +2 -2
- package/packages/shared-skills/skills/lsp-setup/references/csharp/README.md +2 -2
- package/packages/shared-skills/skills/lsp-setup/references/dart/README.md +2 -2
- package/packages/shared-skills/skills/lsp-setup/references/elixir/README.md +2 -2
- package/packages/shared-skills/skills/lsp-setup/references/go/README.md +2 -2
- package/packages/shared-skills/skills/lsp-setup/references/haskell/README.md +2 -2
- package/packages/shared-skills/skills/lsp-setup/references/java/README.md +3 -3
- package/packages/shared-skills/skills/lsp-setup/references/julia/README.md +3 -3
- package/packages/shared-skills/skills/lsp-setup/references/kotlin/README.md +4 -4
- package/packages/shared-skills/skills/lsp-setup/references/lua/README.md +2 -2
- package/packages/shared-skills/skills/lsp-setup/references/php/README.md +3 -3
- package/packages/shared-skills/skills/lsp-setup/references/python/README.md +13 -12
- package/packages/shared-skills/skills/lsp-setup/references/ruby/README.md +2 -2
- package/packages/shared-skills/skills/lsp-setup/references/rust/README.md +2 -2
- package/packages/shared-skills/skills/lsp-setup/references/swift/README.md +4 -4
- package/packages/shared-skills/skills/lsp-setup/references/terraform/README.md +2 -2
- package/packages/shared-skills/skills/lsp-setup/references/typescript/README.md +3 -3
- package/packages/shared-skills/skills/lsp-setup/references/yaml/README.md +2 -2
- package/packages/shared-skills/skills/lsp-setup/references/zig/README.md +2 -2
- package/packages/shared-skills/skills/lsp-setup/scripts/detect-lsp.ts +1 -1
- package/packages/shared-skills/skills/lsp-setup/scripts/lsp-server-table.ts +3 -2
- package/packages/shared-skills/skills/programming/SKILL.md +5 -5
- package/packages/shared-skills/skills/programming/references/code-smells.md +2 -2
- package/packages/shared-skills/skills/programming/references/go/README.md +3 -3
- package/packages/shared-skills/skills/programming/references/python/README.md +8 -8
- package/packages/shared-skills/skills/programming/references/python/data-processing.md +9 -9
- package/packages/shared-skills/skills/programming/references/rust-ub/README.md +3 -3
- package/packages/shared-skills/skills/programming/references/typescript/README.md +5 -5
- package/packages/shared-skills/skills/programming/scripts/typescript/new-project.ts +1 -1
- package/packages/shared-skills/skills/refactor/SKILL.md +35 -35
- package/packages/shared-skills/skills/remove-ai-slops/SKILL.md +6 -6
- package/packages/shared-skills/skills/review-work/SKILL.md +2 -2
- package/packages/shared-skills/skills/ultimate-browsing/SKILL.md +10 -7
- package/packages/shared-skills/skills/ultimate-browsing/engine/AGENTS.md +4 -4
- package/packages/shared-skills/skills/ultimate-browsing/references/agent-reach/README.md +2 -2
- package/packages/shared-skills/skills/ultimate-browsing/references/agent-reach/career.md +1 -1
- package/packages/shared-skills/skills/ultimate-browsing/references/agent-reach/social.md +1 -1
- package/packages/shared-skills/skills/ultimate-browsing/references/agent-reach/web.md +4 -4
- package/packages/shared-skills/skills/ultimate-browsing/references/chrome-stealth.md +2 -1
- package/packages/shared-skills/skills/ultimate-browsing/references/insane-search/README.md +16 -17
- package/packages/shared-skills/skills/ultimate-browsing/references/insane-search/fallback.md +10 -6
- package/packages/shared-skills/skills/ultimate-browsing/references/insane-search/jina.md +12 -12
- package/packages/shared-skills/skills/ultimate-browsing/references/insane-search/naver.md +3 -3
- package/packages/shared-skills/skills/ultimate-browsing/references/insane-search/playwright.md +1 -1
- package/packages/shared-skills/skills/ultimate-browsing/references/insane-search/rss.md +1 -1
- package/packages/shared-skills/skills/ultimate-browsing/references/insane-search/tls-impersonate.md +12 -7
- package/packages/shared-skills/skills/ulw-execute/SKILL.md +9 -6
- package/packages/shared-skills/skills/ulw-plan/references/full-workflow.md +1 -1
- package/packages/shared-skills/skills/ulw-plan/references/intent-unclear.md +2 -2
- package/packages/shared-skills/skills/ulw-research/SKILL.md +3 -3
- package/packages/shared-skills/skills/ulw-research/references/deliverable-phase.md +5 -5
- package/packages/shared-skills/skills/ulw-research/references/report-visualization.md +2 -2
- package/packages/shared-skills/skills/ulw-research/references/research-collection.md +2 -2
- package/packages/shared-skills/skills/ulw-research/references/unit-rules.md +2 -2
- package/packages/shared-skills/skills/visual-qa/AGENTS.md +1 -1
- package/packages/shared-skills/skills/visual-qa/SKILL.md +5 -5
- package/packages/shared-skills/skills/visual-qa/references/browser-setup.md +4 -2
package/dist/index.js
CHANGED
|
@@ -12731,14 +12731,17 @@ import { randomUUID as randomUUID8 } from "crypto";
|
|
|
12731
12731
|
import { readFile as readFile4, stat as stat5 } from "fs/promises";
|
|
12732
12732
|
async function buildLockRecord(ownerTag) {
|
|
12733
12733
|
await registerLockWorker();
|
|
12734
|
-
const processStart = await
|
|
12734
|
+
const processStart = await lockProcessStartLine(process.pid);
|
|
12735
12735
|
return `${ownerTag} ${randomUUID8()}
|
|
12736
12736
|
${process.pid}
|
|
12737
12737
|
${Date.now()}
|
|
12738
12738
|
${lockOwnerInstanceId}
|
|
12739
|
-
${processStart
|
|
12739
|
+
${processStart}
|
|
12740
12740
|
`;
|
|
12741
12741
|
}
|
|
12742
|
+
async function lockProcessStartLine(pid) {
|
|
12743
|
+
return await getProcessStartIdentity(pid) ?? "unavailable";
|
|
12744
|
+
}
|
|
12742
12745
|
function errorCode2(error) {
|
|
12743
12746
|
if (!(error instanceof Error) || !("code" in error))
|
|
12744
12747
|
return null;
|
|
@@ -12886,6 +12889,19 @@ async function unlinkWithRetry(path, deps) {
|
|
|
12886
12889
|
}
|
|
12887
12890
|
}
|
|
12888
12891
|
async function removeLockRecordIfUnchanged(lockPath, expectedRecord, staleAfterMs, deps = {}) {
|
|
12892
|
+
return withRecordGuard(lockPath, expectedRecord, staleAfterMs, deps, async () => {
|
|
12893
|
+
const current = await readLockRecord(lockPath);
|
|
12894
|
+
if (current === null)
|
|
12895
|
+
return "absent";
|
|
12896
|
+
if (current.content !== expectedRecord || !await isLockRecordStale(current, staleAfterMs))
|
|
12897
|
+
return "changed";
|
|
12898
|
+
const unlinked = await unlinkWithRetry(lockPath, deps);
|
|
12899
|
+
if (unlinked !== "stuck")
|
|
12900
|
+
forgetLockRecord(expectedRecord);
|
|
12901
|
+
return unlinked === "absent" ? "absent" : unlinked;
|
|
12902
|
+
});
|
|
12903
|
+
}
|
|
12904
|
+
async function withRecordGuard(lockPath, expectedRecord, staleAfterMs, deps, act) {
|
|
12889
12905
|
const guardPath = reclaimGuardPath(lockPath, expectedRecord);
|
|
12890
12906
|
const guardRecord = await buildLockRecord("lock-reclaim");
|
|
12891
12907
|
if (!await publishLockRecord(guardPath, guardRecord)) {
|
|
@@ -12896,15 +12912,7 @@ async function removeLockRecordIfUnchanged(lockPath, expectedRecord, staleAfterM
|
|
|
12896
12912
|
return "busy";
|
|
12897
12913
|
}
|
|
12898
12914
|
try {
|
|
12899
|
-
|
|
12900
|
-
if (current === null)
|
|
12901
|
-
return "absent";
|
|
12902
|
-
if (current.content !== expectedRecord || !await isLockRecordStale(current, staleAfterMs))
|
|
12903
|
-
return "changed";
|
|
12904
|
-
const unlinked = await unlinkWithRetry(lockPath, deps);
|
|
12905
|
-
if (unlinked !== "stuck")
|
|
12906
|
-
forgetLockRecord(expectedRecord);
|
|
12907
|
-
return unlinked === "absent" ? "absent" : unlinked;
|
|
12915
|
+
return await act();
|
|
12908
12916
|
} finally {
|
|
12909
12917
|
markLockRecordReleased(guardRecord);
|
|
12910
12918
|
if (await unlinkWithRetry(guardPath, deps) !== "stuck")
|
|
@@ -12917,9 +12925,103 @@ var init_lock_reclaim = __esm(() => {
|
|
|
12917
12925
|
init_lock_record();
|
|
12918
12926
|
});
|
|
12919
12927
|
|
|
12920
|
-
// packages/team-core/src/team-state-store/
|
|
12928
|
+
// packages/team-core/src/team-state-store/lock-lease.ts
|
|
12921
12929
|
import { randomUUID as randomUUID9 } from "crypto";
|
|
12922
|
-
import { open as open3, rename as rename3, rm as rm3 } from "fs/promises";
|
|
12930
|
+
import { open as open3, readdir as readdir4, readFile as readFile5, rename as rename3, rm as rm3 } from "fs/promises";
|
|
12931
|
+
import { basename as basename17, dirname as dirname36, join as join98 } from "path";
|
|
12932
|
+
async function replaceRecord(lockPath, content) {
|
|
12933
|
+
const temporary = join98(dirname36(lockPath), `${leaseTempPrefix(lockPath)}${randomUUID9()}${LEASE_TEMP_SUFFIX}`);
|
|
12934
|
+
try {
|
|
12935
|
+
const handle = await open3(temporary, "wx", 384);
|
|
12936
|
+
try {
|
|
12937
|
+
await handle.writeFile(content);
|
|
12938
|
+
} finally {
|
|
12939
|
+
await handle.close();
|
|
12940
|
+
}
|
|
12941
|
+
await rename3(temporary, lockPath);
|
|
12942
|
+
} catch (error) {
|
|
12943
|
+
await rm3(temporary, { force: true });
|
|
12944
|
+
throw error;
|
|
12945
|
+
}
|
|
12946
|
+
}
|
|
12947
|
+
async function removeLeftoverTemps(lockPath) {
|
|
12948
|
+
const pattern = leaseTempPattern(lockPath);
|
|
12949
|
+
let entries;
|
|
12950
|
+
try {
|
|
12951
|
+
entries = await readdir4(dirname36(lockPath));
|
|
12952
|
+
} catch (error) {
|
|
12953
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT")
|
|
12954
|
+
return;
|
|
12955
|
+
throw error;
|
|
12956
|
+
}
|
|
12957
|
+
for (const entry of entries) {
|
|
12958
|
+
if (pattern.test(entry))
|
|
12959
|
+
await rm3(join98(dirname36(lockPath), entry), { force: true });
|
|
12960
|
+
}
|
|
12961
|
+
}
|
|
12962
|
+
async function currentRecord(lockPath) {
|
|
12963
|
+
try {
|
|
12964
|
+
return await readFile5(lockPath, "utf8");
|
|
12965
|
+
} catch (error) {
|
|
12966
|
+
if (error instanceof Error && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR"))
|
|
12967
|
+
return null;
|
|
12968
|
+
throw error;
|
|
12969
|
+
}
|
|
12970
|
+
}
|
|
12971
|
+
function createLockLease(lockPath, ownerRecord, ownerTag, options = {}) {
|
|
12972
|
+
const staleAfterMs = options.staleAfterMs ?? Number.POSITIVE_INFINITY;
|
|
12973
|
+
let handedTo = null;
|
|
12974
|
+
return {
|
|
12975
|
+
async handOver(pid) {
|
|
12976
|
+
if (handedTo !== null)
|
|
12977
|
+
throw new Error("The lock is already handed over; restore it first.");
|
|
12978
|
+
if (!Number.isInteger(pid) || pid <= 0 || pid === process.pid)
|
|
12979
|
+
throw new Error(`Cannot hand the lock to pid ${pid}.`);
|
|
12980
|
+
if (await currentRecord(lockPath) !== ownerRecord)
|
|
12981
|
+
throw new LockLeaseLostError(lockPath);
|
|
12982
|
+
await removeLeftoverTemps(lockPath);
|
|
12983
|
+
const processStart = await lockProcessStartLine(pid);
|
|
12984
|
+
const record = `${ownerTag} ${randomUUID9()}
|
|
12985
|
+
${pid}
|
|
12986
|
+
${Date.now()}
|
|
12987
|
+
${randomUUID9()}
|
|
12988
|
+
${processStart}
|
|
12989
|
+
`;
|
|
12990
|
+
await replaceRecord(lockPath, record);
|
|
12991
|
+
handedTo = record;
|
|
12992
|
+
},
|
|
12993
|
+
async restore() {
|
|
12994
|
+
if (handedTo === null)
|
|
12995
|
+
throw new Error("The lock is not handed over.");
|
|
12996
|
+
const expected = handedTo;
|
|
12997
|
+
handedTo = null;
|
|
12998
|
+
const outcome = await withRecordGuard(lockPath, expected, staleAfterMs, {}, async () => {
|
|
12999
|
+
if (await currentRecord(lockPath) !== expected)
|
|
13000
|
+
return "lost";
|
|
13001
|
+
await options.beforeRestoreRename?.();
|
|
13002
|
+
await replaceRecord(lockPath, ownerRecord);
|
|
13003
|
+
return "restored";
|
|
13004
|
+
});
|
|
13005
|
+
if (outcome !== "restored")
|
|
13006
|
+
throw new LockLeaseLostError(lockPath);
|
|
13007
|
+
}
|
|
13008
|
+
};
|
|
13009
|
+
}
|
|
13010
|
+
var LockLeaseLostError, leaseTempPrefix = (lockPath) => `.${basename17(lockPath)}.`, LEASE_TEMP_SUFFIX = ".lease", UUID = "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", escapeRegExp = (text) => text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), leaseTempPattern = (lockPath) => new RegExp(`^\\.${escapeRegExp(basename17(lockPath))}\\.${UUID}\\.lease$`);
|
|
13011
|
+
var init_lock_lease = __esm(() => {
|
|
13012
|
+
init_lock_record();
|
|
13013
|
+
init_lock_reclaim();
|
|
13014
|
+
LockLeaseLostError = class LockLeaseLostError extends Error {
|
|
13015
|
+
constructor(lockPath) {
|
|
13016
|
+
super(`The lock at ${lockPath} changed while it was handed over; the critical section was aborted.`);
|
|
13017
|
+
this.name = "LockLeaseLostError";
|
|
13018
|
+
}
|
|
13019
|
+
};
|
|
13020
|
+
});
|
|
13021
|
+
|
|
13022
|
+
// packages/team-core/src/team-state-store/locks.ts
|
|
13023
|
+
import { randomUUID as randomUUID10 } from "crypto";
|
|
13024
|
+
import { open as open4, rename as rename4, rm as rm4 } from "fs/promises";
|
|
12923
13025
|
function delay4(ms) {
|
|
12924
13026
|
return new Promise((resolve) => {
|
|
12925
13027
|
setTimeout(resolve, ms);
|
|
@@ -12945,7 +13047,7 @@ async function withLock(lockPath, fn, opts) {
|
|
|
12945
13047
|
const ownerTag = opts?.ownerTag ?? "owner";
|
|
12946
13048
|
const record = await acquireLock(lockPath, ownerTag, staleAfterMs);
|
|
12947
13049
|
try {
|
|
12948
|
-
return await fn();
|
|
13050
|
+
return await fn(createLockLease(lockPath, record, ownerTag, { staleAfterMs }));
|
|
12949
13051
|
} finally {
|
|
12950
13052
|
markLockRecordReleased(record);
|
|
12951
13053
|
const outcome = await removeLockRecordIfUnchanged(lockPath, record, staleAfterMs);
|
|
@@ -12966,10 +13068,10 @@ async function reapStaleLock(lockPath, staleAfterMs = DEFAULT_STALE_AFTER_MS, de
|
|
|
12966
13068
|
return await removeLockRecordIfUnchanged(lockPath, observed.content, staleAfterMs, deps);
|
|
12967
13069
|
}
|
|
12968
13070
|
async function atomicWrite(filePath, content, deps = {}) {
|
|
12969
|
-
const tmpPath = `${filePath}.tmp.${
|
|
12970
|
-
const openFile = deps.open ??
|
|
12971
|
-
const renameFile = deps.rename ??
|
|
12972
|
-
const removeFile = deps.rm ??
|
|
13071
|
+
const tmpPath = `${filePath}.tmp.${randomUUID10()}`;
|
|
13072
|
+
const openFile = deps.open ?? open4;
|
|
13073
|
+
const renameFile = deps.rename ?? rename4;
|
|
13074
|
+
const removeFile = deps.rm ?? rm4;
|
|
12973
13075
|
try {
|
|
12974
13076
|
const fileHandle = await openFile(tmpPath, "wx");
|
|
12975
13077
|
try {
|
|
@@ -12987,21 +13089,22 @@ async function atomicWrite(filePath, content, deps = {}) {
|
|
|
12987
13089
|
var LOCK_RETRY_MS = 50, LOCK_WAIT_TIMEOUT_MS = 15000, DEFAULT_STALE_AFTER_MS = 300000;
|
|
12988
13090
|
var init_locks = __esm(() => {
|
|
12989
13091
|
init_tolerant_fsync();
|
|
13092
|
+
init_lock_lease();
|
|
12990
13093
|
init_lock_publish();
|
|
12991
13094
|
init_lock_reclaim();
|
|
12992
13095
|
init_lock_record();
|
|
12993
13096
|
});
|
|
12994
13097
|
|
|
12995
13098
|
// packages/team-core/src/team-state-store/store.ts
|
|
12996
|
-
import { randomUUID as
|
|
12997
|
-
import { mkdir as mkdir4, readFile as
|
|
13099
|
+
import { randomUUID as randomUUID11 } from "crypto";
|
|
13100
|
+
import { mkdir as mkdir4, readFile as readFile6, readdir as readdir5, rm as rm5, stat as stat6 } from "fs/promises";
|
|
12998
13101
|
import path16 from "path";
|
|
12999
13102
|
function getStatePath(baseDir, teamRunId) {
|
|
13000
13103
|
return path16.join(getRuntimeStateDir(baseDir, teamRunId), STATE_FILE_NAME);
|
|
13001
13104
|
}
|
|
13002
13105
|
async function removeRuntimeDirectoryBestEffort(baseDir, teamRunId, reason) {
|
|
13003
13106
|
try {
|
|
13004
|
-
await
|
|
13107
|
+
await rm5(getRuntimeStateDir(baseDir, teamRunId), { recursive: true, force: true });
|
|
13005
13108
|
} catch (error) {
|
|
13006
13109
|
log6("team runtime cleanup failed", {
|
|
13007
13110
|
event: "team-runtime-cleanup-failed",
|
|
@@ -13063,7 +13166,7 @@ function isValidTransition(fromStatus, toStatus) {
|
|
|
13063
13166
|
}
|
|
13064
13167
|
async function createRuntimeState(spec, leadSessionId, specSource, config) {
|
|
13065
13168
|
const baseDir = resolveBaseDir(config);
|
|
13066
|
-
const teamRunId =
|
|
13169
|
+
const teamRunId = randomUUID11();
|
|
13067
13170
|
const runtimeDirectoryPath = getRuntimeStateDir(baseDir, teamRunId);
|
|
13068
13171
|
const runtimeState = validateRuntimeState({
|
|
13069
13172
|
version: 1,
|
|
@@ -13097,7 +13200,7 @@ async function createRuntimeState(spec, leadSessionId, specSource, config) {
|
|
|
13097
13200
|
}
|
|
13098
13201
|
async function loadRuntimeState(teamRunId, config) {
|
|
13099
13202
|
const baseDir = resolveBaseDir(config);
|
|
13100
|
-
const stateContent = await
|
|
13203
|
+
const stateContent = await readFile6(getStatePath(baseDir, teamRunId), "utf8");
|
|
13101
13204
|
try {
|
|
13102
13205
|
return validateRuntimeState(JSON.parse(stateContent), teamRunId);
|
|
13103
13206
|
} catch (error) {
|
|
@@ -13127,7 +13230,7 @@ async function listActiveTeams(config) {
|
|
|
13127
13230
|
const baseDir = resolveBaseDir(config);
|
|
13128
13231
|
const now = Date.now();
|
|
13129
13232
|
try {
|
|
13130
|
-
const runtimeEntries = await
|
|
13233
|
+
const runtimeEntries = await readdir5(path16.join(baseDir, "runtime"), { withFileTypes: true });
|
|
13131
13234
|
const activeTeams = [];
|
|
13132
13235
|
for (const runtimeEntry of runtimeEntries) {
|
|
13133
13236
|
if (!runtimeEntry.isDirectory())
|
|
@@ -21881,12 +21984,12 @@ var init_paths2 = __esm(() => {
|
|
|
21881
21984
|
});
|
|
21882
21985
|
|
|
21883
21986
|
// packages/omo-opencode/src/features/team-mode/team-runtime/shutdown-helpers.ts
|
|
21884
|
-
import { randomUUID as
|
|
21885
|
-
import { rm as
|
|
21987
|
+
import { randomUUID as randomUUID16 } from "crypto";
|
|
21988
|
+
import { rm as rm7 } from "fs/promises";
|
|
21886
21989
|
function createShutdownMessage(from, to, kind, body) {
|
|
21887
21990
|
return {
|
|
21888
21991
|
version: 1,
|
|
21889
|
-
messageId:
|
|
21992
|
+
messageId: randomUUID16(),
|
|
21890
21993
|
from,
|
|
21891
21994
|
to,
|
|
21892
21995
|
kind,
|
|
@@ -21931,7 +22034,7 @@ async function removeWorktrees(memberPaths) {
|
|
|
21931
22034
|
for (const memberPath of new Set(memberPaths)) {
|
|
21932
22035
|
if (!memberPath)
|
|
21933
22036
|
continue;
|
|
21934
|
-
await
|
|
22037
|
+
await rm7(memberPath, { recursive: true, force: true });
|
|
21935
22038
|
removedWorktrees.push(memberPath);
|
|
21936
22039
|
}
|
|
21937
22040
|
return removedWorktrees;
|
|
@@ -97820,7 +97923,7 @@ init_src();
|
|
|
97820
97923
|
// package.json
|
|
97821
97924
|
var package_default = {
|
|
97822
97925
|
name: "oh-my-opencode",
|
|
97823
|
-
version: "5.1.
|
|
97926
|
+
version: "5.1.64",
|
|
97824
97927
|
description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
|
|
97825
97928
|
main: "./dist/index.js",
|
|
97826
97929
|
types: "dist/index.d.ts",
|
|
@@ -98072,18 +98175,18 @@ var package_default = {
|
|
|
98072
98175
|
typescript: "^7.0.2"
|
|
98073
98176
|
},
|
|
98074
98177
|
optionalDependencies: {
|
|
98075
|
-
"oh-my-opencode-darwin-arm64": "5.1.
|
|
98076
|
-
"oh-my-opencode-darwin-x64": "5.1.
|
|
98077
|
-
"oh-my-opencode-darwin-x64-baseline": "5.1.
|
|
98078
|
-
"oh-my-opencode-linux-arm64": "5.1.
|
|
98079
|
-
"oh-my-opencode-linux-arm64-musl": "5.1.
|
|
98080
|
-
"oh-my-opencode-linux-x64": "5.1.
|
|
98081
|
-
"oh-my-opencode-linux-x64-baseline": "5.1.
|
|
98082
|
-
"oh-my-opencode-linux-x64-musl": "5.1.
|
|
98083
|
-
"oh-my-opencode-linux-x64-musl-baseline": "5.1.
|
|
98084
|
-
"oh-my-opencode-windows-arm64": "5.1.
|
|
98085
|
-
"oh-my-opencode-windows-x64": "5.1.
|
|
98086
|
-
"oh-my-opencode-windows-x64-baseline": "5.1.
|
|
98178
|
+
"oh-my-opencode-darwin-arm64": "5.1.64",
|
|
98179
|
+
"oh-my-opencode-darwin-x64": "5.1.64",
|
|
98180
|
+
"oh-my-opencode-darwin-x64-baseline": "5.1.64",
|
|
98181
|
+
"oh-my-opencode-linux-arm64": "5.1.64",
|
|
98182
|
+
"oh-my-opencode-linux-arm64-musl": "5.1.64",
|
|
98183
|
+
"oh-my-opencode-linux-x64": "5.1.64",
|
|
98184
|
+
"oh-my-opencode-linux-x64-baseline": "5.1.64",
|
|
98185
|
+
"oh-my-opencode-linux-x64-musl": "5.1.64",
|
|
98186
|
+
"oh-my-opencode-linux-x64-musl-baseline": "5.1.64",
|
|
98187
|
+
"oh-my-opencode-windows-arm64": "5.1.64",
|
|
98188
|
+
"oh-my-opencode-windows-x64": "5.1.64",
|
|
98189
|
+
"oh-my-opencode-windows-x64-baseline": "5.1.64"
|
|
98087
98190
|
},
|
|
98088
98191
|
overrides: {
|
|
98089
98192
|
hono: "^4.13.8",
|
|
@@ -118984,12 +119087,12 @@ init_store();
|
|
|
118984
119087
|
// packages/team-core/src/team-mailbox/inbox.ts
|
|
118985
119088
|
init_paths();
|
|
118986
119089
|
init_types2();
|
|
118987
|
-
import { readdir as
|
|
119090
|
+
import { readdir as readdir7, readFile as readFile7 } from "fs/promises";
|
|
118988
119091
|
import path18 from "path";
|
|
118989
119092
|
|
|
118990
119093
|
// packages/team-core/src/team-mailbox/reservation.ts
|
|
118991
119094
|
init_paths();
|
|
118992
|
-
import { mkdir as mkdir5, readdir as
|
|
119095
|
+
import { mkdir as mkdir5, readdir as readdir6, rename as rename5, stat as stat7 } from "fs/promises";
|
|
118993
119096
|
import path17 from "path";
|
|
118994
119097
|
var RESERVED_PREFIX = ".delivering-";
|
|
118995
119098
|
var RESERVED_SUFFIX = ".json";
|
|
@@ -119014,7 +119117,7 @@ async function reserveMessageForDelivery(teamRunId, recipientName, messageId, co
|
|
|
119014
119117
|
throw error;
|
|
119015
119118
|
}
|
|
119016
119119
|
try {
|
|
119017
|
-
await
|
|
119120
|
+
await rename5(reservation.inboxPath, reservation.reservedPath);
|
|
119018
119121
|
return reservation;
|
|
119019
119122
|
} catch (error) {
|
|
119020
119123
|
if (isMissingPathError(error))
|
|
@@ -119024,10 +119127,10 @@ async function reserveMessageForDelivery(teamRunId, recipientName, messageId, co
|
|
|
119024
119127
|
}
|
|
119025
119128
|
async function commitDeliveryReservation(reservation) {
|
|
119026
119129
|
await mkdir5(reservation.processedDir, { recursive: true, mode: 448 });
|
|
119027
|
-
await
|
|
119130
|
+
await rename5(reservation.reservedPath, reservation.processedPath);
|
|
119028
119131
|
}
|
|
119029
119132
|
async function releaseDeliveryReservation(reservation) {
|
|
119030
|
-
await
|
|
119133
|
+
await rename5(reservation.reservedPath, reservation.inboxPath);
|
|
119031
119134
|
}
|
|
119032
119135
|
|
|
119033
119136
|
// packages/team-core/src/team-mailbox/inbox.ts
|
|
@@ -119041,7 +119144,7 @@ async function readInboxMessage(inboxDir, fileName, memberName, teamRunId) {
|
|
|
119041
119144
|
const filePath = path18.join(inboxDir, fileName);
|
|
119042
119145
|
const messageContext = { memberName, teamRunId, fileName };
|
|
119043
119146
|
try {
|
|
119044
|
-
const fileContent = await
|
|
119147
|
+
const fileContent = await readFile7(filePath, "utf8");
|
|
119045
119148
|
const parsedMessage = MessageSchema.safeParse(JSON.parse(fileContent));
|
|
119046
119149
|
if (!parsedMessage.success) {
|
|
119047
119150
|
log6("team mailbox skipped malformed message", {
|
|
@@ -119069,7 +119172,7 @@ async function readUnreadMessageById(teamRunId, memberName, messageId, config) {
|
|
|
119069
119172
|
let fileName = `${messageId}.json`;
|
|
119070
119173
|
for (const candidatePath of candidatePaths) {
|
|
119071
119174
|
try {
|
|
119072
|
-
fileContent = await
|
|
119175
|
+
fileContent = await readFile7(candidatePath, "utf8");
|
|
119073
119176
|
fileName = path18.basename(candidatePath);
|
|
119074
119177
|
break;
|
|
119075
119178
|
} catch (error) {
|
|
@@ -119112,7 +119215,7 @@ async function readUnreadMessageById(teamRunId, memberName, messageId, config) {
|
|
|
119112
119215
|
async function listUnreadMessages(teamRunId, memberName, config) {
|
|
119113
119216
|
const inboxDir = getInboxDir(resolveBaseDir(config), teamRunId, memberName);
|
|
119114
119217
|
try {
|
|
119115
|
-
const directoryEntries = await
|
|
119218
|
+
const directoryEntries = await readdir7(inboxDir, { withFileTypes: true });
|
|
119116
119219
|
const unreadMessages = await Promise.all(directoryEntries.filter(isInboxMessageFile).map((entry) => readInboxMessage(inboxDir, entry.name, memberName, teamRunId)));
|
|
119117
119220
|
return unreadMessages.filter((message) => message !== null).sort((leftMessage, rightMessage) => leftMessage.timestamp - rightMessage.timestamp);
|
|
119118
119221
|
} catch (error) {
|
|
@@ -119914,12 +120017,12 @@ init_logger2();
|
|
|
119914
120017
|
init_logger2();
|
|
119915
120018
|
// packages/omo-opencode/src/hooks/goal/controller.ts
|
|
119916
120019
|
import { mkdirSync as mkdirSync21, writeFileSync as writeFileSync24 } from "fs";
|
|
119917
|
-
import { dirname as
|
|
120020
|
+
import { dirname as dirname37, join as join100 } from "path";
|
|
119918
120021
|
|
|
119919
120022
|
// packages/omo-opencode/src/hooks/goal/store.ts
|
|
119920
|
-
import { randomUUID as
|
|
120023
|
+
import { randomUUID as randomUUID12 } from "crypto";
|
|
119921
120024
|
import { mkdirSync as mkdirSync20, readFileSync as readFileSync50, renameSync as renameSync9, unlinkSync as unlinkSync15, writeFileSync as writeFileSync23 } from "fs";
|
|
119922
|
-
import { join as
|
|
120025
|
+
import { join as join99 } from "path";
|
|
119923
120026
|
|
|
119924
120027
|
// packages/omo-opencode/src/hooks/goal/types.ts
|
|
119925
120028
|
import { z as z59 } from "zod";
|
|
@@ -119957,7 +120060,7 @@ var GoalToolResponseSchema = z59.object({
|
|
|
119957
120060
|
// packages/omo-opencode/src/hooks/goal/store.ts
|
|
119958
120061
|
var STORE_VERSION = 1;
|
|
119959
120062
|
function goalFilePath(ref) {
|
|
119960
|
-
return
|
|
120063
|
+
return join99(ref.baseDir, `${encodeURIComponent(ref.sessionID)}.json`);
|
|
119961
120064
|
}
|
|
119962
120065
|
function ensureGoalStoreDir(baseDir) {
|
|
119963
120066
|
mkdirSync20(baseDir, { recursive: true });
|
|
@@ -119979,7 +120082,7 @@ function readGoal(ref) {
|
|
|
119979
120082
|
function writeGoal(ref, goal) {
|
|
119980
120083
|
ensureGoalStoreDir(ref.baseDir);
|
|
119981
120084
|
const filePath = goalFilePath(ref);
|
|
119982
|
-
const tempPath = `${filePath}.tmp.${
|
|
120085
|
+
const tempPath = `${filePath}.tmp.${randomUUID12()}`;
|
|
119983
120086
|
const file = { version: STORE_VERSION, goal };
|
|
119984
120087
|
writeFileSync23(tempPath, JSON.stringify(file, null, 2), "utf-8");
|
|
119985
120088
|
renameSync9(tempPath, filePath);
|
|
@@ -119999,7 +120102,7 @@ function clearGoal(ref) {
|
|
|
119999
120102
|
function createGoal(ref, objective) {
|
|
120000
120103
|
const now = nowSeconds();
|
|
120001
120104
|
const goal = {
|
|
120002
|
-
id:
|
|
120105
|
+
id: randomUUID12(),
|
|
120003
120106
|
sessionID: ref.sessionID,
|
|
120004
120107
|
objective: objective.trim(),
|
|
120005
120108
|
status: "active",
|
|
@@ -120078,9 +120181,9 @@ function validateObjective(objective) {
|
|
|
120078
120181
|
// packages/omo-opencode/src/hooks/goal/controller.ts
|
|
120079
120182
|
function createGoalController(options) {
|
|
120080
120183
|
const { projectDir } = options;
|
|
120081
|
-
const baseDir =
|
|
120184
|
+
const baseDir = join100(projectDir, ".omo", "goal");
|
|
120082
120185
|
const storeRef = (sessionID) => ({ baseDir, sessionID });
|
|
120083
|
-
const tuiMirrorPath = (sessionID) =>
|
|
120186
|
+
const tuiMirrorPath = (sessionID) => join100(projectDir, ".omo", "ulw-loop", sessionID, "goals.json");
|
|
120084
120187
|
const writeTuiMirror = (sessionID, goal) => {
|
|
120085
120188
|
const path = tuiMirrorPath(sessionID);
|
|
120086
120189
|
const snapshot = {
|
|
@@ -120093,7 +120196,7 @@ function createGoalController(options) {
|
|
|
120093
120196
|
successCriteria: []
|
|
120094
120197
|
}]
|
|
120095
120198
|
};
|
|
120096
|
-
mkdirSync21(
|
|
120199
|
+
mkdirSync21(dirname37(path), { recursive: true });
|
|
120097
120200
|
writeFileSync24(path, `${JSON.stringify(snapshot, null, 2)}
|
|
120098
120201
|
`, "utf-8");
|
|
120099
120202
|
};
|
|
@@ -120528,13 +120631,13 @@ function findSlashCommandPartIndex(parts) {
|
|
|
120528
120631
|
return -1;
|
|
120529
120632
|
}
|
|
120530
120633
|
// packages/omo-opencode/src/hooks/auto-slash-command/executor.ts
|
|
120531
|
-
import { dirname as
|
|
120634
|
+
import { dirname as dirname40 } from "path";
|
|
120532
120635
|
|
|
120533
120636
|
// packages/omo-opencode/src/shared/command-executor/resolve-commands-in-text.ts
|
|
120534
120637
|
init_resolve_commands_in_text();
|
|
120535
120638
|
// packages/skills-loader-core/src/features/opencode-skill-loader/loader.ts
|
|
120536
120639
|
init_src();
|
|
120537
|
-
import { join as
|
|
120640
|
+
import { join as join101 } from "path";
|
|
120538
120641
|
|
|
120539
120642
|
// packages/skills-loader-core/src/tools/skill/scope-priority.ts
|
|
120540
120643
|
var SCOPE_PRIORITY = {
|
|
@@ -120623,7 +120726,7 @@ $ARGUMENTS
|
|
|
120623
120726
|
|
|
120624
120727
|
// packages/skills-loader-core/src/features/opencode-skill-loader/loader.ts
|
|
120625
120728
|
async function loadUserSkills() {
|
|
120626
|
-
const userSkillsDir =
|
|
120729
|
+
const userSkillsDir = join101(getClaudeConfigDir2(), "skills");
|
|
120627
120730
|
const skills = await loadSkillsFromDir({ skillsDir: userSkillsDir, scope: "user" });
|
|
120628
120731
|
return skillsToCommandDefinitionRecord(skills);
|
|
120629
120732
|
}
|
|
@@ -120642,7 +120745,7 @@ async function loadProjectAgentsSkills(directory, provenance) {
|
|
|
120642
120745
|
return skillsToCommandDefinitionRecord(await discoverProjectAgentsSkills(directory, provenance));
|
|
120643
120746
|
}
|
|
120644
120747
|
async function loadGlobalAgentsSkills(homeDirectory = getHomeDirectory()) {
|
|
120645
|
-
const agentsGlobalDir =
|
|
120748
|
+
const agentsGlobalDir = join101(homeDirectory, ".agents", "skills");
|
|
120646
120749
|
const skills = await loadSkillsFromDir({ skillsDir: agentsGlobalDir, scope: "user" });
|
|
120647
120750
|
return skillsToCommandDefinitionRecord(skills);
|
|
120648
120751
|
}
|
|
@@ -120697,7 +120800,7 @@ async function discoverSkills(options = {}) {
|
|
|
120697
120800
|
]);
|
|
120698
120801
|
}
|
|
120699
120802
|
async function discoverUserClaudeSkills() {
|
|
120700
|
-
const userSkillsDir =
|
|
120803
|
+
const userSkillsDir = join101(getClaudeConfigDir2(), "skills");
|
|
120701
120804
|
return loadSkillsFromDir({ skillsDir: userSkillsDir, scope: "user" });
|
|
120702
120805
|
}
|
|
120703
120806
|
async function discoverProjectClaudeSkills(directory, provenance) {
|
|
@@ -120724,16 +120827,16 @@ async function discoverProjectAgentsSkills(directory, provenance) {
|
|
|
120724
120827
|
return deduplicateSkillsByName(allSkills.flat());
|
|
120725
120828
|
}
|
|
120726
120829
|
async function discoverGlobalAgentsSkills(homeDirectory = getHomeDirectory()) {
|
|
120727
|
-
const agentsGlobalDir =
|
|
120830
|
+
const agentsGlobalDir = join101(homeDirectory, ".agents", "skills");
|
|
120728
120831
|
return loadSkillsFromDir({ skillsDir: agentsGlobalDir, scope: "user" });
|
|
120729
120832
|
}
|
|
120730
120833
|
// packages/skills-loader-core/src/features/opencode-skill-loader/merger/builtin-skill-converter.ts
|
|
120731
120834
|
import { existsSync as existsSync76 } from "fs";
|
|
120732
|
-
import { join as
|
|
120835
|
+
import { join as join102 } from "path";
|
|
120733
120836
|
function resolveBuiltinSkillPath(builtin) {
|
|
120734
120837
|
if (builtin.resolvedPath !== undefined)
|
|
120735
120838
|
return builtin.resolvedPath;
|
|
120736
|
-
const sharedSkillPath =
|
|
120839
|
+
const sharedSkillPath = join102(sharedSkillsRootPath(), builtin.name);
|
|
120737
120840
|
return existsSync76(sharedSkillPath) ? sharedSkillPath : undefined;
|
|
120738
120841
|
}
|
|
120739
120842
|
function builtinToLoadedSkill(builtin) {
|
|
@@ -120761,7 +120864,7 @@ function builtinToLoadedSkill(builtin) {
|
|
|
120761
120864
|
|
|
120762
120865
|
// packages/skills-loader-core/src/features/opencode-skill-loader/merger/config-skill-entry-loader.ts
|
|
120763
120866
|
init_src();
|
|
120764
|
-
import { dirname as
|
|
120867
|
+
import { dirname as dirname38, isAbsolute as isAbsolute15, resolve as resolve22 } from "path";
|
|
120765
120868
|
import { homedir as homedir21 } from "os";
|
|
120766
120869
|
function resolveFilePath5(from, configDir) {
|
|
120767
120870
|
let filePath = from;
|
|
@@ -120817,7 +120920,7 @@ function configEntryToLoadedSkill(name, entry, configDir, sourceProvenance) {
|
|
|
120817
120920
|
return null;
|
|
120818
120921
|
}
|
|
120819
120922
|
const description = entry.description || fileMetadata.description || "";
|
|
120820
|
-
const resolvedPath = sourcePath ?
|
|
120923
|
+
const resolvedPath = sourcePath ? dirname38(sourcePath) : configDir || process.cwd();
|
|
120821
120924
|
const resolvedTemplate = resolveSkillPathReferences(template.trim(), resolvedPath);
|
|
120822
120925
|
const wrappedTemplate = `<skill-instruction>
|
|
120823
120926
|
Base directory for this skill: ${resolvedPath}/
|
|
@@ -121168,7 +121271,7 @@ playwright-cli close
|
|
|
121168
121271
|
};
|
|
121169
121272
|
// packages/skills-loader-core/src/features/builtin-skills/skill-file-loader.ts
|
|
121170
121273
|
import { readFileSync as readFileSync51 } from "fs";
|
|
121171
|
-
import { join as
|
|
121274
|
+
import { join as join103 } from "path";
|
|
121172
121275
|
init_src();
|
|
121173
121276
|
function createSharedSkillTemplateLoader(readFile = readFileSync51, skillsRootPath = sharedSkillsRootPath()) {
|
|
121174
121277
|
const cache = new Map;
|
|
@@ -121177,7 +121280,7 @@ function createSharedSkillTemplateLoader(readFile = readFileSync51, skillsRootPa
|
|
|
121177
121280
|
if (cached !== undefined)
|
|
121178
121281
|
return cached;
|
|
121179
121282
|
try {
|
|
121180
|
-
const { body } = parseFrontmatter(readFile(
|
|
121283
|
+
const { body } = parseFrontmatter(readFile(join103(skillsRootPath, skillName, "SKILL.md"), "utf8"));
|
|
121181
121284
|
cache.set(skillName, body);
|
|
121182
121285
|
return body;
|
|
121183
121286
|
} catch (error) {
|
|
@@ -122314,9 +122417,9 @@ var gitMasterSkill = {
|
|
|
122314
122417
|
template: GIT_MASTER_TEMPLATE
|
|
122315
122418
|
};
|
|
122316
122419
|
// packages/skills-loader-core/src/features/builtin-skills/skills/dev-browser.ts
|
|
122317
|
-
import { dirname as
|
|
122420
|
+
import { dirname as dirname39, join as join104 } from "path";
|
|
122318
122421
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
122319
|
-
var CURRENT_DIR =
|
|
122422
|
+
var CURRENT_DIR = dirname39(fileURLToPath7(import.meta.url));
|
|
122320
122423
|
function releaseStaleCdpPortScript({ httpPort = 9222, cdpPort = 9223, graceSeconds = 5 } = {}) {
|
|
122321
122424
|
return `if command -v curl >/dev/null && command -v lsof >/dev/null && ! curl -sf -m 1 -o /dev/null http://localhost:${httpPort}; then
|
|
122322
122425
|
pids=$(lsof -ti:${cdpPort} 2>/dev/null)
|
|
@@ -122549,7 +122652,7 @@ console.log({
|
|
|
122549
122652
|
await client.disconnect();
|
|
122550
122653
|
EOF
|
|
122551
122654
|
\`\`\``,
|
|
122552
|
-
resolvedPath:
|
|
122655
|
+
resolvedPath: join104(CURRENT_DIR, "..", "dev-browser")
|
|
122553
122656
|
};
|
|
122554
122657
|
// packages/skills-loader-core/src/features/builtin-skills/skills/review-work.ts
|
|
122555
122658
|
var reviewWorkSkill = {
|
|
@@ -124014,7 +124117,7 @@ function readOpencodeConfigSkills(directory) {
|
|
|
124014
124117
|
}
|
|
124015
124118
|
// packages/omo-opencode/src/tools/slashcommand/command-discovery.ts
|
|
124016
124119
|
import { existsSync as existsSync78, readdirSync as readdirSync26, readFileSync as readFileSync53, statSync as statSync16 } from "fs";
|
|
124017
|
-
import { basename as
|
|
124120
|
+
import { basename as basename18, join as join106 } from "path";
|
|
124018
124121
|
|
|
124019
124122
|
// packages/omo-opencode/src/shared/excluded-dirs.ts
|
|
124020
124123
|
var EXCLUDED_DIR_NAMES = [
|
|
@@ -124413,7 +124516,7 @@ lsp_diagnostics(filePath) // Errors, warnings before we start
|
|
|
124413
124516
|
|
|
124414
124517
|
\`\`\`bash
|
|
124415
124518
|
// Find structural patterns
|
|
124416
|
-
python3 scripts/ast_grep_helper.py search 'function $NAME($$$) { $$$ }' --lang ts
|
|
124519
|
+
python3 scripts/ast_grep_helper.py search 'function $NAME($$$) { $$$ }' src/ --lang ts
|
|
124417
124520
|
|
|
124418
124521
|
# Preview refactoring first
|
|
124419
124522
|
sg --pattern '[old_pattern]' --rewrite '[new_pattern]' --lang ts src/
|
|
@@ -124531,7 +124634,7 @@ lsp_rename(filePath, line, character, newName) // Execute rename
|
|
|
124531
124634
|
sg --pattern '[pattern]' --rewrite '[rewrite]' --lang ts path/to/file.ts
|
|
124532
124635
|
|
|
124533
124636
|
// If preview looks good, execute
|
|
124534
|
-
python3 scripts/ast_grep_helper.py replace '[pattern]' '[rewrite]'
|
|
124637
|
+
python3 scripts/ast_grep_helper.py replace '[pattern]' '[rewrite]' path/to/file.ts --lang ts --apply
|
|
124535
124638
|
\`\`\`
|
|
124536
124639
|
|
|
124537
124640
|
**For Structural Changes:**
|
|
@@ -125563,13 +125666,13 @@ function discoverCommandsFromDir(commandsDir, scope, prefix = "") {
|
|
|
125563
125666
|
if (entry.name.startsWith("."))
|
|
125564
125667
|
continue;
|
|
125565
125668
|
const nestedPrefix = prefix ? `${prefix}${NESTED_COMMAND_SEPARATOR}${entry.name}` : entry.name;
|
|
125566
|
-
commands.push(...discoverCommandsFromDir(
|
|
125669
|
+
commands.push(...discoverCommandsFromDir(join106(commandsDir, entry.name), scope, nestedPrefix));
|
|
125567
125670
|
continue;
|
|
125568
125671
|
}
|
|
125569
125672
|
if (!isMarkdownFile(entry))
|
|
125570
125673
|
continue;
|
|
125571
|
-
const commandPath =
|
|
125572
|
-
const baseCommandName =
|
|
125674
|
+
const commandPath = join106(commandsDir, entry.name);
|
|
125675
|
+
const baseCommandName = basename18(entry.name, ".md");
|
|
125573
125676
|
const commandName = prefix ? `${prefix}${NESTED_COMMAND_SEPARATOR}${baseCommandName}` : baseCommandName;
|
|
125574
125677
|
try {
|
|
125575
125678
|
const content = readFileSync53(commandPath, "utf-8");
|
|
@@ -125627,8 +125730,8 @@ function deduplicateCommandInfosByName(commands) {
|
|
|
125627
125730
|
return deduplicatedCommands;
|
|
125628
125731
|
}
|
|
125629
125732
|
function discoverCommandsSync(directory, options) {
|
|
125630
|
-
const userCommandsDir =
|
|
125631
|
-
const projectCommandsDir =
|
|
125733
|
+
const userCommandsDir = join106(getClaudeConfigDir(), "commands");
|
|
125734
|
+
const projectCommandsDir = join106(directory ?? process.cwd(), ".claude", "commands");
|
|
125632
125735
|
const opencodeGlobalDirs = getOpenCodeCommandDirs({ binary: "opencode" });
|
|
125633
125736
|
const opencodeProjectDirs = findProjectOpencodeCommandDirs(directory ?? process.cwd());
|
|
125634
125737
|
const userCommands = discoverCommandsFromDir(userCommandsDir, "user");
|
|
@@ -125759,7 +125862,7 @@ async function formatCommandTemplate(cmd, args, sessionID) {
|
|
|
125759
125862
|
if (!content && cmd.lazyContentLoader) {
|
|
125760
125863
|
content = await cmd.lazyContentLoader.load();
|
|
125761
125864
|
}
|
|
125762
|
-
const commandDir = cmd.path ?
|
|
125865
|
+
const commandDir = cmd.path ? dirname40(cmd.path) : process.cwd();
|
|
125763
125866
|
const withFileRefs = await resolveFileReferencesInText(content, commandDir);
|
|
125764
125867
|
const resolvedContent = await resolveCommandsInText(withFileRefs);
|
|
125765
125868
|
const substitutedContent = substituteCommandTemplate(resolvedContent, args, sessionID);
|
|
@@ -126181,11 +126284,11 @@ function isPrometheusAgent(agentName) {
|
|
|
126181
126284
|
|
|
126182
126285
|
// packages/omo-opencode/src/hooks/prometheus-md-only/path-policy.ts
|
|
126183
126286
|
import { existsSync as existsSync79, lstatSync as lstatSync9, realpathSync as realpathSync20 } from "fs";
|
|
126184
|
-
import { basename as
|
|
126287
|
+
import { basename as basename19, dirname as dirname42, join as join108, sep as sep5 } from "path";
|
|
126185
126288
|
|
|
126186
126289
|
// packages/omo-opencode/src/shared/resolve-file-write-path.ts
|
|
126187
126290
|
import { lstatSync as lstatSync8, realpathSync as realpathSync19, statSync as statSync17 } from "fs";
|
|
126188
|
-
import { dirname as
|
|
126291
|
+
import { dirname as dirname41, isAbsolute as isAbsolute16, join as join107, parse as parse3, sep as sep4 } from "path";
|
|
126189
126292
|
function resolveFileWritePath(filePath, cwd, followFinalSymlink = true) {
|
|
126190
126293
|
const input = filePath.replace(/[\\/]/g, sep4);
|
|
126191
126294
|
const absolute = isAbsolute16(input) ? input : `${realpathSync19.native(cwd)}${sep4}${input}`;
|
|
@@ -126200,10 +126303,10 @@ function resolveFileWritePath(filePath, cwd, followFinalSymlink = true) {
|
|
|
126200
126303
|
if (component === ".")
|
|
126201
126304
|
continue;
|
|
126202
126305
|
if (component === "..") {
|
|
126203
|
-
current =
|
|
126306
|
+
current = dirname41(current);
|
|
126204
126307
|
continue;
|
|
126205
126308
|
}
|
|
126206
|
-
const next =
|
|
126309
|
+
const next = join107(current, component);
|
|
126207
126310
|
if (!followFinalSymlink && index === components.length - 1)
|
|
126208
126311
|
return next;
|
|
126209
126312
|
let entry;
|
|
@@ -126227,12 +126330,12 @@ function isInside(path, root) {
|
|
|
126227
126330
|
return path.length > prefix.length && path.startsWith(prefix);
|
|
126228
126331
|
}
|
|
126229
126332
|
function isPlanningName(path) {
|
|
126230
|
-
const name =
|
|
126333
|
+
const name = basename19(path);
|
|
126231
126334
|
if (name === ".omo")
|
|
126232
126335
|
return true;
|
|
126233
126336
|
if (name.toLowerCase() !== ".omo")
|
|
126234
126337
|
return false;
|
|
126235
|
-
const canonicalPath =
|
|
126338
|
+
const canonicalPath = join108(dirname42(path), ".omo");
|
|
126236
126339
|
if (!existsSync79(path) || !existsSync79(canonicalPath))
|
|
126237
126340
|
return false;
|
|
126238
126341
|
const entry = lstatSync9(path);
|
|
@@ -126640,12 +126743,12 @@ to continue: task(task_id="${taskId}", load_skills=[], run_in_background=true, p
|
|
|
126640
126743
|
};
|
|
126641
126744
|
}
|
|
126642
126745
|
// packages/omo-senpi/src/components/agent-home/resolve-agent-home.ts
|
|
126643
|
-
import { join as
|
|
126746
|
+
import { join as join110 } from "path";
|
|
126644
126747
|
|
|
126645
126748
|
// packages/senpi-task/src/agent-home.ts
|
|
126646
126749
|
import { existsSync as existsSync80 } from "fs";
|
|
126647
126750
|
import { homedir as homedir22 } from "os";
|
|
126648
|
-
import { join as
|
|
126751
|
+
import { join as join109, resolve as resolve23 } from "path";
|
|
126649
126752
|
var AGENT_DIR_ENV_NAMES = [
|
|
126650
126753
|
"OMO_CODING_AGENT_DIR",
|
|
126651
126754
|
"SENPI_CODING_AGENT_DIR",
|
|
@@ -126659,18 +126762,18 @@ function resolveAgentHome(options) {
|
|
|
126659
126762
|
if (configured)
|
|
126660
126763
|
return resolve23(configured);
|
|
126661
126764
|
}
|
|
126662
|
-
const brandedHome =
|
|
126663
|
-
const canonical =
|
|
126664
|
-
if (exists(
|
|
126765
|
+
const brandedHome = join109(homeDir, ".omo");
|
|
126766
|
+
const canonical = join109(brandedHome, "agent");
|
|
126767
|
+
if (exists(join109(canonical, AGENT_HOME_SENTINEL)))
|
|
126665
126768
|
return canonical;
|
|
126666
|
-
if (exists(
|
|
126769
|
+
if (exists(join109(brandedHome, AGENT_HOME_SENTINEL)))
|
|
126667
126770
|
return brandedHome;
|
|
126668
|
-
return
|
|
126771
|
+
return join109(homeDir, ".senpi", "agent");
|
|
126669
126772
|
}
|
|
126670
126773
|
|
|
126671
126774
|
// packages/omo-senpi/src/components/agent-home/resolve-agent-home.ts
|
|
126672
126775
|
function resolveAgentSessionsDirectory(options) {
|
|
126673
|
-
return
|
|
126776
|
+
return join110(resolveAgentHome(options), "sessions");
|
|
126674
126777
|
}
|
|
126675
126778
|
|
|
126676
126779
|
// packages/omo-opencode/src/hooks/ulw-execute/ulw-execute-hook.ts
|
|
@@ -126789,7 +126892,7 @@ ${completionInstruction}`;
|
|
|
126789
126892
|
// packages/omo-opencode/src/hooks/ulw-execute/notepad-scaffold.ts
|
|
126790
126893
|
init_logger2();
|
|
126791
126894
|
import { mkdirSync as mkdirSync22, writeFileSync as writeFileSync25 } from "fs";
|
|
126792
|
-
import { join as
|
|
126895
|
+
import { join as join111 } from "path";
|
|
126793
126896
|
var NOTEPAD_FILES = [
|
|
126794
126897
|
"learnings.md",
|
|
126795
126898
|
"decisions.md",
|
|
@@ -126823,14 +126926,14 @@ ${NOTEPAD_FOOTER}
|
|
|
126823
126926
|
}
|
|
126824
126927
|
function ensureNotepadScaffold(params) {
|
|
126825
126928
|
const { directory, planName, timestamp = new Date().toISOString() } = params;
|
|
126826
|
-
const notepadDir =
|
|
126929
|
+
const notepadDir = join111(directory, ".omo", "notepads", planName);
|
|
126827
126930
|
mkdirSync22(notepadDir, { recursive: true });
|
|
126828
126931
|
const created = [];
|
|
126829
126932
|
const skipped = [];
|
|
126830
126933
|
for (const fileName of NOTEPAD_FILES) {
|
|
126831
126934
|
const header = buildHeader(fileName, planName, timestamp);
|
|
126832
126935
|
try {
|
|
126833
|
-
writeFileSync25(
|
|
126936
|
+
writeFileSync25(join111(notepadDir, fileName), header, { flag: "wx" });
|
|
126834
126937
|
created.push(fileName);
|
|
126835
126938
|
} catch (err) {
|
|
126836
126939
|
if (err.code === "EEXIST") {
|
|
@@ -128145,7 +128248,7 @@ async function isSessionInBoulderLineage(input) {
|
|
|
128145
128248
|
|
|
128146
128249
|
// packages/omo-opencode/src/hooks/atlas/session-last-agent.ts
|
|
128147
128250
|
import { readFileSync as readFileSync54, readdirSync as readdirSync27 } from "fs";
|
|
128148
|
-
import { join as
|
|
128251
|
+
import { join as join112 } from "path";
|
|
128149
128252
|
var defaultSessionLastAgentDeps = {
|
|
128150
128253
|
getMessageDir,
|
|
128151
128254
|
isSqliteBackend,
|
|
@@ -128205,7 +128308,7 @@ async function getLastAgentFromSession(sessionID, client, deps = {}) {
|
|
|
128205
128308
|
try {
|
|
128206
128309
|
const messages = readdirSync27(messageDir).filter((fileName) => fileName.endsWith(".json")).map((fileName) => {
|
|
128207
128310
|
try {
|
|
128208
|
-
const content = readFileSync54(
|
|
128311
|
+
const content = readFileSync54(join112(messageDir, fileName), "utf-8");
|
|
128209
128312
|
const parsed = JSON.parse(content);
|
|
128210
128313
|
return {
|
|
128211
128314
|
fileName,
|
|
@@ -133857,7 +133960,7 @@ function createRuntimeFallbackHook(ctx, options, factoryOverrides = {}) {
|
|
|
133857
133960
|
}
|
|
133858
133961
|
// packages/omo-opencode/src/hooks/write-existing-file-guard/hook.ts
|
|
133859
133962
|
import { existsSync as existsSync86, realpathSync as realpathSync22 } from "fs";
|
|
133860
|
-
import { basename as
|
|
133963
|
+
import { basename as basename20, dirname as dirname43, isAbsolute as isAbsolute17, join as join113, normalize as normalize2, relative as relative15, resolve as resolve27 } from "path";
|
|
133861
133964
|
|
|
133862
133965
|
// packages/omo-opencode/src/hooks/write-existing-file-guard/tool-execute-before-handler.ts
|
|
133863
133966
|
import { existsSync as existsSync85 } from "fs";
|
|
@@ -134044,9 +134147,9 @@ function toCanonicalPath2(absolutePath) {
|
|
|
134044
134147
|
canonicalPath = absolutePath;
|
|
134045
134148
|
}
|
|
134046
134149
|
} else {
|
|
134047
|
-
const absoluteDir =
|
|
134150
|
+
const absoluteDir = dirname43(absolutePath);
|
|
134048
134151
|
const resolvedDir = existsSync86(absoluteDir) ? realpathSync22.native(absoluteDir) : absoluteDir;
|
|
134049
|
-
canonicalPath =
|
|
134152
|
+
canonicalPath = join113(resolvedDir, basename20(absolutePath));
|
|
134050
134153
|
}
|
|
134051
134154
|
return normalize2(canonicalPath);
|
|
134052
134155
|
}
|
|
@@ -136808,12 +136911,12 @@ init_plugin_identity();
|
|
|
136808
136911
|
|
|
136809
136912
|
// packages/omo-opencode/src/hooks/legacy-plugin-toast/auto-migrate.ts
|
|
136810
136913
|
import { existsSync as existsSync87, readFileSync as readFileSync58 } from "fs";
|
|
136811
|
-
import { join as
|
|
136914
|
+
import { join as join114 } from "path";
|
|
136812
136915
|
init_plugin_identity();
|
|
136813
136916
|
function detectOpenCodeConfigPath(overrideConfigDir) {
|
|
136814
136917
|
if (overrideConfigDir) {
|
|
136815
|
-
const jsoncPath =
|
|
136816
|
-
const jsonPath =
|
|
136918
|
+
const jsoncPath = join114(overrideConfigDir, "opencode.jsonc");
|
|
136919
|
+
const jsonPath = join114(overrideConfigDir, "opencode.json");
|
|
136817
136920
|
if (existsSync87(jsoncPath))
|
|
136818
136921
|
return jsoncPath;
|
|
136819
136922
|
if (existsSync87(jsonPath))
|
|
@@ -136977,11 +137080,11 @@ function decideNativeEditionNudge(input) {
|
|
|
136977
137080
|
init_logger2();
|
|
136978
137081
|
import { existsSync as existsSync88 } from "fs";
|
|
136979
137082
|
import { homedir as homedir23 } from "os";
|
|
136980
|
-
import { join as
|
|
137083
|
+
import { join as join116 } from "path";
|
|
136981
137084
|
|
|
136982
137085
|
// packages/omo-opencode/src/hooks/native-edition-nudge/state.ts
|
|
136983
137086
|
import { mkdirSync as mkdirSync23, readFileSync as readFileSync59, unlinkSync as unlinkSync16, writeFileSync as writeFileSync26 } from "fs";
|
|
136984
|
-
import { join as
|
|
137087
|
+
import { join as join115 } from "path";
|
|
136985
137088
|
var NUDGE_STATE_FILE = "native-nudge.json";
|
|
136986
137089
|
function isDecision(value) {
|
|
136987
137090
|
return value === "none" || value === "snoozed" || value === "never" || value === "migrated";
|
|
@@ -137015,7 +137118,7 @@ function parseNudgeState(raw) {
|
|
|
137015
137118
|
};
|
|
137016
137119
|
}
|
|
137017
137120
|
function createNudgeStateStore(stateDir) {
|
|
137018
|
-
const path =
|
|
137121
|
+
const path = join115(stateDir, NUDGE_STATE_FILE);
|
|
137019
137122
|
return {
|
|
137020
137123
|
read: () => {
|
|
137021
137124
|
let raw;
|
|
@@ -137037,7 +137140,7 @@ function createNudgeStateStore(stateDir) {
|
|
|
137037
137140
|
}
|
|
137038
137141
|
},
|
|
137039
137142
|
probeWritable: () => {
|
|
137040
|
-
const probe =
|
|
137143
|
+
const probe = join115(stateDir, `.${NUDGE_STATE_FILE}.probe`);
|
|
137041
137144
|
try {
|
|
137042
137145
|
mkdirSync23(stateDir, { recursive: true });
|
|
137043
137146
|
writeFileSync26(probe, "", { mode: 384 });
|
|
@@ -137056,10 +137159,10 @@ function createNudgeStateStore(stateDir) {
|
|
|
137056
137159
|
var NATIVE_NUDGE_TOAST_TITLE = "OmO Native";
|
|
137057
137160
|
var NATIVE_NUDGE_TOAST_MESSAGE = "OmO Native - the OmO agent runtime as one binary, no host app needed. Get it at https://omo.dev";
|
|
137058
137161
|
function nativeEditionStateDir() {
|
|
137059
|
-
return
|
|
137162
|
+
return join116(getUserConfigDir(), "oh-my-openagent");
|
|
137060
137163
|
}
|
|
137061
137164
|
function detectNativeEdition() {
|
|
137062
|
-
return existsSync88(
|
|
137165
|
+
return existsSync88(join116(homedir23(), ".omo", "agent"));
|
|
137063
137166
|
}
|
|
137064
137167
|
function isInteractiveLaunch(env, stdoutIsTTY) {
|
|
137065
137168
|
if (env["CI"] !== undefined && env["CI"] !== "")
|
|
@@ -137557,7 +137660,7 @@ function createMonitorStatusInjectorHook(monitorManager, config) {
|
|
|
137557
137660
|
}
|
|
137558
137661
|
// packages/omo-opencode/src/hooks/momus-review-persistence/hook.ts
|
|
137559
137662
|
import { existsSync as existsSync90, readFileSync as readFileSync61 } from "fs";
|
|
137560
|
-
import { isAbsolute as isAbsolute18, join as
|
|
137663
|
+
import { isAbsolute as isAbsolute18, join as join117 } from "path";
|
|
137561
137664
|
|
|
137562
137665
|
// packages/omo-opencode/src/hooks/momus-review-persistence/review-resolution.ts
|
|
137563
137666
|
var VERDICT_PATTERN2 = /\*\*\[(OKAY|REJECT)\]\*\*/;
|
|
@@ -137695,7 +137798,7 @@ function createMomusReviewPersistenceHook(ctx) {
|
|
|
137695
137798
|
});
|
|
137696
137799
|
return;
|
|
137697
137800
|
}
|
|
137698
|
-
const planFilePath = isAbsolute18(planPath) ? planPath :
|
|
137801
|
+
const planFilePath = isAbsolute18(planPath) ? planPath : join117(ctx.directory, planPath);
|
|
137699
137802
|
let planHash;
|
|
137700
137803
|
if (existsSync90(planFilePath)) {
|
|
137701
137804
|
planHash = hashPlanContent(readFileSync61(planFilePath, "utf-8"));
|
|
@@ -137735,18 +137838,18 @@ tool.schema = z60;
|
|
|
137735
137838
|
// packages/omo-opencode/src/shared/ripgrep-cli.ts
|
|
137736
137839
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
137737
137840
|
import { existsSync as existsSync92 } from "fs";
|
|
137738
|
-
import { dirname as
|
|
137841
|
+
import { dirname as dirname44, join as join119 } from "path";
|
|
137739
137842
|
|
|
137740
137843
|
// packages/omo-opencode/src/tools/grep/downloader.ts
|
|
137741
137844
|
import { existsSync as existsSync91, readdirSync as readdirSync28 } from "fs";
|
|
137742
|
-
import { join as
|
|
137845
|
+
import { join as join118 } from "path";
|
|
137743
137846
|
init_plugin_identity();
|
|
137744
137847
|
function findFileRecursive(dir, filename) {
|
|
137745
137848
|
try {
|
|
137746
137849
|
const entries = readdirSync28(dir, { withFileTypes: true, recursive: true });
|
|
137747
137850
|
for (const entry of entries) {
|
|
137748
137851
|
if (entry.isFile() && entry.name === filename) {
|
|
137749
|
-
return
|
|
137852
|
+
return join118(entry.parentPath ?? dir, entry.name);
|
|
137750
137853
|
}
|
|
137751
137854
|
}
|
|
137752
137855
|
} catch (error) {
|
|
@@ -137770,11 +137873,11 @@ function getPlatformKey() {
|
|
|
137770
137873
|
}
|
|
137771
137874
|
function getInstallDir() {
|
|
137772
137875
|
const homeDir = process.env.HOME || process.env.USERPROFILE || ".";
|
|
137773
|
-
return
|
|
137876
|
+
return join118(homeDir, ".cache", CACHE_DIR_NAME, "bin");
|
|
137774
137877
|
}
|
|
137775
137878
|
function getRgPath() {
|
|
137776
137879
|
const isWindows = process.platform === "win32";
|
|
137777
|
-
return
|
|
137880
|
+
return join118(getInstallDir(), isWindows ? "rg.exe" : "rg");
|
|
137778
137881
|
}
|
|
137779
137882
|
async function extractTarGz2(archivePath, destDir) {
|
|
137780
137883
|
const platformKey = getPlatformKey();
|
|
@@ -137791,7 +137894,7 @@ async function extractZip2(archivePath, destDir) {
|
|
|
137791
137894
|
const binaryName = process.platform === "win32" ? "rg.exe" : "rg";
|
|
137792
137895
|
const foundPath = findFileRecursive(destDir, binaryName);
|
|
137793
137896
|
if (foundPath) {
|
|
137794
|
-
const destPath =
|
|
137897
|
+
const destPath = join118(destDir, binaryName);
|
|
137795
137898
|
if (foundPath !== destPath) {
|
|
137796
137899
|
const { renameSync } = await import("fs");
|
|
137797
137900
|
renameSync(foundPath, destPath);
|
|
@@ -137812,7 +137915,7 @@ async function downloadAndInstallRipgrep() {
|
|
|
137812
137915
|
ensureCacheDir(installDir);
|
|
137813
137916
|
const filename = `ripgrep-${RG_VERSION}-${config.platform}.${config.extension}`;
|
|
137814
137917
|
const url = `https://github.com/BurntSushi/ripgrep/releases/download/${RG_VERSION}/${filename}`;
|
|
137815
|
-
const archivePath =
|
|
137918
|
+
const archivePath = join118(installDir, filename);
|
|
137816
137919
|
try {
|
|
137817
137920
|
await downloadArchive(url, archivePath);
|
|
137818
137921
|
if (config.extension === "tar.gz") {
|
|
@@ -137873,16 +137976,16 @@ function findExecutable(name) {
|
|
|
137873
137976
|
}
|
|
137874
137977
|
function getOpenCodeBundledRg() {
|
|
137875
137978
|
const execPath = process.execPath;
|
|
137876
|
-
const execDir =
|
|
137979
|
+
const execDir = dirname44(execPath);
|
|
137877
137980
|
const isWindows = process.platform === "win32";
|
|
137878
137981
|
const rgName = isWindows ? "rg.exe" : "rg";
|
|
137879
137982
|
const candidates = [
|
|
137880
|
-
|
|
137881
|
-
|
|
137882
|
-
|
|
137883
|
-
|
|
137884
|
-
|
|
137885
|
-
|
|
137983
|
+
join119(getOpenCodeCacheDir(), "bin", rgName),
|
|
137984
|
+
join119(getDataDir(), "opencode", "bin", rgName),
|
|
137985
|
+
join119(execDir, rgName),
|
|
137986
|
+
join119(execDir, "bin", rgName),
|
|
137987
|
+
join119(execDir, "..", "bin", rgName),
|
|
137988
|
+
join119(execDir, "..", "libexec", rgName)
|
|
137886
137989
|
];
|
|
137887
137990
|
for (const candidate of candidates) {
|
|
137888
137991
|
if (existsSync92(candidate)) {
|
|
@@ -138537,7 +138640,7 @@ Use this when a task matches an available skill's or command's description.
|
|
|
138537
138640
|
- The tool will return detailed instructions with your context applied.
|
|
138538
138641
|
`;
|
|
138539
138642
|
// packages/omo-opencode/src/tools/skill/tools.ts
|
|
138540
|
-
import { dirname as
|
|
138643
|
+
import { dirname as dirname49 } from "path";
|
|
138541
138644
|
// packages/omo-opencode/src/tools/skill/session-skill-cache.ts
|
|
138542
138645
|
var seenSessionIDs = new Set;
|
|
138543
138646
|
function shouldInvalidateSkillCacheForSession(sessionID) {
|
|
@@ -138558,7 +138661,7 @@ function resolveMultipleSkills2(skillNames, options) {
|
|
|
138558
138661
|
return resolveMultipleSkills(skillNames, withOpenCodeShell(options));
|
|
138559
138662
|
}
|
|
138560
138663
|
// packages/omo-opencode/src/tools/slashcommand/command-output-formatter.ts
|
|
138561
|
-
import { dirname as
|
|
138664
|
+
import { dirname as dirname45 } from "path";
|
|
138562
138665
|
async function formatLoadedCommand(command, userMessage) {
|
|
138563
138666
|
const sections = [];
|
|
138564
138667
|
sections.push(`# /${command.name} Command
|
|
@@ -138597,7 +138700,7 @@ async function formatLoadedCommand(command, userMessage) {
|
|
|
138597
138700
|
if (!content && command.lazyContentLoader) {
|
|
138598
138701
|
content = await command.lazyContentLoader.load();
|
|
138599
138702
|
}
|
|
138600
|
-
const commandDir = command.path ?
|
|
138703
|
+
const commandDir = command.path ? dirname45(command.path) : process.cwd();
|
|
138601
138704
|
const withFileReferences = await resolveFileReferencesInText(content, commandDir);
|
|
138602
138705
|
const resolvedContent = await resolveCommandsInText(withFileReferences);
|
|
138603
138706
|
let finalContent = resolvedContent.trim();
|
|
@@ -138763,7 +138866,7 @@ function sanitizeJsonSchema(value, depth = 0, isPropertyName = false) {
|
|
|
138763
138866
|
|
|
138764
138867
|
// packages/omo-opencode/src/tools/skill/skill-mcp-authority.ts
|
|
138765
138868
|
import { realpathSync as realpathSync24 } from "fs";
|
|
138766
|
-
import { dirname as
|
|
138869
|
+
import { dirname as dirname46, join as join120 } from "path";
|
|
138767
138870
|
function skillMcpClientInfo(skill, serverName, sessionID, directory) {
|
|
138768
138871
|
const sourcePath = skill.mcpSourcePath ?? skill.path;
|
|
138769
138872
|
const provenance = skill.provenance ?? skillProvenance(skill.path ?? skill.resolvedPath ?? directory ?? ".", skill.scope);
|
|
@@ -138801,12 +138904,12 @@ function skillMcpClientInfo(skill, serverName, sessionID, directory) {
|
|
|
138801
138904
|
if (!path)
|
|
138802
138905
|
return;
|
|
138803
138906
|
const raw = readSkillFileChecked(path, provenance);
|
|
138804
|
-
const sidecar = readMcpJsonFromDirChecked(
|
|
138907
|
+
const sidecar = readMcpJsonFromDirChecked(dirname46(path), provenance);
|
|
138805
138908
|
const configs = sidecar ?? parseSkillMcpConfigFromFrontmatter(raw);
|
|
138806
138909
|
const config = configs?.[serverName];
|
|
138807
138910
|
return config ? {
|
|
138808
138911
|
config,
|
|
138809
|
-
sourcePath: sidecar ?
|
|
138912
|
+
sourcePath: sidecar ? join120(dirname46(path), "mcp.json") : path,
|
|
138810
138913
|
sourceKind: sidecar ? "sidecar" : "frontmatter"
|
|
138811
138914
|
} : undefined;
|
|
138812
138915
|
} : undefined
|
|
@@ -138878,7 +138981,7 @@ function appendPromptSection(sections, prompts) {
|
|
|
138878
138981
|
}
|
|
138879
138982
|
// packages/omo-opencode/src/tools/skill/skill-body.ts
|
|
138880
138983
|
init_src();
|
|
138881
|
-
import { dirname as
|
|
138984
|
+
import { dirname as dirname47 } from "path";
|
|
138882
138985
|
var SKILL_INSTRUCTION_PATTERN = /<skill-instruction>([\s\S]*?)<\/skill-instruction>/;
|
|
138883
138986
|
function trimSkillInstruction(template) {
|
|
138884
138987
|
const templateMatch = template.match(SKILL_INSTRUCTION_PATTERN);
|
|
@@ -138888,7 +138991,7 @@ async function extractSkillBody(skill) {
|
|
|
138888
138991
|
if (skill.path && skillProvenance(skill.path, skill.scope, skill.provenance).kind === "project-auto") {
|
|
138889
138992
|
try {
|
|
138890
138993
|
const body = parseFrontmatter(readSkillFileChecked(skill.path, skillProvenance(skill.path, skill.scope, skill.provenance))).body.trim();
|
|
138891
|
-
return resolveSkillPathReferences(body, skill.resolvedPath ??
|
|
138994
|
+
return resolveSkillPathReferences(body, skill.resolvedPath ?? dirname47(skill.path));
|
|
138892
138995
|
} catch (error) {
|
|
138893
138996
|
reportSkillLoadError(error, skill.path);
|
|
138894
138997
|
throw error;
|
|
@@ -138908,7 +139011,7 @@ async function extractSkillBody(skill) {
|
|
|
138908
139011
|
}
|
|
138909
139012
|
// packages/omo-opencode/src/tools/skill/native-skills.ts
|
|
138910
139013
|
init_src();
|
|
138911
|
-
import { dirname as
|
|
139014
|
+
import { dirname as dirname48, join as join121 } from "path";
|
|
138912
139015
|
import { existsSync as existsSync93 } from "fs";
|
|
138913
139016
|
function loadedSkillToInfo(skill) {
|
|
138914
139017
|
return {
|
|
@@ -138955,13 +139058,13 @@ function nativeSkillToLoadedSkill(native, directory = process.cwd()) {
|
|
|
138955
139058
|
});
|
|
138956
139059
|
const checked = provenance.kind === "project-auto" ? readSkillFileChecked(native.location, provenance) : undefined;
|
|
138957
139060
|
const raw = checked ?? (provenance.kind !== "builtin" && existsSync93(native.location) ? readHostSkillFile(native, provenance) : native.content);
|
|
138958
|
-
const sidecar = provenance.kind === "builtin" ? undefined : readMcpJsonFromDirChecked(
|
|
139061
|
+
const sidecar = provenance.kind === "builtin" ? undefined : readMcpJsonFromDirChecked(dirname48(native.location), provenance);
|
|
138959
139062
|
return {
|
|
138960
139063
|
name: native.name,
|
|
138961
139064
|
path: provenance.kind === "builtin" ? undefined : native.location,
|
|
138962
139065
|
provenance,
|
|
138963
139066
|
mcpConfig: sidecar ?? parseSkillMcpConfigFromFrontmatter(raw),
|
|
138964
|
-
mcpSourcePath: sidecar ?
|
|
139067
|
+
mcpSourcePath: sidecar ? join121(dirname48(native.location), "mcp.json") : native.location,
|
|
138965
139068
|
definition: {
|
|
138966
139069
|
name: native.name,
|
|
138967
139070
|
description: native.description,
|
|
@@ -139176,7 +139279,7 @@ function createSkillTool(options) {
|
|
|
139176
139279
|
if (matchedSkill.name === "git-master") {
|
|
139177
139280
|
body = injectGitMasterConfig2(body, options.gitMasterConfig);
|
|
139178
139281
|
}
|
|
139179
|
-
const dir = matchedSkill.path ?
|
|
139282
|
+
const dir = matchedSkill.path ? dirname49(matchedSkill.path) : matchedSkill.resolvedPath || process.cwd();
|
|
139180
139283
|
const output = [
|
|
139181
139284
|
`## Skill: ${matchedSkill.name}`,
|
|
139182
139285
|
"",
|
|
@@ -143743,9 +143846,9 @@ function createOpencodeClient2(config) {
|
|
|
143743
143846
|
}
|
|
143744
143847
|
|
|
143745
143848
|
// packages/omo-opencode/src/tools/session-manager/constants.ts
|
|
143746
|
-
import { join as
|
|
143747
|
-
var TODO_DIR2 =
|
|
143748
|
-
var TRANSCRIPT_DIR2 =
|
|
143849
|
+
import { join as join122 } from "path";
|
|
143850
|
+
var TODO_DIR2 = join122(getClaudeConfigDir(), "todos");
|
|
143851
|
+
var TRANSCRIPT_DIR2 = join122(getClaudeConfigDir(), "transcripts");
|
|
143749
143852
|
var SESSION_LIST_DESCRIPTION = `List all OpenCode sessions with optional filtering.
|
|
143750
143853
|
|
|
143751
143854
|
Returns a list of available session IDs with metadata including message count, date range, and agents used.
|
|
@@ -143819,8 +143922,8 @@ Has Transcript: Yes (234 entries)`;
|
|
|
143819
143922
|
|
|
143820
143923
|
// packages/omo-opencode/src/tools/session-manager/file-storage.ts
|
|
143821
143924
|
import { existsSync as existsSync94 } from "fs";
|
|
143822
|
-
import { readdir as
|
|
143823
|
-
import { join as
|
|
143925
|
+
import { readdir as readdir8, readFile as readFile8 } from "fs/promises";
|
|
143926
|
+
import { join as join123 } from "path";
|
|
143824
143927
|
|
|
143825
143928
|
// packages/omo-opencode/src/tools/session-manager/directory-filter.ts
|
|
143826
143929
|
import { normalize as normalize4, parse as parse4, sep as sep7 } from "path";
|
|
@@ -143848,17 +143951,17 @@ async function getFileMainSessions(directory) {
|
|
|
143848
143951
|
return [];
|
|
143849
143952
|
const sessions = [];
|
|
143850
143953
|
try {
|
|
143851
|
-
const projectDirs = await
|
|
143954
|
+
const projectDirs = await readdir8(SESSION_STORAGE, { withFileTypes: true });
|
|
143852
143955
|
for (const projectDir of projectDirs) {
|
|
143853
143956
|
if (!projectDir.isDirectory())
|
|
143854
143957
|
continue;
|
|
143855
|
-
const projectPath =
|
|
143856
|
-
const sessionFiles = await
|
|
143958
|
+
const projectPath = join123(SESSION_STORAGE, projectDir.name);
|
|
143959
|
+
const sessionFiles = await readdir8(projectPath);
|
|
143857
143960
|
for (const file of sessionFiles) {
|
|
143858
143961
|
if (!file.endsWith(".json"))
|
|
143859
143962
|
continue;
|
|
143860
143963
|
try {
|
|
143861
|
-
const content = await
|
|
143964
|
+
const content = await readFile8(join123(projectPath, file), "utf-8");
|
|
143862
143965
|
const meta = JSON.parse(content);
|
|
143863
143966
|
if (meta.parentID)
|
|
143864
143967
|
continue;
|
|
@@ -143883,12 +143986,12 @@ async function getFileAllSessions() {
|
|
|
143883
143986
|
const sessions = [];
|
|
143884
143987
|
async function scanDirectory(dir) {
|
|
143885
143988
|
try {
|
|
143886
|
-
const entries = await
|
|
143989
|
+
const entries = await readdir8(dir, { withFileTypes: true });
|
|
143887
143990
|
for (const entry of entries) {
|
|
143888
143991
|
if (!entry.isDirectory())
|
|
143889
143992
|
continue;
|
|
143890
|
-
const sessionPath =
|
|
143891
|
-
const files = await
|
|
143993
|
+
const sessionPath = join123(dir, entry.name);
|
|
143994
|
+
const files = await readdir8(sessionPath);
|
|
143892
143995
|
if (files.some((file) => file.endsWith(".json"))) {
|
|
143893
143996
|
sessions.push(entry.name);
|
|
143894
143997
|
continue;
|
|
@@ -143912,13 +144015,13 @@ async function getFileSessionMessageMetas(sessionID, signal) {
|
|
|
143912
144015
|
return [];
|
|
143913
144016
|
const metas = [];
|
|
143914
144017
|
try {
|
|
143915
|
-
const files = await
|
|
144018
|
+
const files = await readdir8(messageDir);
|
|
143916
144019
|
for (const file of files) {
|
|
143917
144020
|
if (!file.endsWith(".json"))
|
|
143918
144021
|
continue;
|
|
143919
144022
|
signal?.throwIfAborted();
|
|
143920
144023
|
try {
|
|
143921
|
-
const content = await
|
|
144024
|
+
const content = await readFile8(join123(messageDir, file), "utf-8");
|
|
143922
144025
|
const meta = JSON.parse(content);
|
|
143923
144026
|
metas.push({
|
|
143924
144027
|
id: meta.id,
|
|
@@ -143968,17 +144071,17 @@ async function forEachFileSessionMessagePage(sessionID, visit, options) {
|
|
|
143968
144071
|
}
|
|
143969
144072
|
}
|
|
143970
144073
|
async function readParts2(messageID) {
|
|
143971
|
-
const partDir =
|
|
144074
|
+
const partDir = join123(PART_STORAGE, messageID);
|
|
143972
144075
|
if (!existsSync94(partDir))
|
|
143973
144076
|
return [];
|
|
143974
144077
|
const parts = [];
|
|
143975
144078
|
try {
|
|
143976
|
-
const files = await
|
|
144079
|
+
const files = await readdir8(partDir);
|
|
143977
144080
|
for (const file of files) {
|
|
143978
144081
|
if (!file.endsWith(".json"))
|
|
143979
144082
|
continue;
|
|
143980
144083
|
try {
|
|
143981
|
-
const content = await
|
|
144084
|
+
const content = await readFile8(join123(partDir, file), "utf-8");
|
|
143982
144085
|
parts.push(JSON.parse(content));
|
|
143983
144086
|
} catch (error) {
|
|
143984
144087
|
ignoreFileStorageError(error);
|
|
@@ -143995,11 +144098,11 @@ async function getFileSessionTodos(sessionID) {
|
|
|
143995
144098
|
if (!existsSync94(TODO_DIR2))
|
|
143996
144099
|
return [];
|
|
143997
144100
|
try {
|
|
143998
|
-
const allFiles = await
|
|
144101
|
+
const allFiles = await readdir8(TODO_DIR2);
|
|
143999
144102
|
const todoFiles = allFiles.filter((file) => file === `${sessionID}.json`);
|
|
144000
144103
|
for (const file of todoFiles) {
|
|
144001
144104
|
try {
|
|
144002
|
-
const content = await
|
|
144105
|
+
const content = await readFile8(join123(TODO_DIR2, file), "utf-8");
|
|
144003
144106
|
const data = JSON.parse(content);
|
|
144004
144107
|
if (!Array.isArray(data))
|
|
144005
144108
|
continue;
|
|
@@ -144023,11 +144126,11 @@ async function getFileSessionTodos(sessionID) {
|
|
|
144023
144126
|
async function getFileSessionTranscript(sessionID) {
|
|
144024
144127
|
if (!existsSync94(TRANSCRIPT_DIR2))
|
|
144025
144128
|
return 0;
|
|
144026
|
-
const transcriptFile =
|
|
144129
|
+
const transcriptFile = join123(TRANSCRIPT_DIR2, `${sessionID}.jsonl`);
|
|
144027
144130
|
if (!existsSync94(transcriptFile))
|
|
144028
144131
|
return 0;
|
|
144029
144132
|
try {
|
|
144030
|
-
const content = await
|
|
144133
|
+
const content = await readFile8(transcriptFile, "utf-8");
|
|
144031
144134
|
return content.trim().split(`
|
|
144032
144135
|
`).filter(Boolean).length;
|
|
144033
144136
|
} catch (error) {
|
|
@@ -146122,22 +146225,22 @@ Other built-in agents, custom agents, and task categories are intentionally not
|
|
|
146122
146225
|
Pass \`session_id=<id>\` to continue previous agent with full context. Nested subagent depth is tracked automatically and blocked past the configured limit. Prompts MUST be in English. Use \`background_output\` for async results.`;
|
|
146123
146226
|
// packages/claude-code-compat-core/src/features/claude-code-agent-loader/loader.ts
|
|
146124
146227
|
import { existsSync as existsSync99, readdirSync as readdirSync29 } from "fs";
|
|
146125
|
-
import { join as
|
|
146228
|
+
import { join as join129 } from "path";
|
|
146126
146229
|
|
|
146127
146230
|
// packages/claude-code-compat-core/src/shared/claude-config-dir.ts
|
|
146128
146231
|
import { homedir as homedir24 } from "os";
|
|
146129
|
-
import { join as
|
|
146232
|
+
import { join as join124 } from "path";
|
|
146130
146233
|
function getClaudeConfigDir3() {
|
|
146131
146234
|
const envConfigDir = process.env.CLAUDE_CONFIG_DIR;
|
|
146132
146235
|
if (envConfigDir) {
|
|
146133
146236
|
return envConfigDir;
|
|
146134
146237
|
}
|
|
146135
|
-
return
|
|
146238
|
+
return join124(process.env.HOME || process.env.USERPROFILE || homedir24(), ".claude");
|
|
146136
146239
|
}
|
|
146137
146240
|
// packages/claude-code-compat-core/src/shared/opencode-config-dir.ts
|
|
146138
146241
|
import { existsSync as existsSync95, realpathSync as realpathSync25 } from "fs";
|
|
146139
146242
|
import { homedir as homedir25 } from "os";
|
|
146140
|
-
import { join as
|
|
146243
|
+
import { join as join125, posix as posix10, resolve as resolve32, win32 as win3211 } from "path";
|
|
146141
146244
|
var TAURI_APP_IDENTIFIER3 = "ai.opencode.desktop";
|
|
146142
146245
|
var TAURI_APP_IDENTIFIER_DEV3 = "ai.opencode.desktop.dev";
|
|
146143
146246
|
function isDevBuild3(version) {
|
|
@@ -146149,15 +146252,15 @@ function getTauriConfigDir3(identifier) {
|
|
|
146149
146252
|
const platform = process.platform;
|
|
146150
146253
|
switch (platform) {
|
|
146151
146254
|
case "darwin":
|
|
146152
|
-
return
|
|
146255
|
+
return join125(homedir25(), "Library", "Application Support", identifier);
|
|
146153
146256
|
case "win32": {
|
|
146154
|
-
const appData = process.env.APPDATA ||
|
|
146257
|
+
const appData = process.env.APPDATA || join125(homedir25(), "AppData", "Roaming");
|
|
146155
146258
|
return win3211.join(appData, identifier);
|
|
146156
146259
|
}
|
|
146157
146260
|
case "linux":
|
|
146158
146261
|
default: {
|
|
146159
|
-
const xdgConfig = process.env.XDG_CONFIG_HOME ||
|
|
146160
|
-
return
|
|
146262
|
+
const xdgConfig = process.env.XDG_CONFIG_HOME || join125(homedir25(), ".config");
|
|
146263
|
+
return join125(xdgConfig, identifier);
|
|
146161
146264
|
}
|
|
146162
146265
|
}
|
|
146163
146266
|
}
|
|
@@ -146200,8 +146303,8 @@ function getWslLinuxHomeDir3(windowsConfigRoot) {
|
|
|
146200
146303
|
function getCliDefaultConfigDir3() {
|
|
146201
146304
|
const envXdgConfig = process.env.XDG_CONFIG_HOME?.trim();
|
|
146202
146305
|
const shouldIgnoreWindowsXdg = envXdgConfig !== undefined && envXdgConfig.length > 0 && isWslEnvironment3() && isWindowsUserConfigRoot3(envXdgConfig);
|
|
146203
|
-
const xdgConfig = shouldIgnoreWindowsXdg ? posix10.join(getWslLinuxHomeDir3(envXdgConfig) ?? "/home", ".config") : envXdgConfig ||
|
|
146204
|
-
const configDir = isWslEnvironment3() ? posix10.join(xdgConfig, "opencode") :
|
|
146306
|
+
const xdgConfig = shouldIgnoreWindowsXdg ? posix10.join(getWslLinuxHomeDir3(envXdgConfig) ?? "/home", ".config") : envXdgConfig || join125(homedir25(), ".config");
|
|
146307
|
+
const configDir = isWslEnvironment3() ? posix10.join(xdgConfig, "opencode") : join125(xdgConfig, "opencode");
|
|
146205
146308
|
return resolveConfigPath3(configDir);
|
|
146206
146309
|
}
|
|
146207
146310
|
function getCliCustomConfigDir3() {
|
|
@@ -146234,8 +146337,8 @@ function getOpenCodeConfigDir3(options) {
|
|
|
146234
146337
|
const tauriDir = process.platform === "win32" ? win3211.isAbsolute(tauriDirBase) ? win3211.normalize(tauriDirBase) : win3211.resolve(tauriDirBase) : resolveConfigPath3(tauriDirBase);
|
|
146235
146338
|
if (checkExisting) {
|
|
146236
146339
|
const legacyDir = getCliConfigDir3();
|
|
146237
|
-
const legacyConfig =
|
|
146238
|
-
const legacyConfigC =
|
|
146340
|
+
const legacyConfig = join125(legacyDir, "opencode.json");
|
|
146341
|
+
const legacyConfigC = join125(legacyDir, "opencode.jsonc");
|
|
146239
146342
|
if (existsSync95(legacyConfig) || existsSync95(legacyConfigC)) {
|
|
146240
146343
|
return legacyDir;
|
|
146241
146344
|
}
|
|
@@ -146246,10 +146349,10 @@ function getOpenCodeConfigDir3(options) {
|
|
|
146246
146349
|
init_src();
|
|
146247
146350
|
// packages/claude-code-compat-core/src/shared/resolve-agent-definition-paths.ts
|
|
146248
146351
|
import { homedir as homedir26 } from "os";
|
|
146249
|
-
import { isAbsolute as isAbsolute19, join as
|
|
146352
|
+
import { isAbsolute as isAbsolute19, join as join126, resolve as resolve33 } from "path";
|
|
146250
146353
|
function resolveAgentDefinitionPaths(paths, baseDir, containmentDir) {
|
|
146251
146354
|
return paths.flatMap((p) => {
|
|
146252
|
-
const expanded = p.startsWith("~/") ?
|
|
146355
|
+
const expanded = p.startsWith("~/") ? join126(homedir26(), p.slice(2)) : p;
|
|
146253
146356
|
const resolved = isAbsolute19(expanded) ? expanded : resolve33(baseDir, expanded);
|
|
146254
146357
|
if (containmentDir !== null && !isWithinProject(resolved, containmentDir)) {
|
|
146255
146358
|
log4(`agent_definitions path rejected (outside project boundary): ${p} -> ${resolved}`);
|
|
@@ -146277,13 +146380,13 @@ var EXCLUDED_DIR_NAMES2 = [
|
|
|
146277
146380
|
];
|
|
146278
146381
|
var EXCLUDED_DIRS3 = Object.freeze(new Set(EXCLUDED_DIR_NAMES2));
|
|
146279
146382
|
// packages/claude-code-compat-core/src/shared/opencode-command-dirs.ts
|
|
146280
|
-
import { basename as
|
|
146383
|
+
import { basename as basename21, dirname as dirname50, join as join127 } from "path";
|
|
146281
146384
|
function getParentOpencodeConfigDir3(configDir) {
|
|
146282
|
-
const parentDir =
|
|
146283
|
-
if (
|
|
146385
|
+
const parentDir = dirname50(configDir);
|
|
146386
|
+
if (basename21(parentDir) !== "profiles") {
|
|
146284
146387
|
return null;
|
|
146285
146388
|
}
|
|
146286
|
-
return
|
|
146389
|
+
return dirname50(parentDir);
|
|
146287
146390
|
}
|
|
146288
146391
|
function getOpenCodeCommandDirs2(options) {
|
|
146289
146392
|
const configDirs = getOpenCodeConfigDirs3(options);
|
|
@@ -146291,9 +146394,9 @@ function getOpenCodeCommandDirs2(options) {
|
|
|
146291
146394
|
...configDirs.flatMap((configDir) => {
|
|
146292
146395
|
const parentConfigDir = getParentOpencodeConfigDir3(configDir);
|
|
146293
146396
|
return [
|
|
146294
|
-
|
|
146295
|
-
|
|
146296
|
-
...parentConfigDir ? [
|
|
146397
|
+
join127(configDir, "commands"),
|
|
146398
|
+
join127(configDir, "command"),
|
|
146399
|
+
...parentConfigDir ? [join127(parentConfigDir, "commands"), join127(parentConfigDir, "command")] : []
|
|
146297
146400
|
];
|
|
146298
146401
|
})
|
|
146299
146402
|
]));
|
|
@@ -146301,7 +146404,7 @@ function getOpenCodeCommandDirs2(options) {
|
|
|
146301
146404
|
// packages/claude-code-compat-core/src/shared/project-discovery-dirs.ts
|
|
146302
146405
|
import { execFileSync as execFileSync6 } from "child_process";
|
|
146303
146406
|
import { existsSync as existsSync96, realpathSync as realpathSync26 } from "fs";
|
|
146304
|
-
import { dirname as
|
|
146407
|
+
import { dirname as dirname51, join as join128, resolve as resolve34, win32 as win3212 } from "path";
|
|
146305
146408
|
var worktreePathCache3 = new Map;
|
|
146306
146409
|
function normalizePath6(path) {
|
|
146307
146410
|
const resolvedPath = process.platform !== "win32" && win3212.isAbsolute(path) ? path : resolve34(path);
|
|
@@ -146360,10 +146463,10 @@ function detectWorktreePath4(directory) {
|
|
|
146360
146463
|
function findGitMarkerAncestor(directory) {
|
|
146361
146464
|
let currentDirectory = normalizePath6(directory);
|
|
146362
146465
|
while (true) {
|
|
146363
|
-
if (existsSync96(
|
|
146466
|
+
if (existsSync96(join128(currentDirectory, ".git"))) {
|
|
146364
146467
|
return currentDirectory;
|
|
146365
146468
|
}
|
|
146366
|
-
const parentDirectory =
|
|
146469
|
+
const parentDirectory = dirname51(currentDirectory);
|
|
146367
146470
|
if (parentDirectory === currentDirectory) {
|
|
146368
146471
|
return;
|
|
146369
146472
|
}
|
|
@@ -146378,7 +146481,7 @@ function findAncestorDirectories3(startDirectory, targetPaths, stopDirectory) {
|
|
|
146378
146481
|
const stopDirectoryKey = resolvedStopDirectory ? pathKey4(resolvedStopDirectory) : undefined;
|
|
146379
146482
|
while (true) {
|
|
146380
146483
|
for (const targetPath of targetPaths) {
|
|
146381
|
-
const candidateDirectory =
|
|
146484
|
+
const candidateDirectory = join128(currentDirectory, ...targetPath);
|
|
146382
146485
|
if (!existsSync96(candidateDirectory)) {
|
|
146383
146486
|
continue;
|
|
146384
146487
|
}
|
|
@@ -146393,7 +146496,7 @@ function findAncestorDirectories3(startDirectory, targetPaths, stopDirectory) {
|
|
|
146393
146496
|
if (stopDirectoryKey === pathKey4(currentDirectory)) {
|
|
146394
146497
|
return directories;
|
|
146395
146498
|
}
|
|
146396
|
-
const parentDirectory =
|
|
146499
|
+
const parentDirectory = dirname51(currentDirectory);
|
|
146397
146500
|
if (parentDirectory === currentDirectory) {
|
|
146398
146501
|
return directories;
|
|
146399
146502
|
}
|
|
@@ -146409,7 +146512,7 @@ function findProjectOpencodeCommandDirs2(startDirectory, stopDirectory) {
|
|
|
146409
146512
|
}
|
|
146410
146513
|
// packages/claude-code-compat-core/src/features/claude-code-agent-loader/agent-definitions-loader.ts
|
|
146411
146514
|
import { existsSync as existsSync98, readFileSync as readFileSync63 } from "fs";
|
|
146412
|
-
import { basename as
|
|
146515
|
+
import { basename as basename22, extname as extname3 } from "path";
|
|
146413
146516
|
|
|
146414
146517
|
// packages/claude-code-compat-core/src/features/claude-code-agent-loader/json-agent-loader.ts
|
|
146415
146518
|
import { existsSync as existsSync97, readFileSync as readFileSync62 } from "fs";
|
|
@@ -146461,7 +146564,7 @@ function parseMarkdownAgentFile(filePath, scope, anthropicProvider) {
|
|
|
146461
146564
|
}
|
|
146462
146565
|
const content = readFileSync63(filePath, "utf-8");
|
|
146463
146566
|
const { data, body } = parseFrontmatter(content);
|
|
146464
|
-
const fileName =
|
|
146567
|
+
const fileName = basename22(filePath);
|
|
146465
146568
|
const agentName = fileName.replace(/\.md$/i, "");
|
|
146466
146569
|
const name = data.name || agentName;
|
|
146467
146570
|
const originalDescription = data.description || "";
|
|
@@ -146526,7 +146629,7 @@ function loadAgentsFromDir(agentsDir, scope, anthropicProvider) {
|
|
|
146526
146629
|
for (const entry of entries) {
|
|
146527
146630
|
if (!isMarkdownFile(entry))
|
|
146528
146631
|
continue;
|
|
146529
|
-
const agentPath =
|
|
146632
|
+
const agentPath = join129(agentsDir, entry.name);
|
|
146530
146633
|
const agent = parseMarkdownAgentFile(agentPath, scope, anthropicProvider);
|
|
146531
146634
|
if (agent) {
|
|
146532
146635
|
agents.push(agent);
|
|
@@ -146535,7 +146638,7 @@ function loadAgentsFromDir(agentsDir, scope, anthropicProvider) {
|
|
|
146535
146638
|
return agents;
|
|
146536
146639
|
}
|
|
146537
146640
|
function loadUserAgents(anthropicProvider) {
|
|
146538
|
-
const userAgentsDir =
|
|
146641
|
+
const userAgentsDir = join129(getClaudeConfigDir3(), "agents");
|
|
146539
146642
|
const agents = loadAgentsFromDir(userAgentsDir, "user", anthropicProvider);
|
|
146540
146643
|
const result = Object.create(null);
|
|
146541
146644
|
for (const agent of agents) {
|
|
@@ -146544,7 +146647,7 @@ function loadUserAgents(anthropicProvider) {
|
|
|
146544
146647
|
return result;
|
|
146545
146648
|
}
|
|
146546
146649
|
function loadProjectAgents(directory, anthropicProvider) {
|
|
146547
|
-
const projectAgentsDir =
|
|
146650
|
+
const projectAgentsDir = join129(directory ?? process.cwd(), ".claude", "agents");
|
|
146548
146651
|
const agents = loadAgentsFromDir(projectAgentsDir, "project", anthropicProvider);
|
|
146549
146652
|
const result = Object.create(null);
|
|
146550
146653
|
for (const agent of agents) {
|
|
@@ -146556,7 +146659,7 @@ function loadOpencodeGlobalAgents() {
|
|
|
146556
146659
|
const result = Object.create(null);
|
|
146557
146660
|
const configDirs = getOpenCodeConfigDirs3({ binary: "opencode" });
|
|
146558
146661
|
for (const configDir of configDirs) {
|
|
146559
|
-
const opencodeAgentsDir =
|
|
146662
|
+
const opencodeAgentsDir = join129(configDir, "agents");
|
|
146560
146663
|
const agents = loadAgentsFromDir(opencodeAgentsDir, "opencode");
|
|
146561
146664
|
for (const agent of agents) {
|
|
146562
146665
|
if (!(agent.name in result)) {
|
|
@@ -146567,7 +146670,7 @@ function loadOpencodeGlobalAgents() {
|
|
|
146567
146670
|
return result;
|
|
146568
146671
|
}
|
|
146569
146672
|
function loadOpencodeProjectAgents(directory) {
|
|
146570
|
-
const opencodeProjectDir =
|
|
146673
|
+
const opencodeProjectDir = join129(directory ?? process.cwd(), ".opencode", "agents");
|
|
146571
146674
|
const agents = loadAgentsFromDir(opencodeProjectDir, "opencode-project");
|
|
146572
146675
|
const result = Object.create(null);
|
|
146573
146676
|
for (const agent of agents) {
|
|
@@ -147391,14 +147494,14 @@ function validateArgs(args) {
|
|
|
147391
147494
|
|
|
147392
147495
|
// packages/omo-opencode/src/tools/look-at/look-at-input-preparer.ts
|
|
147393
147496
|
import { readFileSync as readFileSync66 } from "fs";
|
|
147394
|
-
import { basename as
|
|
147497
|
+
import { basename as basename23 } from "path";
|
|
147395
147498
|
import { pathToFileURL } from "url";
|
|
147396
147499
|
|
|
147397
147500
|
// packages/omo-opencode/src/tools/look-at/image-converter.ts
|
|
147398
147501
|
import * as childProcess2 from "child_process";
|
|
147399
147502
|
import { existsSync as existsSync101, mkdtempSync as mkdtempSync2, readFileSync as readFileSync65, rmSync as rmSync7, unlinkSync as unlinkSync17, writeFileSync as writeFileSync28 } from "fs";
|
|
147400
147503
|
import { tmpdir as tmpdir8 } from "os";
|
|
147401
|
-
import { dirname as
|
|
147504
|
+
import { dirname as dirname53, join as join131 } from "path";
|
|
147402
147505
|
var SUPPORTED_FORMATS = new Set([
|
|
147403
147506
|
"image/jpeg",
|
|
147404
147507
|
"image/png",
|
|
@@ -147449,8 +147552,8 @@ function convertImageToJpeg(inputPath, mimeType) {
|
|
|
147449
147552
|
if (!existsSync101(inputPath)) {
|
|
147450
147553
|
throw new Error(`File not found: ${inputPath}`);
|
|
147451
147554
|
}
|
|
147452
|
-
const tempDir = mkdtempSync2(
|
|
147453
|
-
const outputPath =
|
|
147555
|
+
const tempDir = mkdtempSync2(join131(tmpdir8(), "opencode-img-"));
|
|
147556
|
+
const outputPath = join131(tempDir, "converted.jpg");
|
|
147454
147557
|
log2(`[image-converter] Converting ${mimeType} to JPEG: ${inputPath}`);
|
|
147455
147558
|
try {
|
|
147456
147559
|
if (process.platform === "darwin") {
|
|
@@ -147499,7 +147602,7 @@ function convertImageToJpeg(inputPath, mimeType) {
|
|
|
147499
147602
|
}
|
|
147500
147603
|
function cleanupConvertedImage(filePath) {
|
|
147501
147604
|
try {
|
|
147502
|
-
const tempDirectory =
|
|
147605
|
+
const tempDirectory = dirname53(filePath);
|
|
147503
147606
|
if (existsSync101(filePath)) {
|
|
147504
147607
|
unlinkSync17(filePath);
|
|
147505
147608
|
log2(`[image-converter] Cleaned up temporary file: ${filePath}`);
|
|
@@ -147514,9 +147617,9 @@ function cleanupConvertedImage(filePath) {
|
|
|
147514
147617
|
}
|
|
147515
147618
|
}
|
|
147516
147619
|
function convertBase64ImageToJpeg(base64Data, mimeType) {
|
|
147517
|
-
const tempDir = mkdtempSync2(
|
|
147620
|
+
const tempDir = mkdtempSync2(join131(tmpdir8(), "opencode-b64-"));
|
|
147518
147621
|
const inputExt = mimeType.split("/")[1] || "bin";
|
|
147519
|
-
const inputPath =
|
|
147622
|
+
const inputPath = join131(tempDir, `input.${inputExt}`);
|
|
147520
147623
|
const tempFiles = [inputPath];
|
|
147521
147624
|
try {
|
|
147522
147625
|
const cleanBase64 = base64Data.replace(/^data:[^;]+;base64,/, "");
|
|
@@ -147568,7 +147671,7 @@ function readJsonTextPart(filePath) {
|
|
|
147568
147671
|
ok: true,
|
|
147569
147672
|
value: {
|
|
147570
147673
|
type: "text",
|
|
147571
|
-
text: `Attached JSON file (${
|
|
147674
|
+
text: `Attached JSON file (${basename23(filePath)}):
|
|
147572
147675
|
|
|
147573
147676
|
${fileContent}`
|
|
147574
147677
|
}
|
|
@@ -147632,7 +147735,7 @@ function prepareLookAtInput(args) {
|
|
|
147632
147735
|
type: "file",
|
|
147633
147736
|
mime: mimeType,
|
|
147634
147737
|
url: pathToFileURL(actualFilePath).href,
|
|
147635
|
-
filename:
|
|
147738
|
+
filename: basename23(actualFilePath)
|
|
147636
147739
|
});
|
|
147637
147740
|
}
|
|
147638
147741
|
for (const imageData of imageDataList) {
|
|
@@ -149488,7 +149591,7 @@ Session ID: ${input.sessionID}`;
|
|
|
149488
149591
|
}
|
|
149489
149592
|
|
|
149490
149593
|
// packages/omo-opencode/src/tools/delegate-task/sync-result-fetcher.ts
|
|
149491
|
-
function
|
|
149594
|
+
function escapeRegExp2(value) {
|
|
149492
149595
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
149493
149596
|
}
|
|
149494
149597
|
function messageFinalText(msg) {
|
|
@@ -149496,7 +149599,7 @@ function messageFinalText(msg) {
|
|
|
149496
149599
|
`);
|
|
149497
149600
|
}
|
|
149498
149601
|
function extractTaggedDeliverable(assistantMessages, tag) {
|
|
149499
|
-
const escaped =
|
|
149602
|
+
const escaped = escapeRegExp2(tag);
|
|
149500
149603
|
const pattern = new RegExp(`<${escaped}>([\\s\\S]*?)</${escaped}>`, "gi");
|
|
149501
149604
|
for (const msg of assistantMessages) {
|
|
149502
149605
|
const text = messageFinalText(msg);
|
|
@@ -151925,7 +152028,7 @@ function isExplicitSyncRun(runInBackground) {
|
|
|
151925
152028
|
return runInBackground === false || runInBackground === "false";
|
|
151926
152029
|
}
|
|
151927
152030
|
// packages/omo-opencode/src/tools/task/task-create.ts
|
|
151928
|
-
import { join as
|
|
152031
|
+
import { join as join133 } from "path";
|
|
151929
152032
|
|
|
151930
152033
|
// packages/omo-opencode/src/tools/task/types.ts
|
|
151931
152034
|
import { z as z61 } from "zod";
|
|
@@ -151980,9 +152083,9 @@ var TaskDeleteInputSchema = z61.object({
|
|
|
151980
152083
|
});
|
|
151981
152084
|
|
|
151982
152085
|
// packages/omo-opencode/src/features/claude-tasks/storage.ts
|
|
151983
|
-
import { join as
|
|
152086
|
+
import { join as join132, dirname as dirname54, basename as basename24, isAbsolute as isAbsolute20 } from "path";
|
|
151984
152087
|
import { existsSync as existsSync102, mkdirSync as mkdirSync24, readFileSync as readFileSync67, writeFileSync as writeFileSync29, renameSync as renameSync10, unlinkSync as unlinkSync18, readdirSync as readdirSync30 } from "fs";
|
|
151985
|
-
import { randomUUID as
|
|
152088
|
+
import { randomUUID as randomUUID13 } from "crypto";
|
|
151986
152089
|
function ignoreClaudeTaskStorageError(error) {
|
|
151987
152090
|
if (error instanceof Error)
|
|
151988
152091
|
return;
|
|
@@ -151992,11 +152095,11 @@ function getTaskDir(config = {}) {
|
|
|
151992
152095
|
const tasksConfig = config.sisyphus?.tasks;
|
|
151993
152096
|
const storagePath = tasksConfig?.storage_path;
|
|
151994
152097
|
if (storagePath) {
|
|
151995
|
-
return isAbsolute20(storagePath) ? storagePath :
|
|
152098
|
+
return isAbsolute20(storagePath) ? storagePath : join132(process.cwd(), storagePath);
|
|
151996
152099
|
}
|
|
151997
152100
|
const configDir = getOpenCodeConfigDir({ binary: "opencode" });
|
|
151998
152101
|
const listId = resolveTaskListId(config);
|
|
151999
|
-
return
|
|
152102
|
+
return join132(configDir, "tasks", listId);
|
|
152000
152103
|
}
|
|
152001
152104
|
function sanitizePathSegment(value) {
|
|
152002
152105
|
return value.replace(/[^a-zA-Z0-9_-]/g, "-") || "default";
|
|
@@ -152011,7 +152114,7 @@ function resolveTaskListId(config = {}) {
|
|
|
152011
152114
|
const configId = config.sisyphus?.tasks?.task_list_id?.trim();
|
|
152012
152115
|
if (configId)
|
|
152013
152116
|
return sanitizePathSegment(configId);
|
|
152014
|
-
return sanitizePathSegment(
|
|
152117
|
+
return sanitizePathSegment(basename24(process.cwd()));
|
|
152015
152118
|
}
|
|
152016
152119
|
function ensureDir(dirPath) {
|
|
152017
152120
|
if (!existsSync102(dirPath)) {
|
|
@@ -152036,7 +152139,7 @@ function readJsonSafe(filePath, schema) {
|
|
|
152036
152139
|
}
|
|
152037
152140
|
}
|
|
152038
152141
|
function writeJsonAtomic(filePath, data) {
|
|
152039
|
-
const dir =
|
|
152142
|
+
const dir = dirname54(filePath);
|
|
152040
152143
|
ensureDir(dir);
|
|
152041
152144
|
const tempPath = `${filePath}.tmp.${Date.now()}`;
|
|
152042
152145
|
try {
|
|
@@ -152072,11 +152175,11 @@ function delay6(ms) {
|
|
|
152072
152175
|
});
|
|
152073
152176
|
}
|
|
152074
152177
|
function generateTaskId() {
|
|
152075
|
-
return `T-${
|
|
152178
|
+
return `T-${randomUUID13()}`;
|
|
152076
152179
|
}
|
|
152077
152180
|
async function acquireLock2(dirPath, options = {}) {
|
|
152078
|
-
const lockPath =
|
|
152079
|
-
const lockId =
|
|
152181
|
+
const lockPath = join132(dirPath, ".lock");
|
|
152182
|
+
const lockId = randomUUID13();
|
|
152080
152183
|
const waitTimeoutMs = options.waitTimeoutMs ?? resolveLockWaitTimeoutMs();
|
|
152081
152184
|
const baseRetryDelayMs = options.retryDelayMs ?? DEFAULT_LOCK_RETRY_DELAY_MS;
|
|
152082
152185
|
const createLock = (timestamp) => {
|
|
@@ -152326,7 +152429,7 @@ async function handleCreate(args, config, ctx, context) {
|
|
|
152326
152429
|
threadID: context.sessionID
|
|
152327
152430
|
};
|
|
152328
152431
|
validatedTask = TaskObjectSchema.parse(task);
|
|
152329
|
-
writeJsonAtomic(
|
|
152432
|
+
writeJsonAtomic(join133(taskDir, `${taskId}.json`), validatedTask);
|
|
152330
152433
|
} finally {
|
|
152331
152434
|
lock.release();
|
|
152332
152435
|
}
|
|
@@ -152348,7 +152451,7 @@ async function handleCreate(args, config, ctx, context) {
|
|
|
152348
152451
|
}
|
|
152349
152452
|
}
|
|
152350
152453
|
// packages/omo-opencode/src/tools/task/task-get.ts
|
|
152351
|
-
import { join as
|
|
152454
|
+
import { join as join134 } from "path";
|
|
152352
152455
|
var TASK_ID_PATTERN = /^T-[A-Za-z0-9-]+$/;
|
|
152353
152456
|
function parseTaskId(id) {
|
|
152354
152457
|
if (!TASK_ID_PATTERN.test(id))
|
|
@@ -152373,7 +152476,7 @@ Returns null if the task does not exist or the file is invalid.`,
|
|
|
152373
152476
|
return JSON.stringify({ error: "invalid_task_id" });
|
|
152374
152477
|
}
|
|
152375
152478
|
const taskDir = getTaskDir(config);
|
|
152376
|
-
const taskPath =
|
|
152479
|
+
const taskPath = join134(taskDir, `${taskId}.json`);
|
|
152377
152480
|
const task = readJsonSafe(taskPath, TaskObjectSchema);
|
|
152378
152481
|
return JSON.stringify({ task: task ?? null });
|
|
152379
152482
|
} catch (error) {
|
|
@@ -152386,7 +152489,7 @@ Returns null if the task does not exist or the file is invalid.`,
|
|
|
152386
152489
|
});
|
|
152387
152490
|
}
|
|
152388
152491
|
// packages/omo-opencode/src/tools/task/task-list.ts
|
|
152389
|
-
import { join as
|
|
152492
|
+
import { join as join135 } from "path";
|
|
152390
152493
|
import { existsSync as existsSync103, readdirSync as readdirSync31 } from "fs";
|
|
152391
152494
|
function createTaskList(config) {
|
|
152392
152495
|
return tool({
|
|
@@ -152407,7 +152510,7 @@ Returns summary format: id, subject, status, owner, blockedBy (not full descript
|
|
|
152407
152510
|
}
|
|
152408
152511
|
const allTasks = [];
|
|
152409
152512
|
for (const fileId of files) {
|
|
152410
|
-
const task = readJsonSafe(
|
|
152513
|
+
const task = readJsonSafe(join135(taskDir, `${fileId}.json`), TaskObjectSchema);
|
|
152411
152514
|
if (task) {
|
|
152412
152515
|
allTasks.push(task);
|
|
152413
152516
|
}
|
|
@@ -152435,7 +152538,7 @@ Returns summary format: id, subject, status, owner, blockedBy (not full descript
|
|
|
152435
152538
|
});
|
|
152436
152539
|
}
|
|
152437
152540
|
// packages/omo-opencode/src/tools/task/task-update.ts
|
|
152438
|
-
import { join as
|
|
152541
|
+
import { join as join136 } from "path";
|
|
152439
152542
|
var TASK_ID_PATTERN2 = /^T-[A-Za-z0-9-]+$/;
|
|
152440
152543
|
function parseTaskId2(id) {
|
|
152441
152544
|
if (!TASK_ID_PATTERN2.test(id))
|
|
@@ -152522,7 +152625,7 @@ async function handleUpdate(args, config, ctx, context) {
|
|
|
152522
152625
|
}
|
|
152523
152626
|
let updatedTask = null;
|
|
152524
152627
|
try {
|
|
152525
|
-
updatedTask = applyTaskUpdate(
|
|
152628
|
+
updatedTask = applyTaskUpdate(join136(taskDir, `${taskId}.json`), validatedArgs);
|
|
152526
152629
|
} finally {
|
|
152527
152630
|
lock.release();
|
|
152528
152631
|
}
|
|
@@ -152875,7 +152978,7 @@ function createHashlineEditTool(ctx) {
|
|
|
152875
152978
|
});
|
|
152876
152979
|
}
|
|
152877
152980
|
// packages/omo-opencode/src/features/team-mode/tools/messaging.ts
|
|
152878
|
-
import { randomUUID as
|
|
152981
|
+
import { randomUUID as randomUUID14 } from "crypto";
|
|
152879
152982
|
init_logger2();
|
|
152880
152983
|
import { z as z62 } from "zod";
|
|
152881
152984
|
|
|
@@ -152884,7 +152987,7 @@ init_paths();
|
|
|
152884
152987
|
init_store();
|
|
152885
152988
|
init_locks();
|
|
152886
152989
|
import { Buffer as Buffer2 } from "buffer";
|
|
152887
|
-
import { mkdir as mkdir6, readdir as
|
|
152990
|
+
import { mkdir as mkdir6, readdir as readdir9, stat as stat9 } from "fs/promises";
|
|
152888
152991
|
import path22 from "path";
|
|
152889
152992
|
|
|
152890
152993
|
class BroadcastNotPermittedError extends Error {
|
|
@@ -152959,7 +153062,7 @@ function resolveRecipients(message, context) {
|
|
|
152959
153062
|
}
|
|
152960
153063
|
async function getUnreadSizeBytes(inboxDir) {
|
|
152961
153064
|
try {
|
|
152962
|
-
const directoryEntries = await
|
|
153065
|
+
const directoryEntries = await readdir9(inboxDir, { withFileTypes: true });
|
|
152963
153066
|
const unreadEntries = directoryEntries.filter((entry) => {
|
|
152964
153067
|
if (!entry.isFile() || !entry.name.endsWith(".json"))
|
|
152965
153068
|
return false;
|
|
@@ -153497,7 +153600,7 @@ function createTeamSendMessageTool(config, client, deps = defaultTeamSendMessage
|
|
|
153497
153600
|
const teamRuntime = await resolveTeamRuntimeDetails(args.teamRunId, sessionID, config, deps);
|
|
153498
153601
|
const message = MessageSchema.parse({
|
|
153499
153602
|
version: 1,
|
|
153500
|
-
messageId:
|
|
153603
|
+
messageId: randomUUID14(),
|
|
153501
153604
|
from: teamRuntime.senderName,
|
|
153502
153605
|
to: args.to,
|
|
153503
153606
|
body: args.body,
|
|
@@ -154398,7 +154501,7 @@ function createHooks(args) {
|
|
|
154398
154501
|
};
|
|
154399
154502
|
}
|
|
154400
154503
|
// packages/omo-opencode/src/features/background-agent/manager.ts
|
|
154401
|
-
import { join as
|
|
154504
|
+
import { join as join138 } from "path";
|
|
154402
154505
|
|
|
154403
154506
|
// packages/omo-opencode/src/features/background-agent/abort-with-timeout.ts
|
|
154404
154507
|
function getAbortResponseError(response) {
|
|
@@ -154687,7 +154790,7 @@ function writeBackgroundTaskMarker(input) {
|
|
|
154687
154790
|
|
|
154688
154791
|
// packages/omo-opencode/src/features/background-agent/compaction-aware-message-resolver.ts
|
|
154689
154792
|
import { readdirSync as readdirSync32, readFileSync as readFileSync68 } from "fs";
|
|
154690
|
-
import { join as
|
|
154793
|
+
import { join as join137 } from "path";
|
|
154691
154794
|
function hasFullAgentAndModel(message) {
|
|
154692
154795
|
return !!message.agent && !isCompactionAgent(message.agent) && !!message.model?.providerID && !!message.model?.modelID;
|
|
154693
154796
|
}
|
|
@@ -154771,7 +154874,7 @@ function findNearestMessageExcludingCompaction(messageDir, sessionID) {
|
|
|
154771
154874
|
const messages = [];
|
|
154772
154875
|
for (const file of files) {
|
|
154773
154876
|
try {
|
|
154774
|
-
const content = readFileSync68(
|
|
154877
|
+
const content = readFileSync68(join137(messageDir, file), "utf-8");
|
|
154775
154878
|
const parsed = JSON.parse(content);
|
|
154776
154879
|
if (hasCompactionPartInStorage(parsed.id) || isCompactionAgent(parsed.agent)) {
|
|
154777
154880
|
continue;
|
|
@@ -159746,7 +159849,7 @@ The task was re-queued on a fallback model after a retryable failure.
|
|
|
159746
159849
|
parentSessionID: task.parentSessionId
|
|
159747
159850
|
});
|
|
159748
159851
|
}
|
|
159749
|
-
const messageDir =
|
|
159852
|
+
const messageDir = join138(MESSAGE_STORAGE, task.parentSessionId);
|
|
159750
159853
|
const currentMessage = messageDir ? findNearestMessageExcludingCompaction(messageDir, task.parentSessionId) : null;
|
|
159751
159854
|
agent = currentMessage?.agent ?? task.parentAgent;
|
|
159752
159855
|
model = currentMessage?.model?.providerID && currentMessage?.model?.modelID ? { providerID: currentMessage.model.providerID, modelID: currentMessage.model.modelID } : undefined;
|
|
@@ -161465,12 +161568,12 @@ import {
|
|
|
161465
161568
|
unlinkSync as unlinkSync19,
|
|
161466
161569
|
writeFileSync as writeFileSync31
|
|
161467
161570
|
} from "fs";
|
|
161468
|
-
import { basename as
|
|
161571
|
+
import { basename as basename25, dirname as dirname55, join as join141 } from "path";
|
|
161469
161572
|
|
|
161470
161573
|
// packages/mcp-client-core/src/config-dir.ts
|
|
161471
161574
|
import { existsSync as existsSync104, realpathSync as realpathSync27 } from "fs";
|
|
161472
161575
|
import { homedir as homedir27 } from "os";
|
|
161473
|
-
import { join as
|
|
161576
|
+
import { join as join139, resolve as resolve35 } from "path";
|
|
161474
161577
|
function resolveConfigPath4(pathValue) {
|
|
161475
161578
|
const resolvedPath = resolve35(pathValue);
|
|
161476
161579
|
if (!existsSync104(resolvedPath))
|
|
@@ -161488,13 +161591,13 @@ function getOpenCodeCliConfigDir(env = process.env) {
|
|
|
161488
161591
|
if (customConfigDir) {
|
|
161489
161592
|
return resolveConfigPath4(customConfigDir);
|
|
161490
161593
|
}
|
|
161491
|
-
const xdgConfigDir = env["XDG_CONFIG_HOME"]?.trim() ||
|
|
161492
|
-
return resolveConfigPath4(
|
|
161594
|
+
const xdgConfigDir = env["XDG_CONFIG_HOME"]?.trim() || join139(homedir27(), ".config");
|
|
161595
|
+
return resolveConfigPath4(join139(xdgConfigDir, "opencode"));
|
|
161493
161596
|
}
|
|
161494
161597
|
|
|
161495
161598
|
// packages/mcp-client-core/src/mcp-oauth/storage-index.ts
|
|
161496
161599
|
import { chmodSync as chmodSync5, existsSync as existsSync105, readFileSync as readFileSync69, renameSync as renameSync11, writeFileSync as writeFileSync30 } from "fs";
|
|
161497
|
-
import { join as
|
|
161600
|
+
import { join as join140 } from "path";
|
|
161498
161601
|
var INDEX_FILE_NAME = "index.json";
|
|
161499
161602
|
function isTokenIndex(value) {
|
|
161500
161603
|
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
@@ -161502,7 +161605,7 @@ function isTokenIndex(value) {
|
|
|
161502
161605
|
return Object.values(value).every((entry) => typeof entry === "string");
|
|
161503
161606
|
}
|
|
161504
161607
|
function getIndexPath(storageDir) {
|
|
161505
|
-
return
|
|
161608
|
+
return join140(storageDir, INDEX_FILE_NAME);
|
|
161506
161609
|
}
|
|
161507
161610
|
function readTokenIndex(storageDir) {
|
|
161508
161611
|
const indexPath = getIndexPath(storageDir);
|
|
@@ -161546,16 +161649,16 @@ function deleteTokenIndexEntry(storageDir, hash) {
|
|
|
161546
161649
|
var STORAGE_DIR_NAME = "mcp-oauth";
|
|
161547
161650
|
var LEGACY_STORAGE_FILE_NAME = "mcp-oauth.json";
|
|
161548
161651
|
function getMcpOauthStorageDir() {
|
|
161549
|
-
return
|
|
161652
|
+
return join141(getOpenCodeCliConfigDir(), STORAGE_DIR_NAME);
|
|
161550
161653
|
}
|
|
161551
161654
|
function getMcpOauthServerHash(serverHost, resource) {
|
|
161552
161655
|
return createHash7("sha256").update(buildKey(serverHost, resource)).digest("hex").slice(0, 32);
|
|
161553
161656
|
}
|
|
161554
161657
|
function getMcpOauthStoragePath(serverHost, resource) {
|
|
161555
|
-
return
|
|
161658
|
+
return join141(getMcpOauthStorageDir(), `${getMcpOauthServerHash(serverHost, resource)}.json`);
|
|
161556
161659
|
}
|
|
161557
161660
|
function getLegacyStoragePath() {
|
|
161558
|
-
return
|
|
161661
|
+
return join141(getOpenCodeCliConfigDir(), LEGACY_STORAGE_FILE_NAME);
|
|
161559
161662
|
}
|
|
161560
161663
|
function normalizeHost(serverHost) {
|
|
161561
161664
|
let host = serverHost.trim();
|
|
@@ -161653,7 +161756,7 @@ function readLegacyStore() {
|
|
|
161653
161756
|
}
|
|
161654
161757
|
function writeTokenFile(filePath, token) {
|
|
161655
161758
|
try {
|
|
161656
|
-
const dir =
|
|
161759
|
+
const dir = dirname55(filePath);
|
|
161657
161760
|
if (!existsSync106(dir)) {
|
|
161658
161761
|
mkdirSync25(dir, { recursive: true });
|
|
161659
161762
|
}
|
|
@@ -167845,17 +167948,17 @@ import { resolve as resolve37 } from "path";
|
|
|
167845
167948
|
|
|
167846
167949
|
// packages/mcp-client-core/src/skill-mcp-manager/env-grants-store.ts
|
|
167847
167950
|
var import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
|
|
167848
|
-
import { createHash as createHash9, randomUUID as
|
|
167951
|
+
import { createHash as createHash9, randomUUID as randomUUID15 } from "crypto";
|
|
167849
167952
|
import { watch } from "fs";
|
|
167850
|
-
import { mkdir as mkdir7, open as
|
|
167953
|
+
import { mkdir as mkdir7, open as open5, rename as rename6, rm as rm6, stat as stat10 } from "fs/promises";
|
|
167851
167954
|
import { homedir as homedir28 } from "os";
|
|
167852
|
-
import { basename as
|
|
167955
|
+
import { basename as basename26, dirname as dirname56, join as join142, resolve as resolve36 } from "path";
|
|
167853
167956
|
import { setTimeout as delay7 } from "timers/promises";
|
|
167854
167957
|
var empty = () => ({ version: 1, generation: 0, grants: {} });
|
|
167855
167958
|
var namePattern = /^[^=\0]+$/;
|
|
167856
167959
|
var digestPattern = /^[a-f0-9]{64}$/;
|
|
167857
167960
|
function resolveGrantsStorePath(configDir) {
|
|
167858
|
-
return
|
|
167961
|
+
return join142(resolve36(configDir ?? join142(process.env.XDG_CONFIG_HOME ?? join142(homedir28(), ".config"), "omo")), "mcp-env-grants.json");
|
|
167859
167962
|
}
|
|
167860
167963
|
function record15(value) {
|
|
167861
167964
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -167876,7 +167979,7 @@ function parse6(value) {
|
|
|
167876
167979
|
}
|
|
167877
167980
|
async function state4(path) {
|
|
167878
167981
|
try {
|
|
167879
|
-
const file = await
|
|
167982
|
+
const file = await open5(path, "r");
|
|
167880
167983
|
try {
|
|
167881
167984
|
const info = await file.stat();
|
|
167882
167985
|
const snapshot = parse6(JSON.parse(await file.readFile("utf8")));
|
|
@@ -167910,7 +168013,7 @@ class GrantsLockLostError extends Error {
|
|
|
167910
168013
|
}
|
|
167911
168014
|
}
|
|
167912
168015
|
async function update(path, mutate) {
|
|
167913
|
-
await mkdir7(
|
|
168016
|
+
await mkdir7(dirname56(path), { recursive: true, mode: 448 });
|
|
167914
168017
|
let lost;
|
|
167915
168018
|
const release = await import_proper_lockfile.default.lock(path, {
|
|
167916
168019
|
realpath: false,
|
|
@@ -167920,7 +168023,7 @@ async function update(path, mutate) {
|
|
|
167920
168023
|
lost ??= error;
|
|
167921
168024
|
}
|
|
167922
168025
|
});
|
|
167923
|
-
const temporary =
|
|
168026
|
+
const temporary = join142(dirname56(path), `.${basename26(path)}.${randomUUID15()}.tmp`);
|
|
167924
168027
|
try {
|
|
167925
168028
|
const previous = await read(path);
|
|
167926
168029
|
const grants = { ...previous.grants };
|
|
@@ -167928,7 +168031,7 @@ async function update(path, mutate) {
|
|
|
167928
168031
|
const next = { version: 1, generation: previous.generation + 1, grants };
|
|
167929
168032
|
if (!Number.isSafeInteger(next.generation))
|
|
167930
168033
|
throw new RangeError("MCP grant generation exhausted");
|
|
167931
|
-
const file = await
|
|
168034
|
+
const file = await open5(temporary, "wx", 384);
|
|
167932
168035
|
try {
|
|
167933
168036
|
await file.writeFile(`${JSON.stringify(next)}
|
|
167934
168037
|
`);
|
|
@@ -167940,7 +168043,7 @@ async function update(path, mutate) {
|
|
|
167940
168043
|
try {
|
|
167941
168044
|
if (lost !== undefined)
|
|
167942
168045
|
throw new GrantsLockLostError(lost);
|
|
167943
|
-
await
|
|
168046
|
+
await rename6(temporary, path);
|
|
167944
168047
|
break;
|
|
167945
168048
|
} catch (error) {
|
|
167946
168049
|
if (process.platform !== "win32" || !record15(error) || !["EPERM", "EACCES", "EBUSY"].includes(String(error.code)) || attempt >= 5)
|
|
@@ -167949,7 +168052,7 @@ async function update(path, mutate) {
|
|
|
167949
168052
|
}
|
|
167950
168053
|
}
|
|
167951
168054
|
if (process.platform !== "win32") {
|
|
167952
|
-
const directory = await
|
|
168055
|
+
const directory = await open5(dirname56(path), "r");
|
|
167953
168056
|
try {
|
|
167954
168057
|
await directory.sync();
|
|
167955
168058
|
} finally {
|
|
@@ -167959,7 +168062,7 @@ async function update(path, mutate) {
|
|
|
167959
168062
|
return next;
|
|
167960
168063
|
} finally {
|
|
167961
168064
|
try {
|
|
167962
|
-
await
|
|
168065
|
+
await rm6(temporary, { force: true });
|
|
167963
168066
|
} finally {
|
|
167964
168067
|
if (lost === undefined)
|
|
167965
168068
|
await release();
|
|
@@ -167993,13 +168096,13 @@ async function observe(path, listener) {
|
|
|
167993
168096
|
let watchedDirectory;
|
|
167994
168097
|
let queue = Promise.resolve();
|
|
167995
168098
|
const arm = async () => {
|
|
167996
|
-
let directory =
|
|
168099
|
+
let directory = dirname56(path);
|
|
167997
168100
|
for (;; ) {
|
|
167998
168101
|
try {
|
|
167999
168102
|
if ((await stat10(directory)).isDirectory())
|
|
168000
168103
|
break;
|
|
168001
168104
|
} catch {}
|
|
168002
|
-
const parent =
|
|
168105
|
+
const parent = dirname56(directory);
|
|
168003
168106
|
if (parent === directory)
|
|
168004
168107
|
break;
|
|
168005
168108
|
directory = parent;
|
|
@@ -168799,15 +168902,15 @@ init_logger2();
|
|
|
168799
168902
|
|
|
168800
168903
|
// packages/omo-opencode/src/features/tui-sidebar/mirror-io.ts
|
|
168801
168904
|
import { mkdirSync as mkdirSync26, readFileSync as readFileSync71 } from "fs";
|
|
168802
|
-
import { dirname as
|
|
168905
|
+
import { dirname as dirname57 } from "path";
|
|
168803
168906
|
|
|
168804
168907
|
// packages/omo-opencode/src/features/tui-sidebar/mirror-path.ts
|
|
168805
168908
|
import { createHash as createHash10 } from "crypto";
|
|
168806
168909
|
import { realpathSync as realpathSync29 } from "fs";
|
|
168807
168910
|
import { homedir as homedir29 } from "os";
|
|
168808
|
-
import { join as
|
|
168911
|
+
import { join as join143, resolve as resolve38 } from "path";
|
|
168809
168912
|
function mirrorStorageDir() {
|
|
168810
|
-
return
|
|
168913
|
+
return join143(process.env.XDG_DATA_HOME ?? join143(homedir29(), ".local", "share"), "opencode", "storage", "oh-my-openagent", MIRROR_DIR_NAME);
|
|
168811
168914
|
}
|
|
168812
168915
|
function canonicalProjectDir(projectDir) {
|
|
168813
168916
|
try {
|
|
@@ -168821,7 +168924,7 @@ function canonicalProjectDir(projectDir) {
|
|
|
168821
168924
|
}
|
|
168822
168925
|
function mirrorFilePath(projectDir) {
|
|
168823
168926
|
const projectHash = createHash10("sha1").update(canonicalProjectDir(projectDir)).digest("hex").slice(0, 16);
|
|
168824
|
-
return
|
|
168927
|
+
return join143(mirrorStorageDir(), `${projectHash}.json`);
|
|
168825
168928
|
}
|
|
168826
168929
|
|
|
168827
168930
|
// packages/omo-opencode/src/features/tui-sidebar/snapshot-schema.ts
|
|
@@ -168874,13 +168977,13 @@ var TuiRuntimeSnapshotSchema = z65.object({
|
|
|
168874
168977
|
function writeMirror(projectDir, snapshot) {
|
|
168875
168978
|
const filePath = mirrorFilePath(projectDir);
|
|
168876
168979
|
const content = JSON.stringify(snapshot);
|
|
168877
|
-
mkdirSync26(
|
|
168980
|
+
mkdirSync26(dirname57(filePath), { recursive: true });
|
|
168878
168981
|
writeFileAtomically2(filePath, content, { mode: 384 });
|
|
168879
168982
|
}
|
|
168880
168983
|
|
|
168881
168984
|
// packages/omo-opencode/src/features/tui-sidebar/loop-reader.ts
|
|
168882
168985
|
import { readdirSync as readdirSync34, readFileSync as readFileSync72, statSync as statSync19 } from "fs";
|
|
168883
|
-
import { join as
|
|
168986
|
+
import { join as join144 } from "path";
|
|
168884
168987
|
import { z as z66 } from "zod";
|
|
168885
168988
|
var CriterionSchema = z66.object({
|
|
168886
168989
|
status: z66.string()
|
|
@@ -168910,7 +169013,7 @@ function enumerateCandidates(projectDir) {
|
|
|
168910
169013
|
return [...currentLoopCandidates(projectDir), legacyLoopCandidate(projectDir)].filter((candidate) => candidate !== null);
|
|
168911
169014
|
}
|
|
168912
169015
|
function currentLoopCandidates(projectDir) {
|
|
168913
|
-
const loopRoot =
|
|
169016
|
+
const loopRoot = join144(projectDir, ".omo", "ulw-loop");
|
|
168914
169017
|
let entries;
|
|
168915
169018
|
try {
|
|
168916
169019
|
entries = readdirSync34(loopRoot, { withFileTypes: true });
|
|
@@ -168920,10 +169023,10 @@ function currentLoopCandidates(projectDir) {
|
|
|
168920
169023
|
}
|
|
168921
169024
|
throw error;
|
|
168922
169025
|
}
|
|
168923
|
-
return entries.filter((entry) => entry.isDirectory()).map((entry) => statCandidate(
|
|
169026
|
+
return entries.filter((entry) => entry.isDirectory()).map((entry) => statCandidate(join144(loopRoot, entry.name, "goals.json"))).filter((candidate) => candidate !== null);
|
|
168924
169027
|
}
|
|
168925
169028
|
function legacyLoopCandidate(projectDir) {
|
|
168926
|
-
return statCandidate(
|
|
169029
|
+
return statCandidate(join144(projectDir, ".omo", "loop", "goals.json"));
|
|
168927
169030
|
}
|
|
168928
169031
|
function statCandidate(path) {
|
|
168929
169032
|
try {
|
|
@@ -171304,7 +171407,7 @@ init_tmux();
|
|
|
171304
171407
|
var SESSION_TIMEOUT_MS2 = 10 * 60 * 1000;
|
|
171305
171408
|
var MIN_STABILITY_TIME_MS4 = 10 * 1000;
|
|
171306
171409
|
// packages/openclaw-core/src/index.ts
|
|
171307
|
-
import { basename as
|
|
171410
|
+
import { basename as basename27 } from "path";
|
|
171308
171411
|
|
|
171309
171412
|
// packages/openclaw-core/src/gateway-url-validation.ts
|
|
171310
171413
|
function validateGatewayUrl(url) {
|
|
@@ -171718,25 +171821,25 @@ import {
|
|
|
171718
171821
|
// packages/openclaw-core/src/reply-listener-paths.ts
|
|
171719
171822
|
import { existsSync as existsSync107, mkdirSync as mkdirSync27 } from "fs";
|
|
171720
171823
|
import { homedir as homedir30 } from "os";
|
|
171721
|
-
import { join as
|
|
171824
|
+
import { join as join145 } from "path";
|
|
171722
171825
|
var REPLY_LISTENER_SECURE_FILE_MODE = 384;
|
|
171723
171826
|
function resolveReplyListenerHomeDir() {
|
|
171724
171827
|
return process.env.HOME ?? process.env.USERPROFILE ?? homedir30();
|
|
171725
171828
|
}
|
|
171726
171829
|
function getReplyListenerStateDir() {
|
|
171727
|
-
return
|
|
171830
|
+
return join145(resolveReplyListenerHomeDir(), ".omo", "openclaw", "state");
|
|
171728
171831
|
}
|
|
171729
171832
|
function getReplyListenerPidFilePath() {
|
|
171730
|
-
return
|
|
171833
|
+
return join145(getReplyListenerStateDir(), "reply-listener.pid");
|
|
171731
171834
|
}
|
|
171732
171835
|
function getReplyListenerStateFilePath() {
|
|
171733
|
-
return
|
|
171836
|
+
return join145(getReplyListenerStateDir(), "reply-listener-state.json");
|
|
171734
171837
|
}
|
|
171735
171838
|
function getReplyListenerConfigFilePath() {
|
|
171736
|
-
return
|
|
171839
|
+
return join145(getReplyListenerStateDir(), "reply-listener-config.json");
|
|
171737
171840
|
}
|
|
171738
171841
|
function getReplyListenerLogFilePath() {
|
|
171739
|
-
return
|
|
171842
|
+
return join145(getReplyListenerStateDir(), "reply-listener.log");
|
|
171740
171843
|
}
|
|
171741
171844
|
function ensureReplyListenerStateDir() {
|
|
171742
171845
|
const stateDir = getReplyListenerStateDir();
|
|
@@ -171796,7 +171899,7 @@ import { constants as constants27, closeSync as closeSync8, openSync as openSync
|
|
|
171796
171899
|
|
|
171797
171900
|
// packages/openclaw-core/src/session-registry-paths.ts
|
|
171798
171901
|
init_src();
|
|
171799
|
-
import { join as
|
|
171902
|
+
import { join as join146 } from "path";
|
|
171800
171903
|
var SECURE_FILE_MODE = 384;
|
|
171801
171904
|
var MAX_AGE_MS = 24 * 60 * 60 * 1000;
|
|
171802
171905
|
var LOCK_TIMEOUT_MS = 2000;
|
|
@@ -171807,16 +171910,16 @@ var cachedRegistryPaths = null;
|
|
|
171807
171910
|
function resolveRegistryPaths() {
|
|
171808
171911
|
if (cachedRegistryPaths !== null)
|
|
171809
171912
|
return cachedRegistryPaths;
|
|
171810
|
-
const openClawStorageDir =
|
|
171913
|
+
const openClawStorageDir = join146(getOpenCodeStorageDir2(), "openclaw");
|
|
171811
171914
|
cachedRegistryPaths = {
|
|
171812
171915
|
openClawStorageDir,
|
|
171813
|
-
registryPath:
|
|
171814
|
-
registryLockPath:
|
|
171916
|
+
registryPath: join146(openClawStorageDir, "reply-session-registry.jsonl"),
|
|
171917
|
+
registryLockPath: join146(openClawStorageDir, "reply-session-registry.lock")
|
|
171815
171918
|
};
|
|
171816
171919
|
return cachedRegistryPaths;
|
|
171817
171920
|
}
|
|
171818
171921
|
function getOpenCodeStorageDir2() {
|
|
171819
|
-
return
|
|
171922
|
+
return join146(resolveXdgDataDir("opencode"), "opencode", "storage");
|
|
171820
171923
|
}
|
|
171821
171924
|
function getRegistryPath() {
|
|
171822
171925
|
return resolveRegistryPaths().registryPath;
|
|
@@ -171827,11 +171930,11 @@ function getRegistryLockPath() {
|
|
|
171827
171930
|
|
|
171828
171931
|
// packages/openclaw-core/src/session-registry-lock.ts
|
|
171829
171932
|
import { constants as constants26, closeSync as closeSync7, existsSync as existsSync110, openSync as openSync7, readFileSync as readFileSync74, statSync as statSync21, unlinkSync as unlinkSync21, writeSync as writeSync2 } from "fs";
|
|
171830
|
-
import { randomUUID as
|
|
171933
|
+
import { randomUUID as randomUUID17 } from "crypto";
|
|
171831
171934
|
|
|
171832
171935
|
// packages/openclaw-core/src/session-registry-storage.ts
|
|
171833
171936
|
import { existsSync as existsSync109, mkdirSync as mkdirSync28, readFileSync as readFileSync73, writeFileSync as writeFileSync33 } from "fs";
|
|
171834
|
-
import { dirname as
|
|
171937
|
+
import { dirname as dirname58 } from "path";
|
|
171835
171938
|
function isSessionMapping(value) {
|
|
171836
171939
|
if (typeof value !== "object" || value === null)
|
|
171837
171940
|
return false;
|
|
@@ -171852,7 +171955,7 @@ function isSessionMapping(value) {
|
|
|
171852
171955
|
return true;
|
|
171853
171956
|
}
|
|
171854
171957
|
function ensureRegistryDir() {
|
|
171855
|
-
const registryDir =
|
|
171958
|
+
const registryDir = dirname58(getRegistryPath());
|
|
171856
171959
|
if (!existsSync109(registryDir)) {
|
|
171857
171960
|
mkdirSync28(registryDir, { recursive: true, mode: 448 });
|
|
171858
171961
|
}
|
|
@@ -171978,7 +172081,7 @@ function acquireRegistryLock() {
|
|
|
171978
172081
|
const started = Date.now();
|
|
171979
172082
|
while (Date.now() - started < LOCK_TIMEOUT_MS) {
|
|
171980
172083
|
try {
|
|
171981
|
-
const token =
|
|
172084
|
+
const token = randomUUID17();
|
|
171982
172085
|
const fd = openSync7(getRegistryLockPath(), constants26.O_CREAT | constants26.O_EXCL | constants26.O_WRONLY, SECURE_FILE_MODE);
|
|
171983
172086
|
try {
|
|
171984
172087
|
const lockPayload = JSON.stringify({
|
|
@@ -172236,7 +172339,7 @@ function getReplyListenerRuntimeSignature(config) {
|
|
|
172236
172339
|
// packages/openclaw-core/src/reply-listener-poll-loop.ts
|
|
172237
172340
|
var PRUNE_INTERVAL_MS = 60 * 60 * 1000;
|
|
172238
172341
|
// packages/openclaw-core/src/reply-listener-start.ts
|
|
172239
|
-
import { dirname as
|
|
172342
|
+
import { dirname as dirname59, join as join148 } from "path";
|
|
172240
172343
|
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
172241
172344
|
|
|
172242
172345
|
// packages/openclaw-core/src/reply-listener-spawn.ts
|
|
@@ -172245,7 +172348,7 @@ init_runtime();
|
|
|
172245
172348
|
// packages/openclaw-core/src/reply-listener-process.ts
|
|
172246
172349
|
init_runtime();
|
|
172247
172350
|
import { readFileSync as readFileSync76 } from "fs";
|
|
172248
|
-
import { join as
|
|
172351
|
+
import { join as join147 } from "path";
|
|
172249
172352
|
var REPLY_LISTENER_DAEMON_IDENTITY_MARKER = "--openclaw-reply-listener-daemon";
|
|
172250
172353
|
var REPLY_LISTENER_DAEMON_ENV_ALLOWLIST = [
|
|
172251
172354
|
"PATH",
|
|
@@ -172281,7 +172384,7 @@ var REPLY_LISTENER_DAEMON_ENV_ALLOWLIST = [
|
|
|
172281
172384
|
];
|
|
172282
172385
|
async function windowsProcessCommandLineHasMarker(pid, deps) {
|
|
172283
172386
|
const systemRoot = process.env.SystemRoot ?? process.env.SYSTEMROOT ?? "C:\\Windows";
|
|
172284
|
-
const powershell =
|
|
172387
|
+
const powershell = join147(systemRoot, "System32", "WindowsPowerShell", "v1.0", "powershell.exe");
|
|
172285
172388
|
const processInfo = deps.spawn([
|
|
172286
172389
|
powershell,
|
|
172287
172390
|
"-NoProfile",
|
|
@@ -172410,14 +172513,14 @@ async function waitForReplyListenerProcessExit(pid, timeoutMs) {
|
|
|
172410
172513
|
}
|
|
172411
172514
|
|
|
172412
172515
|
// packages/openclaw-core/src/reply-listener-startup.ts
|
|
172413
|
-
import { randomUUID as
|
|
172516
|
+
import { randomUUID as randomUUID18 } from "crypto";
|
|
172414
172517
|
var DEFAULT_REPLY_LISTENER_STARTUP_TIMEOUT_MS = 500;
|
|
172415
172518
|
var REPLY_LISTENER_READY_POLL_INTERVAL_MS = 10;
|
|
172416
172519
|
function isPositiveInteger(value) {
|
|
172417
172520
|
return Number.isInteger(value) && value > 0;
|
|
172418
172521
|
}
|
|
172419
172522
|
function createReplyListenerStartupToken() {
|
|
172420
|
-
return
|
|
172523
|
+
return randomUUID18();
|
|
172421
172524
|
}
|
|
172422
172525
|
function getReplyListenerStartupTimeoutMs() {
|
|
172423
172526
|
const raw = process.env.OMO_OPENCLAW_REPLY_LISTENER_STARTUP_TIMEOUT_MS;
|
|
@@ -172498,7 +172601,7 @@ function createStartFailureResult(message, state) {
|
|
|
172498
172601
|
}
|
|
172499
172602
|
function resolveReplyListenerDaemonScript(currentFileUrl) {
|
|
172500
172603
|
const currentFilePath = fileURLToPath8(currentFileUrl);
|
|
172501
|
-
return currentFilePath.endsWith(".ts") ?
|
|
172604
|
+
return currentFilePath.endsWith(".ts") ? join148(dirname59(currentFilePath), "daemon.ts") : join148(dirname59(currentFilePath), "daemon.js");
|
|
172502
172605
|
}
|
|
172503
172606
|
async function startReplyListener(config) {
|
|
172504
172607
|
const normalizedConfig = getNormalizedReplyListenerConfig(config);
|
|
@@ -172656,7 +172759,7 @@ async function wakeOpenClaw(config, event, context) {
|
|
|
172656
172759
|
const variables = {
|
|
172657
172760
|
sessionId: enrichedContext.sessionId,
|
|
172658
172761
|
projectPath: enrichedContext.projectPath,
|
|
172659
|
-
projectName: enrichedContext.projectPath ?
|
|
172762
|
+
projectName: enrichedContext.projectPath ? basename27(enrichedContext.projectPath) : undefined,
|
|
172660
172763
|
tmuxSession,
|
|
172661
172764
|
prompt: enrichedContext.prompt,
|
|
172662
172765
|
contextSummary: enrichedContext.contextSummary,
|
|
@@ -172682,7 +172785,7 @@ async function wakeOpenClaw(config, event, context) {
|
|
|
172682
172785
|
timestamp: now,
|
|
172683
172786
|
sessionId: enrichedContext.sessionId,
|
|
172684
172787
|
projectPath: enrichedContext.projectPath,
|
|
172685
|
-
projectName: enrichedContext.projectPath ?
|
|
172788
|
+
projectName: enrichedContext.projectPath ? basename27(enrichedContext.projectPath) : undefined,
|
|
172686
172789
|
tmuxSession,
|
|
172687
172790
|
tmuxTail,
|
|
172688
172791
|
...replyChannel !== undefined && { channel: replyChannel },
|
|
@@ -172922,12 +173025,12 @@ async function createRuntimeSkillSourceServer(options, runtimeEnv = runtime6) {
|
|
|
172922
173025
|
}
|
|
172923
173026
|
// packages/claude-code-compat-core/src/features/claude-code-mcp-loader/loader.ts
|
|
172924
173027
|
import { existsSync as existsSync112, readFileSync as readFileSync77 } from "fs";
|
|
172925
|
-
import { join as
|
|
173028
|
+
import { join as join149 } from "path";
|
|
172926
173029
|
import { homedir as homedir31 } from "os";
|
|
172927
173030
|
function resolveMcpLoaderContext(options = {}) {
|
|
172928
173031
|
const cwd = options.cwd ?? process.cwd();
|
|
172929
173032
|
const homeDir = options.homeDir ?? getHomeDir();
|
|
172930
|
-
const claudeConfigDir = options.claudeConfigDir ?? (options.homeDir === undefined ? getClaudeConfigDir3() :
|
|
173033
|
+
const claudeConfigDir = options.claudeConfigDir ?? (options.homeDir === undefined ? getClaudeConfigDir3() : join149(homeDir, ".claude"));
|
|
172931
173034
|
return { cwd, homeDir, claudeConfigDir };
|
|
172932
173035
|
}
|
|
172933
173036
|
var mcpLoaderInternals = {
|
|
@@ -172936,10 +173039,10 @@ var mcpLoaderInternals = {
|
|
|
172936
173039
|
function getMcpConfigPaths(context) {
|
|
172937
173040
|
const { claudeConfigDir, homeDir, cwd } = context;
|
|
172938
173041
|
return [
|
|
172939
|
-
{ path:
|
|
172940
|
-
{ path:
|
|
172941
|
-
{ path:
|
|
172942
|
-
{ path:
|
|
173042
|
+
{ path: join149(homeDir, ".claude.json"), scope: "user" },
|
|
173043
|
+
{ path: join149(claudeConfigDir, ".mcp.json"), scope: "user" },
|
|
173044
|
+
{ path: join149(cwd, ".mcp.json"), scope: "project" },
|
|
173045
|
+
{ path: join149(cwd, ".claude", ".mcp.json"), scope: "local" }
|
|
172943
173046
|
];
|
|
172944
173047
|
}
|
|
172945
173048
|
function getHomeDir() {
|
|
@@ -174996,7 +175099,7 @@ var import_ignore2 = __toESM(require_ignore(), 1);
|
|
|
174996
175099
|
|
|
174997
175100
|
// node_modules/.bun/@code-yeongyu+senpi@2026.11.5-1+4d1d9585513888ef/node_modules/@code-yeongyu/senpi/dist/config.js
|
|
174998
175101
|
import { accessSync as accessSync5, constants as constants28, existsSync as existsSync113, readFileSync as readFileSync78, realpathSync as realpathSync30 } from "fs";
|
|
174999
|
-
import { basename as
|
|
175102
|
+
import { basename as basename28, dirname as dirname60, join as join151, resolve as resolve39, sep as sep9, win32 as win3213 } from "path";
|
|
175000
175103
|
import { fileURLToPath as fileURLToPath10 } from "url";
|
|
175001
175104
|
|
|
175002
175105
|
// node_modules/.bun/@code-yeongyu+senpi@2026.11.5-1+4d1d9585513888ef/node_modules/@code-yeongyu/senpi/dist/bun-global-launcher.js
|
|
@@ -175121,7 +175224,7 @@ var import_cross_spawn3 = __toESM(require_cross_spawn(), 1);
|
|
|
175121
175224
|
|
|
175122
175225
|
// node_modules/.bun/@code-yeongyu+senpi@2026.11.5-1+4d1d9585513888ef/node_modules/@code-yeongyu/senpi/dist/utils/paths.js
|
|
175123
175226
|
import { homedir as homedir32 } from "os";
|
|
175124
|
-
import { isAbsolute as isAbsolute21, join as
|
|
175227
|
+
import { isAbsolute as isAbsolute21, join as join150, resolve as nodeResolvePath, parse as parse7, relative as relative16, sep as sep8 } from "path";
|
|
175125
175228
|
import { fileURLToPath as fileURLToPath9 } from "url";
|
|
175126
175229
|
var UNICODE_SPACES = /[\u00A0\u2000-\u200A\u202F\u205F\u3000]/g;
|
|
175127
175230
|
var MISSING_PATH_CODES = new Set(["ENOENT", "ENOTDIR"]);
|
|
@@ -175150,7 +175253,7 @@ function normalizePath7(input, options = {}) {
|
|
|
175150
175253
|
if (normalized === "~")
|
|
175151
175254
|
return home;
|
|
175152
175255
|
if (normalized.startsWith("~/") || process.platform === "win32" && normalized.startsWith("~\\")) {
|
|
175153
|
-
return
|
|
175256
|
+
return join150(home, normalized.slice(2));
|
|
175154
175257
|
}
|
|
175155
175258
|
}
|
|
175156
175259
|
if (/^file:\/\//.test(normalized)) {
|
|
@@ -175169,20 +175272,20 @@ function stripBom5(content) {
|
|
|
175169
175272
|
|
|
175170
175273
|
// node_modules/.bun/@code-yeongyu+senpi@2026.11.5-1+4d1d9585513888ef/node_modules/@code-yeongyu/senpi/dist/config.js
|
|
175171
175274
|
var __filename2 = fileURLToPath10(import.meta.url);
|
|
175172
|
-
var __dirname2 =
|
|
175275
|
+
var __dirname2 = dirname60(__filename2);
|
|
175173
175276
|
var isBunBinary = import.meta.url.includes("$bunfs") || import.meta.url.includes("~BUN") || import.meta.url.includes("%7EBUN");
|
|
175174
175277
|
var isBunRuntime = !!process.versions.bun;
|
|
175175
175278
|
function findNodePackageDir(startDir) {
|
|
175176
175279
|
let dir = startDir;
|
|
175177
|
-
while (dir !==
|
|
175178
|
-
if (existsSync113(
|
|
175179
|
-
const parent =
|
|
175180
|
-
if (
|
|
175280
|
+
while (dir !== dirname60(dir)) {
|
|
175281
|
+
if (existsSync113(join151(dir, "package.json"))) {
|
|
175282
|
+
const parent = dirname60(dir);
|
|
175283
|
+
if (basename28(dir) === "dist" && existsSync113(join151(parent, "package.json"))) {
|
|
175181
175284
|
return parent;
|
|
175182
175285
|
}
|
|
175183
175286
|
return dir;
|
|
175184
175287
|
}
|
|
175185
|
-
dir =
|
|
175288
|
+
dir = dirname60(dir);
|
|
175186
175289
|
}
|
|
175187
175290
|
return startDir;
|
|
175188
175291
|
}
|
|
@@ -175192,14 +175295,14 @@ function getPackageDir() {
|
|
|
175192
175295
|
return normalizePath7(envDir);
|
|
175193
175296
|
}
|
|
175194
175297
|
if (isBunBinary) {
|
|
175195
|
-
return
|
|
175298
|
+
return dirname60(process.execPath);
|
|
175196
175299
|
}
|
|
175197
175300
|
nodePackageDir ??= findNodePackageDir(__dirname2);
|
|
175198
175301
|
return nodePackageDir;
|
|
175199
175302
|
}
|
|
175200
175303
|
var nodePackageDir;
|
|
175201
175304
|
function getPackageJsonPath() {
|
|
175202
|
-
return
|
|
175305
|
+
return join151(getPackageDir(), "package.json");
|
|
175203
175306
|
}
|
|
175204
175307
|
var pkg = {};
|
|
175205
175308
|
try {
|
|
@@ -182284,13 +182387,13 @@ createHephaestusAgent.mode = MODE9;
|
|
|
182284
182387
|
// packages/omo-opencode/src/agents/builtin-agents/resolve-file-uri.ts
|
|
182285
182388
|
import { existsSync as existsSync115, readFileSync as readFileSync81 } from "fs";
|
|
182286
182389
|
import { homedir as homedir33 } from "os";
|
|
182287
|
-
import { isAbsolute as isAbsolute23, join as
|
|
182390
|
+
import { isAbsolute as isAbsolute23, join as join153, resolve as resolve40 } from "path";
|
|
182288
182391
|
init_logger2();
|
|
182289
182392
|
var ALLOWED_HOME_SUBDIRS = [
|
|
182290
|
-
|
|
182291
|
-
|
|
182292
|
-
|
|
182293
|
-
|
|
182393
|
+
join153(homedir33(), ".config", "opencode"),
|
|
182394
|
+
join153(homedir33(), ".config", "oh-my-openagent"),
|
|
182395
|
+
join153(homedir33(), ".omo"),
|
|
182396
|
+
join153(homedir33(), ".opencode")
|
|
182294
182397
|
];
|
|
182295
182398
|
function isWithinAllowedPaths(filePath, projectRoot) {
|
|
182296
182399
|
if (isWithinProject(filePath, projectRoot))
|
|
@@ -183820,7 +183923,7 @@ async function applyAgentConfig(params) {
|
|
|
183820
183923
|
}
|
|
183821
183924
|
// packages/claude-code-compat-core/src/features/claude-code-command-loader/loader.ts
|
|
183822
183925
|
import { promises as fs19 } from "fs";
|
|
183823
|
-
import { join as
|
|
183926
|
+
import { join as join154, basename as basename29 } from "path";
|
|
183824
183927
|
|
|
183825
183928
|
// packages/claude-code-compat-core/src/features/claude-code-command-loader/loader-cache.ts
|
|
183826
183929
|
var commandLoaderCache = new Map;
|
|
@@ -183868,7 +183971,7 @@ async function loadCommandsFromDir(commandsDir, scope, visited = new Set, prefix
|
|
|
183868
183971
|
continue;
|
|
183869
183972
|
if (entry.name.startsWith("."))
|
|
183870
183973
|
continue;
|
|
183871
|
-
const subDirPath =
|
|
183974
|
+
const subDirPath = join154(commandsDir, entry.name);
|
|
183872
183975
|
const subPrefix = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
183873
183976
|
const subCommands = await loadCommandsFromDir(subDirPath, scope, visited, subPrefix);
|
|
183874
183977
|
commands.push(...subCommands);
|
|
@@ -183876,8 +183979,8 @@ async function loadCommandsFromDir(commandsDir, scope, visited = new Set, prefix
|
|
|
183876
183979
|
}
|
|
183877
183980
|
if (!isMarkdownFile(entry))
|
|
183878
183981
|
continue;
|
|
183879
|
-
const commandPath =
|
|
183880
|
-
const baseCommandName =
|
|
183982
|
+
const commandPath = join154(commandsDir, entry.name);
|
|
183983
|
+
const baseCommandName = basename29(entry.name, ".md");
|
|
183881
183984
|
const commandName = prefix ? `${prefix}/${baseCommandName}` : baseCommandName;
|
|
183882
183985
|
try {
|
|
183883
183986
|
const content = await fs19.readFile(commandPath, "utf-8");
|
|
@@ -183939,12 +184042,12 @@ function commandsToRecord(commands) {
|
|
|
183939
184042
|
return result;
|
|
183940
184043
|
}
|
|
183941
184044
|
async function loadUserCommands() {
|
|
183942
|
-
const userCommandsDir =
|
|
184045
|
+
const userCommandsDir = join154(getClaudeConfigDir3(), "commands");
|
|
183943
184046
|
const commands = await loadCommandsFromDir(userCommandsDir, "user");
|
|
183944
184047
|
return commandsToRecord(commands);
|
|
183945
184048
|
}
|
|
183946
184049
|
async function loadProjectCommands(directory) {
|
|
183947
|
-
const projectCommandsDir =
|
|
184050
|
+
const projectCommandsDir = join154(directory ?? process.cwd(), ".claude", "commands");
|
|
183948
184051
|
const commands = await loadCommandsFromDir(projectCommandsDir, "project");
|
|
183949
184052
|
return commandsToRecord(commands);
|
|
183950
184053
|
}
|
|
@@ -184143,7 +184246,7 @@ var grep_app = {
|
|
|
184143
184246
|
|
|
184144
184247
|
// packages/omo-opencode/src/mcp/lsp.ts
|
|
184145
184248
|
import { existsSync as existsSync116, readFileSync as readFileSync82 } from "fs";
|
|
184146
|
-
import { delimiter as delimiter2, dirname as
|
|
184249
|
+
import { delimiter as delimiter2, dirname as dirname61, resolve as resolve42 } from "path";
|
|
184147
184250
|
import { fileURLToPath as fileURLToPath11 } from "url";
|
|
184148
184251
|
import { z as z68 } from "zod";
|
|
184149
184252
|
|
|
@@ -184157,7 +184260,7 @@ function hasCliSuffix(candidatePath, suffix) {
|
|
|
184157
184260
|
|
|
184158
184261
|
// packages/omo-opencode/src/mcp/runtime-executable.ts
|
|
184159
184262
|
init_bun_which_shim();
|
|
184160
|
-
import { basename as
|
|
184263
|
+
import { basename as basename30 } from "path";
|
|
184161
184264
|
var NODE_EXECUTABLE_NAMES = new Set(["node", "node.exe"]);
|
|
184162
184265
|
function isUnsafeCommandName2(commandName) {
|
|
184163
184266
|
if (commandName.length === 0)
|
|
@@ -184173,7 +184276,7 @@ function isUnsafeCommandName2(commandName) {
|
|
|
184173
184276
|
return false;
|
|
184174
184277
|
}
|
|
184175
184278
|
function isNodeExecPath(execPath) {
|
|
184176
|
-
return NODE_EXECUTABLE_NAMES.has(
|
|
184279
|
+
return NODE_EXECUTABLE_NAMES.has(basename30(execPath).toLowerCase());
|
|
184177
184280
|
}
|
|
184178
184281
|
function resolveRuntimeExecutable(commandName, options = {}) {
|
|
184179
184282
|
if (isUnsafeCommandName2(commandName)) {
|
|
@@ -184275,7 +184378,7 @@ var LSP_BOOTSTRAP_SCRIPT = [
|
|
|
184275
184378
|
].join(";");
|
|
184276
184379
|
function getModuleDirectory(moduleUrl) {
|
|
184277
184380
|
try {
|
|
184278
|
-
return
|
|
184381
|
+
return dirname61(fileURLToPath11(moduleUrl));
|
|
184279
184382
|
} catch (error) {
|
|
184280
184383
|
if (!(error instanceof Error))
|
|
184281
184384
|
throw error;
|
|
@@ -185340,7 +185443,7 @@ function shouldReuseCallerLeadSession(spec, callerAgentTypeId) {
|
|
|
185340
185443
|
}
|
|
185341
185444
|
|
|
185342
185445
|
// packages/team-core/src/team-registry/loader.ts
|
|
185343
|
-
import { readFile as
|
|
185446
|
+
import { readFile as readFile9 } from "fs/promises";
|
|
185344
185447
|
init_types2();
|
|
185345
185448
|
|
|
185346
185449
|
// packages/team-core/src/team-registry/team-spec-input-normalizer.ts
|
|
@@ -185680,7 +185783,7 @@ function createZodValidationError(rawSpec, error) {
|
|
|
185680
185783
|
async function loadTeamSpecFromEntry(entry, options) {
|
|
185681
185784
|
let rawText;
|
|
185682
185785
|
try {
|
|
185683
|
-
rawText = await
|
|
185786
|
+
rawText = await readFile9(entry.path, "utf8");
|
|
185684
185787
|
} catch (error) {
|
|
185685
185788
|
const normalizedError = normalizeError2(error);
|
|
185686
185789
|
throw new TeamSpecValidationError(`Failed to read team spec '${entry.name}': ${normalizedError.message}`, "TEAM_SPEC_READ_FAILED");
|
|
@@ -185768,7 +185871,7 @@ init_layout4();
|
|
|
185768
185871
|
init_team_session_registry();
|
|
185769
185872
|
init_store2();
|
|
185770
185873
|
init_session_team_run_registry();
|
|
185771
|
-
import { rm as
|
|
185874
|
+
import { rm as rm8 } from "fs/promises";
|
|
185772
185875
|
function normalizeError3(error) {
|
|
185773
185876
|
return error instanceof Error ? error : new Error(String(error));
|
|
185774
185877
|
}
|
|
@@ -185806,7 +185909,7 @@ async function cleanupTeamRunResources(args) {
|
|
|
185806
185909
|
}
|
|
185807
185910
|
if (resource.worktreePath) {
|
|
185808
185911
|
try {
|
|
185809
|
-
await
|
|
185912
|
+
await rm8(resource.worktreePath, { recursive: true, force: true });
|
|
185810
185913
|
cleanupReport.removedWorktrees.push(resource.worktreePath);
|
|
185811
185914
|
} catch (cleanupError) {
|
|
185812
185915
|
cleanupReport.errors.push(`worktree ${resource.worktreePath}: ${normalizeError3(cleanupError).message}`);
|
|
@@ -186558,14 +186661,14 @@ init_locks();
|
|
|
186558
186661
|
// packages/omo-opencode/src/features/team-mode/team-runtime/status.ts
|
|
186559
186662
|
init_store2();
|
|
186560
186663
|
// packages/team-core/src/team-tasklist/list.ts
|
|
186561
|
-
import { readdir as
|
|
186664
|
+
import { readdir as readdir10, readFile as readFile10 } from "fs/promises";
|
|
186562
186665
|
import path25 from "path";
|
|
186563
186666
|
init_types2();
|
|
186564
186667
|
async function listTasks(teamRunId, config, filter) {
|
|
186565
186668
|
const tasksDirectory = getTasksDir(resolveBaseDir(config), teamRunId);
|
|
186566
186669
|
let entries;
|
|
186567
186670
|
try {
|
|
186568
|
-
entries = await
|
|
186671
|
+
entries = await readdir10(tasksDirectory, { withFileTypes: true });
|
|
186569
186672
|
} catch (error) {
|
|
186570
186673
|
error instanceof Error;
|
|
186571
186674
|
return [];
|
|
@@ -186576,7 +186679,7 @@ async function listTasks(teamRunId, config, filter) {
|
|
|
186576
186679
|
continue;
|
|
186577
186680
|
const taskPath = path25.join(tasksDirectory, entry.name);
|
|
186578
186681
|
try {
|
|
186579
|
-
const taskContent = await
|
|
186682
|
+
const taskContent = await readFile10(taskPath, "utf8");
|
|
186580
186683
|
const parsedTask = TaskSchema.safeParse(JSON.parse(taskContent));
|
|
186581
186684
|
if (!parsedTask.success) {
|
|
186582
186685
|
log6("team-tasklist skipped malformed task", {
|
|
@@ -186604,7 +186707,7 @@ async function listTasks(teamRunId, config, filter) {
|
|
|
186604
186707
|
}
|
|
186605
186708
|
// packages/omo-opencode/src/features/team-mode/team-runtime/status.ts
|
|
186606
186709
|
init_paths2();
|
|
186607
|
-
import { readdir as
|
|
186710
|
+
import { readdir as readdir11 } from "fs/promises";
|
|
186608
186711
|
import path26 from "path";
|
|
186609
186712
|
function getPrimaryModelKey(bgMgr, leadSessionId) {
|
|
186610
186713
|
if (!bgMgr || !leadSessionId)
|
|
@@ -186657,7 +186760,7 @@ async function aggregateStatus(teamRunId, config, bgMgr) {
|
|
|
186657
186760
|
const teamRunIdSpecific = teamBackgroundManager?.listTasksByParentSession?.(runtimeState.leadSessionId ?? teamRunId)?.length;
|
|
186658
186761
|
const baseDir = resolveBaseDir(config);
|
|
186659
186762
|
const claimsDir = path26.join(getTasksDir(baseDir, teamRunId), "claims");
|
|
186660
|
-
const staleLockEntries = await
|
|
186763
|
+
const staleLockEntries = await readdir11(claimsDir, { withFileTypes: true }).catch((error) => {
|
|
186661
186764
|
if (error instanceof Error)
|
|
186662
186765
|
return [];
|
|
186663
186766
|
return [];
|
|
@@ -186774,10 +186877,10 @@ function canClaim(task, allTasks) {
|
|
|
186774
186877
|
}
|
|
186775
186878
|
|
|
186776
186879
|
// packages/team-core/src/team-tasklist/get.ts
|
|
186777
|
-
import { readFile as
|
|
186880
|
+
import { readFile as readFile11 } from "fs/promises";
|
|
186778
186881
|
init_types2();
|
|
186779
186882
|
async function getTask(teamRunId, taskId, config) {
|
|
186780
|
-
const taskContent = await
|
|
186883
|
+
const taskContent = await readFile11(getTaskFilePath(resolveBaseDir(config), teamRunId, taskId), "utf8");
|
|
186781
186884
|
return TaskSchema.parse(JSON.parse(taskContent));
|
|
186782
186885
|
}
|
|
186783
186886
|
|
|
@@ -186856,14 +186959,14 @@ async function claimTask(teamRunId, taskId, memberName, config) {
|
|
|
186856
186959
|
}, { ownerTag: memberName, staleAfterMs: CLAIM_STALE_AFTER_MS });
|
|
186857
186960
|
}
|
|
186858
186961
|
// packages/team-core/src/team-tasklist/store.ts
|
|
186859
|
-
import { mkdir as mkdir10, readFile as
|
|
186962
|
+
import { mkdir as mkdir10, readFile as readFile12 } from "fs/promises";
|
|
186860
186963
|
import path27 from "path";
|
|
186861
186964
|
init_locks();
|
|
186862
186965
|
init_types2();
|
|
186863
186966
|
var HIGH_WATERMARK_FILE = ".highwatermark";
|
|
186864
186967
|
async function readHighWatermark(watermarkPath) {
|
|
186865
186968
|
try {
|
|
186866
|
-
const watermarkContent = (await
|
|
186969
|
+
const watermarkContent = (await readFile12(watermarkPath, "utf8")).trim();
|
|
186867
186970
|
const parsedWatermark = Number.parseInt(watermarkContent, 10);
|
|
186868
186971
|
return Number.isInteger(parsedWatermark) && parsedWatermark >= 0 ? parsedWatermark : 0;
|
|
186869
186972
|
} catch (error) {
|
|
@@ -187504,7 +187607,7 @@ function createChatHeadersHandler(args) {
|
|
|
187504
187607
|
}
|
|
187505
187608
|
|
|
187506
187609
|
// packages/omo-opencode/src/plugin/ultrawork-db-model-override.ts
|
|
187507
|
-
import { join as
|
|
187610
|
+
import { join as join155 } from "path";
|
|
187508
187611
|
import { existsSync as existsSync117 } from "fs";
|
|
187509
187612
|
async function importBunSqlite() {
|
|
187510
187613
|
if (typeof globalThis.Bun === "undefined") {
|
|
@@ -187521,7 +187624,7 @@ async function importBunSqlite() {
|
|
|
187521
187624
|
}
|
|
187522
187625
|
}
|
|
187523
187626
|
function getDbPath() {
|
|
187524
|
-
return
|
|
187627
|
+
return join155(getDataDir(), "opencode", "opencode.db");
|
|
187525
187628
|
}
|
|
187526
187629
|
var MAX_MICROTASK_RETRIES = 10;
|
|
187527
187630
|
function logCaughtDbError(message, metadata, error) {
|
|
@@ -188933,7 +189036,7 @@ function handleMessageUpdatedSessionState(args) {
|
|
|
188933
189036
|
|
|
188934
189037
|
// packages/team-core/src/team-mailbox/ack.ts
|
|
188935
189038
|
init_paths();
|
|
188936
|
-
import { mkdir as mkdir11, rename as
|
|
189039
|
+
import { mkdir as mkdir11, rename as rename7 } from "fs/promises";
|
|
188937
189040
|
import path28 from "path";
|
|
188938
189041
|
async function ackMessages(teamRunId, memberName, messageIds, config) {
|
|
188939
189042
|
const baseDir = resolveBaseDir(config);
|
|
@@ -188949,7 +189052,7 @@ async function ackMessages(teamRunId, memberName, messageIds, config) {
|
|
|
188949
189052
|
const targetPath = path28.join(processedDir, messageFileName);
|
|
188950
189053
|
for (const sourcePath of sourcePaths) {
|
|
188951
189054
|
try {
|
|
188952
|
-
await
|
|
189055
|
+
await rename7(sourcePath, targetPath);
|
|
188953
189056
|
break;
|
|
188954
189057
|
} catch (error) {
|
|
188955
189058
|
const err = error;
|
|
@@ -189292,7 +189395,7 @@ function createTeamLeadOrphanHandler(config, tmuxMgr, bgMgr) {
|
|
|
189292
189395
|
}
|
|
189293
189396
|
|
|
189294
189397
|
// packages/omo-opencode/src/hooks/team-session-events/team-member-error-handler.ts
|
|
189295
|
-
import { randomUUID as
|
|
189398
|
+
import { randomUUID as randomUUID19 } from "crypto";
|
|
189296
189399
|
init_store2();
|
|
189297
189400
|
init_logger2();
|
|
189298
189401
|
function getErroredSessionID(properties) {
|
|
@@ -189434,7 +189537,7 @@ Error: ${errorText}`;
|
|
|
189434
189537
|
try {
|
|
189435
189538
|
await sendMessage({
|
|
189436
189539
|
version: 1,
|
|
189437
|
-
messageId:
|
|
189540
|
+
messageId: randomUUID19(),
|
|
189438
189541
|
from: "system",
|
|
189439
189542
|
to: leaderMember.name,
|
|
189440
189543
|
kind: "announcement",
|
|
@@ -190619,16 +190722,16 @@ function processKillErrorMeansAlive(error) {
|
|
|
190619
190722
|
// packages/utils/src/process-sweep/lsp-daemon-family.ts
|
|
190620
190723
|
import { readFileSync as readFileSync83, readdirSync as readdirSync36 } from "fs";
|
|
190621
190724
|
import { homedir as homedir34 } from "os";
|
|
190622
|
-
import { basename as
|
|
190725
|
+
import { basename as basename31, join as join156, resolve as resolve43 } from "path";
|
|
190623
190726
|
|
|
190624
190727
|
// packages/utils/src/process-sweep/lsp-daemon-owner-attestation.ts
|
|
190625
|
-
import { readFile as
|
|
190728
|
+
import { readFile as readFile13 } from "fs/promises";
|
|
190626
190729
|
import { createConnection } from "net";
|
|
190627
190730
|
var OWNER_PING_REQUEST_ID = "process-sweep-owner-attestation";
|
|
190628
190731
|
var OMO_DAEMON_PROTOCOL_VERSION = 1;
|
|
190629
190732
|
async function attestLspDaemonOwner(target, deps = {}) {
|
|
190630
190733
|
try {
|
|
190631
|
-
const readText = deps.readText ?? ((path) =>
|
|
190734
|
+
const readText = deps.readText ?? ((path) => readFile13(path, "utf8"));
|
|
190632
190735
|
const currentOwner = parseLspDaemonOwner(JSON.parse(await readText(target.ownerPath)));
|
|
190633
190736
|
if (currentOwner === null || !sameOwner(currentOwner, target.owner))
|
|
190634
190737
|
return false;
|
|
@@ -190736,7 +190839,7 @@ function resolveLspDaemonBaseDir(options = {}) {
|
|
|
190736
190839
|
if (override !== undefined && override.trim().length > 0)
|
|
190737
190840
|
return resolve43(override);
|
|
190738
190841
|
const homeDir = options.homeDir ?? env["HOME"] ?? env["USERPROFILE"] ?? homedir34();
|
|
190739
|
-
return
|
|
190842
|
+
return join156(homeDir, ".omo", "lsp-daemon");
|
|
190740
190843
|
}
|
|
190741
190844
|
var VERSION_ENTRY_PATTERN = /^v([A-Za-z0-9][A-Za-z0-9._+-]{0,127})$/;
|
|
190742
190845
|
function listLspDaemonVersionDirs(baseDir) {
|
|
@@ -190755,12 +190858,12 @@ function listLspDaemonVersionDirs(baseDir) {
|
|
|
190755
190858
|
const version = VERSION_ENTRY_PATTERN.exec(entry.name)?.[1];
|
|
190756
190859
|
if (version === undefined)
|
|
190757
190860
|
continue;
|
|
190758
|
-
versions.push({ dir:
|
|
190861
|
+
versions.push({ dir: join156(baseDir, entry.name), version });
|
|
190759
190862
|
}
|
|
190760
190863
|
return versions.sort((left, right) => left.version.localeCompare(right.version));
|
|
190761
190864
|
}
|
|
190762
190865
|
function readLspDaemonOwnerTarget(versionDir) {
|
|
190763
|
-
const ownerPath =
|
|
190866
|
+
const ownerPath = join156(versionDir, "daemon.owner");
|
|
190764
190867
|
let raw;
|
|
190765
190868
|
try {
|
|
190766
190869
|
raw = requireOwnerText(ownerPath);
|
|
@@ -190771,7 +190874,7 @@ function readLspDaemonOwnerTarget(versionDir) {
|
|
|
190771
190874
|
const owner = parseLspDaemonOwner(JSON.parse(raw));
|
|
190772
190875
|
if (owner === null)
|
|
190773
190876
|
return null;
|
|
190774
|
-
return { authPath:
|
|
190877
|
+
return { authPath: join156(versionDir, "daemon.auth"), owner, ownerPath, pid: owner.pid };
|
|
190775
190878
|
} catch {
|
|
190776
190879
|
return null;
|
|
190777
190880
|
}
|
|
@@ -190846,33 +190949,33 @@ function matchLspDaemonProxyCommand(command, roots, platform) {
|
|
|
190846
190949
|
// packages/utils/src/process-sweep/roots.ts
|
|
190847
190950
|
import { existsSync as existsSync118, readdirSync as readdirSync37, realpathSync as realpathSync32 } from "fs";
|
|
190848
190951
|
import { homedir as homedir35 } from "os";
|
|
190849
|
-
import { join as
|
|
190952
|
+
import { join as join157, resolve as resolve44 } from "path";
|
|
190850
190953
|
function discoverOmoOwnedRoots(options = {}) {
|
|
190851
190954
|
const env = options.env ?? process.env;
|
|
190852
190955
|
const homeDir = options.homeDir ?? env["HOME"] ?? env["USERPROFILE"] ?? homedir35();
|
|
190853
190956
|
const roots = new Set;
|
|
190854
|
-
addRoot(roots,
|
|
190957
|
+
addRoot(roots, join157(homeDir, ".claude", "omo"));
|
|
190855
190958
|
addRoot(roots, options.pluginRoot);
|
|
190856
190959
|
for (const root of options.extraRoots ?? [])
|
|
190857
190960
|
addRoot(roots, root);
|
|
190858
|
-
for (const root of readCodexPluginCacheRoots(options.codexHome ?? env["CODEX_HOME"] ??
|
|
190961
|
+
for (const root of readCodexPluginCacheRoots(options.codexHome ?? env["CODEX_HOME"] ?? join157(homeDir, ".codex"))) {
|
|
190859
190962
|
addRoot(roots, root);
|
|
190860
190963
|
}
|
|
190861
190964
|
return [...roots];
|
|
190862
190965
|
}
|
|
190863
190966
|
function readCodexPluginCacheRoots(codexHome) {
|
|
190864
|
-
const cacheRoot =
|
|
190967
|
+
const cacheRoot = join157(codexHome, "plugins", "cache");
|
|
190865
190968
|
if (!existsSync118(cacheRoot))
|
|
190866
190969
|
return [];
|
|
190867
190970
|
const roots = [];
|
|
190868
190971
|
for (const publisher of safeReadDir(cacheRoot)) {
|
|
190869
190972
|
if (!OMO_CODEX_PLUGIN_CACHE_PUBLISHERS.has(publisher))
|
|
190870
190973
|
continue;
|
|
190871
|
-
const omoRoot =
|
|
190974
|
+
const omoRoot = join157(cacheRoot, publisher, "omo");
|
|
190872
190975
|
if (!existsSync118(omoRoot))
|
|
190873
190976
|
continue;
|
|
190874
190977
|
for (const version of safeReadDir(omoRoot))
|
|
190875
|
-
roots.push(
|
|
190978
|
+
roots.push(join157(omoRoot, version));
|
|
190876
190979
|
}
|
|
190877
190980
|
return roots;
|
|
190878
190981
|
}
|
|
@@ -190910,11 +191013,11 @@ function isNonFatalFsError(error) {
|
|
|
190910
191013
|
var OMO_CODEX_PLUGIN_CACHE_PUBLISHERS = new Set(["sisyphuslabs"]);
|
|
190911
191014
|
|
|
190912
191015
|
// packages/utils/src/process-sweep/sweeper.ts
|
|
190913
|
-
import { join as
|
|
191016
|
+
import { join as join158 } from "path";
|
|
190914
191017
|
|
|
190915
191018
|
// packages/utils/src/process-sweep/family-sweeper.ts
|
|
190916
191019
|
import { existsSync as existsSync119, mkdirSync as mkdirSync29, statSync as statSync23, utimesSync, writeFileSync as writeFileSync34 } from "fs";
|
|
190917
|
-
import { dirname as
|
|
191020
|
+
import { dirname as dirname62 } from "path";
|
|
190918
191021
|
var DEFAULT_GRACE_MS = 2000;
|
|
190919
191022
|
var DEFAULT_THROTTLE_MS = 60 * 60 * 1000;
|
|
190920
191023
|
async function runProcessFamilySweep(config, options) {
|
|
@@ -191010,7 +191113,7 @@ function isSweepThrottled(stampFile, nowMs, throttleMs) {
|
|
|
191010
191113
|
return nowMs - statSync23(stampFile).mtimeMs < throttleMs;
|
|
191011
191114
|
}
|
|
191012
191115
|
function writeSweepStamp(stampFile, nowMs) {
|
|
191013
|
-
mkdirSync29(
|
|
191116
|
+
mkdirSync29(dirname62(stampFile), { recursive: true });
|
|
191014
191117
|
writeFileSync34(stampFile, `${new Date(nowMs).toISOString()}
|
|
191015
191118
|
`);
|
|
191016
191119
|
const stampDate = new Date(nowMs);
|
|
@@ -191027,7 +191130,7 @@ function delay8(ms) {
|
|
|
191027
191130
|
// packages/utils/src/process-sweep/sweeper.ts
|
|
191028
191131
|
var LSP_PROXY_SWEEP_STAMP_FILE = "lsp-proxy-sweep.stamp";
|
|
191029
191132
|
async function sweepOrphanedLspDaemonProxies(options = {}) {
|
|
191030
|
-
const stampFile =
|
|
191133
|
+
const stampFile = join158(resolveLspDaemonBaseDir(options), LSP_PROXY_SWEEP_STAMP_FILE);
|
|
191031
191134
|
const ownedRoots = options.ownedRoots ?? discoverOmoOwnedRoots(options);
|
|
191032
191135
|
const result = await runProcessFamilySweep({
|
|
191033
191136
|
familyLabel: "lsp-daemon proxy sweep",
|
|
@@ -191046,7 +191149,7 @@ async function sweepOrphanedLspDaemonProxies(options = {}) {
|
|
|
191046
191149
|
var LSP_DAEMON_SWEEP_STAMP_FILE = "lsp-daemon-sweep.stamp";
|
|
191047
191150
|
async function sweepStaleLspDaemonVersions(options = {}) {
|
|
191048
191151
|
const baseDir = resolveLspDaemonBaseDir(options);
|
|
191049
|
-
const stampFile =
|
|
191152
|
+
const stampFile = join158(baseDir, LSP_DAEMON_SWEEP_STAMP_FILE);
|
|
191050
191153
|
const currentVersion = resolveCurrentLspDaemonVersion(options);
|
|
191051
191154
|
const dryRun = options.dryRun === true;
|
|
191052
191155
|
if (currentVersion === undefined) {
|
|
@@ -191119,15 +191222,15 @@ function defaultPluginRoot() {
|
|
|
191119
191222
|
init_atomic_write();
|
|
191120
191223
|
init_xdg_data_dir();
|
|
191121
191224
|
import { existsSync as existsSync120, mkdirSync as mkdirSync31, readFileSync as readFileSync84 } from "fs";
|
|
191122
|
-
import { basename as
|
|
191225
|
+
import { basename as basename32, join as join160 } from "path";
|
|
191123
191226
|
|
|
191124
191227
|
// packages/telemetry-core/src/day-claim.ts
|
|
191125
191228
|
import { closeSync as closeSync10, mkdirSync as mkdirSync30, openSync as openSync10, readdirSync as readdirSync38, rmSync as rmSync8 } from "fs";
|
|
191126
|
-
import { join as
|
|
191229
|
+
import { join as join159 } from "path";
|
|
191127
191230
|
var CLAIM_PREFIX = "daily-active.";
|
|
191128
191231
|
var CLAIM_SUFFIX = ".claim";
|
|
191129
191232
|
function getTelemetryDayClaimFilePath(stateDir, dayUTC) {
|
|
191130
|
-
return
|
|
191233
|
+
return join159(stateDir, `${CLAIM_PREFIX}${dayUTC}${CLAIM_SUFFIX}`);
|
|
191131
191234
|
}
|
|
191132
191235
|
function claimUtcDay(stateDir, dayUTC) {
|
|
191133
191236
|
try {
|
|
@@ -191153,7 +191256,7 @@ function pruneSupersededClaims(stateDir, dayUTC) {
|
|
|
191153
191256
|
if (!entry.startsWith(CLAIM_PREFIX) || !entry.endsWith(CLAIM_SUFFIX))
|
|
191154
191257
|
continue;
|
|
191155
191258
|
try {
|
|
191156
|
-
rmSync8(
|
|
191259
|
+
rmSync8(join159(stateDir, entry), { force: true });
|
|
191157
191260
|
} catch {}
|
|
191158
191261
|
}
|
|
191159
191262
|
}
|
|
@@ -191166,14 +191269,14 @@ function resolveTelemetryStateDir(product, options = {}) {
|
|
|
191166
191269
|
env: options.env,
|
|
191167
191270
|
osProvider: options.osProvider
|
|
191168
191271
|
});
|
|
191169
|
-
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined :
|
|
191170
|
-
if (dataDir === xdgStateDir || xdgStateDir === undefined &&
|
|
191272
|
+
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined : join160(options.env.XDG_DATA_HOME, product.cacheDirName);
|
|
191273
|
+
if (dataDir === xdgStateDir || xdgStateDir === undefined && basename32(dataDir) === product.cacheDirName) {
|
|
191171
191274
|
return dataDir;
|
|
191172
191275
|
}
|
|
191173
|
-
return
|
|
191276
|
+
return join160(dataDir, product.cacheDirName);
|
|
191174
191277
|
}
|
|
191175
191278
|
function getTelemetryActivityStateFilePath(stateDir) {
|
|
191176
|
-
return
|
|
191279
|
+
return join160(stateDir, POSTHOG_ACTIVITY_STATE_FILE);
|
|
191177
191280
|
}
|
|
191178
191281
|
function getDailyActiveCaptureState(input) {
|
|
191179
191282
|
const dayUTC = getUtcDayString(input.now ?? new Date);
|
|
@@ -191474,7 +191577,7 @@ function getSafeCpuInfo(osProvider, input) {
|
|
|
191474
191577
|
}
|
|
191475
191578
|
|
|
191476
191579
|
// node_modules/.bun/posthog-node@5.52.4/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
191477
|
-
import { dirname as
|
|
191580
|
+
import { dirname as dirname63, posix as posix12, sep as sep11 } from "path";
|
|
191478
191581
|
function createModulerModifier() {
|
|
191479
191582
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
191480
191583
|
return async (frames) => {
|
|
@@ -191483,7 +191586,7 @@ function createModulerModifier() {
|
|
|
191483
191586
|
return frames;
|
|
191484
191587
|
};
|
|
191485
191588
|
}
|
|
191486
|
-
function createGetModuleFromFilename(basePath = process.argv[1] ?
|
|
191589
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname63(process.argv[1]) : process.cwd(), isWindows = sep11 === "\\") {
|
|
191487
191590
|
const normalizedBase = isWindows ? normalizeWindowsPath(basePath) : basePath;
|
|
191488
191591
|
return (filename) => {
|
|
191489
191592
|
if (!filename)
|
|
@@ -191786,13 +191889,13 @@ class BucketedRateLimiter {
|
|
|
191786
191889
|
/*! LICENSE: uuidv7.mjs.LICENSE.txt */
|
|
191787
191890
|
var DIGITS = "0123456789abcdef";
|
|
191788
191891
|
|
|
191789
|
-
class
|
|
191892
|
+
class UUID2 {
|
|
191790
191893
|
constructor(bytes) {
|
|
191791
191894
|
this.bytes = bytes;
|
|
191792
191895
|
}
|
|
191793
191896
|
static ofInner(bytes) {
|
|
191794
191897
|
if (bytes.length === 16)
|
|
191795
|
-
return new
|
|
191898
|
+
return new UUID2(bytes);
|
|
191796
191899
|
throw new TypeError("not 128-bit length");
|
|
191797
191900
|
}
|
|
191798
191901
|
static fromFieldsV7(unixTsMs, randA, randBHi, randBLo) {
|
|
@@ -191815,7 +191918,7 @@ class UUID {
|
|
|
191815
191918
|
bytes[13] = randBLo >>> 16;
|
|
191816
191919
|
bytes[14] = randBLo >>> 8;
|
|
191817
191920
|
bytes[15] = randBLo;
|
|
191818
|
-
return new
|
|
191921
|
+
return new UUID2(bytes);
|
|
191819
191922
|
}
|
|
191820
191923
|
static parse(uuid) {
|
|
191821
191924
|
let hex;
|
|
@@ -191844,7 +191947,7 @@ class UUID {
|
|
|
191844
191947
|
inner[i + 2] = n >>> 8;
|
|
191845
191948
|
inner[i + 3] = n;
|
|
191846
191949
|
}
|
|
191847
|
-
return new
|
|
191950
|
+
return new UUID2(inner);
|
|
191848
191951
|
}
|
|
191849
191952
|
throw new SyntaxError("could not parse UUID string");
|
|
191850
191953
|
}
|
|
@@ -191888,7 +191991,7 @@ class UUID {
|
|
|
191888
191991
|
return this.getVariant() === "VAR_10" ? this.bytes[6] >>> 4 : undefined;
|
|
191889
191992
|
}
|
|
191890
191993
|
clone() {
|
|
191891
|
-
return new
|
|
191994
|
+
return new UUID2(this.bytes.slice(0));
|
|
191892
191995
|
}
|
|
191893
191996
|
equals(other) {
|
|
191894
191997
|
return this.compareTo(other) === 0;
|
|
@@ -191941,7 +192044,7 @@ class V7Generator {
|
|
|
191941
192044
|
this.resetCounter();
|
|
191942
192045
|
}
|
|
191943
192046
|
}
|
|
191944
|
-
return
|
|
192047
|
+
return UUID2.fromFieldsV7(this.timestamp, Math.trunc(this.counter / 2 ** 30), this.counter & 2 ** 30 - 1, this.random.nextUint32());
|
|
191945
192048
|
}
|
|
191946
192049
|
resetCounter() {
|
|
191947
192050
|
this.counter = 1024 * this.random.nextUint32() + (1023 & this.random.nextUint32());
|
|
@@ -191950,7 +192053,7 @@ class V7Generator {
|
|
|
191950
192053
|
const bytes = new Uint8Array(Uint32Array.of(this.random.nextUint32(), this.random.nextUint32(), this.random.nextUint32(), this.random.nextUint32()).buffer);
|
|
191951
192054
|
bytes[6] = 64 | bytes[6] >>> 4;
|
|
191952
192055
|
bytes[8] = 128 | bytes[8] >>> 2;
|
|
191953
|
-
return
|
|
192056
|
+
return UUID2.ofInner(bytes);
|
|
191954
192057
|
}
|
|
191955
192058
|
}
|
|
191956
192059
|
var getDefaultRandom = () => ({
|
|
@@ -200576,12 +200679,12 @@ function createDefaultPostHogTransport(apiKey, options) {
|
|
|
200576
200679
|
// packages/telemetry-core/src/install-id.ts
|
|
200577
200680
|
import { createHash as createHash12, randomBytes as randomBytes4 } from "crypto";
|
|
200578
200681
|
import { mkdirSync as mkdirSync32, readFileSync as readFileSync85, writeFileSync as writeFileSync35 } from "fs";
|
|
200579
|
-
import { dirname as
|
|
200682
|
+
import { dirname as dirname64, join as join161 } from "path";
|
|
200580
200683
|
var TELEMETRY_INSTALL_ID_FILE_NAME = "install-id";
|
|
200581
200684
|
var INSTALL_ID_PATTERN = /^[0-9a-f]{64}$/;
|
|
200582
200685
|
var fallbackInstallIds = new Map;
|
|
200583
200686
|
function getTelemetryInstallDistinctId(stateDir) {
|
|
200584
|
-
return createHash12("sha256").update(readOrCreateInstallId(
|
|
200687
|
+
return createHash12("sha256").update(readOrCreateInstallId(join161(stateDir, TELEMETRY_INSTALL_ID_FILE_NAME))).digest("hex");
|
|
200585
200688
|
}
|
|
200586
200689
|
function readOrCreateInstallId(path) {
|
|
200587
200690
|
const persisted = readInstallId(path);
|
|
@@ -200589,7 +200692,7 @@ function readOrCreateInstallId(path) {
|
|
|
200589
200692
|
return persisted;
|
|
200590
200693
|
const installId = randomBytes4(32).toString("hex");
|
|
200591
200694
|
try {
|
|
200592
|
-
mkdirSync32(
|
|
200695
|
+
mkdirSync32(dirname64(path), { recursive: true });
|
|
200593
200696
|
writeFileSync35(path, `${installId}
|
|
200594
200697
|
`, { flag: "wx", mode: 384 });
|
|
200595
200698
|
fallbackInstallIds.delete(path);
|