@stonerzju/opencode 1.2.16-offline.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +10 -0
- package/BUN_SHELL_MIGRATION_PLAN.md +136 -0
- package/Dockerfile +18 -0
- package/README.md +15 -0
- package/bin/opencode +179 -0
- package/bunfig.toml +7 -0
- package/drizzle.config.ts +10 -0
- package/migration/20260127222353_familiar_lady_ursula/migration.sql +90 -0
- package/migration/20260127222353_familiar_lady_ursula/snapshot.json +796 -0
- package/migration/20260211171708_add_project_commands/migration.sql +1 -0
- package/migration/20260211171708_add_project_commands/snapshot.json +806 -0
- package/migration/20260213144116_wakeful_the_professor/migration.sql +11 -0
- package/migration/20260213144116_wakeful_the_professor/snapshot.json +897 -0
- package/migration/20260225215848_workspace/migration.sql +7 -0
- package/migration/20260225215848_workspace/snapshot.json +959 -0
- package/package.json +140 -0
- package/package.json.bak +140 -0
- package/parsers-config.ts +254 -0
- package/script/build.ts +224 -0
- package/script/check-migrations.ts +16 -0
- package/script/postinstall.mjs +131 -0
- package/script/publish.ts +181 -0
- package/script/schema.ts +63 -0
- package/script/seed-e2e.ts +50 -0
- package/src/acp/README.md +174 -0
- package/src/acp/agent.ts +1741 -0
- package/src/acp/session.ts +116 -0
- package/src/acp/types.ts +23 -0
- package/src/agent/agent.ts +339 -0
- package/src/agent/generate.txt +75 -0
- package/src/agent/prompt/compaction.txt +14 -0
- package/src/agent/prompt/explore.txt +18 -0
- package/src/agent/prompt/summary.txt +11 -0
- package/src/agent/prompt/title.txt +44 -0
- package/src/auth/index.ts +68 -0
- package/src/bun/index.ts +131 -0
- package/src/bun/registry.ts +50 -0
- package/src/bus/bus-event.ts +43 -0
- package/src/bus/global.ts +10 -0
- package/src/bus/index.ts +105 -0
- package/src/cli/bootstrap.ts +17 -0
- package/src/cli/cmd/acp.ts +70 -0
- package/src/cli/cmd/agent.ts +257 -0
- package/src/cli/cmd/auth.ts +449 -0
- package/src/cli/cmd/cmd.ts +7 -0
- package/src/cli/cmd/db.ts +118 -0
- package/src/cli/cmd/debug/agent.ts +167 -0
- package/src/cli/cmd/debug/config.ts +16 -0
- package/src/cli/cmd/debug/file.ts +97 -0
- package/src/cli/cmd/debug/index.ts +48 -0
- package/src/cli/cmd/debug/lsp.ts +52 -0
- package/src/cli/cmd/debug/ripgrep.ts +87 -0
- package/src/cli/cmd/debug/scrap.ts +16 -0
- package/src/cli/cmd/debug/skill.ts +16 -0
- package/src/cli/cmd/debug/snapshot.ts +52 -0
- package/src/cli/cmd/export.ts +88 -0
- package/src/cli/cmd/generate.ts +38 -0
- package/src/cli/cmd/github.ts +1631 -0
- package/src/cli/cmd/import.ts +170 -0
- package/src/cli/cmd/mcp.ts +754 -0
- package/src/cli/cmd/models.ts +77 -0
- package/src/cli/cmd/pr.ts +112 -0
- package/src/cli/cmd/run.ts +625 -0
- package/src/cli/cmd/serve.ts +31 -0
- package/src/cli/cmd/session.ts +156 -0
- package/src/cli/cmd/stats.ts +410 -0
- package/src/cli/cmd/tui/app.tsx +845 -0
- package/src/cli/cmd/tui/attach.ts +88 -0
- package/src/cli/cmd/tui/component/border.tsx +21 -0
- package/src/cli/cmd/tui/component/dialog-agent.tsx +31 -0
- package/src/cli/cmd/tui/component/dialog-command.tsx +147 -0
- package/src/cli/cmd/tui/component/dialog-mcp.tsx +86 -0
- package/src/cli/cmd/tui/component/dialog-model.tsx +165 -0
- package/src/cli/cmd/tui/component/dialog-provider.tsx +259 -0
- package/src/cli/cmd/tui/component/dialog-session-list.tsx +108 -0
- package/src/cli/cmd/tui/component/dialog-session-rename.tsx +31 -0
- package/src/cli/cmd/tui/component/dialog-skill.tsx +36 -0
- package/src/cli/cmd/tui/component/dialog-stash.tsx +87 -0
- package/src/cli/cmd/tui/component/dialog-status.tsx +167 -0
- package/src/cli/cmd/tui/component/dialog-tag.tsx +44 -0
- package/src/cli/cmd/tui/component/dialog-theme-list.tsx +50 -0
- package/src/cli/cmd/tui/component/logo.tsx +85 -0
- package/src/cli/cmd/tui/component/prompt/autocomplete.tsx +667 -0
- package/src/cli/cmd/tui/component/prompt/frecency.tsx +90 -0
- package/src/cli/cmd/tui/component/prompt/history.tsx +108 -0
- package/src/cli/cmd/tui/component/prompt/index.tsx +1155 -0
- package/src/cli/cmd/tui/component/prompt/stash.tsx +101 -0
- package/src/cli/cmd/tui/component/spinner.tsx +24 -0
- package/src/cli/cmd/tui/component/textarea-keybindings.ts +73 -0
- package/src/cli/cmd/tui/component/tips.tsx +152 -0
- package/src/cli/cmd/tui/component/todo-item.tsx +32 -0
- package/src/cli/cmd/tui/context/args.tsx +15 -0
- package/src/cli/cmd/tui/context/directory.ts +13 -0
- package/src/cli/cmd/tui/context/exit.tsx +53 -0
- package/src/cli/cmd/tui/context/helper.tsx +25 -0
- package/src/cli/cmd/tui/context/keybind.tsx +102 -0
- package/src/cli/cmd/tui/context/kv.tsx +52 -0
- package/src/cli/cmd/tui/context/local.tsx +406 -0
- package/src/cli/cmd/tui/context/prompt.tsx +18 -0
- package/src/cli/cmd/tui/context/route.tsx +46 -0
- package/src/cli/cmd/tui/context/sdk.tsx +101 -0
- package/src/cli/cmd/tui/context/sync.tsx +488 -0
- package/src/cli/cmd/tui/context/theme/aura.json +69 -0
- package/src/cli/cmd/tui/context/theme/ayu.json +80 -0
- package/src/cli/cmd/tui/context/theme/carbonfox.json +248 -0
- package/src/cli/cmd/tui/context/theme/catppuccin-frappe.json +233 -0
- package/src/cli/cmd/tui/context/theme/catppuccin-macchiato.json +233 -0
- package/src/cli/cmd/tui/context/theme/catppuccin.json +112 -0
- package/src/cli/cmd/tui/context/theme/cobalt2.json +228 -0
- package/src/cli/cmd/tui/context/theme/cursor.json +249 -0
- package/src/cli/cmd/tui/context/theme/dracula.json +219 -0
- package/src/cli/cmd/tui/context/theme/everforest.json +241 -0
- package/src/cli/cmd/tui/context/theme/flexoki.json +237 -0
- package/src/cli/cmd/tui/context/theme/github.json +233 -0
- package/src/cli/cmd/tui/context/theme/gruvbox.json +242 -0
- package/src/cli/cmd/tui/context/theme/kanagawa.json +77 -0
- package/src/cli/cmd/tui/context/theme/lucent-orng.json +237 -0
- package/src/cli/cmd/tui/context/theme/material.json +235 -0
- package/src/cli/cmd/tui/context/theme/matrix.json +77 -0
- package/src/cli/cmd/tui/context/theme/mercury.json +252 -0
- package/src/cli/cmd/tui/context/theme/monokai.json +221 -0
- package/src/cli/cmd/tui/context/theme/nightowl.json +221 -0
- package/src/cli/cmd/tui/context/theme/nord.json +223 -0
- package/src/cli/cmd/tui/context/theme/one-dark.json +84 -0
- package/src/cli/cmd/tui/context/theme/orng.json +249 -0
- package/src/cli/cmd/tui/context/theme/osaka-jade.json +93 -0
- package/src/cli/cmd/tui/context/theme/palenight.json +222 -0
- package/src/cli/cmd/tui/context/theme/rosepine.json +234 -0
- package/src/cli/cmd/tui/context/theme/solarized.json +223 -0
- package/src/cli/cmd/tui/context/theme/synthwave84.json +226 -0
- package/src/cli/cmd/tui/context/theme/tokyonight.json +243 -0
- package/src/cli/cmd/tui/context/theme/vercel.json +245 -0
- package/src/cli/cmd/tui/context/theme/vesper.json +218 -0
- package/src/cli/cmd/tui/context/theme/zenburn.json +223 -0
- package/src/cli/cmd/tui/context/theme.tsx +1152 -0
- package/src/cli/cmd/tui/context/tui-config.tsx +9 -0
- package/src/cli/cmd/tui/event.ts +48 -0
- package/src/cli/cmd/tui/routes/home.tsx +145 -0
- package/src/cli/cmd/tui/routes/session/dialog-fork-from-timeline.tsx +64 -0
- package/src/cli/cmd/tui/routes/session/dialog-message.tsx +109 -0
- package/src/cli/cmd/tui/routes/session/dialog-subagent.tsx +26 -0
- package/src/cli/cmd/tui/routes/session/dialog-timeline.tsx +47 -0
- package/src/cli/cmd/tui/routes/session/footer.tsx +91 -0
- package/src/cli/cmd/tui/routes/session/header.tsx +135 -0
- package/src/cli/cmd/tui/routes/session/index.tsx +2219 -0
- package/src/cli/cmd/tui/routes/session/permission.tsx +685 -0
- package/src/cli/cmd/tui/routes/session/question.tsx +466 -0
- package/src/cli/cmd/tui/routes/session/sidebar.tsx +321 -0
- package/src/cli/cmd/tui/thread.ts +199 -0
- package/src/cli/cmd/tui/ui/dialog-alert.tsx +59 -0
- package/src/cli/cmd/tui/ui/dialog-confirm.tsx +85 -0
- package/src/cli/cmd/tui/ui/dialog-export-options.tsx +207 -0
- package/src/cli/cmd/tui/ui/dialog-help.tsx +40 -0
- package/src/cli/cmd/tui/ui/dialog-prompt.tsx +80 -0
- package/src/cli/cmd/tui/ui/dialog-select.tsx +401 -0
- package/src/cli/cmd/tui/ui/dialog.tsx +182 -0
- package/src/cli/cmd/tui/ui/link.tsx +28 -0
- package/src/cli/cmd/tui/ui/spinner.ts +368 -0
- package/src/cli/cmd/tui/ui/toast.tsx +100 -0
- package/src/cli/cmd/tui/util/clipboard.ts +164 -0
- package/src/cli/cmd/tui/util/editor.ts +33 -0
- package/src/cli/cmd/tui/util/selection.ts +25 -0
- package/src/cli/cmd/tui/util/signal.ts +7 -0
- package/src/cli/cmd/tui/util/terminal.ts +114 -0
- package/src/cli/cmd/tui/util/transcript.ts +98 -0
- package/src/cli/cmd/tui/win32.ts +129 -0
- package/src/cli/cmd/tui/worker.ts +157 -0
- package/src/cli/cmd/uninstall.ts +356 -0
- package/src/cli/cmd/upgrade.ts +73 -0
- package/src/cli/cmd/web.ts +81 -0
- package/src/cli/cmd/workspace-serve.ts +16 -0
- package/src/cli/error.ts +57 -0
- package/src/cli/logo.ts +6 -0
- package/src/cli/network.ts +60 -0
- package/src/cli/ui.ts +116 -0
- package/src/cli/upgrade.ts +25 -0
- package/src/command/index.ts +150 -0
- package/src/command/template/initialize.txt +10 -0
- package/src/command/template/review.txt +101 -0
- package/src/config/config.ts +1408 -0
- package/src/config/markdown.ts +99 -0
- package/src/config/migrate-tui-config.ts +155 -0
- package/src/config/paths.ts +174 -0
- package/src/config/tui-schema.ts +34 -0
- package/src/config/tui.ts +118 -0
- package/src/control/control.sql.ts +22 -0
- package/src/control/index.ts +67 -0
- package/src/control-plane/adaptors/index.ts +10 -0
- package/src/control-plane/adaptors/types.ts +7 -0
- package/src/control-plane/adaptors/worktree.ts +26 -0
- package/src/control-plane/config.ts +10 -0
- package/src/control-plane/session-proxy-middleware.ts +46 -0
- package/src/control-plane/sse.ts +66 -0
- package/src/control-plane/workspace-server/routes.ts +33 -0
- package/src/control-plane/workspace-server/server.ts +24 -0
- package/src/control-plane/workspace.sql.ts +12 -0
- package/src/control-plane/workspace.ts +160 -0
- package/src/env/index.ts +28 -0
- package/src/file/ignore.ts +82 -0
- package/src/file/index.ts +646 -0
- package/src/file/ripgrep.ts +372 -0
- package/src/file/time.ts +71 -0
- package/src/file/watcher.ts +128 -0
- package/src/flag/flag.ts +109 -0
- package/src/format/formatter.ts +395 -0
- package/src/format/index.ts +140 -0
- package/src/global/index.ts +54 -0
- package/src/id/id.ts +84 -0
- package/src/ide/index.ts +76 -0
- package/src/index.ts +210 -0
- package/src/installation/index.ts +266 -0
- package/src/lsp/client.ts +251 -0
- package/src/lsp/index.ts +485 -0
- package/src/lsp/language.ts +120 -0
- package/src/lsp/server.ts +2142 -0
- package/src/mcp/auth.ts +130 -0
- package/src/mcp/index.ts +937 -0
- package/src/mcp/oauth-callback.ts +200 -0
- package/src/mcp/oauth-provider.ts +176 -0
- package/src/patch/index.ts +680 -0
- package/src/permission/arity.ts +163 -0
- package/src/permission/index.ts +210 -0
- package/src/permission/next.ts +286 -0
- package/src/plugin/codex.ts +624 -0
- package/src/plugin/copilot.ts +327 -0
- package/src/plugin/index.ts +143 -0
- package/src/project/bootstrap.ts +33 -0
- package/src/project/instance.ts +114 -0
- package/src/project/project.sql.ts +15 -0
- package/src/project/project.ts +441 -0
- package/src/project/state.ts +70 -0
- package/src/project/vcs.ts +76 -0
- package/src/provider/auth.ts +147 -0
- package/src/provider/error.ts +189 -0
- package/src/provider/models.ts +146 -0
- package/src/provider/provider.ts +1338 -0
- package/src/provider/sdk/copilot/README.md +5 -0
- package/src/provider/sdk/copilot/chat/convert-to-openai-compatible-chat-messages.ts +164 -0
- package/src/provider/sdk/copilot/chat/get-response-metadata.ts +15 -0
- package/src/provider/sdk/copilot/chat/map-openai-compatible-finish-reason.ts +17 -0
- package/src/provider/sdk/copilot/chat/openai-compatible-api-types.ts +64 -0
- package/src/provider/sdk/copilot/chat/openai-compatible-chat-language-model.ts +780 -0
- package/src/provider/sdk/copilot/chat/openai-compatible-chat-options.ts +28 -0
- package/src/provider/sdk/copilot/chat/openai-compatible-metadata-extractor.ts +44 -0
- package/src/provider/sdk/copilot/chat/openai-compatible-prepare-tools.ts +87 -0
- package/src/provider/sdk/copilot/copilot-provider.ts +100 -0
- package/src/provider/sdk/copilot/index.ts +2 -0
- package/src/provider/sdk/copilot/openai-compatible-error.ts +27 -0
- package/src/provider/sdk/copilot/responses/convert-to-openai-responses-input.ts +303 -0
- package/src/provider/sdk/copilot/responses/map-openai-responses-finish-reason.ts +22 -0
- package/src/provider/sdk/copilot/responses/openai-config.ts +18 -0
- package/src/provider/sdk/copilot/responses/openai-error.ts +22 -0
- package/src/provider/sdk/copilot/responses/openai-responses-api-types.ts +207 -0
- package/src/provider/sdk/copilot/responses/openai-responses-language-model.ts +1732 -0
- package/src/provider/sdk/copilot/responses/openai-responses-prepare-tools.ts +177 -0
- package/src/provider/sdk/copilot/responses/openai-responses-settings.ts +1 -0
- package/src/provider/sdk/copilot/responses/tool/code-interpreter.ts +88 -0
- package/src/provider/sdk/copilot/responses/tool/file-search.ts +128 -0
- package/src/provider/sdk/copilot/responses/tool/image-generation.ts +115 -0
- package/src/provider/sdk/copilot/responses/tool/local-shell.ts +65 -0
- package/src/provider/sdk/copilot/responses/tool/web-search-preview.ts +104 -0
- package/src/provider/sdk/copilot/responses/tool/web-search.ts +103 -0
- package/src/provider/transform.ts +955 -0
- package/src/pty/index.ts +324 -0
- package/src/question/index.ts +171 -0
- package/src/scheduler/index.ts +61 -0
- package/src/server/error.ts +36 -0
- package/src/server/event.ts +7 -0
- package/src/server/mdns.ts +60 -0
- package/src/server/routes/config.ts +92 -0
- package/src/server/routes/experimental.ts +270 -0
- package/src/server/routes/file.ts +197 -0
- package/src/server/routes/global.ts +185 -0
- package/src/server/routes/mcp.ts +225 -0
- package/src/server/routes/permission.ts +68 -0
- package/src/server/routes/project.ts +82 -0
- package/src/server/routes/provider.ts +165 -0
- package/src/server/routes/pty.ts +200 -0
- package/src/server/routes/question.ts +98 -0
- package/src/server/routes/session.ts +974 -0
- package/src/server/routes/tui.ts +379 -0
- package/src/server/routes/workspace.ts +104 -0
- package/src/server/server.ts +623 -0
- package/src/session/compaction.ts +261 -0
- package/src/session/index.ts +877 -0
- package/src/session/instruction.ts +192 -0
- package/src/session/llm.ts +279 -0
- package/src/session/message-v2.ts +899 -0
- package/src/session/message.ts +189 -0
- package/src/session/processor.ts +421 -0
- package/src/session/prompt/anthropic-20250930.txt +166 -0
- package/src/session/prompt/anthropic.txt +105 -0
- package/src/session/prompt/beast.txt +147 -0
- package/src/session/prompt/build-switch.txt +5 -0
- package/src/session/prompt/codex_header.txt +79 -0
- package/src/session/prompt/copilot-gpt-5.txt +143 -0
- package/src/session/prompt/gemini.txt +155 -0
- package/src/session/prompt/max-steps.txt +16 -0
- package/src/session/prompt/plan-reminder-anthropic.txt +67 -0
- package/src/session/prompt/plan.txt +26 -0
- package/src/session/prompt/qwen.txt +109 -0
- package/src/session/prompt/trinity.txt +97 -0
- package/src/session/prompt.ts +1959 -0
- package/src/session/retry.ts +101 -0
- package/src/session/revert.ts +138 -0
- package/src/session/session.sql.ts +88 -0
- package/src/session/status.ts +76 -0
- package/src/session/summary.ts +161 -0
- package/src/session/system.ts +54 -0
- package/src/session/todo.ts +56 -0
- package/src/share/share-next.ts +210 -0
- package/src/share/share.sql.ts +13 -0
- package/src/shell/shell.ts +68 -0
- package/src/skill/discovery.ts +98 -0
- package/src/skill/index.ts +1 -0
- package/src/skill/skill.ts +189 -0
- package/src/snapshot/index.ts +297 -0
- package/src/sql.d.ts +4 -0
- package/src/storage/db.ts +155 -0
- package/src/storage/json-migration.ts +425 -0
- package/src/storage/schema.sql.ts +10 -0
- package/src/storage/schema.ts +5 -0
- package/src/storage/storage.ts +220 -0
- package/src/tool/apply_patch.ts +281 -0
- package/src/tool/apply_patch.txt +33 -0
- package/src/tool/bash.ts +274 -0
- package/src/tool/bash.txt +115 -0
- package/src/tool/batch.ts +181 -0
- package/src/tool/batch.txt +24 -0
- package/src/tool/codesearch.ts +132 -0
- package/src/tool/codesearch.txt +12 -0
- package/src/tool/edit.ts +654 -0
- package/src/tool/edit.txt +10 -0
- package/src/tool/external-directory.ts +32 -0
- package/src/tool/glob.ts +78 -0
- package/src/tool/glob.txt +6 -0
- package/src/tool/grep.ts +156 -0
- package/src/tool/grep.txt +8 -0
- package/src/tool/invalid.ts +17 -0
- package/src/tool/ls.ts +121 -0
- package/src/tool/ls.txt +1 -0
- package/src/tool/lsp.ts +97 -0
- package/src/tool/lsp.txt +19 -0
- package/src/tool/multiedit.ts +46 -0
- package/src/tool/multiedit.txt +41 -0
- package/src/tool/plan-enter.txt +14 -0
- package/src/tool/plan-exit.txt +13 -0
- package/src/tool/plan.ts +131 -0
- package/src/tool/question.ts +33 -0
- package/src/tool/question.txt +10 -0
- package/src/tool/read.ts +293 -0
- package/src/tool/read.txt +14 -0
- package/src/tool/registry.ts +173 -0
- package/src/tool/skill.ts +123 -0
- package/src/tool/task.ts +165 -0
- package/src/tool/task.txt +60 -0
- package/src/tool/todo.ts +53 -0
- package/src/tool/todoread.txt +14 -0
- package/src/tool/todowrite.txt +167 -0
- package/src/tool/tool.ts +89 -0
- package/src/tool/truncation.ts +107 -0
- package/src/tool/webfetch.ts +206 -0
- package/src/tool/webfetch.txt +13 -0
- package/src/tool/websearch.ts +150 -0
- package/src/tool/websearch.txt +14 -0
- package/src/tool/write.ts +84 -0
- package/src/tool/write.txt +8 -0
- package/src/util/abort.ts +35 -0
- package/src/util/archive.ts +16 -0
- package/src/util/color.ts +19 -0
- package/src/util/context.ts +25 -0
- package/src/util/defer.ts +12 -0
- package/src/util/eventloop.ts +20 -0
- package/src/util/filesystem.ts +189 -0
- package/src/util/fn.ts +11 -0
- package/src/util/format.ts +20 -0
- package/src/util/git.ts +35 -0
- package/src/util/glob.ts +34 -0
- package/src/util/iife.ts +3 -0
- package/src/util/keybind.ts +103 -0
- package/src/util/lazy.ts +23 -0
- package/src/util/locale.ts +81 -0
- package/src/util/lock.ts +98 -0
- package/src/util/log.ts +182 -0
- package/src/util/process.ts +126 -0
- package/src/util/proxied.ts +3 -0
- package/src/util/queue.ts +32 -0
- package/src/util/rpc.ts +66 -0
- package/src/util/scrap.ts +10 -0
- package/src/util/signal.ts +12 -0
- package/src/util/timeout.ts +14 -0
- package/src/util/token.ts +7 -0
- package/src/util/wildcard.ts +59 -0
- package/src/worktree/index.ts +643 -0
- package/sst-env.d.ts +10 -0
- package/test/AGENTS.md +81 -0
- package/test/acp/agent-interface.test.ts +51 -0
- package/test/acp/event-subscription.test.ts +683 -0
- package/test/agent/agent.test.ts +689 -0
- package/test/bun.test.ts +53 -0
- package/test/cli/github-action.test.ts +197 -0
- package/test/cli/github-remote.test.ts +80 -0
- package/test/cli/import.test.ts +38 -0
- package/test/cli/plugin-auth-picker.test.ts +120 -0
- package/test/cli/tui/transcript.test.ts +322 -0
- package/test/config/agent-color.test.ts +71 -0
- package/test/config/config.test.ts +1886 -0
- package/test/config/fixtures/empty-frontmatter.md +4 -0
- package/test/config/fixtures/frontmatter.md +28 -0
- package/test/config/fixtures/markdown-header.md +11 -0
- package/test/config/fixtures/no-frontmatter.md +1 -0
- package/test/config/fixtures/weird-model-id.md +13 -0
- package/test/config/markdown.test.ts +228 -0
- package/test/config/tui.test.ts +510 -0
- package/test/control-plane/session-proxy-middleware.test.ts +147 -0
- package/test/control-plane/sse.test.ts +56 -0
- package/test/control-plane/workspace-server-sse.test.ts +65 -0
- package/test/control-plane/workspace-sync.test.ts +97 -0
- package/test/file/ignore.test.ts +10 -0
- package/test/file/index.test.ts +394 -0
- package/test/file/path-traversal.test.ts +198 -0
- package/test/file/ripgrep.test.ts +39 -0
- package/test/file/time.test.ts +361 -0
- package/test/fixture/db.ts +11 -0
- package/test/fixture/fixture.ts +45 -0
- package/test/fixture/lsp/fake-lsp-server.js +77 -0
- package/test/fixture/skills/agents-sdk/SKILL.md +152 -0
- package/test/fixture/skills/agents-sdk/references/callable.md +92 -0
- package/test/fixture/skills/cloudflare/SKILL.md +211 -0
- package/test/fixture/skills/index.json +6 -0
- package/test/ide/ide.test.ts +82 -0
- package/test/keybind.test.ts +421 -0
- package/test/lsp/client.test.ts +95 -0
- package/test/mcp/headers.test.ts +153 -0
- package/test/mcp/oauth-browser.test.ts +249 -0
- package/test/memory/abort-leak.test.ts +136 -0
- package/test/patch/patch.test.ts +348 -0
- package/test/permission/arity.test.ts +33 -0
- package/test/permission/next.test.ts +689 -0
- package/test/permission-task.test.ts +319 -0
- package/test/plugin/auth-override.test.ts +44 -0
- package/test/plugin/codex.test.ts +123 -0
- package/test/preload.ts +80 -0
- package/test/project/project.test.ts +348 -0
- package/test/project/worktree-remove.test.ts +65 -0
- package/test/provider/amazon-bedrock.test.ts +446 -0
- package/test/provider/copilot/convert-to-copilot-messages.test.ts +523 -0
- package/test/provider/copilot/copilot-chat-model.test.ts +592 -0
- package/test/provider/gitlab-duo.test.ts +262 -0
- package/test/provider/provider.test.ts +2220 -0
- package/test/provider/transform.test.ts +2353 -0
- package/test/pty/pty-output-isolation.test.ts +140 -0
- package/test/question/question.test.ts +300 -0
- package/test/scheduler.test.ts +73 -0
- package/test/server/global-session-list.test.ts +89 -0
- package/test/server/session-list.test.ts +90 -0
- package/test/server/session-select.test.ts +78 -0
- package/test/session/compaction.test.ts +423 -0
- package/test/session/instruction.test.ts +170 -0
- package/test/session/llm.test.ts +667 -0
- package/test/session/message-v2.test.ts +924 -0
- package/test/session/prompt.test.ts +211 -0
- package/test/session/retry.test.ts +188 -0
- package/test/session/revert-compact.test.ts +285 -0
- package/test/session/session.test.ts +71 -0
- package/test/session/structured-output-integration.test.ts +233 -0
- package/test/session/structured-output.test.ts +385 -0
- package/test/skill/discovery.test.ts +110 -0
- package/test/skill/skill.test.ts +388 -0
- package/test/snapshot/snapshot.test.ts +1180 -0
- package/test/storage/json-migration.test.ts +846 -0
- package/test/tool/__snapshots__/tool.test.ts.snap +9 -0
- package/test/tool/apply_patch.test.ts +566 -0
- package/test/tool/bash.test.ts +402 -0
- package/test/tool/edit.test.ts +496 -0
- package/test/tool/external-directory.test.ts +127 -0
- package/test/tool/fixtures/large-image.png +0 -0
- package/test/tool/fixtures/models-api.json +38413 -0
- package/test/tool/grep.test.ts +110 -0
- package/test/tool/question.test.ts +107 -0
- package/test/tool/read.test.ts +504 -0
- package/test/tool/registry.test.ts +122 -0
- package/test/tool/skill.test.ts +112 -0
- package/test/tool/truncation.test.ts +160 -0
- package/test/tool/webfetch.test.ts +100 -0
- package/test/tool/write.test.ts +348 -0
- package/test/util/filesystem.test.ts +443 -0
- package/test/util/format.test.ts +59 -0
- package/test/util/glob.test.ts +164 -0
- package/test/util/iife.test.ts +36 -0
- package/test/util/lazy.test.ts +50 -0
- package/test/util/lock.test.ts +72 -0
- package/test/util/process.test.ts +59 -0
- package/test/util/timeout.test.ts +21 -0
- package/test/util/wildcard.test.ts +90 -0
- package/tsconfig.json +16 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// Simple JSON-RPC 2.0 LSP-like fake server over stdio
|
|
2
|
+
// Implements a minimal LSP handshake and triggers a request upon notification
|
|
3
|
+
|
|
4
|
+
const net = require("net")
|
|
5
|
+
|
|
6
|
+
let nextId = 1
|
|
7
|
+
|
|
8
|
+
function encode(message) {
|
|
9
|
+
const json = JSON.stringify(message)
|
|
10
|
+
const header = `Content-Length: ${Buffer.byteLength(json, "utf8")}\r\n\r\n`
|
|
11
|
+
return Buffer.concat([Buffer.from(header, "utf8"), Buffer.from(json, "utf8")])
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function decodeFrames(buffer) {
|
|
15
|
+
const results = []
|
|
16
|
+
let idx
|
|
17
|
+
while ((idx = buffer.indexOf("\r\n\r\n")) !== -1) {
|
|
18
|
+
const header = buffer.slice(0, idx).toString("utf8")
|
|
19
|
+
const m = /Content-Length:\s*(\d+)/i.exec(header)
|
|
20
|
+
const len = m ? parseInt(m[1], 10) : 0
|
|
21
|
+
const bodyStart = idx + 4
|
|
22
|
+
const bodyEnd = bodyStart + len
|
|
23
|
+
if (buffer.length < bodyEnd) break
|
|
24
|
+
const body = buffer.slice(bodyStart, bodyEnd).toString("utf8")
|
|
25
|
+
results.push(body)
|
|
26
|
+
buffer = buffer.slice(bodyEnd)
|
|
27
|
+
}
|
|
28
|
+
return { messages: results, rest: buffer }
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
let readBuffer = Buffer.alloc(0)
|
|
32
|
+
|
|
33
|
+
process.stdin.on("data", (chunk) => {
|
|
34
|
+
readBuffer = Buffer.concat([readBuffer, chunk])
|
|
35
|
+
const { messages, rest } = decodeFrames(readBuffer)
|
|
36
|
+
readBuffer = rest
|
|
37
|
+
for (const m of messages) handle(m)
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
function send(msg) {
|
|
41
|
+
process.stdout.write(encode(msg))
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function sendRequest(method, params) {
|
|
45
|
+
const id = nextId++
|
|
46
|
+
send({ jsonrpc: "2.0", id, method, params })
|
|
47
|
+
return id
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function handle(raw) {
|
|
51
|
+
let data
|
|
52
|
+
try {
|
|
53
|
+
data = JSON.parse(raw)
|
|
54
|
+
} catch {
|
|
55
|
+
return
|
|
56
|
+
}
|
|
57
|
+
if (data.method === "initialize") {
|
|
58
|
+
send({ jsonrpc: "2.0", id: data.id, result: { capabilities: {} } })
|
|
59
|
+
return
|
|
60
|
+
}
|
|
61
|
+
if (data.method === "initialized") {
|
|
62
|
+
return
|
|
63
|
+
}
|
|
64
|
+
if (data.method === "workspace/didChangeConfiguration") {
|
|
65
|
+
return
|
|
66
|
+
}
|
|
67
|
+
if (data.method === "test/trigger") {
|
|
68
|
+
const method = data.params && data.params.method
|
|
69
|
+
if (method) sendRequest(method, {})
|
|
70
|
+
return
|
|
71
|
+
}
|
|
72
|
+
if (typeof data.id !== "undefined") {
|
|
73
|
+
// Respond OK to any request from client to keep transport flowing
|
|
74
|
+
send({ jsonrpc: "2.0", id: data.id, result: null })
|
|
75
|
+
return
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: agents-sdk
|
|
3
|
+
description: Build AI agents on Cloudflare Workers using the Agents SDK. Load when creating stateful agents, durable workflows, real-time WebSocket apps, scheduled tasks, MCP servers, or chat applications. Covers Agent class, state management, callable RPC, Workflows integration, and React hooks.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Cloudflare Agents SDK
|
|
7
|
+
|
|
8
|
+
**STOP.** Your knowledge of the Agents SDK may be outdated. Prefer retrieval over pre-training for any Agents SDK task.
|
|
9
|
+
|
|
10
|
+
## Documentation
|
|
11
|
+
|
|
12
|
+
Fetch current docs from `https://github.com/cloudflare/agents/tree/main/docs` before implementing.
|
|
13
|
+
|
|
14
|
+
| Topic | Doc | Use for |
|
|
15
|
+
| ------------------- | ----------------------------- | ---------------------------------------------- |
|
|
16
|
+
| Getting started | `docs/getting-started.md` | First agent, project setup |
|
|
17
|
+
| State | `docs/state.md` | `setState`, `validateStateChange`, persistence |
|
|
18
|
+
| Routing | `docs/routing.md` | URL patterns, `routeAgentRequest`, `basePath` |
|
|
19
|
+
| Callable methods | `docs/callable-methods.md` | `@callable`, RPC, streaming, timeouts |
|
|
20
|
+
| Scheduling | `docs/scheduling.md` | `schedule()`, `scheduleEvery()`, cron |
|
|
21
|
+
| Workflows | `docs/workflows.md` | `AgentWorkflow`, durable multi-step tasks |
|
|
22
|
+
| HTTP/WebSockets | `docs/http-websockets.md` | Lifecycle hooks, hibernation |
|
|
23
|
+
| Email | `docs/email.md` | Email routing, secure reply resolver |
|
|
24
|
+
| MCP client | `docs/mcp-client.md` | Connecting to MCP servers |
|
|
25
|
+
| MCP server | `docs/mcp-servers.md` | Building MCP servers with `McpAgent` |
|
|
26
|
+
| Client SDK | `docs/client-sdk.md` | `useAgent`, `useAgentChat`, React hooks |
|
|
27
|
+
| Human-in-the-loop | `docs/human-in-the-loop.md` | Approval flows, pausing workflows |
|
|
28
|
+
| Resumable streaming | `docs/resumable-streaming.md` | Stream recovery on disconnect |
|
|
29
|
+
|
|
30
|
+
Cloudflare docs: https://developers.cloudflare.com/agents/
|
|
31
|
+
|
|
32
|
+
## Capabilities
|
|
33
|
+
|
|
34
|
+
The Agents SDK provides:
|
|
35
|
+
|
|
36
|
+
- **Persistent state** - SQLite-backed, auto-synced to clients
|
|
37
|
+
- **Callable RPC** - `@callable()` methods invoked over WebSocket
|
|
38
|
+
- **Scheduling** - One-time, recurring (`scheduleEvery`), and cron tasks
|
|
39
|
+
- **Workflows** - Durable multi-step background processing via `AgentWorkflow`
|
|
40
|
+
- **MCP integration** - Connect to MCP servers or build your own with `McpAgent`
|
|
41
|
+
- **Email handling** - Receive and reply to emails with secure routing
|
|
42
|
+
- **Streaming chat** - `AIChatAgent` with resumable streams
|
|
43
|
+
- **React hooks** - `useAgent`, `useAgentChat` for client apps
|
|
44
|
+
|
|
45
|
+
## FIRST: Verify Installation
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npm ls agents # Should show agents package
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
If not installed:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
npm install agents
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Wrangler Configuration
|
|
58
|
+
|
|
59
|
+
```jsonc
|
|
60
|
+
{
|
|
61
|
+
"durable_objects": {
|
|
62
|
+
"bindings": [{ "name": "MyAgent", "class_name": "MyAgent" }],
|
|
63
|
+
},
|
|
64
|
+
"migrations": [{ "tag": "v1", "new_sqlite_classes": ["MyAgent"] }],
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Agent Class
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
import { Agent, routeAgentRequest, callable } from "agents"
|
|
72
|
+
|
|
73
|
+
type State = { count: number }
|
|
74
|
+
|
|
75
|
+
export class Counter extends Agent<Env, State> {
|
|
76
|
+
initialState = { count: 0 }
|
|
77
|
+
|
|
78
|
+
// Validation hook - runs before state persists (sync, throwing rejects the update)
|
|
79
|
+
validateStateChange(nextState: State, source: Connection | "server") {
|
|
80
|
+
if (nextState.count < 0) throw new Error("Count cannot be negative")
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Notification hook - runs after state persists (async, non-blocking)
|
|
84
|
+
onStateUpdate(state: State, source: Connection | "server") {
|
|
85
|
+
console.log("State updated:", state)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
@callable()
|
|
89
|
+
increment() {
|
|
90
|
+
this.setState({ count: this.state.count + 1 })
|
|
91
|
+
return this.state.count
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export default {
|
|
96
|
+
fetch: (req, env) => routeAgentRequest(req, env) ?? new Response("Not found", { status: 404 }),
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Routing
|
|
101
|
+
|
|
102
|
+
Requests route to `/agents/{agent-name}/{instance-name}`:
|
|
103
|
+
|
|
104
|
+
| Class | URL |
|
|
105
|
+
| ---------- | -------------------------- |
|
|
106
|
+
| `Counter` | `/agents/counter/user-123` |
|
|
107
|
+
| `ChatRoom` | `/agents/chat-room/lobby` |
|
|
108
|
+
|
|
109
|
+
Client: `useAgent({ agent: "Counter", name: "user-123" })`
|
|
110
|
+
|
|
111
|
+
## Core APIs
|
|
112
|
+
|
|
113
|
+
| Task | API |
|
|
114
|
+
| ------------------- | ------------------------------------------------------ |
|
|
115
|
+
| Read state | `this.state.count` |
|
|
116
|
+
| Write state | `this.setState({ count: 1 })` |
|
|
117
|
+
| SQL query | `` this.sql`SELECT * FROM users WHERE id = ${id}` `` |
|
|
118
|
+
| Schedule (delay) | `await this.schedule(60, "task", payload)` |
|
|
119
|
+
| Schedule (cron) | `await this.schedule("0 * * * *", "task", payload)` |
|
|
120
|
+
| Schedule (interval) | `await this.scheduleEvery(30, "poll")` |
|
|
121
|
+
| RPC method | `@callable() myMethod() { ... }` |
|
|
122
|
+
| Streaming RPC | `@callable({ streaming: true }) stream(res) { ... }` |
|
|
123
|
+
| Start workflow | `await this.runWorkflow("ProcessingWorkflow", params)` |
|
|
124
|
+
|
|
125
|
+
## React Client
|
|
126
|
+
|
|
127
|
+
```tsx
|
|
128
|
+
import { useAgent } from "agents/react"
|
|
129
|
+
|
|
130
|
+
function App() {
|
|
131
|
+
const [state, setLocalState] = useState({ count: 0 })
|
|
132
|
+
|
|
133
|
+
const agent = useAgent({
|
|
134
|
+
agent: "Counter",
|
|
135
|
+
name: "my-instance",
|
|
136
|
+
onStateUpdate: (newState) => setLocalState(newState),
|
|
137
|
+
onIdentity: (name, agentType) => console.log(`Connected to ${name}`),
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
return <button onClick={() => agent.setState({ count: state.count + 1 })}>Count: {state.count}</button>
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## References
|
|
145
|
+
|
|
146
|
+
- **[references/workflows.md](references/workflows.md)** - Durable Workflows integration
|
|
147
|
+
- **[references/callable.md](references/callable.md)** - RPC methods, streaming, timeouts
|
|
148
|
+
- **[references/state-scheduling.md](references/state-scheduling.md)** - State persistence, scheduling
|
|
149
|
+
- **[references/streaming-chat.md](references/streaming-chat.md)** - AIChatAgent, resumable streams
|
|
150
|
+
- **[references/mcp.md](references/mcp.md)** - MCP server integration
|
|
151
|
+
- **[references/email.md](references/email.md)** - Email routing and handling
|
|
152
|
+
- **[references/codemode.md](references/codemode.md)** - Code Mode (experimental)
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Callable Methods
|
|
2
|
+
|
|
3
|
+
Fetch `docs/callable-methods.md` from `https://github.com/cloudflare/agents/tree/main/docs` for complete documentation.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
`@callable()` exposes agent methods to clients via WebSocket RPC.
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
import { Agent, callable } from "agents"
|
|
11
|
+
|
|
12
|
+
export class MyAgent extends Agent<Env, State> {
|
|
13
|
+
@callable()
|
|
14
|
+
async greet(name: string): Promise<string> {
|
|
15
|
+
return `Hello, ${name}!`
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@callable()
|
|
19
|
+
async processData(data: unknown): Promise<Result> {
|
|
20
|
+
// Long-running work
|
|
21
|
+
return result
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Client Usage
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
// Basic call
|
|
30
|
+
const greeting = await agent.call("greet", ["World"])
|
|
31
|
+
|
|
32
|
+
// With timeout
|
|
33
|
+
const result = await agent.call("processData", [data], {
|
|
34
|
+
timeout: 5000, // 5 second timeout
|
|
35
|
+
})
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Streaming Responses
|
|
39
|
+
|
|
40
|
+
```typescript
|
|
41
|
+
import { Agent, callable, StreamingResponse } from "agents"
|
|
42
|
+
|
|
43
|
+
export class MyAgent extends Agent<Env, State> {
|
|
44
|
+
@callable({ streaming: true })
|
|
45
|
+
async streamResults(stream: StreamingResponse, query: string) {
|
|
46
|
+
for await (const item of fetchResults(query)) {
|
|
47
|
+
stream.send(JSON.stringify(item))
|
|
48
|
+
}
|
|
49
|
+
stream.close()
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@callable({ streaming: true })
|
|
53
|
+
async streamWithError(stream: StreamingResponse) {
|
|
54
|
+
try {
|
|
55
|
+
// ... work
|
|
56
|
+
} catch (error) {
|
|
57
|
+
stream.error(error.message) // Signal error to client
|
|
58
|
+
return
|
|
59
|
+
}
|
|
60
|
+
stream.close()
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Client with streaming:
|
|
66
|
+
|
|
67
|
+
```typescript
|
|
68
|
+
await agent.call("streamResults", ["search term"], {
|
|
69
|
+
stream: {
|
|
70
|
+
onChunk: (data) => console.log("Chunk:", data),
|
|
71
|
+
onDone: () => console.log("Complete"),
|
|
72
|
+
onError: (error) => console.error("Error:", error),
|
|
73
|
+
},
|
|
74
|
+
})
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Introspection
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
// Get list of callable methods on an agent
|
|
81
|
+
const methods = await agent.call("getCallableMethods", [])
|
|
82
|
+
// Returns: ["greet", "processData", "streamResults", ...]
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## When to Use
|
|
86
|
+
|
|
87
|
+
| Scenario | Use |
|
|
88
|
+
| ------------------------------------ | --------------------------- |
|
|
89
|
+
| Browser/mobile calling agent | `@callable()` |
|
|
90
|
+
| External service calling agent | `@callable()` |
|
|
91
|
+
| Worker calling agent (same codebase) | DO RPC directly |
|
|
92
|
+
| Agent calling another agent | `getAgentByName()` + DO RPC |
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cloudflare
|
|
3
|
+
description: Comprehensive Cloudflare platform skill covering Workers, Pages, storage (KV, D1, R2), AI (Workers AI, Vectorize, Agents SDK), networking (Tunnel, Spectrum), security (WAF, DDoS), and infrastructure-as-code (Terraform, Pulumi). Use for any Cloudflare development task.
|
|
4
|
+
references:
|
|
5
|
+
- workers
|
|
6
|
+
- pages
|
|
7
|
+
- d1
|
|
8
|
+
- durable-objects
|
|
9
|
+
- workers-ai
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Cloudflare Platform Skill
|
|
13
|
+
|
|
14
|
+
Consolidated skill for building on the Cloudflare platform. Use decision trees below to find the right product, then load detailed references.
|
|
15
|
+
|
|
16
|
+
## Quick Decision Trees
|
|
17
|
+
|
|
18
|
+
### "I need to run code"
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
Need to run code?
|
|
22
|
+
├─ Serverless functions at the edge → workers/
|
|
23
|
+
├─ Full-stack web app with Git deploys → pages/
|
|
24
|
+
├─ Stateful coordination/real-time → durable-objects/
|
|
25
|
+
├─ Long-running multi-step jobs → workflows/
|
|
26
|
+
├─ Run containers → containers/
|
|
27
|
+
├─ Multi-tenant (customers deploy code) → workers-for-platforms/
|
|
28
|
+
├─ Scheduled tasks (cron) → cron-triggers/
|
|
29
|
+
├─ Lightweight edge logic (modify HTTP) → snippets/
|
|
30
|
+
├─ Process Worker execution events (logs/observability) → tail-workers/
|
|
31
|
+
└─ Optimize latency to backend infrastructure → smart-placement/
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### "I need to store data"
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
Need storage?
|
|
38
|
+
├─ Key-value (config, sessions, cache) → kv/
|
|
39
|
+
├─ Relational SQL → d1/ (SQLite) or hyperdrive/ (existing Postgres/MySQL)
|
|
40
|
+
├─ Object/file storage (S3-compatible) → r2/
|
|
41
|
+
├─ Message queue (async processing) → queues/
|
|
42
|
+
├─ Vector embeddings (AI/semantic search) → vectorize/
|
|
43
|
+
├─ Strongly-consistent per-entity state → durable-objects/ (DO storage)
|
|
44
|
+
├─ Secrets management → secrets-store/
|
|
45
|
+
├─ Streaming ETL to R2 → pipelines/
|
|
46
|
+
└─ Persistent cache (long-term retention) → cache-reserve/
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### "I need AI/ML"
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
Need AI?
|
|
53
|
+
├─ Run inference (LLMs, embeddings, images) → workers-ai/
|
|
54
|
+
├─ Vector database for RAG/search → vectorize/
|
|
55
|
+
├─ Build stateful AI agents → agents-sdk/
|
|
56
|
+
├─ Gateway for any AI provider (caching, routing) → ai-gateway/
|
|
57
|
+
└─ AI-powered search widget → ai-search/
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### "I need networking/connectivity"
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
Need networking?
|
|
64
|
+
├─ Expose local service to internet → tunnel/
|
|
65
|
+
├─ TCP/UDP proxy (non-HTTP) → spectrum/
|
|
66
|
+
├─ WebRTC TURN server → turn/
|
|
67
|
+
├─ Private network connectivity → network-interconnect/
|
|
68
|
+
├─ Optimize routing → argo-smart-routing/
|
|
69
|
+
├─ Optimize latency to backend (not user) → smart-placement/
|
|
70
|
+
└─ Real-time video/audio → realtimekit/ or realtime-sfu/
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### "I need security"
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
Need security?
|
|
77
|
+
├─ Web Application Firewall → waf/
|
|
78
|
+
├─ DDoS protection → ddos/
|
|
79
|
+
├─ Bot detection/management → bot-management/
|
|
80
|
+
├─ API protection → api-shield/
|
|
81
|
+
├─ CAPTCHA alternative → turnstile/
|
|
82
|
+
└─ Credential leak detection → waf/ (managed ruleset)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### "I need media/content"
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
Need media?
|
|
89
|
+
├─ Image optimization/transformation → images/
|
|
90
|
+
├─ Video streaming/encoding → stream/
|
|
91
|
+
├─ Browser automation/screenshots → browser-rendering/
|
|
92
|
+
└─ Third-party script management → zaraz/
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### "I need infrastructure-as-code"
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
Need IaC? → pulumi/ (Pulumi), terraform/ (Terraform), or api/ (REST API)
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Product Index
|
|
102
|
+
|
|
103
|
+
### Compute & Runtime
|
|
104
|
+
|
|
105
|
+
| Product | Reference |
|
|
106
|
+
| --------------------- | ----------------------------------- |
|
|
107
|
+
| Workers | `references/workers/` |
|
|
108
|
+
| Pages | `references/pages/` |
|
|
109
|
+
| Pages Functions | `references/pages-functions/` |
|
|
110
|
+
| Durable Objects | `references/durable-objects/` |
|
|
111
|
+
| Workflows | `references/workflows/` |
|
|
112
|
+
| Containers | `references/containers/` |
|
|
113
|
+
| Workers for Platforms | `references/workers-for-platforms/` |
|
|
114
|
+
| Cron Triggers | `references/cron-triggers/` |
|
|
115
|
+
| Tail Workers | `references/tail-workers/` |
|
|
116
|
+
| Snippets | `references/snippets/` |
|
|
117
|
+
| Smart Placement | `references/smart-placement/` |
|
|
118
|
+
|
|
119
|
+
### Storage & Data
|
|
120
|
+
|
|
121
|
+
| Product | Reference |
|
|
122
|
+
| --------------- | ----------------------------- |
|
|
123
|
+
| KV | `references/kv/` |
|
|
124
|
+
| D1 | `references/d1/` |
|
|
125
|
+
| R2 | `references/r2/` |
|
|
126
|
+
| Queues | `references/queues/` |
|
|
127
|
+
| Hyperdrive | `references/hyperdrive/` |
|
|
128
|
+
| DO Storage | `references/do-storage/` |
|
|
129
|
+
| Secrets Store | `references/secrets-store/` |
|
|
130
|
+
| Pipelines | `references/pipelines/` |
|
|
131
|
+
| R2 Data Catalog | `references/r2-data-catalog/` |
|
|
132
|
+
| R2 SQL | `references/r2-sql/` |
|
|
133
|
+
|
|
134
|
+
### AI & Machine Learning
|
|
135
|
+
|
|
136
|
+
| Product | Reference |
|
|
137
|
+
| ---------- | ------------------------ |
|
|
138
|
+
| Workers AI | `references/workers-ai/` |
|
|
139
|
+
| Vectorize | `references/vectorize/` |
|
|
140
|
+
| Agents SDK | `references/agents-sdk/` |
|
|
141
|
+
| AI Gateway | `references/ai-gateway/` |
|
|
142
|
+
| AI Search | `references/ai-search/` |
|
|
143
|
+
|
|
144
|
+
### Networking & Connectivity
|
|
145
|
+
|
|
146
|
+
| Product | Reference |
|
|
147
|
+
| -------------------- | ---------------------------------- |
|
|
148
|
+
| Tunnel | `references/tunnel/` |
|
|
149
|
+
| Spectrum | `references/spectrum/` |
|
|
150
|
+
| TURN | `references/turn/` |
|
|
151
|
+
| Network Interconnect | `references/network-interconnect/` |
|
|
152
|
+
| Argo Smart Routing | `references/argo-smart-routing/` |
|
|
153
|
+
| Workers VPC | `references/workers-vpc/` |
|
|
154
|
+
|
|
155
|
+
### Security
|
|
156
|
+
|
|
157
|
+
| Product | Reference |
|
|
158
|
+
| --------------- | ---------------------------- |
|
|
159
|
+
| WAF | `references/waf/` |
|
|
160
|
+
| DDoS Protection | `references/ddos/` |
|
|
161
|
+
| Bot Management | `references/bot-management/` |
|
|
162
|
+
| API Shield | `references/api-shield/` |
|
|
163
|
+
| Turnstile | `references/turnstile/` |
|
|
164
|
+
|
|
165
|
+
### Media & Content
|
|
166
|
+
|
|
167
|
+
| Product | Reference |
|
|
168
|
+
| ----------------- | ------------------------------- |
|
|
169
|
+
| Images | `references/images/` |
|
|
170
|
+
| Stream | `references/stream/` |
|
|
171
|
+
| Browser Rendering | `references/browser-rendering/` |
|
|
172
|
+
| Zaraz | `references/zaraz/` |
|
|
173
|
+
|
|
174
|
+
### Real-Time Communication
|
|
175
|
+
|
|
176
|
+
| Product | Reference |
|
|
177
|
+
| ------------ | -------------------------- |
|
|
178
|
+
| RealtimeKit | `references/realtimekit/` |
|
|
179
|
+
| Realtime SFU | `references/realtime-sfu/` |
|
|
180
|
+
|
|
181
|
+
### Developer Tools
|
|
182
|
+
|
|
183
|
+
| Product | Reference |
|
|
184
|
+
| ------------------ | -------------------------------- |
|
|
185
|
+
| Wrangler | `references/wrangler/` |
|
|
186
|
+
| Miniflare | `references/miniflare/` |
|
|
187
|
+
| C3 | `references/c3/` |
|
|
188
|
+
| Observability | `references/observability/` |
|
|
189
|
+
| Analytics Engine | `references/analytics-engine/` |
|
|
190
|
+
| Web Analytics | `references/web-analytics/` |
|
|
191
|
+
| Sandbox | `references/sandbox/` |
|
|
192
|
+
| Workerd | `references/workerd/` |
|
|
193
|
+
| Workers Playground | `references/workers-playground/` |
|
|
194
|
+
|
|
195
|
+
### Infrastructure as Code
|
|
196
|
+
|
|
197
|
+
| Product | Reference |
|
|
198
|
+
| --------- | ----------------------- |
|
|
199
|
+
| Pulumi | `references/pulumi/` |
|
|
200
|
+
| Terraform | `references/terraform/` |
|
|
201
|
+
| API | `references/api/` |
|
|
202
|
+
|
|
203
|
+
### Other Services
|
|
204
|
+
|
|
205
|
+
| Product | Reference |
|
|
206
|
+
| ------------- | --------------------------- |
|
|
207
|
+
| Email Routing | `references/email-routing/` |
|
|
208
|
+
| Email Workers | `references/email-workers/` |
|
|
209
|
+
| Static Assets | `references/static-assets/` |
|
|
210
|
+
| Bindings | `references/bindings/` |
|
|
211
|
+
| Cache Reserve | `references/cache-reserve/` |
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { describe, expect, test, afterEach } from "bun:test"
|
|
2
|
+
import { Ide } from "../../src/ide"
|
|
3
|
+
|
|
4
|
+
describe("ide", () => {
|
|
5
|
+
const original = { ...process.env }
|
|
6
|
+
|
|
7
|
+
afterEach(() => {
|
|
8
|
+
Object.keys(process.env).forEach((key) => {
|
|
9
|
+
delete process.env[key]
|
|
10
|
+
})
|
|
11
|
+
Object.assign(process.env, original)
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
test("should detect Visual Studio Code", () => {
|
|
15
|
+
process.env["TERM_PROGRAM"] = "vscode"
|
|
16
|
+
process.env["GIT_ASKPASS"] = "/path/to/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/askpass.sh"
|
|
17
|
+
|
|
18
|
+
expect(Ide.ide()).toBe("Visual Studio Code")
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
test("should detect Visual Studio Code Insiders", () => {
|
|
22
|
+
process.env["TERM_PROGRAM"] = "vscode"
|
|
23
|
+
process.env["GIT_ASKPASS"] =
|
|
24
|
+
"/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/git/dist/askpass.sh"
|
|
25
|
+
|
|
26
|
+
expect(Ide.ide()).toBe("Visual Studio Code - Insiders")
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
test("should detect Cursor", () => {
|
|
30
|
+
process.env["TERM_PROGRAM"] = "vscode"
|
|
31
|
+
process.env["GIT_ASKPASS"] = "/path/to/Cursor.app/Contents/Resources/app/extensions/git/dist/askpass.sh"
|
|
32
|
+
|
|
33
|
+
expect(Ide.ide()).toBe("Cursor")
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
test("should detect VSCodium", () => {
|
|
37
|
+
process.env["TERM_PROGRAM"] = "vscode"
|
|
38
|
+
process.env["GIT_ASKPASS"] = "/path/to/VSCodium.app/Contents/Resources/app/extensions/git/dist/askpass.sh"
|
|
39
|
+
|
|
40
|
+
expect(Ide.ide()).toBe("VSCodium")
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
test("should detect Windsurf", () => {
|
|
44
|
+
process.env["TERM_PROGRAM"] = "vscode"
|
|
45
|
+
process.env["GIT_ASKPASS"] = "/path/to/Windsurf.app/Contents/Resources/app/extensions/git/dist/askpass.sh"
|
|
46
|
+
|
|
47
|
+
expect(Ide.ide()).toBe("Windsurf")
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
test("should return unknown when TERM_PROGRAM is not vscode", () => {
|
|
51
|
+
process.env["TERM_PROGRAM"] = "iTerm2"
|
|
52
|
+
process.env["GIT_ASKPASS"] =
|
|
53
|
+
"/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/git/dist/askpass.sh"
|
|
54
|
+
|
|
55
|
+
expect(Ide.ide()).toBe("unknown")
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
test("should return unknown when GIT_ASKPASS does not contain IDE name", () => {
|
|
59
|
+
process.env["TERM_PROGRAM"] = "vscode"
|
|
60
|
+
process.env["GIT_ASKPASS"] = "/path/to/unknown/askpass.sh"
|
|
61
|
+
|
|
62
|
+
expect(Ide.ide()).toBe("unknown")
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
test("should recognize vscode-insiders OPENCODE_CALLER", () => {
|
|
66
|
+
process.env["OPENCODE_CALLER"] = "vscode-insiders"
|
|
67
|
+
|
|
68
|
+
expect(Ide.alreadyInstalled()).toBe(true)
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
test("should recognize vscode OPENCODE_CALLER", () => {
|
|
72
|
+
process.env["OPENCODE_CALLER"] = "vscode"
|
|
73
|
+
|
|
74
|
+
expect(Ide.alreadyInstalled()).toBe(true)
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
test("should return false for unknown OPENCODE_CALLER", () => {
|
|
78
|
+
process.env["OPENCODE_CALLER"] = "unknown"
|
|
79
|
+
|
|
80
|
+
expect(Ide.alreadyInstalled()).toBe(false)
|
|
81
|
+
})
|
|
82
|
+
})
|