@dsmm/dsmm 0.1.9 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -58
- package/agent-presets/dsmm-builder/agent.cordis.yml +91 -186
- package/agent-presets/dsmm-builder/preset.yml +1 -1
- package/agent-presets/dsmm-clarifier/agent.cordis.yml +120 -17
- package/agent-presets/dsmm-clarifier/preset.yml +1 -1
- package/agent-presets/dsmm-code-search/agent.cordis.yml +72 -17
- package/agent-presets/dsmm-code-search/preset.yml +1 -1
- package/agent-presets/dsmm-coding/agent.cordis.yml +169 -0
- package/agent-presets/dsmm-coding/preset.yml +3 -0
- package/agent-presets/dsmm-complex/agent.cordis.yml +154 -0
- package/agent-presets/dsmm-complex/preset.yml +3 -0
- package/agent-presets/dsmm-creative/agent.cordis.yml +122 -15
- package/agent-presets/dsmm-creative/preset.yml +1 -1
- package/agent-presets/dsmm-cross-cutting/agent.cordis.yml +179 -0
- package/agent-presets/dsmm-cross-cutting/preset.yml +3 -0
- package/agent-presets/dsmm-deep/agent.cordis.yml +189 -0
- package/agent-presets/dsmm-deep/preset.yml +3 -0
- package/agent-presets/dsmm-doc-search/agent.cordis.yml +72 -17
- package/agent-presets/dsmm-doc-search/preset.yml +1 -1
- package/agent-presets/dsmm-documenting/agent.cordis.yml +168 -0
- package/agent-presets/dsmm-documenting/preset.yml +3 -0
- package/agent-presets/dsmm-frontend/agent.cordis.yml +161 -0
- package/agent-presets/dsmm-frontend/preset.yml +3 -0
- package/agent-presets/dsmm-hard-reasoning/agent.cordis.yml +153 -0
- package/agent-presets/dsmm-hard-reasoning/preset.yml +3 -0
- package/agent-presets/dsmm-media-reader/agent.cordis.yml +72 -17
- package/agent-presets/dsmm-media-reader/preset.yml +1 -1
- package/agent-presets/dsmm-normal-task/agent.cordis.yml +127 -0
- package/agent-presets/dsmm-normal-task/preset.yml +3 -0
- package/agent-presets/dsmm-oracle/agent.cordis.yml +109 -15
- package/agent-presets/dsmm-oracle/preset.yml +1 -1
- package/agent-presets/dsmm-oracle-2nd/agent.cordis.yml +109 -15
- package/agent-presets/dsmm-oracle-2nd/preset.yml +1 -1
- package/agent-presets/dsmm-orchestrator/agent.cordis.yml +174 -190
- package/agent-presets/dsmm-orchestrator/preset.yml +1 -1
- package/agent-presets/dsmm-plan-critic/agent.cordis.yml +102 -16
- package/agent-presets/dsmm-plan-critic/preset.yml +1 -1
- package/agent-presets/dsmm-planner/agent.cordis.yml +134 -15
- package/agent-presets/dsmm-planner/preset.yml +1 -1
- package/agent-presets/dsmm-quick/agent.cordis.yml +132 -0
- package/agent-presets/dsmm-quick/preset.yml +3 -0
- package/agent-presets/dsmm-research/agent.cordis.yml +156 -0
- package/agent-presets/dsmm-research/preset.yml +3 -0
- package/agent-presets/dsmm-reviewer/agent.cordis.yml +108 -16
- package/agent-presets/dsmm-reviewer/preset.yml +1 -1
- package/cordis.patch.yml +1 -5
- package/docs/agent-presets.md +48 -15
- package/docs/compatibility.md +58 -68
- package/docs/deferred-native-approval-risk.md +19 -0
- package/docs/design.md +43 -2
- package/docs/lsp.md +12 -12
- package/docs/migration-from-ocmm.md +10 -2
- package/docs/model-routing.md +84 -59
- package/docs/native-permissions.md +35 -0
- package/docs/profiles.md +43 -64
- package/docs/releasing.md +159 -8
- package/docs/roadmap.md +77 -17
- package/docs/runtime-recovery.md +12 -0
- package/docs/safety-guards.md +7 -3
- package/docs/settings-status.md +46 -40
- package/docs/skill-sync.md +89 -14
- package/lib/child-admission-contract.d.ts +37 -0
- package/lib/child-admission-contract.js +2 -0
- package/lib/child-admission.d.ts +42 -0
- package/lib/child-admission.js +162 -0
- package/lib/child-capture.d.ts +81 -0
- package/lib/child-capture.js +203 -0
- package/lib/child-evidence.d.ts +17 -0
- package/lib/child-evidence.js +43 -0
- package/lib/client/ChildrenPanel.d.ts +43 -0
- package/lib/client/ChildrenPanel.js +82 -0
- package/lib/client/DeploymentPage.d.ts +18 -0
- package/lib/client/DeploymentPage.js +127 -0
- package/lib/client/EditableChoice.d.ts +17 -0
- package/lib/client/EditableChoice.js +49 -0
- package/lib/client/PermissionsPanel.d.ts +14 -0
- package/lib/client/PermissionsPanel.js +46 -0
- package/lib/client/ProfilesSection.js +32 -15
- package/lib/client/RoleAvailability.d.ts +7 -0
- package/lib/client/RoleAvailability.js +19 -0
- package/lib/client/SessionProfiles.js +27 -9
- package/lib/client/StructuredEditor.js +15 -7
- package/lib/client/children-controller.d.ts +98 -0
- package/lib/client/children-controller.js +296 -0
- package/lib/client/children-locales.d.ts +367 -0
- package/lib/client/children-locales.js +69 -0
- package/lib/client/controller.d.ts +6 -1
- package/lib/client/controller.js +14 -8
- package/lib/client/deployment-controller.d.ts +50 -0
- package/lib/client/deployment-controller.js +193 -0
- package/lib/client/deployment-data.d.ts +17 -0
- package/lib/client/deployment-data.js +138 -0
- package/lib/client/deployment-locales.d.ts +70 -0
- package/lib/client/deployment-locales.js +81 -0
- package/lib/client/diagnostics.d.ts +14 -0
- package/lib/client/diagnostics.js +53 -0
- package/lib/client/index.d.ts +4 -0
- package/lib/client/index.js +145 -1
- package/lib/client/locales.d.ts +58 -0
- package/lib/client/locales.js +38 -18
- package/lib/client/permission-client.d.ts +16 -0
- package/lib/client/permission-client.js +38 -0
- package/lib/client/permission-controller.d.ts +62 -0
- package/lib/client/permission-controller.js +149 -0
- package/lib/client/permission-locales.d.ts +114 -0
- package/lib/client/permission-locales.js +75 -0
- package/lib/client/plugins-contract.d.ts +27 -0
- package/lib/client/plugins-contract.js +2 -0
- package/lib/client/session-labels.js +4 -4
- package/lib/client/structured.js +19 -5
- package/lib/client/styles.d.ts +1 -1
- package/lib/client/styles.js +36 -0
- package/lib/client.js +6724 -1604
- package/lib/commands.js +3 -0
- package/lib/config-file-store.d.ts +23 -0
- package/lib/config-file-store.js +67 -0
- package/lib/core-permission-authority.d.ts +18 -0
- package/lib/core-permission-authority.js +255 -0
- package/lib/core-permissions.d.ts +8 -0
- package/lib/core-permissions.js +33 -0
- package/lib/delivery-authority.d.ts +68 -0
- package/lib/delivery-authority.js +260 -0
- package/lib/deployment-config.d.ts +60 -0
- package/lib/deployment-config.js +205 -0
- package/lib/deployment-permission-rules.d.ts +55 -0
- package/lib/deployment-permission-rules.js +306 -0
- package/lib/dsh-home.d.ts +3 -0
- package/lib/dsh-home.js +10 -0
- package/lib/dsh-types.d.ts +22 -69
- package/lib/guards.d.ts +3 -2
- package/lib/guards.js +44 -6
- package/lib/host-llm-startup.d.ts +41 -0
- package/lib/host-llm-startup.js +65 -0
- package/lib/host-llm.d.ts +92 -0
- package/lib/host-llm.js +325 -0
- package/lib/index.d.ts +23 -5
- package/lib/index.js +383 -40
- package/lib/legacy-child-policy.d.ts +51 -0
- package/lib/legacy-child-policy.js +123 -0
- package/lib/legacy-read-composition.d.ts +20 -0
- package/lib/legacy-read-composition.js +144 -0
- package/lib/legacy-read-contracts.d.ts +157 -0
- package/lib/legacy-read-contracts.js +39 -0
- package/lib/legacy-read-host.d.ts +19 -0
- package/lib/legacy-read-host.js +67 -0
- package/lib/legacy-read-integration.d.ts +121 -0
- package/lib/legacy-read-integration.js +522 -0
- package/lib/legacy-read-proxy.d.ts +26 -0
- package/lib/legacy-read-proxy.js +237 -0
- package/lib/live-pi-ai-owner.d.ts +18 -0
- package/lib/live-pi-ai-owner.js +144 -0
- package/lib/llm-runtime.d.ts +11 -0
- package/lib/llm-runtime.js +21 -0
- package/lib/lsp.d.ts +13 -0
- package/lib/lsp.js +60 -0
- package/lib/managed-settings.d.ts +5 -0
- package/lib/managed-settings.js +14 -0
- package/lib/mode.js +42 -47
- package/lib/model-parameter-policy.d.ts +11 -0
- package/lib/model-parameter-policy.js +27 -0
- package/lib/model-routing.js +33 -19
- package/lib/modules.d.ts +35 -0
- package/lib/modules.js +37 -0
- package/lib/native-child-evidence.d.ts +42 -0
- package/lib/native-child-evidence.js +133 -0
- package/lib/native-pi-ai-wire.d.ts +37 -0
- package/lib/native-pi-ai-wire.js +261 -0
- package/lib/native-scope.d.ts +9 -0
- package/lib/native-scope.js +20 -0
- package/lib/permission-bash.d.ts +6 -0
- package/lib/permission-bash.js +7 -0
- package/lib/permission-control.d.ts +73 -0
- package/lib/permission-control.js +205 -0
- package/lib/permission-controller.d.ts +68 -0
- package/lib/permission-controller.js +317 -0
- package/lib/permission-errors.d.ts +7 -0
- package/lib/permission-errors.js +21 -0
- package/lib/permission-fs-search.d.ts +5 -0
- package/lib/permission-fs-search.js +7 -0
- package/lib/permission-fs.d.ts +5 -0
- package/lib/permission-fs.js +7 -0
- package/lib/permission-native-access.d.ts +11 -0
- package/lib/permission-native-access.js +6 -0
- package/lib/permission-native-command.d.ts +10 -0
- package/lib/permission-native-command.js +93 -0
- package/lib/permission-native-rules.d.ts +75 -0
- package/lib/permission-native-rules.js +278 -0
- package/lib/permission-pwsh.d.ts +6 -0
- package/lib/permission-pwsh.js +7 -0
- package/lib/permission-remote.d.ts +26 -0
- package/lib/permission-remote.js +53 -0
- package/lib/permission-rpc.d.ts +29 -0
- package/lib/permission-rpc.js +152 -0
- package/lib/permission-rules.d.ts +115 -0
- package/lib/permission-rules.js +256 -0
- package/lib/permission-settings.d.ts +45 -0
- package/lib/permission-settings.js +48 -0
- package/lib/permission-shell.d.ts +38 -0
- package/lib/permission-shell.js +150 -0
- package/lib/permission-web.d.ts +5 -0
- package/lib/permission-web.js +7 -0
- package/lib/plan-validation.js +6 -44
- package/lib/preset-materializer.js +2 -0
- package/lib/preset-registry.d.ts +1 -1
- package/lib/preset-registry.js +38 -24
- package/lib/preset-skills.d.ts +4 -1
- package/lib/preset-skills.js +60 -19
- package/lib/profile-diagnostics.d.ts +45 -0
- package/lib/profile-diagnostics.js +148 -0
- package/lib/profile-locale.d.ts +3 -0
- package/lib/profile-locale.js +2 -0
- package/lib/profile-remote.d.ts +22 -0
- package/lib/profile-remote.js +344 -27
- package/lib/profile-rpc.d.ts +25 -1
- package/lib/profile-rpc.js +143 -3
- package/lib/profile-runtime.d.ts +63 -0
- package/lib/profile-runtime.js +496 -77
- package/lib/profile-store.d.ts +56 -1
- package/lib/profile-store.js +377 -111
- package/lib/profile-types.d.ts +125 -1
- package/lib/profile-types.js +1 -0
- package/lib/profiles.d.ts +16 -2
- package/lib/profiles.js +156 -79
- package/lib/prompt-content.d.ts +25 -0
- package/lib/prompt-content.js +27 -0
- package/lib/prompts.d.ts +45 -4
- package/lib/prompts.js +157 -43
- package/lib/recovery-policy.js +20 -7
- package/lib/role-control-remote.d.ts +38 -0
- package/lib/role-control-remote.js +211 -0
- package/lib/role-control-rpc.d.ts +51 -0
- package/lib/role-control-rpc.js +377 -0
- package/lib/role-control-types.d.ts +92 -0
- package/lib/role-control-types.js +8 -0
- package/lib/role-invocation.d.ts +47 -0
- package/lib/role-invocation.js +135 -0
- package/lib/role-llm-runtime.d.ts +17 -0
- package/lib/role-llm-runtime.js +62 -0
- package/lib/role-llm.d.ts +31 -0
- package/lib/role-llm.js +66 -0
- package/lib/role-policy.d.ts +92 -0
- package/lib/role-policy.js +601 -0
- package/lib/role-providers.d.ts +7 -3
- package/lib/role-providers.js +74 -46
- package/lib/role-routing.d.ts +11 -2
- package/lib/role-routing.js +42 -25
- package/lib/role-runs.d.ts +135 -0
- package/lib/role-runs.js +304 -0
- package/lib/role-subagents.d.ts +63 -4
- package/lib/role-subagents.js +299 -47
- package/lib/roles.d.ts +20 -9
- package/lib/roles.js +87 -216
- package/lib/route-json.d.ts +19 -0
- package/lib/route-json.js +129 -0
- package/lib/routing-policy.d.ts +2 -0
- package/lib/routing-policy.js +12 -2
- package/lib/runtime-integration.d.ts +112 -0
- package/lib/runtime-integration.js +784 -0
- package/lib/runtime-recovery.js +34 -13
- package/lib/session-scope.js +2 -0
- package/lib/settings.d.ts +116 -14
- package/lib/settings.js +455 -149
- package/lib/skills.d.ts +24 -9
- package/lib/skills.js +114 -35
- package/lib/state.d.ts +10 -6
- package/lib/state.js +48 -49
- package/lib/status.d.ts +35 -1
- package/lib/status.js +58 -17
- package/lib/subagent-runtime.d.ts +45 -0
- package/lib/subagent-runtime.js +131 -0
- package/locale/en.json +2 -2
- package/locale/zh.json +2 -2
- package/package.json +112 -45
- package/patches/subagent-runtime.yml +15 -0
- package/prompts/deepseek-flash.md +1 -1
- package/prompts/deepseek-v4-pro.md +2 -2
- package/prompts/deepwork.md +153 -20
- package/prompts/source/agents/clarifier.md +47 -0
- package/prompts/source/agents/orchestrator.md +72 -0
- package/prompts/source/agents/plan-critic.md +29 -0
- package/prompts/source/agents/planner.md +21 -0
- package/prompts/source/agents/reviewer.md +23 -0
- package/prompts/source/catalog.json +548 -0
- package/prompts/source/category/coding.md +46 -0
- package/prompts/source/category/complex.md +29 -0
- package/prompts/source/category/creative.md +40 -0
- package/prompts/source/category/cross-cutting.md +54 -0
- package/prompts/source/category/deep.md +64 -0
- package/prompts/source/category/documenting.md +68 -0
- package/prompts/source/category/frontend.md +38 -0
- package/prompts/source/category/hard-reasoning.md +53 -0
- package/prompts/source/category/normal-task.md +27 -0
- package/prompts/source/category/quick.md +34 -0
- package/prompts/source/category/research.md +58 -0
- package/prompts/source/deepwork/claude-opus-5.md +28 -0
- package/prompts/source/deepwork/codex.md +9 -0
- package/prompts/source/deepwork/default.md +136 -0
- package/prompts/source/deepwork/gemini.md +191 -0
- package/prompts/source/deepwork/glm.md +263 -0
- package/prompts/source/deepwork/gpt.md +49 -0
- package/prompts/source/deepwork/kimi-k27.md +13 -0
- package/prompts/source/deepwork/planner.md +44 -0
- package/prompts/source/deepwork/swe-2.md +13 -0
- package/prompts/source/manifest.json +3233 -0
- package/prompts/source/shared/dsh-host-contract.md +8 -0
- package/prompts/source/shared/locale.md +8 -0
- package/prompts/source/shared/shell-safety.md +7 -0
- package/prompts/source/terminal/builder.md +13 -0
- package/prompts/source/terminal/clarifier.md +41 -0
- package/prompts/source/terminal/code-search.md +39 -0
- package/prompts/source/terminal/coding.md +41 -0
- package/prompts/source/terminal/complex.md +43 -0
- package/prompts/source/terminal/creative.md +41 -0
- package/prompts/source/terminal/cross-cutting.md +43 -0
- package/prompts/source/terminal/deep.md +43 -0
- package/prompts/source/terminal/doc-search.md +39 -0
- package/prompts/source/terminal/documenting.md +41 -0
- package/prompts/source/terminal/frontend.md +41 -0
- package/prompts/source/terminal/hard-reasoning.md +41 -0
- package/prompts/source/terminal/media-reader.md +39 -0
- package/prompts/source/terminal/normal-task.md +41 -0
- package/prompts/source/terminal/oracle-2nd.md +53 -0
- package/prompts/source/terminal/oracle.md +53 -0
- package/prompts/source/terminal/orchestrator.md +26 -0
- package/prompts/source/terminal/plan-critic.md +41 -0
- package/prompts/source/terminal/planner.md +42 -0
- package/prompts/source/terminal/quick.md +39 -0
- package/prompts/source/terminal/research.md +39 -0
- package/prompts/source/terminal/reviewer.md +53 -0
- package/scripts/cold-profile-composition.mjs +329 -0
- package/scripts/cold-profile-sources.mjs +238 -0
- package/scripts/migrate-cold-profile.mjs +315 -0
- package/skills/ast-grep/LICENSE +21 -0
- package/skills/ast-grep/README.md +138 -0
- package/skills/ast-grep/SKILL.md +287 -0
- package/skills/ast-grep/SOURCE +1 -0
- package/skills/ast-grep/install.ps1 +235 -0
- package/skills/ast-grep/install.sh +286 -0
- package/skills/ast-grep/references/cli.md +233 -0
- package/skills/ast-grep/references/install.md +168 -0
- package/skills/ast-grep/references/patterns.md +149 -0
- package/skills/ast-grep/references/pitfalls.md +305 -0
- package/skills/ast-grep/references/recipes.md +404 -0
- package/skills/ast-grep/references/sgconfig.md +250 -0
- package/skills/ast-grep/references/yaml-rules.md +511 -0
- package/skills/ast-grep/scripts/ast_grep_helper.py +760 -0
- package/skills/ast-grep/tests/smoke.ps1 +129 -0
- package/skills/ast-grep/tests/smoke.sh +212 -0
- package/skills/ast-grep/tests/test_resolver.py +154 -0
- package/skills/brainstorming/SKILL.md +123 -9
- package/skills/coding-agent-sessions/LICENSE-UPSTREAM.md +82 -0
- package/skills/coding-agent-sessions/NOTICE.md +24 -0
- package/skills/coding-agent-sessions/SKILL.md +147 -0
- package/skills/coding-agent-sessions/agents/openai.yaml +4 -0
- package/skills/coding-agent-sessions/pyrightconfig.json +5 -0
- package/skills/coding-agent-sessions/references/all-platforms.md +77 -0
- package/skills/coding-agent-sessions/references/claude.md +34 -0
- package/skills/coding-agent-sessions/references/codex.md +32 -0
- package/skills/coding-agent-sessions/references/opencode.md +45 -0
- package/skills/coding-agent-sessions/references/senpi.md +29 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/__init__.py +1 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/aside_scanner.py +140 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/claude.py +66 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/cli.py +283 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/codex.py +105 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/file_scanners.py +275 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/jsonio.py +55 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/kiro_scanner.py +91 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/opencode.py +289 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/pi_family.py +46 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/scanners.py +104 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/sqlite_optional_scanners.py +203 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/sqlite_scanners.py +177 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/timeparse.py +51 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/transcript.py +149 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/types.py +57 -0
- package/skills/coding-agent-sessions/scripts/find-agent-sessions.py +19 -0
- package/skills/coding-agent-sessions/scripts/tests/test_agent_sessions.py +322 -0
- package/skills/coding-agent-sessions/scripts/tests/test_aside_scanner.py +131 -0
- package/skills/coding-agent-sessions/scripts/tests/test_cli_contract.py +126 -0
- package/skills/coding-agent-sessions/scripts/tests/test_extended_scanners.py +262 -0
- package/skills/coding-agent-sessions/scripts/tests/test_optional_sqlite_scanners.py +79 -0
- package/skills/coding-agent-sessions/scripts/tests/test_pi_family_scanners.py +130 -0
- package/skills/debugging/SKILL.md +130 -4
- package/skills/debugging/references/logging.md +2 -0
- package/skills/debugging/references/methodology/00-setup.md +16 -62
- package/skills/debugging/references/methodology/02-investigate.md +11 -5
- package/skills/debugging/references/methodology/03-flaky-triage.md +6 -4
- package/skills/debugging/references/methodology/04-hard-reasoning-escalation.md +6 -16
- package/skills/debugging/references/methodology/05-escalate.md +2 -0
- package/skills/debugging/references/methodology/06-fix.md +8 -6
- package/skills/debugging/references/methodology/08-qa.md +7 -5
- package/skills/debugging/references/methodology/09-cleanup.md +16 -152
- package/skills/debugging/references/methodology/partial-runtime-evidence.md +7 -18
- package/skills/debugging/references/runtimes/bundled-js-binary.md +3 -16
- package/skills/debugging/references/runtimes/go.md +2 -0
- package/skills/debugging/references/runtimes/native-binary.md +11 -54
- package/skills/debugging/references/runtimes/node.md +6 -15
- package/skills/debugging/references/runtimes/python.md +5 -15
- package/skills/debugging/references/runtimes/rust.md +4 -18
- package/skills/debugging/references/scripts/dap.test.mjs +539 -0
- package/skills/debugging/references/scripts/fixture-adapter.mjs +164 -0
- package/skills/debugging/references/tools/dap.md +4 -2
- package/skills/debugging/references/tools/ghidra.md +6 -15
- package/skills/debugging/references/tools/playwright-cli.md +5 -15
- package/skills/debugging/references/tools/pwndbg.md +2 -0
- package/skills/debugging/references/tools/pwntools.md +6 -16
- package/skills/dispatching-parallel-agents/SKILL.md +96 -7
- package/skills/frontend/.frontend-materialized.json +856 -0
- package/skills/frontend/ATTRIBUTION.md +37 -0
- package/skills/frontend/LICENSE-Apache-2.0.txt +201 -0
- package/skills/frontend/LICENSE-taste-skill.txt +21 -0
- package/skills/frontend/LICENSE-ui-ux-pro-max.txt +21 -0
- package/skills/frontend/SKILL.md +145 -0
- package/skills/frontend/references/design/README.md +256 -0
- package/skills/frontend/references/design/_INDEX.md +206 -0
- package/skills/frontend/references/design/airbnb.md +393 -0
- package/skills/frontend/references/design/airtable.md +92 -0
- package/skills/frontend/references/design/apple.md +250 -0
- package/skills/frontend/references/design/aside.md +211 -0
- package/skills/frontend/references/design/binance.md +348 -0
- package/skills/frontend/references/design/bmw.md +183 -0
- package/skills/frontend/references/design/brutalist-skill.md +92 -0
- package/skills/frontend/references/design/bugatti.md +271 -0
- package/skills/frontend/references/design/cal.md +262 -0
- package/skills/frontend/references/design/claude.md +315 -0
- package/skills/frontend/references/design/clay.md +307 -0
- package/skills/frontend/references/design/clickhouse.md +284 -0
- package/skills/frontend/references/design/clone-from-url.md +69 -0
- package/skills/frontend/references/design/cohere.md +269 -0
- package/skills/frontend/references/design/coinbase.md +132 -0
- package/skills/frontend/references/design/composio.md +310 -0
- package/skills/frontend/references/design/cursor.md +312 -0
- package/skills/frontend/references/design/design-system-architecture.md +250 -0
- package/skills/frontend/references/design/elevenlabs.md +268 -0
- package/skills/frontend/references/design/expo.md +284 -0
- package/skills/frontend/references/design/ferrari.md +317 -0
- package/skills/frontend/references/design/figma.md +223 -0
- package/skills/frontend/references/design/framer.md +249 -0
- package/skills/frontend/references/design/gpt-tasteskill.md +74 -0
- package/skills/frontend/references/design/hashicorp.md +281 -0
- package/skills/frontend/references/design/ibm.md +335 -0
- package/skills/frontend/references/design/image-to-code-skill.md +1228 -0
- package/skills/frontend/references/design/imagegen-brandkit.md +798 -0
- package/skills/frontend/references/design/imagegen-frontend-mobile.md +1465 -0
- package/skills/frontend/references/design/imagegen-frontend-web.md +987 -0
- package/skills/frontend/references/design/interaction-skill.md +52 -0
- package/skills/frontend/references/design/intercom.md +149 -0
- package/skills/frontend/references/design/kraken.md +128 -0
- package/skills/frontend/references/design/lamborghini.md +291 -0
- package/skills/frontend/references/design/linear.app.md +370 -0
- package/skills/frontend/references/design/lovable.md +301 -0
- package/skills/frontend/references/design/mastercard.md +368 -0
- package/skills/frontend/references/design/meta.md +369 -0
- package/skills/frontend/references/design/minimalist-skill.md +85 -0
- package/skills/frontend/references/design/minimax.md +260 -0
- package/skills/frontend/references/design/mintlify.md +329 -0
- package/skills/frontend/references/design/miro.md +111 -0
- package/skills/frontend/references/design/mistral.ai.md +264 -0
- package/skills/frontend/references/design/mongodb.md +269 -0
- package/skills/frontend/references/design/nike.md +366 -0
- package/skills/frontend/references/design/notion.md +312 -0
- package/skills/frontend/references/design/nvidia.md +296 -0
- package/skills/frontend/references/design/ollama.md +270 -0
- package/skills/frontend/references/design/opencode.ai.md +284 -0
- package/skills/frontend/references/design/output-skill.md +49 -0
- package/skills/frontend/references/design/pinterest.md +233 -0
- package/skills/frontend/references/design/playstation.md +367 -0
- package/skills/frontend/references/design/posthog.md +259 -0
- package/skills/frontend/references/design/raycast.md +271 -0
- package/skills/frontend/references/design/react-dev-tooling-skill.md +232 -0
- package/skills/frontend/references/design/redesign-skill.md +178 -0
- package/skills/frontend/references/design/renault.md +314 -0
- package/skills/frontend/references/design/replicate.md +264 -0
- package/skills/frontend/references/design/resend.md +306 -0
- package/skills/frontend/references/design/revolut.md +188 -0
- package/skills/frontend/references/design/runwayml.md +247 -0
- package/skills/frontend/references/design/sanity.md +360 -0
- package/skills/frontend/references/design/sentry.md +265 -0
- package/skills/frontend/references/design/shopify.md +353 -0
- package/skills/frontend/references/design/soft-skill.md +98 -0
- package/skills/frontend/references/design/spacex.md +197 -0
- package/skills/frontend/references/design/spotify.md +249 -0
- package/skills/frontend/references/design/starbucks.md +583 -0
- package/skills/frontend/references/design/stitch-design-example.md +121 -0
- package/skills/frontend/references/design/stitch-skill.md +184 -0
- package/skills/frontend/references/design/stripe.md +325 -0
- package/skills/frontend/references/design/supabase.md +258 -0
- package/skills/frontend/references/design/superhuman.md +255 -0
- package/skills/frontend/references/design/taste-skill.md +1206 -0
- package/skills/frontend/references/design/tesla.md +289 -0
- package/skills/frontend/references/design/theverge.md +342 -0
- package/skills/frontend/references/design/together.ai.md +266 -0
- package/skills/frontend/references/design/uber.md +298 -0
- package/skills/frontend/references/design/vercel.md +313 -0
- package/skills/frontend/references/design/vodafone.md +426 -0
- package/skills/frontend/references/design/voltagent.md +326 -0
- package/skills/frontend/references/design/warp.md +256 -0
- package/skills/frontend/references/design/webflow.md +95 -0
- package/skills/frontend/references/design/wired.md +281 -0
- package/skills/frontend/references/design/wise.md +176 -0
- package/skills/frontend/references/design/x.ai.md +260 -0
- package/skills/frontend/references/design/zapier.md +331 -0
- package/skills/frontend/references/perfection/README.md +264 -0
- package/skills/frontend/references/perfection/react-perf-tooling.md +234 -0
- package/skills/frontend/references/ui-ux-db/README.md +659 -0
- package/skills/frontend/references/ui-ux-db/data/app-interface.csv +31 -0
- package/skills/frontend/references/ui-ux-db/data/charts.csv +26 -0
- package/skills/frontend/references/ui-ux-db/data/colors.csv +162 -0
- package/skills/frontend/references/ui-ux-db/data/google-fonts.csv +1924 -0
- package/skills/frontend/references/ui-ux-db/data/icons.csv +106 -0
- package/skills/frontend/references/ui-ux-db/data/landing.csv +35 -0
- package/skills/frontend/references/ui-ux-db/data/products.csv +162 -0
- package/skills/frontend/references/ui-ux-db/data/react-performance.csv +45 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/angular.csv +51 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/astro.csv +54 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/flutter.csv +53 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/html-tailwind.csv +56 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/jetpack-compose.csv +53 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/laravel.csv +51 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/nextjs.csv +53 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/nuxt-ui.csv +51 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/nuxtjs.csv +59 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/react-native.csv +52 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/react.csv +54 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/shadcn.csv +61 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/svelte.csv +54 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/swiftui.csv +51 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/threejs.csv +54 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/vue.csv +50 -0
- package/skills/frontend/references/ui-ux-db/data/styles.csv +85 -0
- package/skills/frontend/references/ui-ux-db/data/typography.csv +74 -0
- package/skills/frontend/references/ui-ux-db/data/ui-reasoning.csv +162 -0
- package/skills/frontend/references/ui-ux-db/data/ux-guidelines.csv +100 -0
- package/skills/frontend/references/ui-ux-db/data/web-interface.csv +31 -0
- package/skills/frontend/references/ui-ux-db/scripts/core.py +262 -0
- package/skills/frontend/references/ui-ux-db/scripts/design_system.py +1148 -0
- package/skills/frontend/references/ui-ux-db/scripts/search.py +114 -0
- package/skills/frontend/scripts/perfection/lighthouse-audit.py +201 -0
- package/skills/git-master/SKILL.md +115 -0
- package/skills/git-master/agents/openai.yaml +13 -0
- package/skills/init-deep/SKILL.md +282 -0
- package/skills/receiving-code-review/SKILL.md +117 -7
- package/skills/remove-ai-slops/SKILL.md +160 -8
- package/skills/requesting-code-review/SKILL.md +98 -3
- package/skills/requesting-code-review/code-reviewer.md +59 -0
- package/skills/subagent-driven-development/SKILL.md +179 -6
- package/skills/subagent-driven-development/code-quality-reviewer-prompt.md +23 -0
- package/skills/subagent-driven-development/implementer-prompt.md +87 -0
- package/skills/subagent-driven-development/spec-reviewer-prompt.md +37 -0
- package/skills/using-git-worktrees/SKILL.md +144 -0
- package/skills/writing-plans/SKILL.md +126 -7
- package/skills/writing-plans/plan-document-reviewer-prompt.md +47 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import sqlite3
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
from typing import TypeAlias
|
|
7
|
+
|
|
8
|
+
from .jsonio import as_map, iter_jsonl, parse_json_text, text
|
|
9
|
+
from .timeparse import file_time, unix_millis, unix_seconds
|
|
10
|
+
from .transcript import content_text, existing, flat_parallel, merge_usage, recent
|
|
11
|
+
from .types import JsonMap, Session
|
|
12
|
+
|
|
13
|
+
SqlValue: TypeAlias = str | int | float | bytes | None
|
|
14
|
+
SqlRow: TypeAlias = tuple[SqlValue, ...]
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@dataclass(frozen=True, slots=True)
|
|
18
|
+
class _StateRow:
|
|
19
|
+
parent_id: str | None
|
|
20
|
+
title: str | None
|
|
21
|
+
cwd: str | None
|
|
22
|
+
provider: str | None
|
|
23
|
+
model: str | None
|
|
24
|
+
created_at: str | None
|
|
25
|
+
updated_at: str | None
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def scan_aside(extra_roots: tuple[Path, ...], workers: int) -> list[Session]:
|
|
29
|
+
roots = _roots([Path.home() / ".aside"], extra_roots, (".aside",))
|
|
30
|
+
sessions: list[Session] = []
|
|
31
|
+
for user_dir in _user_dirs(roots):
|
|
32
|
+
index = _state_index(user_dir / "state.db")
|
|
33
|
+
paths = list((user_dir / "sessions").glob("*/messages.jsonl"))
|
|
34
|
+
sessions.extend(flat_parallel(recent(paths), workers, lambda path, rows=index: [_aside_session(path, rows)]))
|
|
35
|
+
return sessions
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def _user_dirs(roots: list[Path]) -> list[Path]:
|
|
39
|
+
dirs: list[Path] = []
|
|
40
|
+
for root in roots:
|
|
41
|
+
users = sorted(path for path in (root / "u").glob("*") if path.is_dir())
|
|
42
|
+
if users:
|
|
43
|
+
dirs.extend(users)
|
|
44
|
+
elif (root / "sessions").exists():
|
|
45
|
+
dirs.append(root)
|
|
46
|
+
return dirs
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def _state_index(db_path: Path) -> dict[str, _StateRow]:
|
|
50
|
+
if not db_path.exists():
|
|
51
|
+
return {}
|
|
52
|
+
try:
|
|
53
|
+
with sqlite3.connect(f"file:{db_path}?mode=ro", uri=True) as conn:
|
|
54
|
+
rows: list[SqlRow] = conn.execute("select id, parent_id, title, cwd, model, created_at, updated_at from sessions").fetchall()
|
|
55
|
+
except sqlite3.Error:
|
|
56
|
+
return {}
|
|
57
|
+
index: dict[str, _StateRow] = {}
|
|
58
|
+
for row in rows:
|
|
59
|
+
sid = _cell_text(row, 0)
|
|
60
|
+
if sid is None:
|
|
61
|
+
continue
|
|
62
|
+
provider, model = _model_fields(_cell_text(row, 4))
|
|
63
|
+
index[sid] = _StateRow(
|
|
64
|
+
_cell_text(row, 1),
|
|
65
|
+
_cell_text(row, 2),
|
|
66
|
+
_cell_text(row, 3),
|
|
67
|
+
provider,
|
|
68
|
+
model,
|
|
69
|
+
unix_seconds(_cell_number(row, 5)),
|
|
70
|
+
unix_seconds(_cell_number(row, 6)),
|
|
71
|
+
)
|
|
72
|
+
return index
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def _cell_text(row: SqlRow, index: int) -> str | None:
|
|
76
|
+
value = row[index] if index < len(row) else None
|
|
77
|
+
return value if isinstance(value, str) else None
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def _cell_number(row: SqlRow, index: int) -> int | float | None:
|
|
81
|
+
value = row[index] if index < len(row) else None
|
|
82
|
+
return value if isinstance(value, int | float) else None
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def _model_fields(model_json: str | None) -> tuple[str | None, str | None]:
|
|
86
|
+
data = as_map(parse_json_text(model_json)) if model_json else None
|
|
87
|
+
if data is None:
|
|
88
|
+
return None, None
|
|
89
|
+
return text(data.get("provider")), text(data.get("modelId")) or text(data.get("model"))
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def _aside_session(path: Path, index: dict[str, _StateRow]) -> Session:
|
|
93
|
+
sid = _dir_session_id(path.parent.name)
|
|
94
|
+
row = index.get(sid)
|
|
95
|
+
first_user = last_user = ""
|
|
96
|
+
provider = model = None
|
|
97
|
+
created = updated = None
|
|
98
|
+
usage: JsonMap = {}
|
|
99
|
+
for data in iter_jsonl(path):
|
|
100
|
+
stamp = data.get("timestamp")
|
|
101
|
+
moment = unix_millis(int(stamp)) if isinstance(stamp, int | float) else None
|
|
102
|
+
created = created or moment
|
|
103
|
+
updated = moment or updated
|
|
104
|
+
role = text(data.get("role"))
|
|
105
|
+
if role == "user":
|
|
106
|
+
prompt = content_text(data.get("content"))
|
|
107
|
+
if prompt:
|
|
108
|
+
first_user = first_user or prompt
|
|
109
|
+
last_user = prompt
|
|
110
|
+
elif role == "assistant":
|
|
111
|
+
provider = provider or text(data.get("provider"))
|
|
112
|
+
model = model or text(data.get("model"))
|
|
113
|
+
merge_usage(usage, as_map(data.get("usage")))
|
|
114
|
+
return Session(
|
|
115
|
+
"aside",
|
|
116
|
+
sid,
|
|
117
|
+
str(path),
|
|
118
|
+
row.cwd if row is not None else None,
|
|
119
|
+
(row.created_at if row is not None else None) or created or file_time(path),
|
|
120
|
+
(row.updated_at if row is not None else None) or updated or created or file_time(path),
|
|
121
|
+
(row.provider if row is not None else None) or provider,
|
|
122
|
+
(row.model if row is not None else None) or model,
|
|
123
|
+
first_user,
|
|
124
|
+
usage,
|
|
125
|
+
row.parent_id if row is not None else None,
|
|
126
|
+
row.title if row is not None and row.parent_id is not None else None,
|
|
127
|
+
last_user,
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def _dir_session_id(name: str) -> str:
|
|
132
|
+
return name.split("_", 1)[-1]
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
def _roots(defaults: list[Path], extra_roots: tuple[Path, ...], children: tuple[str, ...]) -> list[Path]:
|
|
136
|
+
candidates = [*defaults]
|
|
137
|
+
for root in extra_roots:
|
|
138
|
+
candidates.append(root)
|
|
139
|
+
candidates.extend(root / child for child in children)
|
|
140
|
+
return existing(candidates)
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from concurrent.futures import ThreadPoolExecutor, as_completed
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
from .jsonio import as_map, iter_jsonl, read_json, text
|
|
7
|
+
from .timeparse import file_time
|
|
8
|
+
from .transcript import content_text, env_path, existing, jsonl_parallel, recent
|
|
9
|
+
from .types import Session
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def scan_claude(extra_roots: tuple[Path, ...], workers: int) -> list[Session]:
|
|
13
|
+
appdata = env_path("APPDATA")
|
|
14
|
+
roots = existing([Path.home() / ".claude", *(path / "Claude" for path in (appdata,) if path is not None), *extra_roots])
|
|
15
|
+
mains: list[Path] = []
|
|
16
|
+
subagents: list[Path] = []
|
|
17
|
+
for root in roots:
|
|
18
|
+
mains.extend((root / "transcripts").glob("*.jsonl"))
|
|
19
|
+
mains.extend((root / "projects").glob("*/*.jsonl"))
|
|
20
|
+
mains.extend((root / "pre-compact-session-histories").glob("*.jsonl"))
|
|
21
|
+
subagents.extend((root / "projects").glob("*/*/subagents/**/agent-*.jsonl"))
|
|
22
|
+
sessions = jsonl_parallel(recent(mains), workers, "claude", lambda path: path.stem)
|
|
23
|
+
sessions.extend(_subagent_parallel(recent(subagents), workers))
|
|
24
|
+
return sessions
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def _subagent_parallel(paths: list[Path], workers: int) -> list[Session]:
|
|
28
|
+
if not paths:
|
|
29
|
+
return []
|
|
30
|
+
sessions: list[Session] = []
|
|
31
|
+
with ThreadPoolExecutor(max_workers=min(workers, max(len(paths), 1))) as pool:
|
|
32
|
+
futures = [pool.submit(_subagent_session, path) for path in paths]
|
|
33
|
+
for future in as_completed(futures):
|
|
34
|
+
session = future.result()
|
|
35
|
+
if session is not None:
|
|
36
|
+
sessions.append(session)
|
|
37
|
+
return sessions
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def _subagent_session(path: Path) -> Session | None:
|
|
41
|
+
parts = path.parts
|
|
42
|
+
if "subagents" not in parts:
|
|
43
|
+
return None
|
|
44
|
+
parent_sid = parts[parts.index("subagents") - 1]
|
|
45
|
+
meta = as_map(read_json(path.with_name(path.stem + ".meta.json"))) or {}
|
|
46
|
+
first = next(iter_jsonl(path), None) or {}
|
|
47
|
+
message = as_map(first.get("message")) or {}
|
|
48
|
+
description = text(meta.get("description")) or ""
|
|
49
|
+
task = content_text(message.get("content"))
|
|
50
|
+
prompt = "\n".join(part for part in (description, task) if part)
|
|
51
|
+
created = text(first.get("timestamp")) or file_time(path)
|
|
52
|
+
return Session(
|
|
53
|
+
"claude",
|
|
54
|
+
path.stem.removeprefix("agent-"),
|
|
55
|
+
str(path),
|
|
56
|
+
text(first.get("cwd")),
|
|
57
|
+
created,
|
|
58
|
+
file_time(path) or created,
|
|
59
|
+
None,
|
|
60
|
+
None,
|
|
61
|
+
prompt,
|
|
62
|
+
{},
|
|
63
|
+
parent_sid,
|
|
64
|
+
text(meta.get("agentType")),
|
|
65
|
+
prompt,
|
|
66
|
+
)
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
from concurrent.futures import ThreadPoolExecutor, as_completed
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
from .jsonio import as_map, dumps, iter_jsonl
|
|
8
|
+
from .scanners import DEFAULT_PLATFORMS, scan
|
|
9
|
+
from .timeparse import date_bound, parse_stamp
|
|
10
|
+
from .transcript import user_text
|
|
11
|
+
from .types import Json, JsonMap, Options, Session
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def main() -> int:
|
|
15
|
+
command, opts, rest = _parse()
|
|
16
|
+
sessions = sorted(scan(opts.platforms, opts.roots, opts.workers), key=lambda item: item.created_at or "", reverse=True)
|
|
17
|
+
if command == "list":
|
|
18
|
+
_emit(_list_payload(_filter(sessions, opts), sessions, opts.limit, include_subagents=opts.include_subagents))
|
|
19
|
+
return 0
|
|
20
|
+
if command == "search":
|
|
21
|
+
queries = _queries(opts, rest)
|
|
22
|
+
_require(list(queries), "search requires a query")
|
|
23
|
+
_emit(_search_payload(_filter(sessions, opts), sessions, queries, opts.limit, opts.workers, include_subagents=opts.include_subagents))
|
|
24
|
+
return 0
|
|
25
|
+
if command == "get":
|
|
26
|
+
_require(rest, "read requires at least one session id")
|
|
27
|
+
_emit(_get_payload(sessions, rest))
|
|
28
|
+
return 0
|
|
29
|
+
raise SystemExit(f"unknown command: {command}")
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _parse() -> tuple[str, Options, list[str]]:
|
|
33
|
+
import sys
|
|
34
|
+
|
|
35
|
+
args = sys.argv[1:]
|
|
36
|
+
if not args or args[0] in {"-h", "--help"}:
|
|
37
|
+
usage = (
|
|
38
|
+
"Usage: find-agent-sessions.py list|find|search|read|get [query|ids...] [--query TEXT ...] "
|
|
39
|
+
"[--platform NAME ...] [--root PATH] [--from DATE] [--to DATE] [--cwd TEXT] "
|
|
40
|
+
"[--model TEXT] [--limit N] [--workers N] [--include-subagents]"
|
|
41
|
+
)
|
|
42
|
+
print(usage)
|
|
43
|
+
raise SystemExit(0)
|
|
44
|
+
command = args.pop(0)
|
|
45
|
+
if command == "find":
|
|
46
|
+
command = "search"
|
|
47
|
+
elif command == "read":
|
|
48
|
+
command = "get"
|
|
49
|
+
roots: list[Path] = []
|
|
50
|
+
queries: list[str] = []
|
|
51
|
+
platforms: list[str] = []
|
|
52
|
+
date_from = date_to = cwd = model = None
|
|
53
|
+
limit = 20
|
|
54
|
+
workers = _default_workers()
|
|
55
|
+
include_subagents = False
|
|
56
|
+
rest: list[str] = []
|
|
57
|
+
index = 0
|
|
58
|
+
while index < len(args):
|
|
59
|
+
arg = args[index]
|
|
60
|
+
if arg == "--root":
|
|
61
|
+
roots.append(Path(args[index + 1]).expanduser())
|
|
62
|
+
index += 2
|
|
63
|
+
elif arg == "--query":
|
|
64
|
+
queries.append(args[index + 1])
|
|
65
|
+
index += 2
|
|
66
|
+
elif arg == "--platform":
|
|
67
|
+
platform = args[index + 1].strip().lower()
|
|
68
|
+
if "," in platform:
|
|
69
|
+
raise SystemExit("Use repeated --platform flags, for example: --platform senpi --platform opencode")
|
|
70
|
+
platforms.append(platform)
|
|
71
|
+
index += 2
|
|
72
|
+
elif arg == "--from":
|
|
73
|
+
date_from = args[index + 1]
|
|
74
|
+
index += 2
|
|
75
|
+
elif arg == "--to":
|
|
76
|
+
date_to = args[index + 1]
|
|
77
|
+
index += 2
|
|
78
|
+
elif arg == "--cwd":
|
|
79
|
+
cwd = args[index + 1].lower()
|
|
80
|
+
index += 2
|
|
81
|
+
elif arg == "--model":
|
|
82
|
+
model = args[index + 1].lower()
|
|
83
|
+
index += 2
|
|
84
|
+
elif arg == "--limit":
|
|
85
|
+
limit = int(args[index + 1])
|
|
86
|
+
index += 2
|
|
87
|
+
elif arg == "--workers":
|
|
88
|
+
workers = max(int(args[index + 1]), 1)
|
|
89
|
+
index += 2
|
|
90
|
+
elif arg == "--include-subagents":
|
|
91
|
+
include_subagents = True
|
|
92
|
+
index += 1
|
|
93
|
+
else:
|
|
94
|
+
rest.append(arg)
|
|
95
|
+
index += 1
|
|
96
|
+
selected_platforms = frozenset(platforms) if platforms else DEFAULT_PLATFORMS
|
|
97
|
+
return command, Options(selected_platforms, tuple(roots), tuple(queries), date_from, date_to, cwd, model, limit, workers, include_subagents), rest
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def _filter(sessions: list[Session], opts: Options) -> list[Session]:
|
|
101
|
+
start = date_bound(opts.date_from)
|
|
102
|
+
end = date_bound(opts.date_to, end=True)
|
|
103
|
+
result: list[Session] = []
|
|
104
|
+
for item in sessions:
|
|
105
|
+
stamp = parse_stamp(item.created_at)
|
|
106
|
+
if start is not None and stamp is not None and stamp < start:
|
|
107
|
+
continue
|
|
108
|
+
if end is not None and stamp is not None and stamp >= end:
|
|
109
|
+
continue
|
|
110
|
+
if opts.cwd is not None and opts.cwd not in (item.cwd or "").lower():
|
|
111
|
+
continue
|
|
112
|
+
if opts.model is not None and opts.model not in (item.model or "").lower():
|
|
113
|
+
continue
|
|
114
|
+
result.append(item)
|
|
115
|
+
return result
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def _child_counts(sessions: list[Session]) -> dict[tuple[str, str], int]:
|
|
119
|
+
counts: dict[tuple[str, str], int] = {}
|
|
120
|
+
for item in sessions:
|
|
121
|
+
if item.parent_id is not None:
|
|
122
|
+
key = (item.platform, item.parent_id)
|
|
123
|
+
counts[key] = counts.get(key, 0) + 1
|
|
124
|
+
return counts
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def _annotate(item: Session, counts: dict[tuple[str, str], int]) -> JsonMap:
|
|
128
|
+
data = item.to_json()
|
|
129
|
+
data["subagent_count"] = counts.get((item.platform, item.id), 0)
|
|
130
|
+
data["detail_hint"] = _detail_hint(item)
|
|
131
|
+
return data
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def _list_payload(filtered: list[Session], all_sessions: list[Session], limit: int, include_subagents: bool = False) -> JsonMap:
|
|
135
|
+
counts = _child_counts(all_sessions)
|
|
136
|
+
candidates = filtered if include_subagents else [item for item in filtered if item.parent_id is None]
|
|
137
|
+
results: list[Json] = [_annotate(item, counts) for item in candidates[:limit]]
|
|
138
|
+
return {"count": len(results), "results": results}
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
def _search_payload(filtered: list[Session], all_sessions: list[Session], queries: tuple[str, ...], limit: int, workers: int, include_subagents: bool = False) -> JsonMap:
|
|
142
|
+
counts = _child_counts(all_sessions)
|
|
143
|
+
candidates = filtered if include_subagents else [item for item in filtered if item.parent_id is None]
|
|
144
|
+
per_query: list[Json] = []
|
|
145
|
+
merged: dict[tuple[str, str], tuple[Session, list[JsonMap]]] = {}
|
|
146
|
+
with ThreadPoolExecutor(max_workers=min(workers, max(len(queries), 1))) as pool:
|
|
147
|
+
futures = [pool.submit(_search_one, candidates, query, limit) for query in queries]
|
|
148
|
+
for future in as_completed(futures):
|
|
149
|
+
query, matches = future.result()
|
|
150
|
+
per_query.append({"query": query, "count": len(matches), "results": [_annotate_search(item, counts, reasons) for item, reasons in matches]})
|
|
151
|
+
for item, reasons in matches:
|
|
152
|
+
key = (item.platform, item.id)
|
|
153
|
+
if key not in merged:
|
|
154
|
+
merged[key] = (item, reasons)
|
|
155
|
+
results: list[Json] = [_annotate_search(item, counts, reasons) for item, reasons in list(merged.values())[:limit]]
|
|
156
|
+
return {"count": len(results), "queries": per_query, "results": results}
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
def _get_payload(sessions: list[Session], ids: list[str]) -> JsonMap:
|
|
160
|
+
counts = _child_counts(sessions)
|
|
161
|
+
results: list[Json] = []
|
|
162
|
+
for item in sessions:
|
|
163
|
+
if item.id not in ids and not any(item.id.startswith(prefix) for prefix in ids):
|
|
164
|
+
continue
|
|
165
|
+
events = _events(item)
|
|
166
|
+
first_prompt, last_prompt = _prompt_edges(item, events)
|
|
167
|
+
session = _annotate(item, counts)
|
|
168
|
+
session["first_user_message"] = first_prompt[:300]
|
|
169
|
+
session["last_user_message"] = last_prompt[:300]
|
|
170
|
+
children = sorted(
|
|
171
|
+
(child for child in sessions if child.platform == item.platform and child.parent_id == item.id),
|
|
172
|
+
key=lambda child: child.created_at or "",
|
|
173
|
+
)
|
|
174
|
+
results.append(
|
|
175
|
+
{
|
|
176
|
+
"session": session,
|
|
177
|
+
"prompts": {"first_user_message": first_prompt, "last_user_message": last_prompt},
|
|
178
|
+
"events": events,
|
|
179
|
+
"subagents": [_annotate(child, counts) for child in children],
|
|
180
|
+
"detail_hint": _detail_hint(item),
|
|
181
|
+
}
|
|
182
|
+
)
|
|
183
|
+
return {"count": len(results), "results": results}
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
def _annotate_search(item: Session, counts: dict[tuple[str, str], int], reasons: list[JsonMap]) -> JsonMap:
|
|
187
|
+
data = _annotate(item, counts)
|
|
188
|
+
reason_rows: list[Json] = []
|
|
189
|
+
reason_rows.extend(reasons)
|
|
190
|
+
data["match_reasons"] = reason_rows
|
|
191
|
+
return data
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
def _detail_hint(item: Session) -> str:
|
|
195
|
+
return f"python3 scripts/find-agent-sessions.py read {item.id} --platform {item.platform}"
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
def _events(item: Session) -> list[Json]:
|
|
199
|
+
if item.path.endswith(".jsonl"):
|
|
200
|
+
return list(iter_jsonl(Path(item.path)))
|
|
201
|
+
events: list[Json] = []
|
|
202
|
+
if item.first_user_message:
|
|
203
|
+
events.append({"type": "message", "message": {"role": "user", "content": item.first_user_message}})
|
|
204
|
+
if item.last_user_message and item.last_user_message != item.first_user_message:
|
|
205
|
+
events.append({"type": "message", "message": {"role": "user", "content": item.last_user_message}})
|
|
206
|
+
return events
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
def _prompt_edges(item: Session, events: list[Json]) -> tuple[str, str]:
|
|
210
|
+
first_prompt = item.first_user_message
|
|
211
|
+
last_prompt = item.last_user_message or item.first_user_message
|
|
212
|
+
for event in events:
|
|
213
|
+
if not isinstance(event, dict):
|
|
214
|
+
continue
|
|
215
|
+
message = as_map(event.get("message")) or as_map(event.get("payload")) or {}
|
|
216
|
+
prompt = user_text(event, message)
|
|
217
|
+
if prompt:
|
|
218
|
+
first_prompt = first_prompt or prompt
|
|
219
|
+
last_prompt = prompt
|
|
220
|
+
return first_prompt, last_prompt
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
def _match_reasons(item: Session, query: str) -> list[JsonMap]:
|
|
224
|
+
needle = query.lower()
|
|
225
|
+
reasons: list[JsonMap] = []
|
|
226
|
+
for field, value in _search_fields(item):
|
|
227
|
+
if needle in value.lower():
|
|
228
|
+
reasons.append({"query": query, "platform": item.platform, "field": field, "snippet": _snippet(value, needle)})
|
|
229
|
+
return reasons
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
def _search_fields(item: Session) -> tuple[tuple[str, str], ...]:
|
|
233
|
+
return (
|
|
234
|
+
("platform", item.platform),
|
|
235
|
+
("id", item.id),
|
|
236
|
+
("path", item.path),
|
|
237
|
+
("cwd", item.cwd or ""),
|
|
238
|
+
("provider", item.provider or ""),
|
|
239
|
+
("model", item.model or ""),
|
|
240
|
+
("agent", item.agent or ""),
|
|
241
|
+
("first_user_message", item.first_user_message),
|
|
242
|
+
("last_user_message", item.last_user_message),
|
|
243
|
+
)
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
def _snippet(value: str, needle: str) -> str:
|
|
247
|
+
start = max(value.lower().find(needle) - 60, 0)
|
|
248
|
+
end = min(start + 160, len(value))
|
|
249
|
+
return value[start:end]
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
def _queries(opts: Options, rest: list[str]) -> tuple[str, ...]:
|
|
253
|
+
if opts.queries:
|
|
254
|
+
return opts.queries
|
|
255
|
+
joined = " ".join(rest).strip()
|
|
256
|
+
return (joined,) if joined else ()
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
def _search_one(sessions: list[Session], query: str, limit: int) -> tuple[str, list[tuple[Session, list[JsonMap]]]]:
|
|
260
|
+
matches: list[tuple[Session, list[JsonMap]]] = []
|
|
261
|
+
for item in sessions:
|
|
262
|
+
reasons = _match_reasons(item, query)
|
|
263
|
+
if reasons:
|
|
264
|
+
matches.append((item, reasons))
|
|
265
|
+
return query, matches[:limit]
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
def _emit(value: JsonMap) -> None:
|
|
269
|
+
print(dumps(value))
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
def _require(values: list[str], message: str) -> None:
|
|
273
|
+
if not values:
|
|
274
|
+
raise SystemExit(message)
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
def _default_workers() -> int:
|
|
278
|
+
cpu = os.cpu_count() or 4
|
|
279
|
+
return min(max(cpu * 4, 8), 64)
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
if __name__ == "__main__":
|
|
283
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import sqlite3
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from typing import TypeAlias
|
|
6
|
+
|
|
7
|
+
from .timeparse import unix_seconds
|
|
8
|
+
from .transcript import env_path, existing, flat_parallel, jsonl_parallel, nick_role, recent, spawn_info, stem_id
|
|
9
|
+
from .types import Json, Session
|
|
10
|
+
|
|
11
|
+
THREADS_SQL = (
|
|
12
|
+
"SELECT id, rollout_path, cwd, created_at, updated_at, model_provider, model, first_user_message, tokens_used, "
|
|
13
|
+
"source, agent_nickname, agent_role FROM threads"
|
|
14
|
+
)
|
|
15
|
+
LEGACY_THREADS_SQL = (
|
|
16
|
+
"SELECT id, rollout_path, cwd, created_at, updated_at, model_provider, model, first_user_message, tokens_used FROM threads"
|
|
17
|
+
)
|
|
18
|
+
SPAWN_EDGES_SQL = "SELECT child_thread_id, parent_thread_id FROM thread_spawn_edges"
|
|
19
|
+
|
|
20
|
+
SqliteScalar: TypeAlias = str | int | float | bytes | None
|
|
21
|
+
CodexRow: TypeAlias = tuple[SqliteScalar, ...]
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def scan_codex(extra_roots: tuple[Path, ...], workers: int) -> list[Session]:
|
|
25
|
+
roots = existing([*(path for path in (env_path("CODEX_HOME"),) if path is not None), Path.home() / ".codex", *extra_roots])
|
|
26
|
+
db_paths: list[Path] = []
|
|
27
|
+
rollouts: list[Path] = []
|
|
28
|
+
for root in roots:
|
|
29
|
+
db_paths.extend(root.glob("state_*.sqlite"))
|
|
30
|
+
rollouts.extend((root / "sessions").rglob("rollout-*.jsonl"))
|
|
31
|
+
rollouts.extend((root / "archived_sessions").glob("rollout-*.jsonl"))
|
|
32
|
+
sessions = flat_parallel(db_paths, workers, _codex_db)
|
|
33
|
+
sessions.extend(jsonl_parallel(recent(rollouts), workers, "codex", lambda path: stem_id(path, "rollout-")))
|
|
34
|
+
return sessions
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def _codex_db(path: Path) -> list[Session]:
|
|
38
|
+
conn: sqlite3.Connection | None = None
|
|
39
|
+
try:
|
|
40
|
+
conn = sqlite3.connect(str(path), timeout=3)
|
|
41
|
+
edges = _spawn_edges(conn)
|
|
42
|
+
rows = _thread_rows(conn)
|
|
43
|
+
except sqlite3.Error:
|
|
44
|
+
return []
|
|
45
|
+
finally:
|
|
46
|
+
if conn is not None:
|
|
47
|
+
conn.close()
|
|
48
|
+
return [_codex_row(path, row, edges) for row in rows]
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def _thread_rows(conn: sqlite3.Connection) -> list[CodexRow]:
|
|
52
|
+
try:
|
|
53
|
+
primary_rows: list[CodexRow] = conn.execute(THREADS_SQL).fetchall()
|
|
54
|
+
return primary_rows
|
|
55
|
+
except sqlite3.Error:
|
|
56
|
+
legacy_rows: list[CodexRow] = conn.execute(LEGACY_THREADS_SQL).fetchall()
|
|
57
|
+
return legacy_rows
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def _spawn_edges(conn: sqlite3.Connection) -> dict[str, str]:
|
|
61
|
+
try:
|
|
62
|
+
rows: list[CodexRow] = conn.execute(SPAWN_EDGES_SQL).fetchall()
|
|
63
|
+
except sqlite3.Error:
|
|
64
|
+
return {}
|
|
65
|
+
edges: dict[str, str] = {}
|
|
66
|
+
for row in rows:
|
|
67
|
+
child = _row_text(_row_value(row, 0))
|
|
68
|
+
parent = _row_text(_row_value(row, 1))
|
|
69
|
+
if child is not None and parent is not None:
|
|
70
|
+
edges[child] = parent
|
|
71
|
+
return edges
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def _codex_row(path: Path, row: CodexRow, edges: dict[str, str]) -> Session:
|
|
75
|
+
thread_id = str(_row_value(row, 0))
|
|
76
|
+
source_parent, source_agent = spawn_info(_row_text(_row_value(row, 9)))
|
|
77
|
+
return Session(
|
|
78
|
+
"codex",
|
|
79
|
+
thread_id,
|
|
80
|
+
str(_row_value(row, 1) or path),
|
|
81
|
+
_row_text(_row_value(row, 2)),
|
|
82
|
+
unix_seconds(_row_number(_row_value(row, 3))),
|
|
83
|
+
unix_seconds(_row_number(_row_value(row, 4))),
|
|
84
|
+
_row_text(_row_value(row, 5)),
|
|
85
|
+
_row_text(_row_value(row, 6)),
|
|
86
|
+
_row_text(_row_value(row, 7)) or "",
|
|
87
|
+
{"total_tokens": _row_number(_row_value(row, 8))},
|
|
88
|
+
edges.get(thread_id) or source_parent,
|
|
89
|
+
nick_role(_row_text(_row_value(row, 10)), _row_text(_row_value(row, 11))) or source_agent,
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def _row_text(value: Json | int | float | None) -> str | None:
|
|
94
|
+
return value if isinstance(value, str) else None
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def _row_number(value: Json | int | float | None) -> int | float | None:
|
|
98
|
+
return value if isinstance(value, int | float) else None
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def _row_value(row: CodexRow, index: int) -> Json | int | float | None:
|
|
102
|
+
value = row[index] if index < len(row) else None
|
|
103
|
+
if value is None or isinstance(value, str | int | float | bool):
|
|
104
|
+
return value
|
|
105
|
+
return None
|