oh-my-opencode 4.13.0 → 4.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/skills/codex-qa/SKILL.md +15 -0
- package/.agents/skills/codex-qa/references/logging-debug.md +12 -0
- package/.agents/skills/opencode-qa/SKILL.md +17 -0
- package/.agents/skills/opencode-qa/references/tui-tmux.md +17 -0
- package/.agents/skills/work-with-pr/SKILL.md +18 -10
- package/.opencode/skills/work-with-pr/SKILL.md +18 -10
- package/README.md +2 -2
- package/dist/cli/doctor/checks/telemetry.d.ts +2 -0
- package/dist/cli/doctor/framework/constants.d.ts +1 -0
- package/dist/cli/doctor/framework/doctor-target.d.ts +1 -1
- package/dist/cli/index.js +24651 -16452
- package/dist/cli-node/index.js +24651 -16452
- package/dist/config/schema/oh-my-opencode-config.d.ts +1 -0
- package/dist/features/team-mode/test-support/async-test-helpers.d.ts +19 -0
- package/dist/hooks/atlas/final-wave-approval-gate.d.ts +1 -0
- package/dist/hooks/atlas/subagent-completion-reminder.d.ts +30 -0
- package/dist/hooks/atlas/types.d.ts +2 -0
- package/dist/hooks/atlas/verification-reminders.d.ts +3 -0
- package/dist/hooks/team-session-events/team-idle-wake-hint.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +33232 -19559
- package/dist/mcp/context7.d.ts +9 -8
- package/dist/oh-my-opencode.schema.json +4 -0
- package/dist/shared/posthog.d.ts +17 -10
- package/dist/shared/telemetry-product-identity.d.ts +2 -0
- package/dist/skills/coding-agent-sessions/SKILL.md +128 -0
- package/dist/skills/coding-agent-sessions/agents/openai.yaml +4 -0
- package/dist/skills/coding-agent-sessions/references/all-platforms.md +71 -0
- package/dist/skills/coding-agent-sessions/references/claude.md +32 -0
- package/dist/skills/coding-agent-sessions/references/codex.md +30 -0
- package/dist/skills/coding-agent-sessions/references/opencode.md +43 -0
- package/dist/skills/coding-agent-sessions/references/senpi.md +17 -0
- package/dist/skills/coding-agent-sessions/scripts/agent_sessions/__init__.py +1 -0
- package/dist/skills/coding-agent-sessions/scripts/agent_sessions/claude.py +66 -0
- package/dist/skills/coding-agent-sessions/scripts/agent_sessions/cli.py +283 -0
- package/dist/skills/coding-agent-sessions/scripts/agent_sessions/codex.py +105 -0
- package/dist/skills/coding-agent-sessions/scripts/agent_sessions/file_scanners.py +275 -0
- package/dist/skills/coding-agent-sessions/scripts/agent_sessions/jsonio.py +55 -0
- package/dist/skills/coding-agent-sessions/scripts/agent_sessions/kiro_scanner.py +91 -0
- package/dist/skills/coding-agent-sessions/scripts/agent_sessions/opencode.py +289 -0
- package/dist/skills/coding-agent-sessions/scripts/agent_sessions/scanners.py +92 -0
- package/dist/skills/coding-agent-sessions/scripts/agent_sessions/sqlite_optional_scanners.py +203 -0
- package/dist/skills/coding-agent-sessions/scripts/agent_sessions/sqlite_scanners.py +177 -0
- package/dist/skills/coding-agent-sessions/scripts/agent_sessions/timeparse.py +51 -0
- package/dist/skills/coding-agent-sessions/scripts/agent_sessions/transcript.py +149 -0
- package/dist/skills/coding-agent-sessions/scripts/agent_sessions/types.py +57 -0
- package/dist/skills/coding-agent-sessions/scripts/find-agent-sessions.py +19 -0
- package/dist/skills/frontend/ATTRIBUTION.md +52 -8
- package/dist/skills/frontend/SKILL.md +29 -8
- package/dist/skills/frontend/references/design/README.md +29 -12
- package/dist/skills/frontend/references/design/_INDEX.md +3 -3
- package/dist/skills/frontend/references/design/design-system-architecture.md +22 -19
- package/dist/skills/frontend/references/designpowers/EVIDENCE.md +89 -0
- package/dist/skills/frontend/references/designpowers/README.md +48 -0
- package/dist/skills/frontend/references/designpowers/UPSTREAM.md +80 -0
- package/dist/skills/frontend/references/designpowers/lane-a-direction.md +64 -0
- package/dist/skills/frontend/references/designpowers/lane-b-execution.md +65 -0
- package/dist/skills/frontend/references/designpowers/lane-c-review.md +65 -0
- package/dist/skills/frontend/references/designpowers/lane-d-memory.md +83 -0
- package/dist/skills/frontend/references/designpowers/orchestration.md +80 -0
- package/dist/skills/frontend/references/designpowers/routing.md +79 -0
- package/dist/skills/frontend/references/designpowers/vendor/LICENSE +21 -0
- package/dist/skills/frontend/references/designpowers/vendor/agents/accessibility-reviewer.md +83 -0
- package/dist/skills/frontend/references/designpowers/vendor/agents/content-writer.md +132 -0
- package/dist/skills/frontend/references/designpowers/vendor/agents/design-builder.md +109 -0
- package/dist/skills/frontend/references/designpowers/vendor/agents/design-critic.md +89 -0
- package/dist/skills/frontend/references/designpowers/vendor/agents/design-lead.md +113 -0
- package/dist/skills/frontend/references/designpowers/vendor/agents/design-scout.md +78 -0
- package/dist/skills/frontend/references/designpowers/vendor/agents/design-strategist.md +121 -0
- package/dist/skills/frontend/references/designpowers/vendor/agents/heuristic-evaluator.md +268 -0
- package/dist/skills/frontend/references/designpowers/vendor/agents/inspiration-scout.md +107 -0
- package/dist/skills/frontend/references/designpowers/vendor/agents/motion-designer.md +120 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/accessible-content/SKILL.md +101 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/adaptive-interfaces/SKILL.md +109 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/cognitive-accessibility/SKILL.md +107 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/design-debate/SKILL.md +199 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/design-debt-tracker/SKILL.md +174 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/design-handoff/SKILL.md +125 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/design-md/SKILL.md +106 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/design-retrospective/SKILL.md +266 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/design-review/SKILL.md +123 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/design-system-alignment/SKILL.md +120 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/designpowers-critique/SKILL.md +164 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/heuristic-evaluation/SKILL.md +85 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/inclusive-personas/SKILL.md +98 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/inspiration-scouting/SKILL.md +165 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/interaction-design/SKILL.md +122 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/motion-choreography/SKILL.md +81 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/research-planning/SKILL.md +96 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/responsive-patterns/SKILL.md +77 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/synthetic-user-testing/SKILL.md +192 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/taste-feedback/SKILL.md +165 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/taste-report/SKILL.md +78 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/token-architecture/SKILL.md +75 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/ui-composition/SKILL.md +117 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/usability-testing/SKILL.md +78 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/verification-before-shipping/SKILL.md +125 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/voice-and-tone/SKILL.md +79 -0
- package/dist/skills/frontend/references/designpowers/vendor/skills/writing-design-plans/SKILL.md +119 -0
- package/dist/skills/frontend/references/ui-ux-db/scripts/core.py +0 -0
- package/dist/skills/git-master/SKILL.md +4 -0
- package/dist/skills/review-work/SKILL.md +3 -3
- package/dist/skills/start-work/SKILL.md +7 -5
- package/dist/skills/ultraresearch/SKILL.md +4 -252
- package/dist/skills/ulw-plan/SKILL.md +8 -6
- package/dist/skills/ulw-plan/references/full-workflow.md +11 -6
- package/dist/skills/ulw-plan/references/intent-clear.md +3 -3
- package/dist/skills/ulw-plan/references/intent-unclear.md +1 -1
- package/dist/skills/{ultraresearch → ulw-research}/ATTRIBUTION.md +1 -1
- package/dist/skills/ulw-research/SKILL.md +260 -0
- package/dist/skills/visual-qa/SKILL.md +105 -14
- package/dist/skills/visual-qa/scripts/skill-prompt-contract.test.ts +120 -1
- package/dist/testing/create-plugin-module.d.ts +2 -0
- package/dist/tui.js +23917 -16117
- package/docs/reference/github-attachment-upload.md +51 -0
- package/docs/reference/web-terminal-visual-qa.md +81 -0
- package/package.json +20 -14
- package/packages/lsp-core/src/lsp/process.ts +4 -1
- package/packages/lsp-core/src/mcp.ts +1 -0
- package/packages/lsp-daemon/dist/cli.js +5 -1
- package/packages/lsp-daemon/dist/index.js +5 -1
- package/packages/lsp-daemon/dist/proxy.js +1 -0
- package/packages/lsp-tools-mcp/dist/cli.js +5 -1
- package/packages/lsp-tools-mcp/dist/lsp/manager.js +4 -1
- package/packages/lsp-tools-mcp/dist/mcp.js +5 -1
- package/packages/lsp-tools-mcp/dist/tools.js +4 -1
- package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/dist/cli.js +323 -62
- package/packages/omo-codex/plugin/components/bootstrap/package.json +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/scripts/bootstrap.ps1 +37 -68
- package/packages/omo-codex/plugin/components/bootstrap/scripts/node-dispatch.ps1 +75 -0
- package/packages/omo-codex/plugin/components/bootstrap/src/cli.ts +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/src/setup.ts +2 -18
- package/packages/omo-codex/plugin/components/codegraph/dist/cli.js +575 -334
- package/packages/omo-codex/plugin/components/codegraph/dist/serve.js +204 -39
- package/packages/omo-codex/plugin/components/codegraph/package.json +2 -2
- package/packages/omo-codex/plugin/components/codegraph/src/hook-types.ts +7 -1
- package/packages/omo-codex/plugin/components/codegraph/src/hook.ts +103 -3
- package/packages/omo-codex/plugin/components/codegraph/src/mcp-bridge.ts +114 -0
- package/packages/omo-codex/plugin/components/codegraph/src/serve-invocation.ts +29 -0
- package/packages/omo-codex/plugin/components/codegraph/src/serve.ts +31 -57
- package/packages/omo-codex/plugin/components/codegraph/src/session-start-worker.ts +7 -4
- package/packages/omo-codex/plugin/components/codegraph/test/hook.test.ts +43 -9
- package/packages/omo-codex/plugin/components/codegraph/test/serve-mcp-bridge.test.ts +146 -0
- package/packages/omo-codex/plugin/components/codegraph/test/serve.test.ts +12 -7
- package/packages/omo-codex/plugin/components/codegraph/test/session-start-worker-flow.test.ts +71 -1
- package/packages/omo-codex/plugin/components/comment-checker/package.json +1 -1
- package/packages/omo-codex/plugin/components/git-bash/package.json +1 -1
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/package.json +1 -1
- package/packages/omo-codex/plugin/components/lsp/dist/cli.js +4 -1
- package/packages/omo-codex/plugin/components/lsp/package.json +1 -1
- package/packages/omo-codex/plugin/components/rules/dist/cli.js +2 -2
- package/packages/omo-codex/plugin/components/rules/package.json +1 -1
- package/packages/omo-codex/plugin/components/rules/src/sparkshell-awareness.ts +2 -2
- package/packages/omo-codex/plugin/components/rules/test/sparkshell-awareness.test.ts +11 -2
- package/packages/omo-codex/plugin/components/start-work-continuation/directive.md +6 -6
- package/packages/omo-codex/plugin/components/start-work-continuation/package.json +1 -1
- package/packages/omo-codex/plugin/components/start-work-continuation/test/codex-hook.test.ts +23 -0
- package/packages/omo-codex/plugin/components/teammode/dist/cli.js +22 -4
- package/packages/omo-codex/plugin/components/teammode/package.json +1 -1
- package/packages/omo-codex/plugin/components/teammode/skills/teammode/SKILL.md +40 -2
- package/packages/omo-codex/plugin/components/teammode/skills/teammode/scripts/team-guide.mjs +32 -5
- package/packages/omo-codex/plugin/components/teammode/skills/teammode/scripts/team.mjs +7 -3
- package/packages/omo-codex/plugin/components/teammode/src/codex-hook.ts +19 -4
- package/packages/omo-codex/plugin/components/teammode/test/thread-title-hook.test.ts +32 -2
- package/packages/omo-codex/plugin/components/telemetry/package.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/README.md +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/agents/explorer.toml +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/agents/plan.toml +2 -2
- package/packages/omo-codex/plugin/components/ultrawork/directive.md +23 -7
- package/packages/omo-codex/plugin/components/ultrawork/dist/cli.js +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/package.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/SKILL.md +6 -4
- package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/references/full-workflow.md +11 -6
- package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/references/intent-clear.md +3 -3
- package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/references/intent-unclear.md +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/src/codex-hook.ts +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/test/codex-hook-trigger-policy.test.ts +24 -0
- package/packages/omo-codex/plugin/components/ultrawork/test/package-smoke.test.ts +6 -1
- package/packages/omo-codex/plugin/components/ulw-loop/AGENTS.md +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/README.md +25 -21
- package/packages/omo-codex/plugin/components/ulw-loop/biome.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/directive.md +381 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-steering.js +14 -1
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli.js +145 -14
- package/packages/omo-codex/plugin/components/ulw-loop/dist/codex-hook.d.ts +6 -3
- package/packages/omo-codex/plugin/components/ulw-loop/dist/codex-hook.js +16 -6
- package/packages/omo-codex/plugin/components/ulw-loop/dist/ultrawork-directive.d.ts +5 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/ultrawork-directive.js +104 -0
- package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/package.json +2 -1
- package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/references/full-workflow.md +19 -11
- package/packages/omo-codex/plugin/components/ulw-loop/src/cli-steering.ts +14 -1
- package/packages/omo-codex/plugin/components/ulw-loop/src/cli.ts +4 -2
- package/packages/omo-codex/plugin/components/ulw-loop/src/codex-hook.ts +28 -6
- package/packages/omo-codex/plugin/components/ulw-loop/src/ultrawork-directive.ts +113 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/cli-entrypoint.test.ts +33 -2
- package/packages/omo-codex/plugin/components/ulw-loop/test/cli-steering-kind-guidance.test.ts +31 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/codex-hook.test.ts +13 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/package-smoke.test.ts +36 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/skill-contract.test.ts +12 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/ultrawork-directive.test.ts +64 -0
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-git-bash-mcp-reminder.json +2 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-lsp-diagnostics-cache.json +2 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-project-rule-cache.json +2 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-codegraph-init-guidance.json +2 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-comments.json +2 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-lsp-diagnostics.json +2 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-thread-title-hygiene.json +2 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-matching-project-rules.json +2 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-enforcing-unlimited-goal-budget.json +2 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-recommending-git-bash-mcp.json +2 -1
- package/packages/omo-codex/plugin/hooks/session-start-checking-auto-update.json +2 -1
- package/packages/omo-codex/plugin/hooks/session-start-checking-codegraph-bootstrap.json +2 -1
- package/packages/omo-codex/plugin/hooks/session-start-loading-project-rules.json +2 -1
- package/packages/omo-codex/plugin/hooks/session-start-recording-session-telemetry.json +2 -1
- package/packages/omo-codex/plugin/hooks/stop-checking-start-work-continuation.json +2 -1
- package/packages/omo-codex/plugin/hooks/subagent-stop-checking-start-work-continuation.json +2 -1
- package/packages/omo-codex/plugin/hooks/subagent-stop-verifying-lazycodex-executor-evidence.json +2 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ultrawork-trigger.json +2 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ulw-loop-steering.json +2 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-loading-project-rules.json +2 -1
- package/packages/omo-codex/plugin/package-lock.json +13 -13
- package/packages/omo-codex/plugin/package.json +1 -1
- package/packages/omo-codex/plugin/scripts/auto-update.mjs +9 -5
- package/packages/omo-codex/plugin/scripts/materialize-shared-upstreams.mjs +1 -0
- package/packages/omo-codex/plugin/scripts/migrate-codex-config/context7-placeholder-guard.mjs +131 -0
- package/packages/omo-codex/plugin/scripts/migrate-codex-config/multi-agent-mode-guard.mjs +60 -0
- package/packages/omo-codex/plugin/scripts/migrate-codex-config/multi-agent-v2-guard.mjs +3 -10
- package/packages/omo-codex/plugin/scripts/migrate-codex-config/root-settings.mjs +31 -1
- package/packages/omo-codex/plugin/scripts/migrate-codex-config/subagent-limit-guard.mjs +73 -0
- package/packages/omo-codex/plugin/scripts/migrate-codex-config.mjs +20 -3
- package/packages/omo-codex/plugin/scripts/sync-skills.mjs +30 -8
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/SKILL.md +128 -0
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/agents/openai.yaml +4 -0
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/references/all-platforms.md +71 -0
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/references/claude.md +32 -0
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/references/codex.md +30 -0
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/references/opencode.md +43 -0
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/references/senpi.md +17 -0
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/__init__.py +1 -0
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/claude.py +66 -0
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/cli.py +283 -0
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/codex.py +105 -0
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/file_scanners.py +275 -0
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/jsonio.py +55 -0
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/kiro_scanner.py +91 -0
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/opencode.py +289 -0
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/scanners.py +92 -0
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/sqlite_optional_scanners.py +203 -0
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/sqlite_scanners.py +177 -0
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/timeparse.py +51 -0
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/transcript.py +149 -0
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/types.py +57 -0
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/find-agent-sessions.py +19 -0
- package/packages/omo-codex/plugin/skills/frontend/ATTRIBUTION.md +52 -8
- package/packages/omo-codex/plugin/skills/frontend/SKILL.md +29 -8
- package/packages/omo-codex/plugin/skills/frontend/references/design/README.md +29 -12
- package/packages/omo-codex/plugin/skills/frontend/references/design/_INDEX.md +3 -3
- package/packages/omo-codex/plugin/skills/frontend/references/design/design-system-architecture.md +22 -19
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/EVIDENCE.md +89 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/README.md +48 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/UPSTREAM.md +80 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/lane-a-direction.md +64 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/lane-b-execution.md +65 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/lane-c-review.md +65 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/lane-d-memory.md +83 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/orchestration.md +80 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/routing.md +79 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/LICENSE +21 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/agents/accessibility-reviewer.md +83 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/agents/content-writer.md +132 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/agents/design-builder.md +109 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/agents/design-critic.md +89 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/agents/design-lead.md +113 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/agents/design-scout.md +78 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/agents/design-strategist.md +121 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/agents/heuristic-evaluator.md +268 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/agents/inspiration-scout.md +107 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/agents/motion-designer.md +120 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/accessible-content/SKILL.md +101 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/adaptive-interfaces/SKILL.md +109 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/cognitive-accessibility/SKILL.md +107 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/design-debate/SKILL.md +199 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/design-debt-tracker/SKILL.md +174 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/design-handoff/SKILL.md +125 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/design-md/SKILL.md +106 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/design-retrospective/SKILL.md +266 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/design-review/SKILL.md +123 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/design-system-alignment/SKILL.md +120 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/designpowers-critique/SKILL.md +164 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/heuristic-evaluation/SKILL.md +85 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/inclusive-personas/SKILL.md +98 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/inspiration-scouting/SKILL.md +165 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/interaction-design/SKILL.md +122 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/motion-choreography/SKILL.md +81 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/research-planning/SKILL.md +96 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/responsive-patterns/SKILL.md +77 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/synthetic-user-testing/SKILL.md +192 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/taste-feedback/SKILL.md +165 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/taste-report/SKILL.md +78 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/token-architecture/SKILL.md +75 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/ui-composition/SKILL.md +117 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/usability-testing/SKILL.md +78 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/verification-before-shipping/SKILL.md +125 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/voice-and-tone/SKILL.md +79 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/writing-design-plans/SKILL.md +119 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/scripts/core.py +0 -0
- package/packages/omo-codex/plugin/skills/git-master/SKILL.md +4 -0
- package/packages/omo-codex/plugin/skills/init-deep/SKILL.md +4 -0
- package/packages/omo-codex/plugin/skills/refactor/SKILL.md +4 -0
- package/packages/omo-codex/plugin/skills/remove-ai-slops/SKILL.md +4 -0
- package/packages/omo-codex/plugin/skills/review-work/SKILL.md +12 -4
- package/packages/omo-codex/plugin/skills/start-work/SKILL.md +14 -8
- package/packages/omo-codex/plugin/skills/teammode/SKILL.md +40 -2
- package/packages/omo-codex/plugin/skills/teammode/scripts/team-guide.mjs +32 -5
- package/packages/omo-codex/plugin/skills/teammode/scripts/team.mjs +7 -3
- package/packages/omo-codex/plugin/skills/ultraresearch/SKILL.md +4 -250
- package/packages/omo-codex/plugin/skills/ulw-loop/references/full-workflow.md +19 -11
- package/packages/omo-codex/plugin/skills/ulw-plan/SKILL.md +6 -4
- package/packages/omo-codex/plugin/skills/ulw-plan/references/full-workflow.md +11 -6
- package/packages/omo-codex/plugin/skills/ulw-plan/references/intent-clear.md +3 -3
- package/packages/omo-codex/plugin/skills/ulw-plan/references/intent-unclear.md +1 -1
- package/packages/{shared-skills/skills/ultraresearch → omo-codex/plugin/skills/ulw-research}/ATTRIBUTION.md +1 -1
- package/packages/omo-codex/plugin/skills/ulw-research/SKILL.md +262 -0
- package/packages/omo-codex/plugin/skills/ulw-research/agents/openai.yaml +2 -0
- package/packages/omo-codex/plugin/skills/visual-qa/SKILL.md +109 -14
- package/packages/omo-codex/plugin/test/aggregate-hooks.test.mjs +23 -0
- package/packages/omo-codex/plugin/test/aggregate-manifest.test.mjs +1 -0
- package/packages/omo-codex/plugin/test/auto-update-release-notes.test.mjs +1 -0
- package/packages/omo-codex/plugin/test/auto-update-restart-notice.test.mjs +24 -1
- package/packages/omo-codex/plugin/test/bootstrap-binlinks.test.mjs +23 -5
- package/packages/omo-codex/plugin/test/bootstrap-hooks.test.mjs +38 -0
- package/packages/omo-codex/plugin/test/bootstrap-ps-guard.test.mjs +25 -0
- package/packages/omo-codex/plugin/test/bootstrap-setup.test.mjs +1 -7
- package/packages/omo-codex/plugin/test/migrate-codex-config.test.mjs +206 -6
- package/packages/omo-codex/plugin/test/subagent-limit-migration.test.mjs +44 -0
- package/packages/omo-codex/plugin/test/sync-skills-orchestration.test.mjs +50 -1
- package/packages/omo-codex/plugin/test/sync-skills-test-support.mjs +10 -7
- package/packages/omo-codex/plugin/test/sync-skills.test.mjs +28 -2
- package/packages/omo-codex/plugin/test/teammode-communication.test.mjs +20 -0
- package/packages/omo-codex/plugin/test/teammode-thread-links.test.mjs +117 -0
- package/packages/omo-codex/plugin/test/teammode-worktree.test.mjs +5 -2
- package/packages/omo-codex/plugin/test/ulw-research-skill-contract.test.mjs +285 -0
- package/packages/omo-codex/scripts/install-bin-links.test.mjs +6 -1
- package/packages/omo-codex/scripts/install-cache-copy.test.mjs +51 -0
- package/packages/omo-codex/scripts/install-config.test.mjs +198 -17
- package/packages/omo-codex/scripts/install-dist/install-local.mjs +701 -282
- package/packages/omo-codex/scripts/install-local-git-bash-preflight.test.mjs +24 -15
- package/packages/omo-codex/scripts/install-local.test.mjs +5 -1
- package/packages/omo-codex/scripts/install-mcp-context7-runtime.test.mjs +84 -0
- package/packages/shared-skills/skills/coding-agent-sessions/SKILL.md +128 -0
- package/packages/shared-skills/skills/coding-agent-sessions/agents/openai.yaml +4 -0
- package/packages/shared-skills/skills/coding-agent-sessions/references/all-platforms.md +71 -0
- package/packages/shared-skills/skills/coding-agent-sessions/references/claude.md +32 -0
- package/packages/shared-skills/skills/coding-agent-sessions/references/codex.md +30 -0
- package/packages/shared-skills/skills/coding-agent-sessions/references/opencode.md +43 -0
- package/packages/shared-skills/skills/coding-agent-sessions/references/senpi.md +17 -0
- package/packages/shared-skills/skills/coding-agent-sessions/scripts/agent_sessions/__init__.py +1 -0
- package/packages/shared-skills/skills/coding-agent-sessions/scripts/agent_sessions/claude.py +66 -0
- package/packages/shared-skills/skills/coding-agent-sessions/scripts/agent_sessions/cli.py +283 -0
- package/packages/shared-skills/skills/coding-agent-sessions/scripts/agent_sessions/codex.py +105 -0
- package/packages/shared-skills/skills/coding-agent-sessions/scripts/agent_sessions/file_scanners.py +275 -0
- package/packages/shared-skills/skills/coding-agent-sessions/scripts/agent_sessions/jsonio.py +55 -0
- package/packages/shared-skills/skills/coding-agent-sessions/scripts/agent_sessions/kiro_scanner.py +91 -0
- package/packages/shared-skills/skills/coding-agent-sessions/scripts/agent_sessions/opencode.py +289 -0
- package/packages/shared-skills/skills/coding-agent-sessions/scripts/agent_sessions/scanners.py +92 -0
- package/packages/shared-skills/skills/coding-agent-sessions/scripts/agent_sessions/sqlite_optional_scanners.py +203 -0
- package/packages/shared-skills/skills/coding-agent-sessions/scripts/agent_sessions/sqlite_scanners.py +177 -0
- package/packages/shared-skills/skills/coding-agent-sessions/scripts/agent_sessions/timeparse.py +51 -0
- package/packages/shared-skills/skills/coding-agent-sessions/scripts/agent_sessions/transcript.py +149 -0
- package/packages/shared-skills/skills/coding-agent-sessions/scripts/agent_sessions/types.py +57 -0
- package/packages/shared-skills/skills/coding-agent-sessions/scripts/find-agent-sessions.py +19 -0
- package/packages/shared-skills/skills/frontend/ATTRIBUTION.md +52 -8
- package/packages/shared-skills/skills/frontend/SKILL.md +29 -8
- package/packages/shared-skills/skills/frontend/references/design/README.md +29 -12
- package/packages/shared-skills/skills/frontend/references/design/_INDEX.md +3 -3
- package/packages/shared-skills/skills/frontend/references/design/design-system-architecture.md +22 -19
- package/packages/shared-skills/skills/frontend/references/designpowers/EVIDENCE.md +89 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/README.md +48 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/UPSTREAM.md +80 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/lane-a-direction.md +64 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/lane-b-execution.md +65 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/lane-c-review.md +65 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/lane-d-memory.md +83 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/orchestration.md +80 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/routing.md +79 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/LICENSE +21 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/agents/accessibility-reviewer.md +83 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/agents/content-writer.md +132 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/agents/design-builder.md +109 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/agents/design-critic.md +89 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/agents/design-lead.md +113 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/agents/design-scout.md +78 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/agents/design-strategist.md +121 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/agents/heuristic-evaluator.md +268 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/agents/inspiration-scout.md +107 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/agents/motion-designer.md +120 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/accessible-content/SKILL.md +101 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/adaptive-interfaces/SKILL.md +109 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/cognitive-accessibility/SKILL.md +107 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/design-debate/SKILL.md +199 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/design-debt-tracker/SKILL.md +174 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/design-handoff/SKILL.md +125 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/design-md/SKILL.md +106 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/design-retrospective/SKILL.md +266 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/design-review/SKILL.md +123 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/design-system-alignment/SKILL.md +120 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/designpowers-critique/SKILL.md +164 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/heuristic-evaluation/SKILL.md +85 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/inclusive-personas/SKILL.md +98 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/inspiration-scouting/SKILL.md +165 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/interaction-design/SKILL.md +122 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/motion-choreography/SKILL.md +81 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/research-planning/SKILL.md +96 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/responsive-patterns/SKILL.md +77 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/synthetic-user-testing/SKILL.md +192 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/taste-feedback/SKILL.md +165 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/taste-report/SKILL.md +78 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/token-architecture/SKILL.md +75 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/ui-composition/SKILL.md +117 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/usability-testing/SKILL.md +78 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/verification-before-shipping/SKILL.md +125 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/voice-and-tone/SKILL.md +79 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/writing-design-plans/SKILL.md +119 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/scripts/core.py +0 -0
- package/packages/shared-skills/skills/git-master/SKILL.md +4 -0
- package/packages/shared-skills/skills/review-work/SKILL.md +3 -3
- package/packages/shared-skills/skills/start-work/SKILL.md +7 -5
- package/packages/shared-skills/skills/ultraresearch/SKILL.md +4 -252
- package/packages/shared-skills/skills/ulw-plan/SKILL.md +8 -6
- package/packages/shared-skills/skills/ulw-plan/references/full-workflow.md +11 -6
- package/packages/shared-skills/skills/ulw-plan/references/intent-clear.md +3 -3
- package/packages/shared-skills/skills/ulw-plan/references/intent-unclear.md +1 -1
- package/packages/{omo-codex/plugin/skills/ultraresearch → shared-skills/skills/ulw-research}/ATTRIBUTION.md +1 -1
- package/packages/shared-skills/skills/ulw-research/SKILL.md +260 -0
- package/packages/shared-skills/skills/visual-qa/SKILL.md +105 -14
- package/packages/shared-skills/skills/visual-qa/scripts/skill-prompt-contract.test.ts +120 -1
- package/script/qa/web-terminal-redaction.d.mts +13 -0
- package/script/qa/web-terminal-redaction.mjs +43 -0
- package/script/qa/web-terminal-renderer.mjs +218 -0
- package/script/qa/web-terminal-visual-qa.mjs +264 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/scripts/tests/test_cookie_domain_filter.py +0 -110
- package/packages/omo-codex/plugin/skills/ultimate-browsing/scripts/tests/test_extract_cookies.py +0 -245
- package/packages/omo-codex/plugin/test/ultraresearch-skill-contract.test.mjs +0 -204
package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/opencode.py
ADDED
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import shutil
|
|
4
|
+
import sqlite3
|
|
5
|
+
import subprocess
|
|
6
|
+
from concurrent.futures import ThreadPoolExecutor, as_completed
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
from typing import TypeAlias
|
|
9
|
+
|
|
10
|
+
from .jsonio import as_map, int_value, parse_json_text, read_json, text
|
|
11
|
+
from .timeparse import unix_millis
|
|
12
|
+
from .transcript import env_path, existing
|
|
13
|
+
from .types import JsonMap, Session
|
|
14
|
+
|
|
15
|
+
MAX_OPENCODE_SESSIONS = 50000
|
|
16
|
+
MAX_OPENCODE_CLI_SESSIONS = 100
|
|
17
|
+
OPENCODE_TIMEOUT_SECONDS = 8
|
|
18
|
+
SESSION_SQL = (
|
|
19
|
+
"select id, title, directory, time_created, time_updated, cost, tokens_input, tokens_output, "
|
|
20
|
+
"tokens_reasoning, tokens_cache_read, tokens_cache_write, model, parent_id, agent "
|
|
21
|
+
"from session where time_archived is null "
|
|
22
|
+
f"order by time_updated desc limit {MAX_OPENCODE_SESSIONS}"
|
|
23
|
+
)
|
|
24
|
+
LEGACY_SESSION_SQL = (
|
|
25
|
+
"select id, title, directory, time_created, time_updated, cost, tokens_input, tokens_output, "
|
|
26
|
+
"tokens_reasoning, tokens_cache_read, tokens_cache_write, model "
|
|
27
|
+
"from session where time_archived is null "
|
|
28
|
+
"order by time_updated desc limit 2000"
|
|
29
|
+
)
|
|
30
|
+
SqlValue: TypeAlias = str | int | float | bytes | None
|
|
31
|
+
OpenCodeRow: TypeAlias = tuple[SqlValue, ...]
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def scan_opencode(extra_roots: tuple[Path, ...], workers: int) -> list[Session]:
|
|
35
|
+
if not extra_roots:
|
|
36
|
+
sessions = _db_sessions()
|
|
37
|
+
if sessions:
|
|
38
|
+
return sessions
|
|
39
|
+
sessions = _cli_sessions()
|
|
40
|
+
if sessions:
|
|
41
|
+
return sessions
|
|
42
|
+
appdata = env_path("APPDATA")
|
|
43
|
+
roots = existing([
|
|
44
|
+
*(path for path in (env_path("OPENCODE_HOME"),) if path is not None),
|
|
45
|
+
Path.home() / ".opencode",
|
|
46
|
+
Path.home() / ".local" / "share" / "opencode",
|
|
47
|
+
*(path / "opencode" for path in (appdata,) if path is not None),
|
|
48
|
+
*extra_roots,
|
|
49
|
+
])
|
|
50
|
+
message_dirs = [message_dir for root in roots for message_dir in (root / "messages").glob("ses_*")]
|
|
51
|
+
sessions: list[Session] = []
|
|
52
|
+
if message_dirs:
|
|
53
|
+
with ThreadPoolExecutor(max_workers=min(workers, len(message_dirs))) as pool:
|
|
54
|
+
futures = [pool.submit(_file_session, message_dir.parents[1], message_dir) for message_dir in message_dirs]
|
|
55
|
+
for future in as_completed(futures):
|
|
56
|
+
session = future.result()
|
|
57
|
+
if session is not None:
|
|
58
|
+
sessions.append(session)
|
|
59
|
+
sessions.extend(_storage_sessions(roots))
|
|
60
|
+
return sessions
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def _storage_sessions(roots: list[Path]) -> list[Session]:
|
|
64
|
+
sessions: list[Session] = []
|
|
65
|
+
for root in roots:
|
|
66
|
+
for path in (root / "storage" / "session").glob("*/ses_*.json"):
|
|
67
|
+
info = as_map(read_json(path))
|
|
68
|
+
if info is None:
|
|
69
|
+
continue
|
|
70
|
+
time_info = as_map(info.get("time")) or {}
|
|
71
|
+
sessions.append(
|
|
72
|
+
Session(
|
|
73
|
+
"opencode",
|
|
74
|
+
text(info.get("id")) or path.stem,
|
|
75
|
+
str(path),
|
|
76
|
+
text(info.get("directory")),
|
|
77
|
+
unix_millis(int_value(time_info.get("created"))),
|
|
78
|
+
unix_millis(int_value(time_info.get("updated"))),
|
|
79
|
+
None,
|
|
80
|
+
None,
|
|
81
|
+
text(info.get("title")) or "",
|
|
82
|
+
{},
|
|
83
|
+
text(info.get("parentID")),
|
|
84
|
+
text(info.get("agent")),
|
|
85
|
+
)
|
|
86
|
+
)
|
|
87
|
+
return sessions
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def _db_sessions() -> list[Session]:
|
|
91
|
+
path = _db_path()
|
|
92
|
+
if path is None:
|
|
93
|
+
return []
|
|
94
|
+
conn: sqlite3.Connection | None = None
|
|
95
|
+
try:
|
|
96
|
+
conn = sqlite3.connect(str(path), timeout=3)
|
|
97
|
+
rows: list[OpenCodeRow] = _session_rows(conn)
|
|
98
|
+
except sqlite3.Error:
|
|
99
|
+
return []
|
|
100
|
+
finally:
|
|
101
|
+
if conn is not None:
|
|
102
|
+
conn.close()
|
|
103
|
+
return [_db_session(row) for row in rows]
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def _session_rows(conn: sqlite3.Connection) -> list[OpenCodeRow]:
|
|
107
|
+
try:
|
|
108
|
+
return conn.execute(SESSION_SQL).fetchall()
|
|
109
|
+
except sqlite3.Error:
|
|
110
|
+
return conn.execute(LEGACY_SESSION_SQL).fetchall()
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def _db_path() -> Path | None:
|
|
114
|
+
data = _opencode_text(["db", "path"])
|
|
115
|
+
candidates = [Path(data.strip()).expanduser()] if data else []
|
|
116
|
+
appdata = env_path("APPDATA")
|
|
117
|
+
candidates.extend([Path.home() / ".local" / "share" / "opencode" / "opencode.db"])
|
|
118
|
+
candidates.extend(path / "opencode" / "opencode.db" for path in (appdata,) if path is not None)
|
|
119
|
+
for path in candidates:
|
|
120
|
+
if str(path) and path.exists():
|
|
121
|
+
return path
|
|
122
|
+
return None
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
def _db_session(row: OpenCodeRow) -> Session:
|
|
126
|
+
session_id = _row_text(row, 0) or ""
|
|
127
|
+
title = _row_text(row, 1) or ""
|
|
128
|
+
model = as_map(parse_json_text(_row_text(row, 11) or ""))
|
|
129
|
+
return Session(
|
|
130
|
+
"opencode",
|
|
131
|
+
session_id,
|
|
132
|
+
f"opencode://{session_id}",
|
|
133
|
+
_row_text(row, 2),
|
|
134
|
+
unix_millis(_row_int(row, 3)),
|
|
135
|
+
unix_millis(_row_int(row, 4)),
|
|
136
|
+
text(model.get("providerID")) if model is not None else None,
|
|
137
|
+
text(model.get("id")) if model is not None else None,
|
|
138
|
+
title,
|
|
139
|
+
_db_usage(row),
|
|
140
|
+
_row_text(row, 12),
|
|
141
|
+
_row_text(row, 13),
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
def _db_usage(row: OpenCodeRow) -> JsonMap:
|
|
146
|
+
usage: JsonMap = {}
|
|
147
|
+
for index, key in ((5, "cost_total"), (6, "input"), (7, "output"), (8, "reasoning"), (9, "cacheRead"), (10, "cacheWrite")):
|
|
148
|
+
value = _row_number(row, index)
|
|
149
|
+
if value is not None:
|
|
150
|
+
usage[key] = value
|
|
151
|
+
return usage
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
def _row_text(row: OpenCodeRow, index: int) -> str | None:
|
|
155
|
+
value = row[index] if index < len(row) else None
|
|
156
|
+
return value if isinstance(value, str) else None
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
def _row_number(row: OpenCodeRow, index: int) -> int | float | None:
|
|
160
|
+
value = row[index] if index < len(row) else None
|
|
161
|
+
return value if isinstance(value, int | float) else None
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
def _row_int(row: OpenCodeRow, index: int) -> int | None:
|
|
165
|
+
value = row[index] if index < len(row) else None
|
|
166
|
+
return value if isinstance(value, int) else None
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
def _cli_sessions() -> list[Session]:
|
|
170
|
+
data = _opencode_json(["session", "list", "--format", "json", "--max-count", str(MAX_OPENCODE_CLI_SESSIONS)])
|
|
171
|
+
if not isinstance(data, list):
|
|
172
|
+
return []
|
|
173
|
+
return [_cli_session(item) for item in data]
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
def _cli_session(item: JsonMap) -> Session:
|
|
177
|
+
session_id = text(item.get("id")) or ""
|
|
178
|
+
title = text(item.get("title")) or ""
|
|
179
|
+
usage = _usage(item)
|
|
180
|
+
return Session(
|
|
181
|
+
"opencode",
|
|
182
|
+
session_id,
|
|
183
|
+
f"opencode://{session_id}",
|
|
184
|
+
text(item.get("directory")),
|
|
185
|
+
unix_millis(int_value(item.get("created"))),
|
|
186
|
+
unix_millis(int_value(item.get("updated"))),
|
|
187
|
+
None,
|
|
188
|
+
None,
|
|
189
|
+
title,
|
|
190
|
+
usage,
|
|
191
|
+
)
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
def _opencode_json(args: list[str]) -> JsonMap | list[JsonMap] | None:
|
|
195
|
+
data = _opencode_text(args)
|
|
196
|
+
return _json_result(data) if data is not None else None
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
def _opencode_text(args: list[str]) -> str | None:
|
|
200
|
+
binary = shutil.which("opencode")
|
|
201
|
+
if binary is None:
|
|
202
|
+
return None
|
|
203
|
+
try:
|
|
204
|
+
proc = subprocess.run(
|
|
205
|
+
[binary, *args],
|
|
206
|
+
check=False,
|
|
207
|
+
capture_output=True,
|
|
208
|
+
text=True,
|
|
209
|
+
timeout=OPENCODE_TIMEOUT_SECONDS,
|
|
210
|
+
)
|
|
211
|
+
except (OSError, subprocess.TimeoutExpired):
|
|
212
|
+
return None
|
|
213
|
+
if proc.returncode != 0:
|
|
214
|
+
return None
|
|
215
|
+
return proc.stdout
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
def _json_result(value: str) -> JsonMap | list[JsonMap] | None:
|
|
219
|
+
data = parse_json_text(value)
|
|
220
|
+
if isinstance(data, dict):
|
|
221
|
+
return data
|
|
222
|
+
if isinstance(data, list):
|
|
223
|
+
rows = [item for item in data if isinstance(item, dict)]
|
|
224
|
+
return rows
|
|
225
|
+
return None
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
def _usage(item: JsonMap) -> JsonMap:
|
|
229
|
+
usage: JsonMap = {}
|
|
230
|
+
cost = item.get("cost")
|
|
231
|
+
tokens = as_map(item.get("tokens"))
|
|
232
|
+
if isinstance(cost, int | float):
|
|
233
|
+
usage["cost_total"] = cost
|
|
234
|
+
if tokens is not None:
|
|
235
|
+
for key in ("input", "output", "reasoning", "cacheRead", "cacheWrite"):
|
|
236
|
+
value = tokens.get(key)
|
|
237
|
+
if isinstance(value, int | float):
|
|
238
|
+
usage[key] = value
|
|
239
|
+
return usage
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
def _file_session(root: Path, message_dir: Path) -> Session | None:
|
|
243
|
+
messages = sorted(message_dir.glob("*.json"), key=lambda item: item.name)
|
|
244
|
+
first = as_map(read_json(messages[0])) if messages else None
|
|
245
|
+
if first is None:
|
|
246
|
+
return None
|
|
247
|
+
session_id = text(first.get("sessionID")) or message_dir.name
|
|
248
|
+
model = as_map(first.get("model")) or {}
|
|
249
|
+
path_info = as_map(first.get("path")) or {}
|
|
250
|
+
stamps = [_message_millis(path) for path in messages]
|
|
251
|
+
known = [stamp for stamp in stamps if stamp is not None]
|
|
252
|
+
first_prompt, last_prompt = _prompt_edges(root, session_id, messages)
|
|
253
|
+
return Session(
|
|
254
|
+
"opencode",
|
|
255
|
+
session_id,
|
|
256
|
+
str(message_dir),
|
|
257
|
+
text(path_info.get("cwd")),
|
|
258
|
+
unix_millis(min(known) if known else None),
|
|
259
|
+
unix_millis(max(known) if known else None),
|
|
260
|
+
text(model.get("providerID")),
|
|
261
|
+
text(model.get("modelID")),
|
|
262
|
+
first_prompt,
|
|
263
|
+
{"message_count": len(messages)},
|
|
264
|
+
last_user_message=last_prompt,
|
|
265
|
+
)
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
def _prompt_edges(root: Path, session_id: str, messages: list[Path]) -> tuple[str, str]:
|
|
269
|
+
first_prompt = ""
|
|
270
|
+
last_prompt = ""
|
|
271
|
+
for path in messages:
|
|
272
|
+
data = as_map(read_json(path))
|
|
273
|
+
if data is None or data.get("role") != "user":
|
|
274
|
+
continue
|
|
275
|
+
message_id = text(data.get("id"))
|
|
276
|
+
for part in (root / "parts" / (message_id or "")).glob("*.json"):
|
|
277
|
+
part_data = as_map(read_json(part))
|
|
278
|
+
if part_data is not None and part_data.get("sessionID") == session_id:
|
|
279
|
+
value = text(part_data.get("text"))
|
|
280
|
+
if value:
|
|
281
|
+
first_prompt = first_prompt or value
|
|
282
|
+
last_prompt = value
|
|
283
|
+
return first_prompt, last_prompt
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
def _message_millis(path: Path) -> int | None:
|
|
287
|
+
data = as_map(read_json(path))
|
|
288
|
+
time_data = as_map(data.get("time")) if data is not None else None
|
|
289
|
+
return int_value(time_data.get("created")) if time_data is not None else None
|
package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/scanners.py
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from concurrent.futures import ThreadPoolExecutor, as_completed
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from typing import Callable, TypeAlias
|
|
6
|
+
|
|
7
|
+
from .claude import scan_claude
|
|
8
|
+
from .codex import scan_codex
|
|
9
|
+
from .file_scanners import (
|
|
10
|
+
scan_aider,
|
|
11
|
+
scan_amp,
|
|
12
|
+
scan_cline,
|
|
13
|
+
scan_codebuff,
|
|
14
|
+
scan_droid,
|
|
15
|
+
scan_gemini,
|
|
16
|
+
scan_kilocode,
|
|
17
|
+
scan_kimi,
|
|
18
|
+
scan_openclaw,
|
|
19
|
+
scan_qwen,
|
|
20
|
+
scan_roocode,
|
|
21
|
+
)
|
|
22
|
+
from .kiro_scanner import scan_kiro
|
|
23
|
+
from .opencode import scan_opencode
|
|
24
|
+
from .sqlite_optional_scanners import scan_crush, scan_goose, scan_hermes, scan_kilo_cli, scan_zed
|
|
25
|
+
from .sqlite_scanners import scan_cursor_cli, scan_kodu
|
|
26
|
+
from .transcript import existing, jsonl_parallel, recent, stem_id
|
|
27
|
+
from .types import Session
|
|
28
|
+
|
|
29
|
+
Scanner: TypeAlias = Callable[[tuple[Path, ...], int], list[Session]]
|
|
30
|
+
|
|
31
|
+
PLATFORM_SCANNERS: dict[str, Scanner] = {
|
|
32
|
+
"codex": scan_codex,
|
|
33
|
+
"claude": scan_claude,
|
|
34
|
+
"senpi": lambda roots, workers: scan_senpi(roots, workers),
|
|
35
|
+
"opencode": scan_opencode,
|
|
36
|
+
"openclaw": scan_openclaw,
|
|
37
|
+
"droid": scan_droid,
|
|
38
|
+
"amp": scan_amp,
|
|
39
|
+
"gemini": scan_gemini,
|
|
40
|
+
"kimi": scan_kimi,
|
|
41
|
+
"qwen": scan_qwen,
|
|
42
|
+
"codebuff": scan_codebuff,
|
|
43
|
+
"roo-code": scan_roocode,
|
|
44
|
+
"kilo-code": scan_kilocode,
|
|
45
|
+
"cline": scan_cline,
|
|
46
|
+
"kodu": scan_kodu,
|
|
47
|
+
"cursor-cli": scan_cursor_cli,
|
|
48
|
+
"aider": scan_aider,
|
|
49
|
+
"kilo-cli": scan_kilo_cli,
|
|
50
|
+
"hermes": scan_hermes,
|
|
51
|
+
"goose": scan_goose,
|
|
52
|
+
"crush": scan_crush,
|
|
53
|
+
"zed": scan_zed,
|
|
54
|
+
"kiro": scan_kiro,
|
|
55
|
+
}
|
|
56
|
+
DEFAULT_PLATFORMS = frozenset(PLATFORM_SCANNERS)
|
|
57
|
+
PLATFORM_ALIASES = {"cursor": "cursor-cli", "factory": "droid", "roo": "roo-code", "roocode": "roo-code", "kilocode": "kilo-code", "kilo": "kilo-cli"}
|
|
58
|
+
|
|
59
|
+
__all__ = ["DEFAULT_PLATFORMS", "PLATFORM_SCANNERS", "scan", "scan_claude", "scan_codex", "scan_opencode", "scan_senpi"]
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def scan(platforms: frozenset[str], roots: tuple[Path, ...], workers: int) -> list[Session]:
|
|
63
|
+
selected = frozenset(PLATFORM_ALIASES.get(platform, platform) for platform in platforms)
|
|
64
|
+
tasks = [task for platform, task in PLATFORM_SCANNERS.items() if platform in selected]
|
|
65
|
+
if not tasks:
|
|
66
|
+
return []
|
|
67
|
+
sessions: list[Session] = []
|
|
68
|
+
with ThreadPoolExecutor(max_workers=min(workers, max(len(tasks), 1))) as pool:
|
|
69
|
+
futures = [pool.submit(task, roots, workers) for task in tasks]
|
|
70
|
+
for future in as_completed(futures):
|
|
71
|
+
sessions.extend(future.result())
|
|
72
|
+
return _dedupe(sessions)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def scan_senpi(extra_roots: tuple[Path, ...], workers: int) -> list[Session]:
|
|
76
|
+
roots = existing([Path.home() / ".senpi" / "agent", Path.home() / ".pi" / "agent", *extra_roots])
|
|
77
|
+
paths = [path for root in roots for path in (root / "sessions").rglob("*.jsonl")]
|
|
78
|
+
return jsonl_parallel(recent(paths), workers, "senpi", lambda path: stem_id(path, "_"))
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def _dedupe(sessions: list[Session]) -> list[Session]:
|
|
82
|
+
found: dict[tuple[str, str], Session] = {}
|
|
83
|
+
for session in sessions:
|
|
84
|
+
key = (session.platform, session.id)
|
|
85
|
+
current = found.get(key)
|
|
86
|
+
if current is None or _linkage_score(session) > _linkage_score(current):
|
|
87
|
+
found[key] = session
|
|
88
|
+
return list(found.values())
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def _linkage_score(session: Session) -> int:
|
|
92
|
+
return int(session.parent_id is not None) + int(session.agent is not None)
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import sqlite3
|
|
4
|
+
from collections.abc import Iterable
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
from .jsonio import as_map, parse_json_text, text
|
|
8
|
+
from .timeparse import file_time, unix_millis
|
|
9
|
+
from .transcript import content_text, existing, flat_parallel, recent
|
|
10
|
+
from .types import JsonMap, Session
|
|
11
|
+
|
|
12
|
+
SqlValue = str | int | float | bytes | None
|
|
13
|
+
SqlRow = tuple[SqlValue, ...]
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def scan_kilo_cli(extra_roots: tuple[Path, ...], workers: int) -> list[Session]:
|
|
17
|
+
paths = existing([Path.home() / ".local" / "share" / "kilo" / "kilo.db", *(root / "kilo.db" for root in extra_roots)])
|
|
18
|
+
return flat_parallel(recent(paths), workers, lambda path: _message_table_sessions(path, "kilo-cli", "message"))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def scan_hermes(extra_roots: tuple[Path, ...], workers: int) -> list[Session]:
|
|
22
|
+
paths = existing([Path.home() / ".hermes" / "state.db", *(root / "state.db" for root in extra_roots)])
|
|
23
|
+
return flat_parallel(recent(paths), workers, lambda path: _message_table_sessions(path, "hermes", "messages"))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def scan_goose(extra_roots: tuple[Path, ...], workers: int) -> list[Session]:
|
|
27
|
+
defaults = [
|
|
28
|
+
Path.home() / ".local" / "share" / "goose" / "sessions" / "sessions.db",
|
|
29
|
+
Path.home() / "Library" / "Application Support" / "goose" / "sessions" / "sessions.db",
|
|
30
|
+
]
|
|
31
|
+
paths = existing([*defaults, *(root / "sessions.db" for root in extra_roots)])
|
|
32
|
+
return flat_parallel(recent(paths), workers, lambda path: _message_table_sessions(path, "goose", "messages"))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def scan_crush(extra_roots: tuple[Path, ...], workers: int) -> list[Session]:
|
|
36
|
+
paths = existing([Path.home() / ".local" / "share" / "crush" / "crush.db", *(root / "crush.db" for root in extra_roots)])
|
|
37
|
+
return flat_parallel(recent(paths), workers, _crush_sessions)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def scan_zed(extra_roots: tuple[Path, ...], workers: int) -> list[Session]:
|
|
41
|
+
paths = existing([Path.home() / "Library" / "Application Support" / "Zed" / "threads" / "threads.db", *(root / "threads.db" for root in extra_roots)])
|
|
42
|
+
return flat_parallel(recent(paths), workers, _zed_sessions)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def _message_table_sessions(path: Path, platform: str, table: str) -> list[Session]:
|
|
46
|
+
try:
|
|
47
|
+
with sqlite3.connect(path) as conn:
|
|
48
|
+
rows = _fetch_all(conn, f"select session_id, role, data, created_at from {table} order by created_at")
|
|
49
|
+
except sqlite3.Error:
|
|
50
|
+
return []
|
|
51
|
+
return _group_message_rows(platform, path, rows)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def _crush_sessions(path: Path) -> list[Session]:
|
|
55
|
+
try:
|
|
56
|
+
with sqlite3.connect(path) as conn:
|
|
57
|
+
rows = _fetch_all(conn, "select session_id, role, parts, created_at from messages order by created_at")
|
|
58
|
+
except sqlite3.Error:
|
|
59
|
+
return []
|
|
60
|
+
return _group_message_rows("crush", path, rows)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def _zed_sessions(path: Path) -> list[Session]:
|
|
64
|
+
try:
|
|
65
|
+
with sqlite3.connect(path) as conn:
|
|
66
|
+
rows = _fetch_all(conn, "select id, data_type, data, updated_at from threads")
|
|
67
|
+
except sqlite3.Error:
|
|
68
|
+
return []
|
|
69
|
+
sessions: list[Session] = []
|
|
70
|
+
for row in rows:
|
|
71
|
+
if _row_text(row, 1) != "json":
|
|
72
|
+
continue
|
|
73
|
+
data = _json_blob(_row_bytes(row, 2))
|
|
74
|
+
messages = _json_messages(data)
|
|
75
|
+
first_user, last_user = _message_edges(messages)
|
|
76
|
+
if not first_user:
|
|
77
|
+
continue
|
|
78
|
+
sid = _row_text(row, 0) or path.stem
|
|
79
|
+
sessions.append(Session("zed", sid, str(path), None, _row_text(row, 3) or file_time(path), _row_text(row, 3) or file_time(path), "zed.dev", _zed_model(data), first_user, {"message_count": len(messages)}, last_user_message=last_user))
|
|
80
|
+
return sessions
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def _group_message_rows(platform: str, path: Path, rows: Iterable[SqlRow]) -> list[Session]:
|
|
84
|
+
grouped: dict[str, list[JsonMap]] = {}
|
|
85
|
+
stamps: dict[str, str] = {}
|
|
86
|
+
for row in rows:
|
|
87
|
+
sid = _row_text(row, 0)
|
|
88
|
+
if sid is None:
|
|
89
|
+
continue
|
|
90
|
+
message = _message_json(row)
|
|
91
|
+
if message is None:
|
|
92
|
+
continue
|
|
93
|
+
if sid not in grouped:
|
|
94
|
+
grouped[sid] = []
|
|
95
|
+
grouped[sid].append(message)
|
|
96
|
+
if sid not in stamps:
|
|
97
|
+
stamps[sid] = _stamp(row, 3) or file_time(path) or ""
|
|
98
|
+
sessions: list[Session] = []
|
|
99
|
+
for sid, messages in grouped.items():
|
|
100
|
+
first_user, last_user = _message_edges(messages)
|
|
101
|
+
if not first_user:
|
|
102
|
+
continue
|
|
103
|
+
sessions.append(Session(platform, sid, str(path), None, stamps.get(sid) or file_time(path), file_time(path), _provider(messages), _model(messages), first_user, {"message_count": len(messages)}, last_user_message=last_user))
|
|
104
|
+
return sessions
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
def _message_json(row: SqlRow) -> JsonMap | None:
|
|
108
|
+
role = _row_text(row, 1)
|
|
109
|
+
raw = _row_json(row, 2)
|
|
110
|
+
if raw is None:
|
|
111
|
+
return {"role": role or "", "content": _row_text(row, 2) or ""}
|
|
112
|
+
if "role" not in raw:
|
|
113
|
+
raw["role"] = role or text(raw.get("role")) or ""
|
|
114
|
+
return raw
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
def _message_edges(messages: list[JsonMap]) -> tuple[str, str]:
|
|
118
|
+
first_user = last_user = ""
|
|
119
|
+
for message in messages:
|
|
120
|
+
if text(message.get("role")) != "user":
|
|
121
|
+
continue
|
|
122
|
+
prompt = _content(message)
|
|
123
|
+
if prompt:
|
|
124
|
+
first_user = first_user or prompt
|
|
125
|
+
last_user = prompt
|
|
126
|
+
return first_user, last_user
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def _content(message: JsonMap) -> str:
|
|
130
|
+
for key in ("content", "parts", "text"):
|
|
131
|
+
value = message.get(key)
|
|
132
|
+
parsed = parse_json_text(value) if isinstance(value, str) else value
|
|
133
|
+
result = content_text(parsed) or (value if isinstance(value, str) else "")
|
|
134
|
+
if result:
|
|
135
|
+
return result
|
|
136
|
+
return ""
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def _json_messages(data: JsonMap | None) -> list[JsonMap]:
|
|
140
|
+
if data is None:
|
|
141
|
+
return []
|
|
142
|
+
for key in ("messages", "turns", "entries"):
|
|
143
|
+
value = data.get(key)
|
|
144
|
+
if isinstance(value, list):
|
|
145
|
+
return [item for item in value if isinstance(item, dict)]
|
|
146
|
+
return []
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
def _model(messages: list[JsonMap]) -> str | None:
|
|
150
|
+
for message in messages:
|
|
151
|
+
model = text(message.get("modelID")) or text(message.get("model_id")) or text(message.get("model"))
|
|
152
|
+
if model:
|
|
153
|
+
return model
|
|
154
|
+
return None
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
def _provider(messages: list[JsonMap]) -> str | None:
|
|
158
|
+
for message in messages:
|
|
159
|
+
provider = text(message.get("providerID")) or text(message.get("provider_id")) or text(message.get("provider"))
|
|
160
|
+
if provider:
|
|
161
|
+
return provider
|
|
162
|
+
return None
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
def _zed_model(data: JsonMap | None) -> str | None:
|
|
166
|
+
model = as_map(data.get("model")) if data is not None else None
|
|
167
|
+
return text(model.get("model")) if model is not None else None
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
def _fetch_all(conn: sqlite3.Connection, sql: str) -> list[SqlRow]:
|
|
171
|
+
rows: list[SqlRow] = conn.execute(sql).fetchall()
|
|
172
|
+
return rows
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
def _row_json(row: SqlRow, index: int) -> JsonMap | None:
|
|
176
|
+
value = _row_text(row, index)
|
|
177
|
+
return as_map(parse_json_text(value)) if value is not None else None
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
def _json_blob(value: bytes | None) -> JsonMap | None:
|
|
181
|
+
if value is None:
|
|
182
|
+
return None
|
|
183
|
+
try:
|
|
184
|
+
return as_map(parse_json_text(value.decode()))
|
|
185
|
+
except UnicodeDecodeError:
|
|
186
|
+
return None
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
def _row_text(row: SqlRow, index: int) -> str | None:
|
|
190
|
+
value = row[index] if index < len(row) else None
|
|
191
|
+
return text(value) if not isinstance(value, bytes) else None
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
def _row_bytes(row: SqlRow, index: int) -> bytes | None:
|
|
195
|
+
value = row[index] if index < len(row) else None
|
|
196
|
+
return value if isinstance(value, bytes) else None
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
def _stamp(row: SqlRow, index: int) -> str | None:
|
|
200
|
+
value = row[index] if index < len(row) else None
|
|
201
|
+
if isinstance(value, int):
|
|
202
|
+
return unix_millis(value) if value > 10_000_000_000 else None
|
|
203
|
+
return value if isinstance(value, str) else None
|