@blxzer/cursor-trellis 0.1.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/CHANGELOG.md +45 -0
- package/LICENSE +235 -0
- package/README.md +9 -0
- package/bin/smart-search.js +79 -0
- package/bin/trellis.js +3 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +258 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/commands/channel/adapters/claude.d.ts +29 -0
- package/dist/commands/channel/adapters/claude.d.ts.map +1 -0
- package/dist/commands/channel/adapters/claude.js +203 -0
- package/dist/commands/channel/adapters/claude.js.map +1 -0
- package/dist/commands/channel/adapters/codex.d.ts +85 -0
- package/dist/commands/channel/adapters/codex.d.ts.map +1 -0
- package/dist/commands/channel/adapters/codex.js +505 -0
- package/dist/commands/channel/adapters/codex.js.map +1 -0
- package/dist/commands/channel/adapters/index.d.ts +84 -0
- package/dist/commands/channel/adapters/index.d.ts.map +1 -0
- package/dist/commands/channel/adapters/index.js +115 -0
- package/dist/commands/channel/adapters/index.js.map +1 -0
- package/dist/commands/channel/adapters/types.d.ts +33 -0
- package/dist/commands/channel/adapters/types.d.ts.map +1 -0
- package/dist/commands/channel/adapters/types.js +2 -0
- package/dist/commands/channel/adapters/types.js.map +1 -0
- package/dist/commands/channel/agent-loader.d.ts +32 -0
- package/dist/commands/channel/agent-loader.d.ts.map +1 -0
- package/dist/commands/channel/agent-loader.js +154 -0
- package/dist/commands/channel/agent-loader.js.map +1 -0
- package/dist/commands/channel/context-loader.d.ts +26 -0
- package/dist/commands/channel/context-loader.d.ts.map +1 -0
- package/dist/commands/channel/context-loader.js +290 -0
- package/dist/commands/channel/context-loader.js.map +1 -0
- package/dist/commands/channel/context.d.ts +16 -0
- package/dist/commands/channel/context.d.ts.map +1 -0
- package/dist/commands/channel/context.js +83 -0
- package/dist/commands/channel/context.js.map +1 -0
- package/dist/commands/channel/create.d.ts +27 -0
- package/dist/commands/channel/create.d.ts.map +1 -0
- package/dist/commands/channel/create.js +39 -0
- package/dist/commands/channel/create.js.map +1 -0
- package/dist/commands/channel/dev-parse-trace.d.ts +14 -0
- package/dist/commands/channel/dev-parse-trace.d.ts.map +1 -0
- package/dist/commands/channel/dev-parse-trace.js +70 -0
- package/dist/commands/channel/dev-parse-trace.js.map +1 -0
- package/dist/commands/channel/guard.d.ts +150 -0
- package/dist/commands/channel/guard.d.ts.map +1 -0
- package/dist/commands/channel/guard.js +474 -0
- package/dist/commands/channel/guard.js.map +1 -0
- package/dist/commands/channel/index.d.ts +3 -0
- package/dist/commands/channel/index.d.ts.map +1 -0
- package/dist/commands/channel/index.js +531 -0
- package/dist/commands/channel/index.js.map +1 -0
- package/dist/commands/channel/interrupt.d.ts +10 -0
- package/dist/commands/channel/interrupt.d.ts.map +1 -0
- package/dist/commands/channel/interrupt.js +22 -0
- package/dist/commands/channel/interrupt.js.map +1 -0
- package/dist/commands/channel/kill.d.ts +7 -0
- package/dist/commands/channel/kill.d.ts.map +1 -0
- package/dist/commands/channel/kill.js +121 -0
- package/dist/commands/channel/kill.js.map +1 -0
- package/dist/commands/channel/list.d.ts +17 -0
- package/dist/commands/channel/list.d.ts.map +1 -0
- package/dist/commands/channel/list.js +233 -0
- package/dist/commands/channel/list.js.map +1 -0
- package/dist/commands/channel/messages.d.ts +15 -0
- package/dist/commands/channel/messages.d.ts.map +1 -0
- package/dist/commands/channel/messages.js +245 -0
- package/dist/commands/channel/messages.js.map +1 -0
- package/dist/commands/channel/rm.d.ts +27 -0
- package/dist/commands/channel/rm.d.ts.map +1 -0
- package/dist/commands/channel/rm.js +216 -0
- package/dist/commands/channel/rm.js.map +1 -0
- package/dist/commands/channel/run.d.ts +30 -0
- package/dist/commands/channel/run.d.ts.map +1 -0
- package/dist/commands/channel/run.js +130 -0
- package/dist/commands/channel/run.js.map +1 -0
- package/dist/commands/channel/send.d.ts +11 -0
- package/dist/commands/channel/send.d.ts.map +1 -0
- package/dist/commands/channel/send.js +24 -0
- package/dist/commands/channel/send.js.map +1 -0
- package/dist/commands/channel/spawn.d.ts +40 -0
- package/dist/commands/channel/spawn.d.ts.map +1 -0
- package/dist/commands/channel/spawn.js +244 -0
- package/dist/commands/channel/spawn.js.map +1 -0
- package/dist/commands/channel/store/events.d.ts +39 -0
- package/dist/commands/channel/store/events.d.ts.map +1 -0
- package/dist/commands/channel/store/events.js +87 -0
- package/dist/commands/channel/store/events.js.map +1 -0
- package/dist/commands/channel/store/filter.d.ts +3 -0
- package/dist/commands/channel/store/filter.d.ts.map +1 -0
- package/dist/commands/channel/store/filter.js +2 -0
- package/dist/commands/channel/store/filter.js.map +1 -0
- package/dist/commands/channel/store/lock.d.ts +23 -0
- package/dist/commands/channel/store/lock.d.ts.map +1 -0
- package/dist/commands/channel/store/lock.js +99 -0
- package/dist/commands/channel/store/lock.js.map +1 -0
- package/dist/commands/channel/store/paths.d.ts +63 -0
- package/dist/commands/channel/store/paths.d.ts.map +1 -0
- package/dist/commands/channel/store/paths.js +246 -0
- package/dist/commands/channel/store/paths.js.map +1 -0
- package/dist/commands/channel/store/schema.d.ts +27 -0
- package/dist/commands/channel/store/schema.d.ts.map +1 -0
- package/dist/commands/channel/store/schema.js +34 -0
- package/dist/commands/channel/store/schema.js.map +1 -0
- package/dist/commands/channel/store/thread-state.d.ts +5 -0
- package/dist/commands/channel/store/thread-state.d.ts.map +1 -0
- package/dist/commands/channel/store/thread-state.js +16 -0
- package/dist/commands/channel/store/thread-state.js.map +1 -0
- package/dist/commands/channel/store/watch.d.ts +19 -0
- package/dist/commands/channel/store/watch.d.ts.map +1 -0
- package/dist/commands/channel/store/watch.js +146 -0
- package/dist/commands/channel/store/watch.js.map +1 -0
- package/dist/commands/channel/supervisor/idle.d.ts +46 -0
- package/dist/commands/channel/supervisor/idle.d.ts.map +1 -0
- package/dist/commands/channel/supervisor/idle.js +72 -0
- package/dist/commands/channel/supervisor/idle.js.map +1 -0
- package/dist/commands/channel/supervisor/inbox.d.ts +30 -0
- package/dist/commands/channel/supervisor/inbox.d.ts.map +1 -0
- package/dist/commands/channel/supervisor/inbox.js +160 -0
- package/dist/commands/channel/supervisor/inbox.js.map +1 -0
- package/dist/commands/channel/supervisor/shutdown.d.ts +68 -0
- package/dist/commands/channel/supervisor/shutdown.d.ts.map +1 -0
- package/dist/commands/channel/supervisor/shutdown.js +146 -0
- package/dist/commands/channel/supervisor/shutdown.js.map +1 -0
- package/dist/commands/channel/supervisor/stdout.d.ts +51 -0
- package/dist/commands/channel/supervisor/stdout.d.ts.map +1 -0
- package/dist/commands/channel/supervisor/stdout.js +121 -0
- package/dist/commands/channel/supervisor/stdout.js.map +1 -0
- package/dist/commands/channel/supervisor/turns.d.ts +31 -0
- package/dist/commands/channel/supervisor/turns.d.ts.map +1 -0
- package/dist/commands/channel/supervisor/turns.js +45 -0
- package/dist/commands/channel/supervisor/turns.js.map +1 -0
- package/dist/commands/channel/supervisor/warning.d.ts +48 -0
- package/dist/commands/channel/supervisor/warning.d.ts.map +1 -0
- package/dist/commands/channel/supervisor/warning.js +77 -0
- package/dist/commands/channel/supervisor/warning.js.map +1 -0
- package/dist/commands/channel/supervisor.d.ts +59 -0
- package/dist/commands/channel/supervisor.d.ts.map +1 -0
- package/dist/commands/channel/supervisor.js +344 -0
- package/dist/commands/channel/supervisor.js.map +1 -0
- package/dist/commands/channel/text-body.d.ts +13 -0
- package/dist/commands/channel/text-body.d.ts.map +1 -0
- package/dist/commands/channel/text-body.js +47 -0
- package/dist/commands/channel/text-body.js.map +1 -0
- package/dist/commands/channel/threads.d.ts +39 -0
- package/dist/commands/channel/threads.d.ts.map +1 -0
- package/dist/commands/channel/threads.js +106 -0
- package/dist/commands/channel/threads.js.map +1 -0
- package/dist/commands/channel/title.d.ts +12 -0
- package/dist/commands/channel/title.d.ts.map +1 -0
- package/dist/commands/channel/title.js +24 -0
- package/dist/commands/channel/title.js.map +1 -0
- package/dist/commands/channel/wait.d.ts +17 -0
- package/dist/commands/channel/wait.d.ts.map +1 -0
- package/dist/commands/channel/wait.js +75 -0
- package/dist/commands/channel/wait.js.map +1 -0
- package/dist/commands/init.d.ts +62 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +1656 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/mem.d.ts +30 -0
- package/dist/commands/mem.d.ts.map +1 -0
- package/dist/commands/mem.js +424 -0
- package/dist/commands/mem.js.map +1 -0
- package/dist/commands/rollout.d.ts +34 -0
- package/dist/commands/rollout.d.ts.map +1 -0
- package/dist/commands/rollout.js +102 -0
- package/dist/commands/rollout.js.map +1 -0
- package/dist/commands/uninstall.d.ts +27 -0
- package/dist/commands/uninstall.d.ts.map +1 -0
- package/dist/commands/uninstall.js +339 -0
- package/dist/commands/uninstall.js.map +1 -0
- package/dist/commands/update.d.ts +80 -0
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/commands/update.js +2185 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/commands/upgrade.d.ts +28 -0
- package/dist/commands/upgrade.d.ts.map +1 -0
- package/dist/commands/upgrade.js +84 -0
- package/dist/commands/upgrade.js.map +1 -0
- package/dist/commands/workflow.d.ts +35 -0
- package/dist/commands/workflow.d.ts.map +1 -0
- package/dist/commands/workflow.js +219 -0
- package/dist/commands/workflow.js.map +1 -0
- package/dist/configurators/antigravity.d.ts +7 -0
- package/dist/configurators/antigravity.d.ts.map +1 -0
- package/dist/configurators/antigravity.js +19 -0
- package/dist/configurators/antigravity.js.map +1 -0
- package/dist/configurators/claude.d.ts +9 -0
- package/dist/configurators/claude.d.ts.map +1 -0
- package/dist/configurators/claude.js +72 -0
- package/dist/configurators/claude.js.map +1 -0
- package/dist/configurators/codebuddy.d.ts +10 -0
- package/dist/configurators/codebuddy.d.ts.map +1 -0
- package/dist/configurators/codebuddy.js +30 -0
- package/dist/configurators/codebuddy.js.map +1 -0
- package/dist/configurators/codex.d.ts +8 -0
- package/dist/configurators/codex.d.ts.map +1 -0
- package/dist/configurators/codex.js +87 -0
- package/dist/configurators/codex.js.map +1 -0
- package/dist/configurators/copilot.d.ts +10 -0
- package/dist/configurators/copilot.d.ts.map +1 -0
- package/dist/configurators/copilot.js +51 -0
- package/dist/configurators/copilot.js.map +1 -0
- package/dist/configurators/cursor.d.ts +20 -0
- package/dist/configurators/cursor.d.ts.map +1 -0
- package/dist/configurators/cursor.js +49 -0
- package/dist/configurators/cursor.js.map +1 -0
- package/dist/configurators/cursor2plus-local.d.ts +6 -0
- package/dist/configurators/cursor2plus-local.d.ts.map +1 -0
- package/dist/configurators/cursor2plus-local.js +20 -0
- package/dist/configurators/cursor2plus-local.js.map +1 -0
- package/dist/configurators/droid.d.ts +10 -0
- package/dist/configurators/droid.d.ts.map +1 -0
- package/dist/configurators/droid.js +30 -0
- package/dist/configurators/droid.js.map +1 -0
- package/dist/configurators/gemini.d.ts +16 -0
- package/dist/configurators/gemini.d.ts.map +1 -0
- package/dist/configurators/gemini.js +38 -0
- package/dist/configurators/gemini.js.map +1 -0
- package/dist/configurators/index.d.ts +69 -0
- package/dist/configurators/index.d.ts.map +1 -0
- package/dist/configurators/index.js +395 -0
- package/dist/configurators/index.js.map +1 -0
- package/dist/configurators/kilo.d.ts +7 -0
- package/dist/configurators/kilo.d.ts.map +1 -0
- package/dist/configurators/kilo.js +19 -0
- package/dist/configurators/kilo.js.map +1 -0
- package/dist/configurators/kiro.d.ts +8 -0
- package/dist/configurators/kiro.d.ts.map +1 -0
- package/dist/configurators/kiro.js +24 -0
- package/dist/configurators/kiro.js.map +1 -0
- package/dist/configurators/opencode.d.ts +14 -0
- package/dist/configurators/opencode.d.ts.map +1 -0
- package/dist/configurators/opencode.js +96 -0
- package/dist/configurators/opencode.js.map +1 -0
- package/dist/configurators/pi.d.ts +3 -0
- package/dist/configurators/pi.d.ts.map +1 -0
- package/dist/configurators/pi.js +45 -0
- package/dist/configurators/pi.js.map +1 -0
- package/dist/configurators/qoder.d.ts +11 -0
- package/dist/configurators/qoder.d.ts.map +1 -0
- package/dist/configurators/qoder.js +31 -0
- package/dist/configurators/qoder.js.map +1 -0
- package/dist/configurators/shared.d.ts +183 -0
- package/dist/configurators/shared.d.ts.map +1 -0
- package/dist/configurators/shared.js +557 -0
- package/dist/configurators/shared.js.map +1 -0
- package/dist/configurators/windsurf.d.ts +7 -0
- package/dist/configurators/windsurf.d.ts.map +1 -0
- package/dist/configurators/windsurf.js +19 -0
- package/dist/configurators/windsurf.js.map +1 -0
- package/dist/configurators/workflow.d.ts +46 -0
- package/dist/configurators/workflow.d.ts.map +1 -0
- package/dist/configurators/workflow.js +180 -0
- package/dist/configurators/workflow.js.map +1 -0
- package/dist/constants/paths.d.ts +70 -0
- package/dist/constants/paths.d.ts.map +1 -0
- package/dist/constants/paths.js +79 -0
- package/dist/constants/paths.js.map +1 -0
- package/dist/constants/version.d.ts +9 -0
- package/dist/constants/version.d.ts.map +1 -0
- package/dist/constants/version.js +15 -0
- package/dist/constants/version.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/migrations/index.d.ts +62 -0
- package/dist/migrations/index.d.ts.map +1 -0
- package/dist/migrations/index.js +187 -0
- package/dist/migrations/index.js.map +1 -0
- package/dist/migrations/manifests/0.1.0.json +9 -0
- package/dist/templates/claude/agents/trellis-check.md +124 -0
- package/dist/templates/claude/agents/trellis-implement.md +110 -0
- package/dist/templates/claude/agents/trellis-research.md +137 -0
- package/dist/templates/claude/index.d.ts +22 -0
- package/dist/templates/claude/index.d.ts.map +1 -0
- package/dist/templates/claude/index.js +46 -0
- package/dist/templates/claude/index.js.map +1 -0
- package/dist/templates/claude/settings.json +84 -0
- package/dist/templates/codebuddy/agents/trellis-check.md +115 -0
- package/dist/templates/codebuddy/agents/trellis-implement.md +110 -0
- package/dist/templates/codebuddy/agents/trellis-research.md +137 -0
- package/dist/templates/codebuddy/index.d.ts +15 -0
- package/dist/templates/codebuddy/index.d.ts.map +1 -0
- package/dist/templates/codebuddy/index.js +15 -0
- package/dist/templates/codebuddy/index.js.map +1 -0
- package/dist/templates/codebuddy/settings.json +70 -0
- package/dist/templates/codex/agents/trellis-check.toml +67 -0
- package/dist/templates/codex/agents/trellis-implement.toml +40 -0
- package/dist/templates/codex/agents/trellis-research.toml +73 -0
- package/dist/templates/codex/config.toml +28 -0
- package/dist/templates/codex/hooks/session-start.py +575 -0
- package/dist/templates/codex/hooks.json +15 -0
- package/dist/templates/codex/index.d.ts +39 -0
- package/dist/templates/codex/index.d.ts.map +1 -0
- package/dist/templates/codex/index.js +85 -0
- package/dist/templates/codex/index.js.map +1 -0
- package/dist/templates/codex/skills/before-dev/SKILL.md +40 -0
- package/dist/templates/codex/skills/brainstorm/SKILL.md +112 -0
- package/dist/templates/codex/skills/break-loop/SKILL.md +130 -0
- package/dist/templates/codex/skills/check/SKILL.md +98 -0
- package/dist/templates/codex/skills/check-cross-layer/SKILL.md +158 -0
- package/dist/templates/codex/skills/create-command/SKILL.md +101 -0
- package/dist/templates/codex/skills/finish-work/SKILL.md +90 -0
- package/dist/templates/codex/skills/improve-ut/SKILL.md +69 -0
- package/dist/templates/codex/skills/integrate-skill/SKILL.md +221 -0
- package/dist/templates/codex/skills/onboard/SKILL.md +363 -0
- package/dist/templates/codex/skills/record-session/SKILL.md +67 -0
- package/dist/templates/codex/skills/start/SKILL.md +66 -0
- package/dist/templates/codex/skills/update-spec/SKILL.md +335 -0
- package/dist/templates/common/bundled-skills/smart-search-cli/SKILL.md +388 -0
- package/dist/templates/common/bundled-skills/smart-search-cli/agents/openai.yaml +3 -0
- package/dist/templates/common/bundled-skills/smart-search-cli/examples/batch-search.md +98 -0
- package/dist/templates/common/bundled-skills/smart-search-cli/examples/evidence-gathering.md +89 -0
- package/dist/templates/common/bundled-skills/smart-search-cli/references/cli-contract.md +337 -0
- package/dist/templates/common/bundled-skills/trellis-cursor2plus-setup/SKILL.md +62 -0
- package/dist/templates/common/bundled-skills/trellis-meta/SKILL.md +73 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/add-project-local-conventions.md +83 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-agents.md +54 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-context-loading.md +84 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-hooks.md +57 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-skills-or-commands.md +80 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-spec-structure.md +83 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-task-lifecycle.md +88 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-workflow.md +65 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/overview.md +55 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/context-injection.md +68 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/generated-files.md +80 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/overview.md +51 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/spec-system.md +102 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/task-system.md +133 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/workflow.md +75 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/workspace-memory.md +71 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/agents.md +80 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/hooks-and-settings.md +69 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/overview.md +61 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/platform-map.md +76 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/skills-and-commands.md +128 -0
- package/dist/templates/common/bundled-skills/trellis-micro-grill/SKILL.md +47 -0
- package/dist/templates/common/bundled-skills/trellis-skill-creator/SKILL.md +44 -0
- package/dist/templates/common/bundled-skills/trellis-skill-creator/references/authoring-rules.md +97 -0
- package/dist/templates/common/bundled-skills/trellis-skill-creator/references/review-checklist.md +47 -0
- package/dist/templates/common/bundled-skills/trellis-skill-creator/references/trellis-skill-locations.md +52 -0
- package/dist/templates/common/bundled-skills/trellis-spec-bootstrap/SKILL.md +41 -0
- package/dist/templates/common/bundled-skills/trellis-spec-bootstrap/references/mcp-setup.md +90 -0
- package/dist/templates/common/bundled-skills/trellis-spec-bootstrap/references/repository-analysis.md +59 -0
- package/dist/templates/common/bundled-skills/trellis-spec-bootstrap/references/spec-task-planning.md +61 -0
- package/dist/templates/common/bundled-skills/trellis-spec-bootstrap/references/spec-writing.md +70 -0
- package/dist/templates/common/commands/continue.md +63 -0
- package/dist/templates/common/commands/finish-work.md +68 -0
- package/dist/templates/common/commands/start.md +69 -0
- package/dist/templates/common/index.d.ts +48 -0
- package/dist/templates/common/index.d.ts.map +1 -0
- package/dist/templates/common/index.js +104 -0
- package/dist/templates/common/index.js.map +1 -0
- package/dist/templates/common/skills/before-dev.md +35 -0
- package/dist/templates/common/skills/brainstorm.md +164 -0
- package/dist/templates/common/skills/break-loop.md +125 -0
- package/dist/templates/common/skills/check.md +106 -0
- package/dist/templates/common/skills/update-spec.md +364 -0
- package/dist/templates/copilot/hooks/session-start.py +557 -0
- package/dist/templates/copilot/hooks.json +19 -0
- package/dist/templates/copilot/index.d.ts +23 -0
- package/dist/templates/copilot/index.d.ts.map +1 -0
- package/dist/templates/copilot/index.js +54 -0
- package/dist/templates/copilot/index.js.map +1 -0
- package/dist/templates/copilot/prompts/before-dev.prompt.md +39 -0
- package/dist/templates/copilot/prompts/brainstorm.prompt.md +111 -0
- package/dist/templates/copilot/prompts/break-loop.prompt.md +129 -0
- package/dist/templates/copilot/prompts/check-cross-layer.prompt.md +157 -0
- package/dist/templates/copilot/prompts/check.prompt.md +97 -0
- package/dist/templates/copilot/prompts/create-command.prompt.md +116 -0
- package/dist/templates/copilot/prompts/finish-work.prompt.md +99 -0
- package/dist/templates/copilot/prompts/integrate-skill.prompt.md +223 -0
- package/dist/templates/copilot/prompts/onboard.prompt.md +362 -0
- package/dist/templates/copilot/prompts/parallel.prompt.md +204 -0
- package/dist/templates/copilot/prompts/record-session.prompt.md +66 -0
- package/dist/templates/copilot/prompts/start.prompt.md +63 -0
- package/dist/templates/copilot/prompts/update-spec.prompt.md +358 -0
- package/dist/templates/cursor/agents/trellis-check.md +139 -0
- package/dist/templates/cursor/agents/trellis-implement.md +119 -0
- package/dist/templates/cursor/agents/trellis-research.md +147 -0
- package/dist/templates/cursor/commands/cursor2plus-setup.md +82 -0
- package/dist/templates/cursor/hooks.json +30 -0
- package/dist/templates/cursor/index.d.ts +19 -0
- package/dist/templates/cursor/index.d.ts.map +1 -0
- package/dist/templates/cursor/index.js +19 -0
- package/dist/templates/cursor/index.js.map +1 -0
- package/dist/templates/cursor/rules/trellis-triage.mdc +38 -0
- package/dist/templates/cursor/worktrees.json +11 -0
- package/dist/templates/droid/droids/trellis-check.md +107 -0
- package/dist/templates/droid/droids/trellis-implement.md +102 -0
- package/dist/templates/droid/droids/trellis-research.md +137 -0
- package/dist/templates/droid/index.d.ts +15 -0
- package/dist/templates/droid/index.d.ts.map +1 -0
- package/dist/templates/droid/index.js +15 -0
- package/dist/templates/droid/index.js.map +1 -0
- package/dist/templates/droid/settings.json +70 -0
- package/dist/templates/extract.d.ts +40 -0
- package/dist/templates/extract.d.ts.map +1 -0
- package/dist/templates/extract.js +106 -0
- package/dist/templates/extract.js.map +1 -0
- package/dist/templates/gemini/agents/trellis-check.md +107 -0
- package/dist/templates/gemini/agents/trellis-implement.md +102 -0
- package/dist/templates/gemini/agents/trellis-research.md +136 -0
- package/dist/templates/gemini/index.d.ts +13 -0
- package/dist/templates/gemini/index.d.ts.map +1 -0
- package/dist/templates/gemini/index.js +13 -0
- package/dist/templates/gemini/index.js.map +1 -0
- package/dist/templates/gemini/settings.json +28 -0
- package/dist/templates/kiro/agents/trellis-check.json +26 -0
- package/dist/templates/kiro/agents/trellis-implement.json +26 -0
- package/dist/templates/kiro/agents/trellis-research.json +30 -0
- package/dist/templates/kiro/index.d.ts +18 -0
- package/dist/templates/kiro/index.d.ts.map +1 -0
- package/dist/templates/kiro/index.js +18 -0
- package/dist/templates/kiro/index.js.map +1 -0
- package/dist/templates/markdown/agents.md +32 -0
- package/dist/templates/markdown/gitignore.txt +15 -0
- package/dist/templates/markdown/index.d.ts +30 -0
- package/dist/templates/markdown/index.d.ts.map +1 -0
- package/dist/templates/markdown/index.js +55 -0
- package/dist/templates/markdown/index.js.map +1 -0
- package/dist/templates/markdown/spec/backend/database-guidelines.md.txt +51 -0
- package/dist/templates/markdown/spec/backend/directory-structure.md.txt +54 -0
- package/dist/templates/markdown/spec/backend/error-handling.md.txt +51 -0
- package/dist/templates/markdown/spec/backend/index.md.txt +38 -0
- package/dist/templates/markdown/spec/backend/logging-guidelines.md.txt +51 -0
- package/dist/templates/markdown/spec/backend/quality-guidelines.md.txt +51 -0
- package/dist/templates/markdown/spec/frontend/component-guidelines.md.txt +59 -0
- package/dist/templates/markdown/spec/frontend/directory-structure.md.txt +54 -0
- package/dist/templates/markdown/spec/frontend/hook-guidelines.md.txt +51 -0
- package/dist/templates/markdown/spec/frontend/index.md.txt +39 -0
- package/dist/templates/markdown/spec/frontend/quality-guidelines.md.txt +51 -0
- package/dist/templates/markdown/spec/frontend/state-management.md.txt +51 -0
- package/dist/templates/markdown/spec/frontend/type-safety.md.txt +51 -0
- package/dist/templates/markdown/spec/guides/code-reuse-thinking-guide.md.txt +223 -0
- package/dist/templates/markdown/spec/guides/cross-layer-thinking-guide.md.txt +259 -0
- package/dist/templates/markdown/spec/guides/cross-platform-thinking-guide.md.txt +633 -0
- package/dist/templates/markdown/spec/guides/cursor-context-injection-guide.md.txt +65 -0
- package/dist/templates/markdown/spec/guides/cursor-subagent-policy.md.txt +382 -0
- package/dist/templates/markdown/spec/guides/durable-learning-decision-guide.md.txt +76 -0
- package/dist/templates/markdown/spec/guides/index.md.txt +101 -0
- package/dist/templates/markdown/spec/guides/retrieval-daily-guide.md.txt +92 -0
- package/dist/templates/markdown/workspace-index.md +125 -0
- package/dist/templates/markdown/worktree.yaml.txt +58 -0
- package/dist/templates/opencode/agents/trellis-check.md +122 -0
- package/dist/templates/opencode/agents/trellis-implement.md +118 -0
- package/dist/templates/opencode/agents/trellis-research.md +145 -0
- package/dist/templates/opencode/lib/session-utils.js +667 -0
- package/dist/templates/opencode/lib/trellis-context.js +336 -0
- package/dist/templates/opencode/package.json +5 -0
- package/dist/templates/opencode/plugins/inject-subagent-context.js +495 -0
- package/dist/templates/opencode/plugins/inject-workflow-state.js +159 -0
- package/dist/templates/opencode/plugins/session-start.js +101 -0
- package/dist/templates/pi/agents/trellis-check.md +37 -0
- package/dist/templates/pi/agents/trellis-implement.md +42 -0
- package/dist/templates/pi/agents/trellis-research.md +25 -0
- package/dist/templates/pi/extensions/trellis/index.ts.txt +1600 -0
- package/dist/templates/pi/index.d.ts +5 -0
- package/dist/templates/pi/index.d.ts.map +1 -0
- package/dist/templates/pi/index.js +12 -0
- package/dist/templates/pi/index.js.map +1 -0
- package/dist/templates/pi/settings.json +12 -0
- package/dist/templates/qoder/agents/trellis-check.md +108 -0
- package/dist/templates/qoder/agents/trellis-implement.md +103 -0
- package/dist/templates/qoder/agents/trellis-research.md +137 -0
- package/dist/templates/qoder/index.d.ts +15 -0
- package/dist/templates/qoder/index.d.ts.map +1 -0
- package/dist/templates/qoder/index.js +15 -0
- package/dist/templates/qoder/index.js.map +1 -0
- package/dist/templates/qoder/settings.json +47 -0
- package/dist/templates/shared-hooks/index.d.ts +50 -0
- package/dist/templates/shared-hooks/index.d.ts.map +1 -0
- package/dist/templates/shared-hooks/index.js +92 -0
- package/dist/templates/shared-hooks/index.js.map +1 -0
- package/dist/templates/shared-hooks/inject-shell-session-context.py +183 -0
- package/dist/templates/shared-hooks/inject-subagent-context.py +774 -0
- package/dist/templates/shared-hooks/inject-workflow-state.py +366 -0
- package/dist/templates/shared-hooks/research-end-retrieval-pack.py +220 -0
- package/dist/templates/shared-hooks/session-start.py +873 -0
- package/dist/templates/template-utils.d.ts +28 -0
- package/dist/templates/template-utils.d.ts.map +1 -0
- package/dist/templates/template-utils.js +83 -0
- package/dist/templates/template-utils.js.map +1 -0
- package/dist/templates/trellis/config.yaml +132 -0
- package/dist/templates/trellis/gitignore.txt +39 -0
- package/dist/templates/trellis/index.d.ts +80 -0
- package/dist/templates/trellis/index.d.ts.map +1 -0
- package/dist/templates/trellis/index.js +171 -0
- package/dist/templates/trellis/index.js.map +1 -0
- package/dist/templates/trellis/local/README.md +59 -0
- package/dist/templates/trellis/local/config.local.json.example +6 -0
- package/dist/templates/trellis/local/index.d.ts +7 -0
- package/dist/templates/trellis/local/index.d.ts.map +1 -0
- package/dist/templates/trellis/local/index.js +14 -0
- package/dist/templates/trellis/local/index.js.map +1 -0
- package/dist/templates/trellis/local/patch_wpelc8.py +297 -0
- package/dist/templates/trellis/local/subagent-models.json.example +4 -0
- package/dist/templates/trellis/local/trellis-task-models.json.example +10 -0
- package/dist/templates/trellis/local/trellis-task-models.json5.example +45 -0
- package/dist/templates/trellis/local/trellis_task_models_config.py +200 -0
- package/dist/templates/trellis/scripts/__init__.py +5 -0
- package/dist/templates/trellis/scripts/add_session.py +547 -0
- package/dist/templates/trellis/scripts/build_context_pack.py +12 -0
- package/dist/templates/trellis/scripts/build_retrieval_pack.py +12 -0
- package/dist/templates/trellis/scripts/common/__init__.py +103 -0
- package/dist/templates/trellis/scripts/common/active_task.py +607 -0
- package/dist/templates/trellis/scripts/common/artifact_search.py +587 -0
- package/dist/templates/trellis/scripts/common/cli_adapter.py +811 -0
- package/dist/templates/trellis/scripts/common/cli_environment.py +155 -0
- package/dist/templates/trellis/scripts/common/codebase_retrieval_router.py +902 -0
- package/dist/templates/trellis/scripts/common/config.py +458 -0
- package/dist/templates/trellis/scripts/common/context_pack.py +371 -0
- package/dist/templates/trellis/scripts/common/developer.py +190 -0
- package/dist/templates/trellis/scripts/common/git.py +31 -0
- package/dist/templates/trellis/scripts/common/git_context.py +149 -0
- package/dist/templates/trellis/scripts/common/io.py +37 -0
- package/dist/templates/trellis/scripts/common/log.py +45 -0
- package/dist/templates/trellis/scripts/common/packages_context.py +239 -0
- package/dist/templates/trellis/scripts/common/parent_orchestration.py +691 -0
- package/dist/templates/trellis/scripts/common/paths.py +457 -0
- package/dist/templates/trellis/scripts/common/retrieval_adapter_metadata.py +889 -0
- package/dist/templates/trellis/scripts/common/retrieval_evidence.py +917 -0
- package/dist/templates/trellis/scripts/common/retrieval_pack.py +425 -0
- package/dist/templates/trellis/scripts/common/retrieval_pack_context.py +126 -0
- package/dist/templates/trellis/scripts/common/safe_commit.py +285 -0
- package/dist/templates/trellis/scripts/common/session_context.py +1159 -0
- package/dist/templates/trellis/scripts/common/session_memory.py +360 -0
- package/dist/templates/trellis/scripts/common/smart_search_evidence.py +479 -0
- package/dist/templates/trellis/scripts/common/smart_search_resolve.py +125 -0
- package/dist/templates/trellis/scripts/common/task_context.py +223 -0
- package/dist/templates/trellis/scripts/common/task_dashboard.py +140 -0
- package/dist/templates/trellis/scripts/common/task_gates.py +1735 -0
- package/dist/templates/trellis/scripts/common/task_map.py +586 -0
- package/dist/templates/trellis/scripts/common/task_queue.py +188 -0
- package/dist/templates/trellis/scripts/common/task_store.py +1533 -0
- package/dist/templates/trellis/scripts/common/task_utils.py +274 -0
- package/dist/templates/trellis/scripts/common/tasks.py +231 -0
- package/dist/templates/trellis/scripts/common/test_retrieval_arbitration.py +333 -0
- package/dist/templates/trellis/scripts/common/trellis_config.py +131 -0
- package/dist/templates/trellis/scripts/common/types.py +110 -0
- package/dist/templates/trellis/scripts/common/workflow_phase.py +212 -0
- package/dist/templates/trellis/scripts/get_context.py +17 -0
- package/dist/templates/trellis/scripts/get_developer.py +26 -0
- package/dist/templates/trellis/scripts/hooks/linear_sync.py +243 -0
- package/dist/templates/trellis/scripts/init_developer.py +51 -0
- package/dist/templates/trellis/scripts/route_codebase_retrieval.py +77 -0
- package/dist/templates/trellis/scripts/run_smart_search.py +12 -0
- package/dist/templates/trellis/scripts/search_artifacts.py +13 -0
- package/dist/templates/trellis/scripts/search_memory.py +12 -0
- package/dist/templates/trellis/scripts/task.py +851 -0
- package/dist/templates/trellis/tasks/.gitkeep +0 -0
- package/dist/templates/trellis/tasks/templates/release-execution/design.md +61 -0
- package/dist/templates/trellis/tasks/templates/release-execution/handoff-template.md +29 -0
- package/dist/templates/trellis/tasks/templates/release-execution/implement.md +29 -0
- package/dist/templates/trellis/tasks/templates/release-execution/prd.md +31 -0
- package/dist/templates/trellis/tasks/templates/release-readiness/design.md +50 -0
- package/dist/templates/trellis/tasks/templates/release-readiness/handoff-template.md +39 -0
- package/dist/templates/trellis/tasks/templates/release-readiness/implement.md +29 -0
- package/dist/templates/trellis/tasks/templates/release-readiness/prd.md +31 -0
- package/dist/templates/trellis/workflow.md +960 -0
- package/dist/types/ai-tools.d.ts +106 -0
- package/dist/types/ai-tools.d.ts.map +1 -0
- package/dist/types/ai-tools.js +294 -0
- package/dist/types/ai-tools.js.map +1 -0
- package/dist/types/migration.d.ts +125 -0
- package/dist/types/migration.d.ts.map +1 -0
- package/dist/types/migration.js +8 -0
- package/dist/types/migration.js.map +1 -0
- package/dist/utils/codebase-retrieval-router.d.ts +77 -0
- package/dist/utils/codebase-retrieval-router.d.ts.map +1 -0
- package/dist/utils/codebase-retrieval-router.js +767 -0
- package/dist/utils/codebase-retrieval-router.js.map +1 -0
- package/dist/utils/compare-versions.d.ts +12 -0
- package/dist/utils/compare-versions.d.ts.map +1 -0
- package/dist/utils/compare-versions.js +86 -0
- package/dist/utils/compare-versions.js.map +1 -0
- package/dist/utils/cwd-guard.d.ts +38 -0
- package/dist/utils/cwd-guard.d.ts.map +1 -0
- package/dist/utils/cwd-guard.js +62 -0
- package/dist/utils/cwd-guard.js.map +1 -0
- package/dist/utils/file-writer.d.ts +36 -0
- package/dist/utils/file-writer.d.ts.map +1 -0
- package/dist/utils/file-writer.js +203 -0
- package/dist/utils/file-writer.js.map +1 -0
- package/dist/utils/manifest-prune.d.ts +61 -0
- package/dist/utils/manifest-prune.d.ts.map +1 -0
- package/dist/utils/manifest-prune.js +136 -0
- package/dist/utils/manifest-prune.js.map +1 -0
- package/dist/utils/posix.d.ts +13 -0
- package/dist/utils/posix.d.ts.map +1 -0
- package/dist/utils/posix.js +15 -0
- package/dist/utils/posix.js.map +1 -0
- package/dist/utils/post-update-smoke.d.ts +7 -0
- package/dist/utils/post-update-smoke.d.ts.map +1 -0
- package/dist/utils/post-update-smoke.js +40 -0
- package/dist/utils/post-update-smoke.js.map +1 -0
- package/dist/utils/project-capabilities.d.ts +54 -0
- package/dist/utils/project-capabilities.d.ts.map +1 -0
- package/dist/utils/project-capabilities.js +515 -0
- package/dist/utils/project-capabilities.js.map +1 -0
- package/dist/utils/project-detector.d.ts +46 -0
- package/dist/utils/project-detector.d.ts.map +1 -0
- package/dist/utils/project-detector.js +666 -0
- package/dist/utils/project-detector.js.map +1 -0
- package/dist/utils/proxy.d.ts +25 -0
- package/dist/utils/proxy.d.ts.map +1 -0
- package/dist/utils/proxy.js +60 -0
- package/dist/utils/proxy.js.map +1 -0
- package/dist/utils/readiness.d.ts +20 -0
- package/dist/utils/readiness.d.ts.map +1 -0
- package/dist/utils/readiness.js +430 -0
- package/dist/utils/readiness.js.map +1 -0
- package/dist/utils/retrieval-execution-telemetry.d.ts +162 -0
- package/dist/utils/retrieval-execution-telemetry.d.ts.map +1 -0
- package/dist/utils/retrieval-execution-telemetry.js +288 -0
- package/dist/utils/retrieval-execution-telemetry.js.map +1 -0
- package/dist/utils/retrieval-result-ranking.d.ts +40 -0
- package/dist/utils/retrieval-result-ranking.d.ts.map +1 -0
- package/dist/utils/retrieval-result-ranking.js +162 -0
- package/dist/utils/retrieval-result-ranking.js.map +1 -0
- package/dist/utils/task-json.d.ts +13 -0
- package/dist/utils/task-json.d.ts.map +1 -0
- package/dist/utils/task-json.js +12 -0
- package/dist/utils/task-json.js.map +1 -0
- package/dist/utils/template-fetcher.d.ts +150 -0
- package/dist/utils/template-fetcher.d.ts.map +1 -0
- package/dist/utils/template-fetcher.js +907 -0
- package/dist/utils/template-fetcher.js.map +1 -0
- package/dist/utils/template-hash.d.ts +123 -0
- package/dist/utils/template-hash.d.ts.map +1 -0
- package/dist/utils/template-hash.js +334 -0
- package/dist/utils/template-hash.js.map +1 -0
- package/dist/utils/uninstall-scrubbers.d.ts +66 -0
- package/dist/utils/uninstall-scrubbers.d.ts.map +1 -0
- package/dist/utils/uninstall-scrubbers.js +342 -0
- package/dist/utils/uninstall-scrubbers.js.map +1 -0
- package/dist/utils/update-rollout-report.d.ts +137 -0
- package/dist/utils/update-rollout-report.d.ts.map +1 -0
- package/dist/utils/update-rollout-report.js +108 -0
- package/dist/utils/update-rollout-report.js.map +1 -0
- package/dist/utils/workflow-resolver.d.ts +86 -0
- package/dist/utils/workflow-resolver.d.ts.map +1 -0
- package/dist/utils/workflow-resolver.js +265 -0
- package/dist/utils/workflow-resolver.js.map +1 -0
- package/package.json +137 -0
- package/scripts/postinstall.js +45 -0
- package/vendor/smart-search/LICENSE +21 -0
- package/vendor/smart-search/README.md +412 -0
- package/vendor/smart-search/README.zh-CN.md +430 -0
- package/vendor/smart-search/npm/bin/smart-search.js +63 -0
- package/vendor/smart-search/npm/scripts/postinstall.js +87 -0
- package/vendor/smart-search/npm/scripts/resolve-prerelease-version.js +108 -0
- package/vendor/smart-search/npm/scripts/set-package-version.js +35 -0
- package/vendor/smart-search/npm/scripts/sync-python-version.js +22 -0
- package/vendor/smart-search/npm/scripts/test-wrapper-repair.js +99 -0
- package/vendor/smart-search/npm/scripts/test.js +85 -0
- package/vendor/smart-search/package.json +42 -0
- package/vendor/smart-search/pyproject.toml +37 -0
- package/vendor/smart-search/skills/smart-search-cli/SKILL.md +387 -0
- package/vendor/smart-search/skills/smart-search-cli/agents/openai.yaml +3 -0
- package/vendor/smart-search/skills/smart-search-cli/examples/batch-search.md +98 -0
- package/vendor/smart-search/skills/smart-search-cli/examples/evidence-gathering.md +89 -0
- package/vendor/smart-search/skills/smart-search-cli/references/cli-contract.md +337 -0
- package/vendor/smart-search/src/smart_search/__init__.py +1 -0
- package/vendor/smart-search/src/smart_search/assets/skills/smart-search-cli/SKILL.md +387 -0
- package/vendor/smart-search/src/smart_search/assets/skills/smart-search-cli/agents/openai.yaml +3 -0
- package/vendor/smart-search/src/smart_search/assets/skills/smart-search-cli/examples/batch-search.md +98 -0
- package/vendor/smart-search/src/smart_search/assets/skills/smart-search-cli/examples/evidence-gathering.md +89 -0
- package/vendor/smart-search/src/smart_search/assets/skills/smart-search-cli/references/cli-contract.md +337 -0
- package/vendor/smart-search/src/smart_search/cli.py +2003 -0
- package/vendor/smart-search/src/smart_search/config.py +580 -0
- package/vendor/smart-search/src/smart_search/logger.py +43 -0
- package/vendor/smart-search/src/smart_search/providers/__init__.py +16 -0
- package/vendor/smart-search/src/smart_search/providers/base.py +41 -0
- package/vendor/smart-search/src/smart_search/providers/context7.py +141 -0
- package/vendor/smart-search/src/smart_search/providers/exa.py +206 -0
- package/vendor/smart-search/src/smart_search/providers/jina.py +136 -0
- package/vendor/smart-search/src/smart_search/providers/openai_compatible.py +370 -0
- package/vendor/smart-search/src/smart_search/providers/zhipu.py +143 -0
- package/vendor/smart-search/src/smart_search/service.py +2865 -0
- package/vendor/smart-search/src/smart_search/sources.py +429 -0
- package/vendor/smart-search/src/smart_search/utils.py +220 -0
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
import httpx
|
|
2
|
+
import json
|
|
3
|
+
import logging
|
|
4
|
+
from datetime import datetime, timezone
|
|
5
|
+
from email.utils import parsedate_to_datetime
|
|
6
|
+
from typing import List, Optional
|
|
7
|
+
from tenacity import AsyncRetrying, retry_if_exception, stop_after_attempt, wait_random_exponential
|
|
8
|
+
from tenacity.wait import wait_base
|
|
9
|
+
from .base import BaseSearchProvider, SearchResult
|
|
10
|
+
from ..utils import search_prompt, fetch_prompt, url_describe_prompt, rank_sources_prompt
|
|
11
|
+
from ..logger import log_info
|
|
12
|
+
from ..config import config
|
|
13
|
+
|
|
14
|
+
_logger = logging.getLogger(__name__)
|
|
15
|
+
_ssl_warning_emitted = False
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def get_local_time_info() -> str:
|
|
19
|
+
try:
|
|
20
|
+
local_tz = datetime.now().astimezone().tzinfo
|
|
21
|
+
local_now = datetime.now(local_tz)
|
|
22
|
+
except Exception:
|
|
23
|
+
local_now = datetime.now(timezone.utc)
|
|
24
|
+
|
|
25
|
+
weekdays_cn = ["星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"]
|
|
26
|
+
weekday = weekdays_cn[local_now.weekday()]
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
f"[Current Time Context]\n"
|
|
30
|
+
f"- Date: {local_now.strftime('%Y-%m-%d')} ({weekday})\n"
|
|
31
|
+
f"- Time: {local_now.strftime('%H:%M:%S')}\n"
|
|
32
|
+
f"- Timezone: {local_now.tzname() or 'Local'}\n"
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
RETRYABLE_STATUS_CODES = {408, 429, 500, 502, 503, 504}
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def _is_retryable_exception(exc) -> bool:
|
|
40
|
+
if isinstance(exc, (httpx.TimeoutException, httpx.NetworkError, httpx.ConnectError, httpx.RemoteProtocolError)):
|
|
41
|
+
return True
|
|
42
|
+
if isinstance(exc, httpx.HTTPStatusError):
|
|
43
|
+
return exc.response.status_code in RETRYABLE_STATUS_CODES
|
|
44
|
+
return False
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class _WaitWithRetryAfter(wait_base):
|
|
48
|
+
|
|
49
|
+
def __init__(self, multiplier: float, max_wait: int):
|
|
50
|
+
self._base_wait = wait_random_exponential(multiplier=multiplier, max=max_wait)
|
|
51
|
+
self._protocol_error_base = 3.0
|
|
52
|
+
|
|
53
|
+
def __call__(self, retry_state):
|
|
54
|
+
if retry_state.outcome and retry_state.outcome.failed:
|
|
55
|
+
exc = retry_state.outcome.exception()
|
|
56
|
+
if isinstance(exc, httpx.HTTPStatusError) and exc.response.status_code == 429:
|
|
57
|
+
retry_after = self._parse_retry_after(exc.response)
|
|
58
|
+
if retry_after is not None:
|
|
59
|
+
return retry_after
|
|
60
|
+
if isinstance(exc, httpx.RemoteProtocolError):
|
|
61
|
+
return self._base_wait(retry_state) + self._protocol_error_base
|
|
62
|
+
return self._base_wait(retry_state)
|
|
63
|
+
|
|
64
|
+
def _parse_retry_after(self, response: httpx.Response) -> Optional[float]:
|
|
65
|
+
header = response.headers.get("Retry-After")
|
|
66
|
+
if not header:
|
|
67
|
+
return None
|
|
68
|
+
header = header.strip()
|
|
69
|
+
|
|
70
|
+
if header.isdigit():
|
|
71
|
+
return float(header)
|
|
72
|
+
|
|
73
|
+
try:
|
|
74
|
+
retry_dt = parsedate_to_datetime(header)
|
|
75
|
+
if retry_dt.tzinfo is None:
|
|
76
|
+
retry_dt = retry_dt.replace(tzinfo=timezone.utc)
|
|
77
|
+
delay = (retry_dt - datetime.now(timezone.utc)).total_seconds()
|
|
78
|
+
return max(0.0, delay)
|
|
79
|
+
except (TypeError, ValueError):
|
|
80
|
+
return None
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
class OpenAICompatibleSearchProvider(BaseSearchProvider):
|
|
84
|
+
def __init__(self, api_url: str, api_key: str, model: str = "grok-4-fast", stream: bool = False):
|
|
85
|
+
super().__init__(api_url, api_key)
|
|
86
|
+
self.model = model
|
|
87
|
+
self.stream = stream
|
|
88
|
+
|
|
89
|
+
def get_provider_name(self) -> str:
|
|
90
|
+
return "OpenAI-compatible"
|
|
91
|
+
|
|
92
|
+
def _build_api_headers(self) -> dict:
|
|
93
|
+
return {
|
|
94
|
+
"Authorization": f"Bearer {self.api_key}",
|
|
95
|
+
"Content-Type": "application/json",
|
|
96
|
+
"Accept": "application/json, text/event-stream",
|
|
97
|
+
"User-Agent": "smart-search/0.1.0",
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
def _get_ssl_verify(self) -> bool:
|
|
101
|
+
global _ssl_warning_emitted
|
|
102
|
+
verify = config.ssl_verify_enabled
|
|
103
|
+
if not verify and not _ssl_warning_emitted:
|
|
104
|
+
_ssl_warning_emitted = True
|
|
105
|
+
_logger.warning("SSL_VERIFY=false: OpenAI-compatible API 请求已禁用 SSL 证书验证,存在安全风险")
|
|
106
|
+
return verify
|
|
107
|
+
|
|
108
|
+
async def search(self, query: str, platform: str = "", ctx=None) -> List[SearchResult]:
|
|
109
|
+
headers = self._build_api_headers()
|
|
110
|
+
platform_prompt = ""
|
|
111
|
+
|
|
112
|
+
if platform:
|
|
113
|
+
platform_prompt = "\n\nYou should search the web for the information you need, and focus on these platform: " + platform + "\n"
|
|
114
|
+
|
|
115
|
+
time_context = get_local_time_info() + "\n"
|
|
116
|
+
|
|
117
|
+
payload = {
|
|
118
|
+
"model": self.model,
|
|
119
|
+
"messages": [
|
|
120
|
+
{
|
|
121
|
+
"role": "system",
|
|
122
|
+
"content": search_prompt,
|
|
123
|
+
},
|
|
124
|
+
{"role": "user", "content": time_context + query + platform_prompt},
|
|
125
|
+
],
|
|
126
|
+
"stream": self.stream,
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
await log_info(ctx, f"platform_prompt: { query + platform_prompt}", config.debug_enabled)
|
|
130
|
+
|
|
131
|
+
if self.stream:
|
|
132
|
+
return await self._execute_stream_with_retry(headers, payload, ctx)
|
|
133
|
+
return await self._execute_completion_with_retry(headers, payload, ctx)
|
|
134
|
+
|
|
135
|
+
async def fetch(self, url: str, ctx=None) -> str:
|
|
136
|
+
headers = self._build_api_headers()
|
|
137
|
+
payload = {
|
|
138
|
+
"model": self.model,
|
|
139
|
+
"messages": [
|
|
140
|
+
{
|
|
141
|
+
"role": "system",
|
|
142
|
+
"content": fetch_prompt,
|
|
143
|
+
},
|
|
144
|
+
{"role": "user", "content": url + "\n获取该网页内容并返回其结构化Markdown格式" },
|
|
145
|
+
],
|
|
146
|
+
"stream": self.stream,
|
|
147
|
+
}
|
|
148
|
+
if self.stream:
|
|
149
|
+
return await self._execute_stream_with_retry(headers, payload, ctx)
|
|
150
|
+
return await self._execute_completion_with_retry(headers, payload, ctx)
|
|
151
|
+
|
|
152
|
+
async def _parse_streaming_response(self, response, ctx=None) -> str:
|
|
153
|
+
content = ""
|
|
154
|
+
full_body_buffer = []
|
|
155
|
+
|
|
156
|
+
async for line in response.aiter_lines():
|
|
157
|
+
line = line.strip()
|
|
158
|
+
if not line:
|
|
159
|
+
continue
|
|
160
|
+
|
|
161
|
+
full_body_buffer.append(line)
|
|
162
|
+
|
|
163
|
+
if line.startswith("data:"):
|
|
164
|
+
if line in ("data: [DONE]", "data:[DONE]"):
|
|
165
|
+
continue
|
|
166
|
+
try:
|
|
167
|
+
json_str = line[5:].lstrip()
|
|
168
|
+
data = json.loads(json_str)
|
|
169
|
+
choices = data.get("choices", [])
|
|
170
|
+
if choices and len(choices) > 0:
|
|
171
|
+
delta = choices[0].get("delta", {})
|
|
172
|
+
if "content" in delta:
|
|
173
|
+
content += delta["content"]
|
|
174
|
+
except (json.JSONDecodeError, IndexError):
|
|
175
|
+
continue
|
|
176
|
+
|
|
177
|
+
if not content and full_body_buffer:
|
|
178
|
+
try:
|
|
179
|
+
full_text = "".join(full_body_buffer)
|
|
180
|
+
data = json.loads(full_text)
|
|
181
|
+
if "choices" in data and len(data["choices"]) > 0:
|
|
182
|
+
message = data["choices"][0].get("message", {})
|
|
183
|
+
content = message.get("content", "")
|
|
184
|
+
except json.JSONDecodeError:
|
|
185
|
+
pass
|
|
186
|
+
|
|
187
|
+
await log_info(ctx, f"content: {content}", config.debug_enabled)
|
|
188
|
+
|
|
189
|
+
return content
|
|
190
|
+
|
|
191
|
+
async def _execute_stream_with_retry(self, headers: dict, payload: dict, ctx=None) -> str:
|
|
192
|
+
timeout = httpx.Timeout(connect=6.0, read=120.0, write=10.0, pool=None)
|
|
193
|
+
|
|
194
|
+
async with httpx.AsyncClient(timeout=timeout, follow_redirects=True, verify=self._get_ssl_verify()) as client:
|
|
195
|
+
async for attempt in AsyncRetrying(
|
|
196
|
+
stop=stop_after_attempt(config.retry_max_attempts + 1),
|
|
197
|
+
wait=_WaitWithRetryAfter(config.retry_multiplier, config.retry_max_wait),
|
|
198
|
+
retry=retry_if_exception(_is_retryable_exception),
|
|
199
|
+
reraise=True,
|
|
200
|
+
):
|
|
201
|
+
with attempt:
|
|
202
|
+
async with client.stream(
|
|
203
|
+
"POST",
|
|
204
|
+
f"{self.api_url}/chat/completions",
|
|
205
|
+
headers=headers,
|
|
206
|
+
json=payload,
|
|
207
|
+
) as response:
|
|
208
|
+
response.raise_for_status()
|
|
209
|
+
return await self._parse_streaming_response(response, ctx)
|
|
210
|
+
|
|
211
|
+
async def _parse_completion_response(self, response: httpx.Response, ctx=None) -> str:
|
|
212
|
+
"""解析非流式 completion 响应,兼容 JSON 和 SSE 文本 fallback"""
|
|
213
|
+
content = ""
|
|
214
|
+
body_text = response.text or ""
|
|
215
|
+
sources: list[dict] = []
|
|
216
|
+
|
|
217
|
+
try:
|
|
218
|
+
data = response.json()
|
|
219
|
+
except Exception:
|
|
220
|
+
data = None
|
|
221
|
+
|
|
222
|
+
if isinstance(data, dict):
|
|
223
|
+
sources = self._extract_citations(data)
|
|
224
|
+
choices = data.get("choices", [])
|
|
225
|
+
if choices:
|
|
226
|
+
message = choices[0].get("message", {})
|
|
227
|
+
if isinstance(message, dict):
|
|
228
|
+
content = message.get("content", "") or ""
|
|
229
|
+
message_citations = self._normalize_citations(message.get("citations"))
|
|
230
|
+
if message_citations:
|
|
231
|
+
sources = self._merge_citations(sources, message_citations)
|
|
232
|
+
|
|
233
|
+
# SSE fallback: 部分中转站即使设置 stream=False 仍可能返回 SSE 格式
|
|
234
|
+
if not content and body_text.lstrip().startswith("data:"):
|
|
235
|
+
class _LineResponse:
|
|
236
|
+
def __init__(self, text: str):
|
|
237
|
+
self._lines = text.splitlines()
|
|
238
|
+
|
|
239
|
+
async def aiter_lines(self):
|
|
240
|
+
for line in self._lines:
|
|
241
|
+
yield line
|
|
242
|
+
|
|
243
|
+
content = await self._parse_streaming_response(_LineResponse(body_text), ctx)
|
|
244
|
+
|
|
245
|
+
if content and sources:
|
|
246
|
+
content = f"{content.rstrip()}\n\nsources({json.dumps(sources, ensure_ascii=False)})"
|
|
247
|
+
|
|
248
|
+
await log_info(ctx, f"content: {content}", config.debug_enabled)
|
|
249
|
+
|
|
250
|
+
return content
|
|
251
|
+
|
|
252
|
+
def _extract_citations(self, data: dict) -> list[dict]:
|
|
253
|
+
sources = self._normalize_citations(data.get("citations"))
|
|
254
|
+
for choice in data.get("choices", []) or []:
|
|
255
|
+
if not isinstance(choice, dict):
|
|
256
|
+
continue
|
|
257
|
+
message = choice.get("message")
|
|
258
|
+
if isinstance(message, dict):
|
|
259
|
+
sources = self._merge_citations(sources, self._normalize_citations(message.get("citations")))
|
|
260
|
+
return sources
|
|
261
|
+
|
|
262
|
+
def _normalize_citations(self, citations) -> list[dict]:
|
|
263
|
+
if not citations:
|
|
264
|
+
return []
|
|
265
|
+
if not isinstance(citations, list):
|
|
266
|
+
citations = [citations]
|
|
267
|
+
|
|
268
|
+
normalized: list[dict] = []
|
|
269
|
+
seen: set[str] = set()
|
|
270
|
+
for item in citations:
|
|
271
|
+
source: dict = {}
|
|
272
|
+
if isinstance(item, str):
|
|
273
|
+
url = item.strip()
|
|
274
|
+
if not url.startswith(("http://", "https://")):
|
|
275
|
+
continue
|
|
276
|
+
source["url"] = url
|
|
277
|
+
elif isinstance(item, dict):
|
|
278
|
+
url = item.get("url") or item.get("href") or item.get("link")
|
|
279
|
+
if not isinstance(url, str) or not url.startswith(("http://", "https://")):
|
|
280
|
+
continue
|
|
281
|
+
source["url"] = url
|
|
282
|
+
title = item.get("title") or item.get("name") or item.get("label")
|
|
283
|
+
if isinstance(title, str) and title.strip():
|
|
284
|
+
source["title"] = title.strip()
|
|
285
|
+
else:
|
|
286
|
+
continue
|
|
287
|
+
|
|
288
|
+
if source["url"] in seen:
|
|
289
|
+
continue
|
|
290
|
+
seen.add(source["url"])
|
|
291
|
+
normalized.append(source)
|
|
292
|
+
return normalized
|
|
293
|
+
|
|
294
|
+
def _merge_citations(self, *source_lists: list[dict]) -> list[dict]:
|
|
295
|
+
merged: list[dict] = []
|
|
296
|
+
seen: set[str] = set()
|
|
297
|
+
for source_list in source_lists:
|
|
298
|
+
for item in source_list or []:
|
|
299
|
+
url = item.get("url")
|
|
300
|
+
if not isinstance(url, str) or not url or url in seen:
|
|
301
|
+
continue
|
|
302
|
+
seen.add(url)
|
|
303
|
+
merged.append(item)
|
|
304
|
+
return merged
|
|
305
|
+
|
|
306
|
+
async def _execute_completion_with_retry(self, headers: dict, payload: dict, ctx=None) -> str:
|
|
307
|
+
"""执行带重试机制的非流式 HTTP 请求,兼容上游返回 JSON 或 SSE 文本"""
|
|
308
|
+
timeout = httpx.Timeout(connect=6.0, read=120.0, write=10.0, pool=None)
|
|
309
|
+
|
|
310
|
+
async with httpx.AsyncClient(timeout=timeout, follow_redirects=True, verify=self._get_ssl_verify()) as client:
|
|
311
|
+
async for attempt in AsyncRetrying(
|
|
312
|
+
stop=stop_after_attempt(config.retry_max_attempts + 1),
|
|
313
|
+
wait=_WaitWithRetryAfter(config.retry_multiplier, config.retry_max_wait),
|
|
314
|
+
retry=retry_if_exception(_is_retryable_exception),
|
|
315
|
+
reraise=True,
|
|
316
|
+
):
|
|
317
|
+
with attempt:
|
|
318
|
+
response = await client.post(
|
|
319
|
+
f"{self.api_url}/chat/completions",
|
|
320
|
+
headers=headers,
|
|
321
|
+
json=payload,
|
|
322
|
+
)
|
|
323
|
+
response.raise_for_status()
|
|
324
|
+
return await self._parse_completion_response(response, ctx)
|
|
325
|
+
|
|
326
|
+
async def describe_url(self, url: str, ctx=None) -> dict:
|
|
327
|
+
headers = self._build_api_headers()
|
|
328
|
+
payload = {
|
|
329
|
+
"model": self.model,
|
|
330
|
+
"messages": [
|
|
331
|
+
{"role": "system", "content": url_describe_prompt},
|
|
332
|
+
{"role": "user", "content": url},
|
|
333
|
+
],
|
|
334
|
+
"stream": False,
|
|
335
|
+
}
|
|
336
|
+
result = await self._execute_completion_with_retry(headers, payload, ctx)
|
|
337
|
+
title, extracts = url, ""
|
|
338
|
+
for line in result.strip().splitlines():
|
|
339
|
+
if line.startswith("Title:"):
|
|
340
|
+
title = line[6:].strip() or url
|
|
341
|
+
elif line.startswith("Extracts:"):
|
|
342
|
+
extracts = line[9:].strip()
|
|
343
|
+
return {"title": title, "extracts": extracts, "url": url}
|
|
344
|
+
|
|
345
|
+
async def rank_sources(self, query: str, sources_text: str, total: int, ctx=None) -> list[int]:
|
|
346
|
+
"""让 OpenAI-compatible 模型按查询相关度对信源排序,返回排序后的序号列表"""
|
|
347
|
+
headers = self._build_api_headers()
|
|
348
|
+
payload = {
|
|
349
|
+
"model": self.model,
|
|
350
|
+
"messages": [
|
|
351
|
+
{"role": "system", "content": rank_sources_prompt},
|
|
352
|
+
{"role": "user", "content": f"Query: {query}\n\n{sources_text}"},
|
|
353
|
+
],
|
|
354
|
+
"stream": False,
|
|
355
|
+
}
|
|
356
|
+
result = await self._execute_completion_with_retry(headers, payload, ctx)
|
|
357
|
+
order: list[int] = []
|
|
358
|
+
seen: set[int] = set()
|
|
359
|
+
for token in result.strip().split():
|
|
360
|
+
try:
|
|
361
|
+
n = int(token)
|
|
362
|
+
if 1 <= n <= total and n not in seen:
|
|
363
|
+
seen.add(n)
|
|
364
|
+
order.append(n)
|
|
365
|
+
except ValueError:
|
|
366
|
+
continue
|
|
367
|
+
for i in range(1, total + 1):
|
|
368
|
+
if i not in seen:
|
|
369
|
+
order.append(i)
|
|
370
|
+
return order
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import time
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
from tenacity import AsyncRetrying, retry_if_exception, stop_after_attempt, wait_random_exponential
|
|
7
|
+
|
|
8
|
+
from .base import BaseSearchProvider
|
|
9
|
+
from ..config import config
|
|
10
|
+
from ..logger import log_info
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
RETRYABLE_STATUS_CODES = {408, 500, 502, 503, 504}
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def _is_retryable_exception(exc) -> bool:
|
|
17
|
+
if isinstance(exc, (httpx.TimeoutException, httpx.NetworkError, httpx.ConnectError)):
|
|
18
|
+
return True
|
|
19
|
+
if isinstance(exc, httpx.HTTPStatusError):
|
|
20
|
+
return exc.response.status_code in RETRYABLE_STATUS_CODES
|
|
21
|
+
return False
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def _normalize_result(item: dict[str, Any]) -> dict[str, Any]:
|
|
25
|
+
return {
|
|
26
|
+
"title": item.get("title") or "",
|
|
27
|
+
"url": item.get("link") or item.get("url") or "",
|
|
28
|
+
"description": item.get("content") or "",
|
|
29
|
+
"provider": "zhipu",
|
|
30
|
+
"source": item.get("media") or "",
|
|
31
|
+
"published_date": item.get("publish_date") or "",
|
|
32
|
+
"icon": item.get("icon") or "",
|
|
33
|
+
"refer": item.get("refer") or "",
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def _error_payload(exc: Exception) -> dict[str, Any]:
|
|
38
|
+
if isinstance(exc, httpx.HTTPStatusError):
|
|
39
|
+
status_code = exc.response.status_code
|
|
40
|
+
if status_code == 429:
|
|
41
|
+
error_type = "rate_limited"
|
|
42
|
+
elif status_code in {401, 403}:
|
|
43
|
+
error_type = "auth_error"
|
|
44
|
+
else:
|
|
45
|
+
error_type = "network_error"
|
|
46
|
+
return {"error_type": error_type, "error": f"HTTP {status_code}: {exc.response.reason_phrase}"}
|
|
47
|
+
if isinstance(exc, httpx.TimeoutException):
|
|
48
|
+
return {"error_type": "timeout", "error": "request timed out"}
|
|
49
|
+
if isinstance(exc, httpx.RequestError):
|
|
50
|
+
return {"error_type": "network_error", "error": str(exc)}
|
|
51
|
+
return {"error_type": "runtime_error", "error": str(exc)}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class ZhipuWebSearchProvider(BaseSearchProvider):
|
|
55
|
+
def __init__(
|
|
56
|
+
self,
|
|
57
|
+
api_url: str,
|
|
58
|
+
api_key: str,
|
|
59
|
+
search_engine: str = "search_std",
|
|
60
|
+
timeout: float = 30.0,
|
|
61
|
+
):
|
|
62
|
+
super().__init__(api_url.rstrip("/"), api_key)
|
|
63
|
+
self.search_engine = search_engine
|
|
64
|
+
self.timeout = timeout
|
|
65
|
+
|
|
66
|
+
def get_provider_name(self) -> str:
|
|
67
|
+
return "Zhipu Web Search"
|
|
68
|
+
|
|
69
|
+
async def search(
|
|
70
|
+
self,
|
|
71
|
+
query: str,
|
|
72
|
+
count: int = 10,
|
|
73
|
+
search_engine: str | None = None,
|
|
74
|
+
search_intent: bool = True,
|
|
75
|
+
search_domain_filter: str = "",
|
|
76
|
+
search_recency_filter: str = "noLimit",
|
|
77
|
+
content_size: str = "medium",
|
|
78
|
+
user_id: str = "",
|
|
79
|
+
ctx=None,
|
|
80
|
+
) -> str:
|
|
81
|
+
endpoint = f"{self.api_url}/paas/v4/web_search"
|
|
82
|
+
headers = {
|
|
83
|
+
"Authorization": f"Bearer {self.api_key}",
|
|
84
|
+
"Content-Type": "application/json",
|
|
85
|
+
"Accept": "application/json",
|
|
86
|
+
}
|
|
87
|
+
payload: dict[str, Any] = {
|
|
88
|
+
"search_query": query[:70],
|
|
89
|
+
"search_engine": search_engine or self.search_engine,
|
|
90
|
+
"search_intent": search_intent,
|
|
91
|
+
"count": count,
|
|
92
|
+
"search_recency_filter": search_recency_filter,
|
|
93
|
+
"content_size": content_size,
|
|
94
|
+
}
|
|
95
|
+
if search_domain_filter:
|
|
96
|
+
payload["search_domain_filter"] = search_domain_filter
|
|
97
|
+
if user_id:
|
|
98
|
+
payload["user_id"] = user_id
|
|
99
|
+
|
|
100
|
+
await log_info(ctx, f"Zhipu search: {query}", config.debug_enabled)
|
|
101
|
+
start_time = time.time()
|
|
102
|
+
try:
|
|
103
|
+
data = await self._request_with_retry(endpoint, headers, payload)
|
|
104
|
+
elapsed_ms = round((time.time() - start_time) * 1000, 2)
|
|
105
|
+
results = [_normalize_result(item) for item in data.get("search_result", []) or []]
|
|
106
|
+
output = {
|
|
107
|
+
"ok": True,
|
|
108
|
+
"query": query,
|
|
109
|
+
"provider": "zhipu",
|
|
110
|
+
"search_engine": payload["search_engine"],
|
|
111
|
+
"results": results,
|
|
112
|
+
"total": len(results),
|
|
113
|
+
"search_intent": data.get("search_intent", []),
|
|
114
|
+
"request_id": data.get("request_id", ""),
|
|
115
|
+
"elapsed_ms": elapsed_ms,
|
|
116
|
+
}
|
|
117
|
+
except Exception as e:
|
|
118
|
+
elapsed_ms = round((time.time() - start_time) * 1000, 2)
|
|
119
|
+
error = _error_payload(e)
|
|
120
|
+
output = {
|
|
121
|
+
"ok": False,
|
|
122
|
+
"query": query,
|
|
123
|
+
"provider": "zhipu",
|
|
124
|
+
"error_type": error["error_type"],
|
|
125
|
+
"error": error["error"],
|
|
126
|
+
"elapsed_ms": elapsed_ms,
|
|
127
|
+
}
|
|
128
|
+
return json.dumps(output, ensure_ascii=False, indent=2)
|
|
129
|
+
|
|
130
|
+
async def _request_with_retry(self, endpoint: str, headers: dict, payload: dict) -> dict[str, Any]:
|
|
131
|
+
timeout = httpx.Timeout(connect=6.0, read=self.timeout, write=10.0, pool=None)
|
|
132
|
+
async with httpx.AsyncClient(timeout=timeout, follow_redirects=True) as client:
|
|
133
|
+
async for attempt in AsyncRetrying(
|
|
134
|
+
stop=stop_after_attempt(config.retry_max_attempts + 1),
|
|
135
|
+
wait=wait_random_exponential(multiplier=config.retry_multiplier, max=config.retry_max_wait),
|
|
136
|
+
retry=retry_if_exception(_is_retryable_exception),
|
|
137
|
+
reraise=True,
|
|
138
|
+
):
|
|
139
|
+
with attempt:
|
|
140
|
+
response = await client.post(endpoint, headers=headers, json=payload)
|
|
141
|
+
response.raise_for_status()
|
|
142
|
+
return response.json()
|
|
143
|
+
return {}
|