anymous 1.2.7 → 1.3.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/bin/anymous.exe +7 -0
- package/package.json +20 -135
- package/postinstall.mjs +214 -0
- package/bin/anymous.cjs +0 -45
- package/src/account/account.ts +0 -473
- package/src/account/repo.ts +0 -171
- package/src/account/schema.ts +0 -99
- package/src/account/url.ts +0 -8
- package/src/acp/agent.ts +0 -95
- package/src/acp/config-option.ts +0 -203
- package/src/acp/content.ts +0 -269
- package/src/acp/directory.ts +0 -212
- package/src/acp/error.ts +0 -97
- package/src/acp/event.ts +0 -342
- package/src/acp/permission.ts +0 -254
- package/src/acp/profile.ts +0 -42
- package/src/acp/service.ts +0 -1097
- package/src/acp/session.ts +0 -232
- package/src/acp/tool.ts +0 -364
- package/src/acp/usage.ts +0 -239
- package/src/agent/agent.ts +0 -973
- package/src/agent/generate.txt +0 -75
- package/src/agent/prompt/architect.txt +0 -26
- package/src/agent/prompt/backend.txt +0 -26
- package/src/agent/prompt/build.txt +0 -31
- package/src/agent/prompt/code-reviewer.txt +0 -29
- package/src/agent/prompt/compaction.txt +0 -45
- package/src/agent/prompt/database.txt +0 -27
- package/src/agent/prompt/debug-tools.txt +0 -40
- package/src/agent/prompt/debug.txt +0 -23
- package/src/agent/prompt/devops.txt +0 -26
- package/src/agent/prompt/docs.txt +0 -23
- package/src/agent/prompt/exe-extractor.txt +0 -39
- package/src/agent/prompt/explore.txt +0 -42
- package/src/agent/prompt/frontend.txt +0 -29
- package/src/agent/prompt/general.txt +0 -25
- package/src/agent/prompt/memory-dump.txt +0 -37
- package/src/agent/prompt/pentest-critic.txt +0 -51
- package/src/agent/prompt/pentest-enumerator.txt +0 -72
- package/src/agent/prompt/pentest-exploiter.txt +0 -69
- package/src/agent/prompt/pentest-identity.txt +0 -59
- package/src/agent/prompt/pentest-lead.txt +0 -46
- package/src/agent/prompt/pentest-postexploit.txt +0 -84
- package/src/agent/prompt/pentest-recon.txt +0 -50
- package/src/agent/prompt/pentest-reporter.txt +0 -76
- package/src/agent/prompt/pentest-scanner.txt +0 -57
- package/src/agent/prompt/pentest-webapp.txt +0 -94
- package/src/agent/prompt/performance.txt +0 -27
- package/src/agent/prompt/plan.txt +0 -35
- package/src/agent/prompt/refactor.txt +0 -31
- package/src/agent/prompt/reverser-automator.txt +0 -96
- package/src/agent/prompt/reverser-binary.txt +0 -62
- package/src/agent/prompt/reverser-dynamic.txt +0 -76
- package/src/agent/prompt/reverser-source.txt +0 -93
- package/src/agent/prompt/reverser-static.txt +0 -76
- package/src/agent/prompt/security.txt +0 -34
- package/src/agent/prompt/summary.txt +0 -22
- package/src/agent/prompt/test-writer.txt +0 -34
- package/src/agent/prompt/title.txt +0 -44
- package/src/agent/prompt/web-designer.txt +0 -23
- package/src/agent/subagent-permissions.ts +0 -27
- package/src/audio.d.ts +0 -14
- package/src/auth/index.ts +0 -97
- package/src/background/job.ts +0 -37
- package/src/bus/global.ts +0 -22
- package/src/cli/bootstrap.ts +0 -11
- package/src/cli/cmd/account.ts +0 -264
- package/src/cli/cmd/acp.ts +0 -73
- package/src/cli/cmd/agent.ts +0 -259
- package/src/cli/cmd/attach.ts +0 -148
- package/src/cli/cmd/cmd.ts +0 -7
- package/src/cli/cmd/db.ts +0 -62
- package/src/cli/cmd/debug/agent.handler.ts +0 -193
- package/src/cli/cmd/debug/agent.ts +0 -27
- package/src/cli/cmd/debug/config.ts +0 -14
- package/src/cli/cmd/debug/file.ts +0 -73
- package/src/cli/cmd/debug/index.ts +0 -87
- package/src/cli/cmd/debug/lsp.ts +0 -50
- package/src/cli/cmd/debug/ripgrep.ts +0 -79
- package/src/cli/cmd/debug/scrap.ts +0 -16
- package/src/cli/cmd/debug/skill.ts +0 -15
- package/src/cli/cmd/debug/snapshot.ts +0 -50
- package/src/cli/cmd/debug/startup.ts +0 -11
- package/src/cli/cmd/debug/v2.ts +0 -42
- package/src/cli/cmd/export.ts +0 -292
- package/src/cli/cmd/generate.ts +0 -54
- package/src/cli/cmd/github.handler.ts +0 -1593
- package/src/cli/cmd/github.shared.ts +0 -30
- package/src/cli/cmd/github.ts +0 -42
- package/src/cli/cmd/import.ts +0 -230
- package/src/cli/cmd/mcp.ts +0 -840
- package/src/cli/cmd/models.ts +0 -66
- package/src/cli/cmd/plug.ts +0 -230
- package/src/cli/cmd/pr.ts +0 -115
- package/src/cli/cmd/prompt-display.ts +0 -1
- package/src/cli/cmd/providers.ts +0 -534
- package/src/cli/cmd/run/demo.ts +0 -1274
- package/src/cli/cmd/run/entry.body.ts +0 -205
- package/src/cli/cmd/run/footer.command.tsx +0 -1070
- package/src/cli/cmd/run/footer.menu.tsx +0 -351
- package/src/cli/cmd/run/footer.permission.tsx +0 -472
- package/src/cli/cmd/run/footer.prompt.tsx +0 -1315
- package/src/cli/cmd/run/footer.question.tsx +0 -573
- package/src/cli/cmd/run/footer.subagent.tsx +0 -175
- package/src/cli/cmd/run/footer.ts +0 -1129
- package/src/cli/cmd/run/footer.view.tsx +0 -945
- package/src/cli/cmd/run/footer.width.ts +0 -27
- package/src/cli/cmd/run/permission.shared.ts +0 -256
- package/src/cli/cmd/run/prompt.editor.ts +0 -157
- package/src/cli/cmd/run/prompt.shared.ts +0 -153
- package/src/cli/cmd/run/question.shared.ts +0 -340
- package/src/cli/cmd/run/runtime.boot.ts +0 -202
- package/src/cli/cmd/run/runtime.lifecycle.ts +0 -410
- package/src/cli/cmd/run/runtime.queue.ts +0 -349
- package/src/cli/cmd/run/runtime.shared.ts +0 -17
- package/src/cli/cmd/run/runtime.stdin.ts +0 -37
- package/src/cli/cmd/run/runtime.ts +0 -821
- package/src/cli/cmd/run/scrollback.shared.ts +0 -92
- package/src/cli/cmd/run/scrollback.surface.ts +0 -431
- package/src/cli/cmd/run/scrollback.writer.tsx +0 -352
- package/src/cli/cmd/run/session-data.ts +0 -1113
- package/src/cli/cmd/run/session-replay.ts +0 -374
- package/src/cli/cmd/run/session.shared.ts +0 -196
- package/src/cli/cmd/run/splash.ts +0 -289
- package/src/cli/cmd/run/stream.transport.ts +0 -1462
- package/src/cli/cmd/run/stream.ts +0 -175
- package/src/cli/cmd/run/subagent-data.ts +0 -876
- package/src/cli/cmd/run/theme.ts +0 -690
- package/src/cli/cmd/run/tool.ts +0 -1486
- package/src/cli/cmd/run/trace.ts +0 -94
- package/src/cli/cmd/run/turn-summary.ts +0 -47
- package/src/cli/cmd/run/types.ts +0 -350
- package/src/cli/cmd/run/variant.shared.ts +0 -216
- package/src/cli/cmd/run.ts +0 -1011
- package/src/cli/cmd/serve.ts +0 -24
- package/src/cli/cmd/session.ts +0 -147
- package/src/cli/cmd/stats.ts +0 -393
- package/src/cli/cmd/tui.ts +0 -309
- package/src/cli/cmd/uninstall.ts +0 -353
- package/src/cli/cmd/upgrade.ts +0 -113
- package/src/cli/cmd/web.ts +0 -84
- package/src/cli/effect/prompt.ts +0 -37
- package/src/cli/effect-cmd.ts +0 -96
- package/src/cli/error.ts +0 -130
- package/src/cli/heap.ts +0 -45
- package/src/cli/logo.ts +0 -1
- package/src/cli/network.ts +0 -80
- package/src/cli/tui/layer.ts +0 -8
- package/src/cli/tui/validate-session.ts +0 -29
- package/src/cli/tui/worker.ts +0 -80
- package/src/cli/ui.ts +0 -146
- package/src/cli/upgrade.ts +0 -79
- package/src/cli/version.ts +0 -14
- package/src/command/index.ts +0 -177
- package/src/command/template/initialize.txt +0 -66
- package/src/command/template/review.txt +0 -101
- package/src/config/agent.ts +0 -59
- package/src/config/command.ts +0 -39
- package/src/config/config.ts +0 -689
- package/src/config/entry-name.ts +0 -19
- package/src/config/managed.ts +0 -69
- package/src/config/markdown.ts +0 -36
- package/src/config/parse.ts +0 -79
- package/src/config/paths.ts +0 -45
- package/src/config/plugin.ts +0 -79
- package/src/config/tui-cwd.ts +0 -5
- package/src/config/tui-host-attention.ts +0 -21
- package/src/config/tui-migrate.ts +0 -132
- package/src/config/tui.ts +0 -276
- package/src/config/variable.ts +0 -91
- package/src/control-plane/adapters/index.ts +0 -41
- package/src/control-plane/adapters/worktree.ts +0 -96
- package/src/control-plane/dev/README.md +0 -19
- package/src/control-plane/dev/debug-workspace-plugin.ts +0 -73
- package/src/control-plane/types.ts +0 -59
- package/src/control-plane/util.ts +0 -39
- package/src/control-plane/workspace-adapter-runtime.ts +0 -51
- package/src/control-plane/workspace-context.ts +0 -26
- package/src/control-plane/workspace.ts +0 -964
- package/src/effect/app-node-builder-v1.ts +0 -12
- package/src/effect/app-runtime.ts +0 -137
- package/src/effect/bootstrap-runtime.ts +0 -19
- package/src/effect/bridge.ts +0 -84
- package/src/effect/config-service.ts +0 -67
- package/src/effect/instance-ref.ts +0 -11
- package/src/effect/instance-registry.ts +0 -12
- package/src/effect/instance-state.ts +0 -69
- package/src/effect/promise.ts +0 -17
- package/src/effect/run-service.ts +0 -47
- package/src/effect/runner.ts +0 -217
- package/src/effect/runtime-flags.ts +0 -79
- package/src/env/index.ts +0 -41
- package/src/event-manifest.ts +0 -3
- package/src/event-v2-bridge.ts +0 -71
- package/src/format/formatter.ts +0 -404
- package/src/format/index.ts +0 -203
- package/src/git/index.ts +0 -348
- package/src/id/id.ts +0 -80
- package/src/ide/index.ts +0 -54
- package/src/image/image.ts +0 -172
- package/src/index.ts +0 -142
- package/src/installation/index.ts +0 -336
- package/src/lsp/client.ts +0 -650
- package/src/lsp/diagnostic.ts +0 -29
- package/src/lsp/language.ts +0 -121
- package/src/lsp/launch.ts +0 -21
- package/src/lsp/lsp.ts +0 -507
- package/src/lsp/server.ts +0 -1983
- package/src/markdown.d.ts +0 -4
- package/src/mcp/auth.ts +0 -163
- package/src/mcp/browser.ts +0 -37
- package/src/mcp/catalog.ts +0 -170
- package/src/mcp/index.ts +0 -1004
- package/src/mcp/oauth-callback.ts +0 -194
- package/src/mcp/oauth-provider.ts +0 -259
- package/src/memory/memory.ts +0 -133
- package/src/node.ts +0 -4
- package/src/patch/index.ts +0 -686
- package/src/permission/arity.ts +0 -163
- package/src/permission/evaluate.ts +0 -1
- package/src/permission/index.ts +0 -229
- package/src/plugin/azure.ts +0 -26
- package/src/plugin/cloudflare.ts +0 -76
- package/src/plugin/digitalocean.ts +0 -325
- package/src/plugin/github-copilot/copilot.ts +0 -414
- package/src/plugin/github-copilot/models.ts +0 -258
- package/src/plugin/index.ts +0 -311
- package/src/plugin/install.ts +0 -439
- package/src/plugin/loader.ts +0 -237
- package/src/plugin/meta.ts +0 -188
- package/src/plugin/openai/README.md +0 -31
- package/src/plugin/openai/codex.ts +0 -565
- package/src/plugin/openai/ws-pool.ts +0 -270
- package/src/plugin/openai/ws.ts +0 -381
- package/src/plugin/pty-environment.ts +0 -24
- package/src/plugin/shared.ts +0 -323
- package/src/plugin/snowflake-cortex.ts +0 -507
- package/src/plugin/tui/internal.ts +0 -10
- package/src/plugin/tui/runtime.ts +0 -1131
- package/src/plugin/xai.ts +0 -626
- package/src/project/bootstrap-service.ts +0 -9
- package/src/project/bootstrap.ts +0 -58
- package/src/project/instance-context.ts +0 -24
- package/src/project/instance-runtime.ts +0 -16
- package/src/project/instance-store.ts +0 -213
- package/src/project/project.ts +0 -483
- package/src/project/vcs.ts +0 -423
- package/src/provider/auth.ts +0 -229
- package/src/provider/error.ts +0 -188
- package/src/provider/model-status.ts +0 -8
- package/src/provider/provider.ts +0 -2006
- package/src/provider/transform.ts +0 -1832
- package/src/question/index.ts +0 -161
- package/src/question/schema.ts +0 -4
- package/src/server/auth.ts +0 -48
- package/src/server/event.ts +0 -10
- package/src/server/global-lifecycle.ts +0 -28
- package/src/server/init-projectors.ts +0 -3
- package/src/server/mdns.ts +0 -47
- package/src/server/projectors.ts +0 -1
- package/src/server/proxy-util.ts +0 -48
- package/src/server/routes/instance/httpapi/AGENTS.md +0 -39
- package/src/server/routes/instance/httpapi/api.ts +0 -97
- package/src/server/routes/instance/httpapi/errors.ts +0 -193
- package/src/server/routes/instance/httpapi/groups/config.ts +0 -65
- package/src/server/routes/instance/httpapi/groups/control-plane.ts +0 -35
- package/src/server/routes/instance/httpapi/groups/control.ts +0 -76
- package/src/server/routes/instance/httpapi/groups/event.ts +0 -29
- package/src/server/routes/instance/httpapi/groups/experimental.ts +0 -275
- package/src/server/routes/instance/httpapi/groups/file.ts +0 -185
- package/src/server/routes/instance/httpapi/groups/global.ts +0 -136
- package/src/server/routes/instance/httpapi/groups/instance.ts +0 -206
- package/src/server/routes/instance/httpapi/groups/mcp.ts +0 -156
- package/src/server/routes/instance/httpapi/groups/metadata.ts +0 -18
- package/src/server/routes/instance/httpapi/groups/permission.ts +0 -61
- package/src/server/routes/instance/httpapi/groups/project-copy.ts +0 -32
- package/src/server/routes/instance/httpapi/groups/project.ts +0 -93
- package/src/server/routes/instance/httpapi/groups/provider.ts +0 -101
- package/src/server/routes/instance/httpapi/groups/pty.ts +0 -172
- package/src/server/routes/instance/httpapi/groups/query.ts +0 -12
- package/src/server/routes/instance/httpapi/groups/question.ts +0 -74
- package/src/server/routes/instance/httpapi/groups/session.ts +0 -462
- package/src/server/routes/instance/httpapi/groups/sync.ts +0 -113
- package/src/server/routes/instance/httpapi/groups/tui.ts +0 -208
- package/src/server/routes/instance/httpapi/groups/workspace.ts +0 -141
- package/src/server/routes/instance/httpapi/handlers/config.ts +0 -34
- package/src/server/routes/instance/httpapi/handlers/control-plane.ts +0 -37
- package/src/server/routes/instance/httpapi/handlers/control.ts +0 -43
- package/src/server/routes/instance/httpapi/handlers/event.ts +0 -99
- package/src/server/routes/instance/httpapi/handlers/experimental.ts +0 -193
- package/src/server/routes/instance/httpapi/handlers/file.ts +0 -139
- package/src/server/routes/instance/httpapi/handlers/global.ts +0 -156
- package/src/server/routes/instance/httpapi/handlers/instance.ts +0 -110
- package/src/server/routes/instance/httpapi/handlers/mcp.ts +0 -111
- package/src/server/routes/instance/httpapi/handlers/permission.ts +0 -41
- package/src/server/routes/instance/httpapi/handlers/project-copy.ts +0 -83
- package/src/server/routes/instance/httpapi/handlers/project.ts +0 -63
- package/src/server/routes/instance/httpapi/handlers/provider.ts +0 -113
- package/src/server/routes/instance/httpapi/handlers/pty.ts +0 -273
- package/src/server/routes/instance/httpapi/handlers/question.ts +0 -54
- package/src/server/routes/instance/httpapi/handlers/session-errors.ts +0 -21
- package/src/server/routes/instance/httpapi/handlers/session.ts +0 -442
- package/src/server/routes/instance/httpapi/handlers/sync.ts +0 -89
- package/src/server/routes/instance/httpapi/handlers/tui.ts +0 -131
- package/src/server/routes/instance/httpapi/handlers/workspace.ts +0 -102
- package/src/server/routes/instance/httpapi/lifecycle.ts +0 -54
- package/src/server/routes/instance/httpapi/middleware/authorization.ts +0 -150
- package/src/server/routes/instance/httpapi/middleware/compression.ts +0 -64
- package/src/server/routes/instance/httpapi/middleware/cors-vary.ts +0 -29
- package/src/server/routes/instance/httpapi/middleware/error.ts +0 -43
- package/src/server/routes/instance/httpapi/middleware/fence.ts +0 -25
- package/src/server/routes/instance/httpapi/middleware/instance-context.ts +0 -43
- package/src/server/routes/instance/httpapi/middleware/proxy.ts +0 -108
- package/src/server/routes/instance/httpapi/middleware/schema-error.ts +0 -41
- package/src/server/routes/instance/httpapi/middleware/workspace-routing.ts +0 -250
- package/src/server/routes/instance/httpapi/public.ts +0 -537
- package/src/server/routes/instance/httpapi/server.ts +0 -327
- package/src/server/routes/instance/httpapi/websocket-tracker.ts +0 -60
- package/src/server/server.ts +0 -226
- package/src/server/shared/fence.ts +0 -60
- package/src/server/shared/pty-ticket.ts +0 -15
- package/src/server/shared/public-ui.ts +0 -12
- package/src/server/shared/tui-control.ts +0 -28
- package/src/server/shared/ui.ts +0 -108
- package/src/server/shared/workspace-routing.ts +0 -38
- package/src/server/tui-event.ts +0 -1
- package/src/session/compaction.ts +0 -562
- package/src/session/instruction.ts +0 -237
- package/src/session/llm/AGENTS.md +0 -90
- package/src/session/llm/ai-sdk.ts +0 -288
- package/src/session/llm/native-request.ts +0 -196
- package/src/session/llm/native-runtime.ts +0 -195
- package/src/session/llm/request.ts +0 -226
- package/src/session/llm.ts +0 -404
- package/src/session/message-error.ts +0 -14
- package/src/session/message-v2.ts +0 -734
- package/src/session/message.ts +0 -148
- package/src/session/overflow.ts +0 -34
- package/src/session/processor.ts +0 -718
- package/src/session/prompt/anthropic.txt +0 -96
- package/src/session/prompt/beast.txt +0 -147
- package/src/session/prompt/build-switch.txt +0 -5
- package/src/session/prompt/codex.txt +0 -79
- package/src/session/prompt/copilot-gpt-5.txt +0 -143
- package/src/session/prompt/default.txt +0 -89
- package/src/session/prompt/gemini.txt +0 -155
- package/src/session/prompt/gpt.txt +0 -107
- package/src/session/prompt/kimi.txt +0 -95
- package/src/session/prompt/meta.txt +0 -64
- package/src/session/prompt/plan-mode.txt +0 -70
- package/src/session/prompt/plan-reminder-anthropic.txt +0 -67
- package/src/session/prompt/plan.txt +0 -26
- package/src/session/prompt/trinity.txt +0 -97
- package/src/session/prompt.ts +0 -1636
- package/src/session/reminders.ts +0 -92
- package/src/session/retry.ts +0 -201
- package/src/session/revert.ts +0 -146
- package/src/session/run-state.ts +0 -151
- package/src/session/schema.ts +0 -26
- package/src/session/session.ts +0 -1018
- package/src/session/status.ts +0 -56
- package/src/session/summary.ts +0 -160
- package/src/session/system.ts +0 -145
- package/src/session/todo.ts +0 -74
- package/src/session/tools.ts +0 -590
- package/src/share/session.ts +0 -58
- package/src/share/share-next.ts +0 -371
- package/src/skill/discovery.ts +0 -140
- package/src/skill/index.ts +0 -354
- package/src/snapshot/index.ts +0 -807
- package/src/sql.d.ts +0 -4
- package/src/storage/schema.ts +0 -5
- package/src/storage/storage.ts +0 -327
- package/src/sync/README.md +0 -179
- package/src/sync/schema.ts +0 -11
- package/src/temporary.ts +0 -31
- package/src/tool/apply_patch.ts +0 -313
- package/src/tool/apply_patch.txt +0 -33
- package/src/tool/code-mode.ts +0 -310
- package/src/tool/computer.ts +0 -476
- package/src/tool/computer.txt +0 -25
- package/src/tool/edit.ts +0 -737
- package/src/tool/edit.txt +0 -10
- package/src/tool/external-directory.ts +0 -49
- package/src/tool/glob.ts +0 -76
- package/src/tool/glob.txt +0 -6
- package/src/tool/grep.ts +0 -115
- package/src/tool/grep.txt +0 -8
- package/src/tool/invalid.ts +0 -21
- package/src/tool/json-schema.ts +0 -164
- package/src/tool/lsp.ts +0 -113
- package/src/tool/lsp.txt +0 -24
- package/src/tool/mcp-websearch.ts +0 -96
- package/src/tool/memory.ts +0 -59
- package/src/tool/memory.txt +0 -14
- package/src/tool/plan-enter.txt +0 -14
- package/src/tool/plan-exit.txt +0 -13
- package/src/tool/plan.ts +0 -79
- package/src/tool/question.ts +0 -44
- package/src/tool/question.txt +0 -10
- package/src/tool/read.ts +0 -386
- package/src/tool/read.txt +0 -14
- package/src/tool/registry.ts +0 -460
- package/src/tool/schema.ts +0 -14
- package/src/tool/shell/id.ts +0 -19
- package/src/tool/shell/prompt.ts +0 -293
- package/src/tool/shell/shell.txt +0 -21
- package/src/tool/shell.ts +0 -645
- package/src/tool/skill.ts +0 -70
- package/src/tool/skill.txt +0 -5
- package/src/tool/task.ts +0 -360
- package/src/tool/task.txt +0 -19
- package/src/tool/todo.ts +0 -46
- package/src/tool/todowrite.txt +0 -44
- package/src/tool/tool.ts +0 -183
- package/src/tool/truncate.ts +0 -156
- package/src/tool/truncation-dir.ts +0 -4
- package/src/tool/webfetch.ts +0 -192
- package/src/tool/webfetch.txt +0 -13
- package/src/tool/websearch.ts +0 -143
- package/src/tool/websearch.txt +0 -14
- package/src/tool/write.ts +0 -104
- package/src/tool/write.txt +0 -8
- package/src/util/archive.ts +0 -17
- package/src/util/bom.ts +0 -27
- package/src/util/data-url.ts +0 -9
- package/src/util/defer.ts +0 -10
- package/src/util/effect-http-client.ts +0 -11
- package/src/util/error.ts +0 -1
- package/src/util/filesystem.ts +0 -251
- package/src/util/html.ts +0 -8
- package/src/util/iife.ts +0 -3
- package/src/util/lazy.ts +0 -20
- package/src/util/local-context.ts +0 -25
- package/src/util/locale.ts +0 -2
- package/src/util/media.ts +0 -26
- package/src/util/process.ts +0 -177
- package/src/util/proxy-env.ts +0 -72
- package/src/util/queue.ts +0 -32
- package/src/util/record.ts +0 -1
- package/src/util/repository.ts +0 -232
- package/src/util/rpc.ts +0 -66
- package/src/util/signal.ts +0 -12
- package/src/util/timeout.ts +0 -13
- package/src/util/token.ts +0 -1
- package/src/util/wildcard.ts +0 -59
- package/src/worktree/index.ts +0 -623
- package/tsconfig.json +0 -17
package/src/agent/agent.ts
DELETED
|
@@ -1,973 +0,0 @@
|
|
|
1
|
-
import { LayerNode } from "@anymous-ai/core/effect/layer-node"
|
|
2
|
-
import { PermissionV1 } from "@anymous-ai/core/v1/permission"
|
|
3
|
-
import { Config } from "@/config/config"
|
|
4
|
-
import { serviceUse } from "@anymous-ai/core/effect/service-use"
|
|
5
|
-
import { Provider } from "@/provider/provider"
|
|
6
|
-
import { ConfigMigrateV1 } from "@anymous-ai/core/v1/config/migrate"
|
|
7
|
-
|
|
8
|
-
import { generateObject, streamObject, type ModelMessage } from "ai"
|
|
9
|
-
import { Truncate } from "@/tool/truncate"
|
|
10
|
-
import { Auth } from "../auth"
|
|
11
|
-
import { ProviderTransform } from "@/provider/transform"
|
|
12
|
-
import PROMPT_GENERATE from "./generate.txt"
|
|
13
|
-
import PROMPT_BUILD from "./prompt/build.txt"
|
|
14
|
-
import PROMPT_PLAN from "./prompt/plan.txt"
|
|
15
|
-
import PROMPT_GENERAL from "./prompt/general.txt"
|
|
16
|
-
import PROMPT_COMPACTION from "./prompt/compaction.txt"
|
|
17
|
-
import PROMPT_EXPLORE from "./prompt/explore.txt"
|
|
18
|
-
import PROMPT_SUMMARY from "./prompt/summary.txt"
|
|
19
|
-
import PROMPT_TITLE from "./prompt/title.txt"
|
|
20
|
-
import PROMPT_CODE_REVIEWER from "./prompt/code-reviewer.txt"
|
|
21
|
-
import PROMPT_DEBUG from "./prompt/debug.txt"
|
|
22
|
-
import PROMPT_TEST_WRITER from "./prompt/test-writer.txt"
|
|
23
|
-
import PROMPT_SECURITY from "./prompt/security.txt"
|
|
24
|
-
import PROMPT_FRONTEND from "./prompt/frontend.txt"
|
|
25
|
-
import PROMPT_BACKEND from "./prompt/backend.txt"
|
|
26
|
-
import PROMPT_DATABASE from "./prompt/database.txt"
|
|
27
|
-
import PROMPT_DEVOPS from "./prompt/devops.txt"
|
|
28
|
-
import PROMPT_DOCS from "./prompt/docs.txt"
|
|
29
|
-
import PROMPT_REFACTOR from "./prompt/refactor.txt"
|
|
30
|
-
import PROMPT_ARCHITECT from "./prompt/architect.txt"
|
|
31
|
-
import PROMPT_PERFORMANCE from "./prompt/performance.txt"
|
|
32
|
-
import PROMPT_WEB_DESIGNER from "./prompt/web-designer.txt"
|
|
33
|
-
import PROMPT_REVERSER_STATIC from "./prompt/reverser-static.txt"
|
|
34
|
-
import PROMPT_REVERSER_DYNAMIC from "./prompt/reverser-dynamic.txt"
|
|
35
|
-
import PROMPT_REVERSER_BINARY from "./prompt/reverser-binary.txt"
|
|
36
|
-
import PROMPT_REVERSER_SOURCE from "./prompt/reverser-source.txt"
|
|
37
|
-
import PROMPT_REVERSER_AUTOMATOR from "./prompt/reverser-automator.txt"
|
|
38
|
-
import PROMPT_MEMORY_DUMP from "./prompt/memory-dump.txt"
|
|
39
|
-
import PROMPT_EXE_EXTRACTOR from "./prompt/exe-extractor.txt"
|
|
40
|
-
import PROMPT_DEBUG_TOOLS from "./prompt/debug-tools.txt"
|
|
41
|
-
import PROMPT_PENTEST_LEAD from "./prompt/pentest-lead.txt"
|
|
42
|
-
import PROMPT_PENTEST_RECON from "./prompt/pentest-recon.txt"
|
|
43
|
-
import PROMPT_PENTEST_SCANNER from "./prompt/pentest-scanner.txt"
|
|
44
|
-
import PROMPT_PENTEST_ENUMERATOR from "./prompt/pentest-enumerator.txt"
|
|
45
|
-
import PROMPT_PENTEST_EXPLOITER from "./prompt/pentest-exploiter.txt"
|
|
46
|
-
import PROMPT_PENTEST_IDENTITY from "./prompt/pentest-identity.txt"
|
|
47
|
-
import PROMPT_PENTEST_WEBAPP from "./prompt/pentest-webapp.txt"
|
|
48
|
-
import PROMPT_PENTEST_POSTEXPLOIT from "./prompt/pentest-postexploit.txt"
|
|
49
|
-
import PROMPT_PENTEST_CRITIC from "./prompt/pentest-critic.txt"
|
|
50
|
-
import PROMPT_PENTEST_REPORTER from "./prompt/pentest-reporter.txt"
|
|
51
|
-
import { Permission } from "@/permission"
|
|
52
|
-
import { mergeDeep, pipe, sortBy, values } from "remeda"
|
|
53
|
-
import { Global } from "@anymous-ai/core/global"
|
|
54
|
-
import path from "path"
|
|
55
|
-
import { Plugin } from "@/plugin"
|
|
56
|
-
import { Skill } from "../skill"
|
|
57
|
-
import { Effect, Context, Layer, Schema } from "effect"
|
|
58
|
-
import { InstanceState } from "@/effect/instance-state"
|
|
59
|
-
import * as Option from "effect/Option"
|
|
60
|
-
import * as OtelTracer from "@effect/opentelemetry/Tracer"
|
|
61
|
-
import { AbsolutePath, type DeepMutable } from "@anymous-ai/core/schema"
|
|
62
|
-
import { ProviderV2 } from "@anymous-ai/core/provider"
|
|
63
|
-
import { ModelV2 } from "@anymous-ai/core/model"
|
|
64
|
-
import { LocationServiceMap, locationServiceMapLayer } from "@anymous-ai/core/location-services"
|
|
65
|
-
import { Reference } from "@anymous-ai/core/reference"
|
|
66
|
-
import { Location } from "@anymous-ai/core/location"
|
|
67
|
-
import { PluginV2 } from "@anymous-ai/core/plugin"
|
|
68
|
-
|
|
69
|
-
export const Info = Schema.Struct({
|
|
70
|
-
name: Schema.String,
|
|
71
|
-
description: Schema.optional(Schema.String),
|
|
72
|
-
mode: Schema.Literals(["subagent", "primary", "all"]),
|
|
73
|
-
native: Schema.optional(Schema.Boolean),
|
|
74
|
-
hidden: Schema.optional(Schema.Boolean),
|
|
75
|
-
topP: Schema.optional(Schema.Finite),
|
|
76
|
-
temperature: Schema.optional(Schema.Finite),
|
|
77
|
-
color: Schema.optional(Schema.String),
|
|
78
|
-
permission: PermissionV1.Ruleset,
|
|
79
|
-
model: Schema.optional(
|
|
80
|
-
Schema.Struct({
|
|
81
|
-
modelID: ModelV2.ID,
|
|
82
|
-
providerID: ProviderV2.ID,
|
|
83
|
-
}),
|
|
84
|
-
),
|
|
85
|
-
variant: Schema.optional(Schema.String),
|
|
86
|
-
prompt: Schema.optional(Schema.String),
|
|
87
|
-
options: Schema.Record(Schema.String, Schema.Unknown),
|
|
88
|
-
steps: Schema.optional(Schema.Finite),
|
|
89
|
-
}).annotate({ identifier: "Agent" })
|
|
90
|
-
export type Info = DeepMutable<Schema.Schema.Type<typeof Info>>
|
|
91
|
-
|
|
92
|
-
const GeneratedAgent = Schema.Struct({
|
|
93
|
-
identifier: Schema.String,
|
|
94
|
-
whenToUse: Schema.String,
|
|
95
|
-
systemPrompt: Schema.String,
|
|
96
|
-
})
|
|
97
|
-
|
|
98
|
-
export interface Interface {
|
|
99
|
-
readonly get: (agent: string) => Effect.Effect<Info>
|
|
100
|
-
readonly list: () => Effect.Effect<Info[]>
|
|
101
|
-
readonly defaultInfo: () => Effect.Effect<Info>
|
|
102
|
-
readonly defaultAgent: () => Effect.Effect<string>
|
|
103
|
-
readonly generate: (input: {
|
|
104
|
-
description: string
|
|
105
|
-
model?: { providerID: ProviderV2.ID; modelID: ModelV2.ID }
|
|
106
|
-
}) => Effect.Effect<
|
|
107
|
-
{
|
|
108
|
-
identifier: string
|
|
109
|
-
whenToUse: string
|
|
110
|
-
systemPrompt: string
|
|
111
|
-
},
|
|
112
|
-
Provider.DefaultModelError
|
|
113
|
-
>
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
type State = Omit<Interface, "generate">
|
|
117
|
-
|
|
118
|
-
export class Service extends Context.Service<Service, Interface>()("@anymous/Agent") {}
|
|
119
|
-
|
|
120
|
-
export const use = serviceUse(Service)
|
|
121
|
-
|
|
122
|
-
const layer = Layer.effect(
|
|
123
|
-
Service,
|
|
124
|
-
Effect.gen(function* () {
|
|
125
|
-
const config = yield* Config.Service
|
|
126
|
-
const auth = yield* Auth.Service
|
|
127
|
-
const plugin = yield* Plugin.Service
|
|
128
|
-
const skill = yield* Skill.Service
|
|
129
|
-
const provider = yield* Provider.Service
|
|
130
|
-
const locations = yield* LocationServiceMap.Service
|
|
131
|
-
|
|
132
|
-
const state = yield* InstanceState.make<State>(
|
|
133
|
-
Effect.fn("Agent.state")(function* (ctx) {
|
|
134
|
-
const cfg = yield* config.get()
|
|
135
|
-
const skillDirs = yield* skill.dirs()
|
|
136
|
-
const referenceDirs = Object.keys(cfg.references ?? cfg.reference ?? {}).length
|
|
137
|
-
? yield* Effect.gen(function* () {
|
|
138
|
-
yield* (yield* PluginV2.Service).wait(PluginV2.ID.make("core/config-reference"))
|
|
139
|
-
return (yield* (yield* Reference.Service).list()).map((reference) => reference.path)
|
|
140
|
-
}).pipe(Effect.provide(locations.get(Location.Ref.make({ directory: AbsolutePath.make(ctx.directory) }))))
|
|
141
|
-
: []
|
|
142
|
-
const whitelistedDirs = [
|
|
143
|
-
Truncate.GLOB,
|
|
144
|
-
path.join(Global.Path.tmp, "*"),
|
|
145
|
-
...skillDirs.map((dir) => path.join(dir, "*")),
|
|
146
|
-
...referenceDirs.map((dir) => path.join(dir, "*")),
|
|
147
|
-
]
|
|
148
|
-
const readonlyExternalDirectory = {
|
|
149
|
-
"*": "ask",
|
|
150
|
-
...Object.fromEntries(whitelistedDirs.map((dir) => [dir, "allow"])),
|
|
151
|
-
} satisfies Record<string, "allow" | "ask" | "deny">
|
|
152
|
-
|
|
153
|
-
const defaults = Permission.fromConfig({
|
|
154
|
-
"*": "allow",
|
|
155
|
-
doom_loop: "ask",
|
|
156
|
-
external_directory: {
|
|
157
|
-
"*": "ask",
|
|
158
|
-
...Object.fromEntries(whitelistedDirs.map((dir) => [dir, "allow"])),
|
|
159
|
-
},
|
|
160
|
-
question: "deny",
|
|
161
|
-
plan_enter: "deny",
|
|
162
|
-
plan_exit: "deny",
|
|
163
|
-
// mirrors github.com/github/gitignore Node.gitignore pattern for .env files
|
|
164
|
-
read: {
|
|
165
|
-
"*": "allow",
|
|
166
|
-
"*.env": "ask",
|
|
167
|
-
"*.env.*": "ask",
|
|
168
|
-
"*.env.example": "allow",
|
|
169
|
-
},
|
|
170
|
-
})
|
|
171
|
-
|
|
172
|
-
const user = Permission.fromConfig(cfg.permission ?? {})
|
|
173
|
-
|
|
174
|
-
const agents: Record<string, Info> = {
|
|
175
|
-
build: {
|
|
176
|
-
name: "build",
|
|
177
|
-
description: "The default agent. Executes tools based on configured permissions.",
|
|
178
|
-
prompt: PROMPT_BUILD,
|
|
179
|
-
options: {},
|
|
180
|
-
permission: Permission.merge(
|
|
181
|
-
defaults,
|
|
182
|
-
Permission.fromConfig({
|
|
183
|
-
question: "allow",
|
|
184
|
-
plan_enter: "allow",
|
|
185
|
-
}),
|
|
186
|
-
user,
|
|
187
|
-
),
|
|
188
|
-
mode: "primary",
|
|
189
|
-
native: true,
|
|
190
|
-
},
|
|
191
|
-
plan: {
|
|
192
|
-
name: "plan",
|
|
193
|
-
description: "Plan mode. Disallows all edit tools.",
|
|
194
|
-
prompt: PROMPT_PLAN,
|
|
195
|
-
options: {},
|
|
196
|
-
permission: Permission.merge(
|
|
197
|
-
defaults,
|
|
198
|
-
Permission.fromConfig({
|
|
199
|
-
question: "allow",
|
|
200
|
-
plan_exit: "allow",
|
|
201
|
-
task: {
|
|
202
|
-
general: "deny",
|
|
203
|
-
},
|
|
204
|
-
external_directory: {
|
|
205
|
-
[path.join(Global.Path.data, "plans", "*")]: "allow",
|
|
206
|
-
},
|
|
207
|
-
edit: {
|
|
208
|
-
"*": "deny",
|
|
209
|
-
[path.join(".anymous", "plans", "*.md")]: "allow",
|
|
210
|
-
[path.relative(ctx.worktree, path.join(Global.Path.data, path.join("plans", "*.md")))]: "allow",
|
|
211
|
-
},
|
|
212
|
-
}),
|
|
213
|
-
user,
|
|
214
|
-
),
|
|
215
|
-
mode: "primary",
|
|
216
|
-
native: true,
|
|
217
|
-
},
|
|
218
|
-
general: {
|
|
219
|
-
name: "general",
|
|
220
|
-
description: `General-purpose agent for researching complex questions and executing multi-step tasks. Use this agent to execute multiple units of work in parallel.`,
|
|
221
|
-
prompt: PROMPT_GENERAL,
|
|
222
|
-
permission: Permission.merge(
|
|
223
|
-
defaults,
|
|
224
|
-
Permission.fromConfig({
|
|
225
|
-
todowrite: "deny",
|
|
226
|
-
}),
|
|
227
|
-
user,
|
|
228
|
-
),
|
|
229
|
-
options: {},
|
|
230
|
-
mode: "subagent",
|
|
231
|
-
native: true,
|
|
232
|
-
},
|
|
233
|
-
explore: {
|
|
234
|
-
name: "explore",
|
|
235
|
-
permission: Permission.merge(
|
|
236
|
-
defaults,
|
|
237
|
-
Permission.fromConfig({
|
|
238
|
-
"*": "deny",
|
|
239
|
-
grep: "allow",
|
|
240
|
-
glob: "allow",
|
|
241
|
-
list: "allow",
|
|
242
|
-
bash: "allow",
|
|
243
|
-
webfetch: "allow",
|
|
244
|
-
websearch: "allow",
|
|
245
|
-
read: "allow",
|
|
246
|
-
external_directory: readonlyExternalDirectory,
|
|
247
|
-
}),
|
|
248
|
-
user,
|
|
249
|
-
),
|
|
250
|
-
description: `Fast agent specialized for exploring codebases. Use this when you need to quickly find files by patterns (eg. "src/components/**/*.tsx"), search code for keywords (eg. "API endpoints"), or answer questions about the codebase (eg. "how do API endpoints work?"). When calling this agent, specify the desired thoroughness level: "quick" for basic searches, "medium" for moderate exploration, or "very thorough" for comprehensive analysis across multiple locations and naming conventions.`,
|
|
251
|
-
prompt: PROMPT_EXPLORE,
|
|
252
|
-
options: {},
|
|
253
|
-
mode: "subagent",
|
|
254
|
-
native: true,
|
|
255
|
-
},
|
|
256
|
-
compaction: {
|
|
257
|
-
name: "compaction",
|
|
258
|
-
mode: "primary",
|
|
259
|
-
native: true,
|
|
260
|
-
hidden: true,
|
|
261
|
-
prompt: PROMPT_COMPACTION,
|
|
262
|
-
permission: Permission.merge(
|
|
263
|
-
defaults,
|
|
264
|
-
Permission.fromConfig({
|
|
265
|
-
"*": "deny",
|
|
266
|
-
}),
|
|
267
|
-
user,
|
|
268
|
-
),
|
|
269
|
-
options: {},
|
|
270
|
-
},
|
|
271
|
-
title: {
|
|
272
|
-
name: "title",
|
|
273
|
-
mode: "primary",
|
|
274
|
-
options: {},
|
|
275
|
-
native: true,
|
|
276
|
-
hidden: true,
|
|
277
|
-
temperature: 0.5,
|
|
278
|
-
permission: Permission.merge(
|
|
279
|
-
defaults,
|
|
280
|
-
Permission.fromConfig({
|
|
281
|
-
"*": "deny",
|
|
282
|
-
}),
|
|
283
|
-
user,
|
|
284
|
-
),
|
|
285
|
-
prompt: PROMPT_TITLE,
|
|
286
|
-
},
|
|
287
|
-
summary: {
|
|
288
|
-
name: "summary",
|
|
289
|
-
mode: "primary",
|
|
290
|
-
options: {},
|
|
291
|
-
native: true,
|
|
292
|
-
hidden: true,
|
|
293
|
-
permission: Permission.merge(
|
|
294
|
-
defaults,
|
|
295
|
-
Permission.fromConfig({
|
|
296
|
-
"*": "deny",
|
|
297
|
-
}),
|
|
298
|
-
user,
|
|
299
|
-
),
|
|
300
|
-
prompt: PROMPT_SUMMARY,
|
|
301
|
-
},
|
|
302
|
-
"reverser-static": {
|
|
303
|
-
name: "reverser-static",
|
|
304
|
-
description: "Specialist in static binary analysis, disassembly, and decompilation. Use for IDA/Ghidra analysis, binary structure evaluation, algorithm extraction.",
|
|
305
|
-
permission: Permission.merge(
|
|
306
|
-
defaults,
|
|
307
|
-
Permission.fromConfig({
|
|
308
|
-
todowrite: "deny",
|
|
309
|
-
}),
|
|
310
|
-
user,
|
|
311
|
-
),
|
|
312
|
-
options: {},
|
|
313
|
-
mode: "subagent",
|
|
314
|
-
native: true,
|
|
315
|
-
prompt: PROMPT_REVERSER_STATIC,
|
|
316
|
-
},
|
|
317
|
-
"reverser-dynamic": {
|
|
318
|
-
name: "reverser-dynamic",
|
|
319
|
-
description: "Specialist in dynamic/runtime binary analysis, debugging, and instrumentation. Use for Frida, debugger automation, API monitoring, anti-debug bypass.",
|
|
320
|
-
permission: Permission.merge(
|
|
321
|
-
defaults,
|
|
322
|
-
Permission.fromConfig({
|
|
323
|
-
todowrite: "deny",
|
|
324
|
-
}),
|
|
325
|
-
user,
|
|
326
|
-
),
|
|
327
|
-
options: {},
|
|
328
|
-
mode: "subagent",
|
|
329
|
-
native: true,
|
|
330
|
-
prompt: PROMPT_REVERSER_DYNAMIC,
|
|
331
|
-
},
|
|
332
|
-
"reverser-binary": {
|
|
333
|
-
name: "reverser-binary",
|
|
334
|
-
description: "Specialist in binary formats, packers, and protection analysis. Use for PE/ELF/Mach-O analysis, unpacking, shellcode analysis.",
|
|
335
|
-
permission: Permission.merge(
|
|
336
|
-
defaults,
|
|
337
|
-
Permission.fromConfig({
|
|
338
|
-
todowrite: "deny",
|
|
339
|
-
}),
|
|
340
|
-
user,
|
|
341
|
-
),
|
|
342
|
-
options: {},
|
|
343
|
-
mode: "subagent",
|
|
344
|
-
native: true,
|
|
345
|
-
prompt: PROMPT_REVERSER_BINARY,
|
|
346
|
-
},
|
|
347
|
-
"reverser-source": {
|
|
348
|
-
name: "reverser-source",
|
|
349
|
-
description: "Specialist in source-level reverse engineering and deobfuscation. Use for pseudocode reconstruction, algorithm recovery, decompilation.",
|
|
350
|
-
permission: Permission.merge(
|
|
351
|
-
defaults,
|
|
352
|
-
Permission.fromConfig({
|
|
353
|
-
todowrite: "deny",
|
|
354
|
-
}),
|
|
355
|
-
user,
|
|
356
|
-
),
|
|
357
|
-
options: {},
|
|
358
|
-
mode: "subagent",
|
|
359
|
-
native: true,
|
|
360
|
-
prompt: PROMPT_REVERSER_SOURCE,
|
|
361
|
-
},
|
|
362
|
-
"reverser-automator": {
|
|
363
|
-
name: "reverser-automator",
|
|
364
|
-
description: "Specialist in automation, detection engineering, and binary patching. Use for YARA rules, IDAPython scripts, binary patches, loaders.",
|
|
365
|
-
permission: Permission.merge(
|
|
366
|
-
defaults,
|
|
367
|
-
Permission.fromConfig({
|
|
368
|
-
todowrite: "deny",
|
|
369
|
-
}),
|
|
370
|
-
user,
|
|
371
|
-
),
|
|
372
|
-
options: {},
|
|
373
|
-
mode: "subagent",
|
|
374
|
-
native: true,
|
|
375
|
-
prompt: PROMPT_REVERSER_AUTOMATOR,
|
|
376
|
-
},
|
|
377
|
-
"memory-dump": {
|
|
378
|
-
name: "memory-dump",
|
|
379
|
-
description: "Specialist in memory dumping, analysis, and forensic acquisition. Use for process dump, crash dump analysis, heap inspection, memory forensics with Volatility.",
|
|
380
|
-
permission: Permission.merge(
|
|
381
|
-
defaults,
|
|
382
|
-
Permission.fromConfig({
|
|
383
|
-
todowrite: "deny",
|
|
384
|
-
}),
|
|
385
|
-
user,
|
|
386
|
-
),
|
|
387
|
-
options: {},
|
|
388
|
-
mode: "subagent",
|
|
389
|
-
native: true,
|
|
390
|
-
prompt: PROMPT_MEMORY_DUMP,
|
|
391
|
-
},
|
|
392
|
-
"exe-extractor": {
|
|
393
|
-
name: "exe-extractor",
|
|
394
|
-
description: "Specialist in extracting executables from packers, installers, and archives. Use for unpacking UPX/Themida/VMProtect, resource extraction, embedded EXE carving.",
|
|
395
|
-
permission: Permission.merge(
|
|
396
|
-
defaults,
|
|
397
|
-
Permission.fromConfig({
|
|
398
|
-
todowrite: "deny",
|
|
399
|
-
}),
|
|
400
|
-
user,
|
|
401
|
-
),
|
|
402
|
-
options: {},
|
|
403
|
-
mode: "subagent",
|
|
404
|
-
native: true,
|
|
405
|
-
prompt: PROMPT_EXE_EXTRACTOR,
|
|
406
|
-
},
|
|
407
|
-
"debug-tools": {
|
|
408
|
-
name: "debug-tools",
|
|
409
|
-
description: "Specialist in creating custom debugging tools, hook engines, and instrumentation utilities. Use for API monitor creation, DLL injectors, debuggers, runtime patchers.",
|
|
410
|
-
permission: Permission.merge(
|
|
411
|
-
defaults,
|
|
412
|
-
Permission.fromConfig({
|
|
413
|
-
todowrite: "deny",
|
|
414
|
-
}),
|
|
415
|
-
user,
|
|
416
|
-
),
|
|
417
|
-
options: {},
|
|
418
|
-
mode: "subagent",
|
|
419
|
-
native: true,
|
|
420
|
-
prompt: PROMPT_DEBUG_TOOLS,
|
|
421
|
-
},
|
|
422
|
-
"pentest-lead": {
|
|
423
|
-
name: "pentest-lead",
|
|
424
|
-
description: "Lead strategist and coordinator for penetration testing engagements. Breaks down attacks into phases, dispatches specialist subagents, and tracks engagement state.",
|
|
425
|
-
permission: Permission.merge(
|
|
426
|
-
defaults,
|
|
427
|
-
Permission.fromConfig({
|
|
428
|
-
todowrite: "deny",
|
|
429
|
-
}),
|
|
430
|
-
user,
|
|
431
|
-
),
|
|
432
|
-
options: {},
|
|
433
|
-
mode: "subagent",
|
|
434
|
-
native: true,
|
|
435
|
-
prompt: PROMPT_PENTEST_LEAD,
|
|
436
|
-
},
|
|
437
|
-
"pentest-recon": {
|
|
438
|
-
name: "pentest-recon",
|
|
439
|
-
description: "Reconnaissance and OSINT specialist. Gathers passive intelligence, discovers subdomains, enumerates technologies, and maps attack surface before active testing.",
|
|
440
|
-
permission: Permission.merge(
|
|
441
|
-
defaults,
|
|
442
|
-
Permission.fromConfig({
|
|
443
|
-
todowrite: "deny",
|
|
444
|
-
}),
|
|
445
|
-
user,
|
|
446
|
-
),
|
|
447
|
-
options: {},
|
|
448
|
-
mode: "subagent",
|
|
449
|
-
native: true,
|
|
450
|
-
prompt: PROMPT_PENTEST_RECON,
|
|
451
|
-
},
|
|
452
|
-
"pentest-scanner": {
|
|
453
|
-
name: "pentest-scanner",
|
|
454
|
-
description: "Network scanning specialist. Identifies live hosts, open ports, service versions, and OS fingerprints using nmap, masscan, and other scanning tools.",
|
|
455
|
-
permission: Permission.merge(
|
|
456
|
-
defaults,
|
|
457
|
-
Permission.fromConfig({
|
|
458
|
-
todowrite: "deny",
|
|
459
|
-
}),
|
|
460
|
-
user,
|
|
461
|
-
),
|
|
462
|
-
options: {},
|
|
463
|
-
mode: "subagent",
|
|
464
|
-
native: true,
|
|
465
|
-
prompt: PROMPT_PENTEST_SCANNER,
|
|
466
|
-
},
|
|
467
|
-
"pentest-enumerator": {
|
|
468
|
-
name: "pentest-enumerator",
|
|
469
|
-
description: "Service enumeration specialist. Deeply enumerates SMB, LDAP, DNS, SNMP, HTTP, and database services to extract maximum information.",
|
|
470
|
-
permission: Permission.merge(
|
|
471
|
-
defaults,
|
|
472
|
-
Permission.fromConfig({
|
|
473
|
-
todowrite: "deny",
|
|
474
|
-
}),
|
|
475
|
-
user,
|
|
476
|
-
),
|
|
477
|
-
options: {},
|
|
478
|
-
mode: "subagent",
|
|
479
|
-
native: true,
|
|
480
|
-
prompt: PROMPT_PENTEST_ENUMERATOR,
|
|
481
|
-
},
|
|
482
|
-
"pentest-exploiter": {
|
|
483
|
-
name: "pentest-exploiter",
|
|
484
|
-
description: "Exploitation specialist. Weaponizes findings to gain initial access, execute known exploits (web, network, AD), and perform credential-based attacks.",
|
|
485
|
-
permission: Permission.merge(
|
|
486
|
-
defaults,
|
|
487
|
-
Permission.fromConfig({
|
|
488
|
-
todowrite: "deny",
|
|
489
|
-
}),
|
|
490
|
-
user,
|
|
491
|
-
),
|
|
492
|
-
options: {},
|
|
493
|
-
mode: "subagent",
|
|
494
|
-
native: true,
|
|
495
|
-
prompt: PROMPT_PENTEST_EXPLOITER,
|
|
496
|
-
},
|
|
497
|
-
"pentest-identity": {
|
|
498
|
-
name: "pentest-identity",
|
|
499
|
-
description: "Active Directory and identity infrastructure specialist. Performs AD enumeration, Kerberos attacks (AS-REP, Kerberoasting, DCSync), and Azure AD assessment.",
|
|
500
|
-
permission: Permission.merge(
|
|
501
|
-
defaults,
|
|
502
|
-
Permission.fromConfig({
|
|
503
|
-
todowrite: "deny",
|
|
504
|
-
}),
|
|
505
|
-
user,
|
|
506
|
-
),
|
|
507
|
-
options: {},
|
|
508
|
-
mode: "subagent",
|
|
509
|
-
native: true,
|
|
510
|
-
prompt: PROMPT_PENTEST_IDENTITY,
|
|
511
|
-
},
|
|
512
|
-
"pentest-webapp": {
|
|
513
|
-
name: "pentest-webapp",
|
|
514
|
-
description: "Web application security specialist. Tests OWASP Top 10 (injection, broken access control, SSRF, API security) with comprehensive payload crafting.",
|
|
515
|
-
permission: Permission.merge(
|
|
516
|
-
defaults,
|
|
517
|
-
Permission.fromConfig({
|
|
518
|
-
todowrite: "deny",
|
|
519
|
-
}),
|
|
520
|
-
user,
|
|
521
|
-
),
|
|
522
|
-
options: {},
|
|
523
|
-
mode: "subagent",
|
|
524
|
-
native: true,
|
|
525
|
-
prompt: PROMPT_PENTEST_WEBAPP,
|
|
526
|
-
},
|
|
527
|
-
"pentest-postexploit": {
|
|
528
|
-
name: "pentest-postexploit",
|
|
529
|
-
description: "Post-exploitation and lateral movement specialist. Escalates privileges, extracts credentials, moves laterally, and establishes persistence across Windows and Linux.",
|
|
530
|
-
permission: Permission.merge(
|
|
531
|
-
defaults,
|
|
532
|
-
Permission.fromConfig({
|
|
533
|
-
todowrite: "deny",
|
|
534
|
-
}),
|
|
535
|
-
user,
|
|
536
|
-
),
|
|
537
|
-
options: {},
|
|
538
|
-
mode: "subagent",
|
|
539
|
-
native: true,
|
|
540
|
-
prompt: PROMPT_PENTEST_POSTEXPLOIT,
|
|
541
|
-
},
|
|
542
|
-
"pentest-critic": {
|
|
543
|
-
name: "pentest-critic",
|
|
544
|
-
description: "False-positive validator and findings reviewer. Independently verifies every vulnerability, exploit result, and credential before reporting.",
|
|
545
|
-
permission: Permission.merge(
|
|
546
|
-
defaults,
|
|
547
|
-
Permission.fromConfig({
|
|
548
|
-
todowrite: "deny",
|
|
549
|
-
}),
|
|
550
|
-
user,
|
|
551
|
-
),
|
|
552
|
-
options: {},
|
|
553
|
-
mode: "subagent",
|
|
554
|
-
native: true,
|
|
555
|
-
prompt: PROMPT_PENTEST_CRITIC,
|
|
556
|
-
},
|
|
557
|
-
"pentest-reporter": {
|
|
558
|
-
name: "pentest-reporter",
|
|
559
|
-
description: "Report generation specialist. Compiles all validated findings into professional reports with executive summaries, technical details, CVSS scoring, and remediation plans.",
|
|
560
|
-
permission: Permission.merge(
|
|
561
|
-
defaults,
|
|
562
|
-
Permission.fromConfig({
|
|
563
|
-
todowrite: "deny",
|
|
564
|
-
}),
|
|
565
|
-
user,
|
|
566
|
-
),
|
|
567
|
-
options: {},
|
|
568
|
-
mode: "subagent",
|
|
569
|
-
native: true,
|
|
570
|
-
prompt: PROMPT_PENTEST_REPORTER,
|
|
571
|
-
},
|
|
572
|
-
"code-reviewer": {
|
|
573
|
-
name: "code-reviewer",
|
|
574
|
-
description: "Code review specialist. Analyzes code for security vulnerabilities, correctness bugs, performance issues, and maintainability concerns with line-level feedback.",
|
|
575
|
-
permission: Permission.merge(
|
|
576
|
-
defaults,
|
|
577
|
-
Permission.fromConfig({
|
|
578
|
-
todowrite: "deny",
|
|
579
|
-
edit: "deny",
|
|
580
|
-
}),
|
|
581
|
-
user,
|
|
582
|
-
),
|
|
583
|
-
options: {},
|
|
584
|
-
mode: "subagent",
|
|
585
|
-
native: true,
|
|
586
|
-
prompt: PROMPT_CODE_REVIEWER,
|
|
587
|
-
},
|
|
588
|
-
debug: {
|
|
589
|
-
name: "debug",
|
|
590
|
-
description: "Debugging specialist. Systematically diagnoses and fixes software defects by reproducing, isolating, and resolving root causes.",
|
|
591
|
-
permission: Permission.merge(
|
|
592
|
-
defaults,
|
|
593
|
-
Permission.fromConfig({
|
|
594
|
-
todowrite: "deny",
|
|
595
|
-
}),
|
|
596
|
-
user,
|
|
597
|
-
),
|
|
598
|
-
options: {},
|
|
599
|
-
mode: "subagent",
|
|
600
|
-
native: true,
|
|
601
|
-
prompt: PROMPT_DEBUG,
|
|
602
|
-
},
|
|
603
|
-
"test-writer": {
|
|
604
|
-
name: "test-writer",
|
|
605
|
-
description: "Test engineering specialist. Writes thorough, maintainable tests covering happy path, error cases, edge cases, and boundary conditions.",
|
|
606
|
-
permission: Permission.merge(
|
|
607
|
-
defaults,
|
|
608
|
-
Permission.fromConfig({
|
|
609
|
-
todowrite: "deny",
|
|
610
|
-
}),
|
|
611
|
-
user,
|
|
612
|
-
),
|
|
613
|
-
options: {},
|
|
614
|
-
mode: "subagent",
|
|
615
|
-
native: true,
|
|
616
|
-
prompt: PROMPT_TEST_WRITER,
|
|
617
|
-
},
|
|
618
|
-
security: {
|
|
619
|
-
name: "security",
|
|
620
|
-
description: "Application security specialist. Assesses code for OWASP Top 10 vulnerabilities, dependency CVEs, secrets exposure, and auth bypasses with CVSS-scored findings.",
|
|
621
|
-
permission: Permission.merge(
|
|
622
|
-
defaults,
|
|
623
|
-
Permission.fromConfig({
|
|
624
|
-
todowrite: "deny",
|
|
625
|
-
edit: "deny",
|
|
626
|
-
}),
|
|
627
|
-
user,
|
|
628
|
-
),
|
|
629
|
-
options: {},
|
|
630
|
-
mode: "subagent",
|
|
631
|
-
native: true,
|
|
632
|
-
prompt: PROMPT_SECURITY,
|
|
633
|
-
},
|
|
634
|
-
frontend: {
|
|
635
|
-
name: "frontend",
|
|
636
|
-
description: "Senior frontend engineer specializing in React, SolidJS, TypeScript, CSS, accessibility, and web performance. Builds composable UIs with modern best practices.",
|
|
637
|
-
permission: Permission.merge(
|
|
638
|
-
defaults,
|
|
639
|
-
Permission.fromConfig({
|
|
640
|
-
todowrite: "deny",
|
|
641
|
-
}),
|
|
642
|
-
user,
|
|
643
|
-
),
|
|
644
|
-
options: {},
|
|
645
|
-
mode: "subagent",
|
|
646
|
-
native: true,
|
|
647
|
-
prompt: PROMPT_FRONTEND,
|
|
648
|
-
},
|
|
649
|
-
backend: {
|
|
650
|
-
name: "backend",
|
|
651
|
-
description: "Senior backend engineer specializing in API design, databases, auth, message queues, caching, and observability. Builds scalable server-side systems.",
|
|
652
|
-
permission: Permission.merge(
|
|
653
|
-
defaults,
|
|
654
|
-
Permission.fromConfig({
|
|
655
|
-
todowrite: "deny",
|
|
656
|
-
}),
|
|
657
|
-
user,
|
|
658
|
-
),
|
|
659
|
-
options: {},
|
|
660
|
-
mode: "subagent",
|
|
661
|
-
native: true,
|
|
662
|
-
prompt: PROMPT_BACKEND,
|
|
663
|
-
},
|
|
664
|
-
database: {
|
|
665
|
-
name: "database",
|
|
666
|
-
description: "Database specialist. Designs schemas, optimizes queries, plans migrations, and advises on data modeling for SQL and NoSQL systems.",
|
|
667
|
-
permission: Permission.merge(
|
|
668
|
-
defaults,
|
|
669
|
-
Permission.fromConfig({
|
|
670
|
-
todowrite: "deny",
|
|
671
|
-
edit: "deny", // advisory only — schema changes via backend agent
|
|
672
|
-
}),
|
|
673
|
-
user,
|
|
674
|
-
),
|
|
675
|
-
options: {},
|
|
676
|
-
mode: "subagent",
|
|
677
|
-
native: true,
|
|
678
|
-
prompt: PROMPT_DATABASE,
|
|
679
|
-
},
|
|
680
|
-
devops: {
|
|
681
|
-
name: "devops",
|
|
682
|
-
description: "DevOps/platform engineer specializing in CI/CD, Docker, Kubernetes, cloud infrastructure (AWS/GCP/Azure), IaC, and observability.",
|
|
683
|
-
permission: Permission.merge(
|
|
684
|
-
defaults,
|
|
685
|
-
Permission.fromConfig({
|
|
686
|
-
todowrite: "deny",
|
|
687
|
-
}),
|
|
688
|
-
user,
|
|
689
|
-
),
|
|
690
|
-
options: {},
|
|
691
|
-
mode: "subagent",
|
|
692
|
-
native: true,
|
|
693
|
-
prompt: PROMPT_DEVOPS,
|
|
694
|
-
},
|
|
695
|
-
docs: {
|
|
696
|
-
name: "docs",
|
|
697
|
-
description: "Technical documentation specialist. Writes clear READMEs, API references, guides, ADRs, and troubleshooting docs with code examples.",
|
|
698
|
-
permission: Permission.merge(
|
|
699
|
-
defaults,
|
|
700
|
-
Permission.fromConfig({
|
|
701
|
-
todowrite: "deny",
|
|
702
|
-
edit: "deny",
|
|
703
|
-
}),
|
|
704
|
-
user,
|
|
705
|
-
),
|
|
706
|
-
options: {},
|
|
707
|
-
mode: "subagent",
|
|
708
|
-
native: true,
|
|
709
|
-
prompt: PROMPT_DOCS,
|
|
710
|
-
},
|
|
711
|
-
refactor: {
|
|
712
|
-
name: "refactor",
|
|
713
|
-
description: "Code refactoring specialist. Improves code structure — extracts duplication, simplifies complexity, renames for clarity — without changing behavior.",
|
|
714
|
-
permission: Permission.merge(
|
|
715
|
-
defaults,
|
|
716
|
-
Permission.fromConfig({
|
|
717
|
-
todowrite: "deny",
|
|
718
|
-
}),
|
|
719
|
-
user,
|
|
720
|
-
),
|
|
721
|
-
options: {},
|
|
722
|
-
mode: "subagent",
|
|
723
|
-
native: true,
|
|
724
|
-
prompt: PROMPT_REFACTOR,
|
|
725
|
-
},
|
|
726
|
-
architect: {
|
|
727
|
-
name: "architect",
|
|
728
|
-
description: "Software architect. Designs system-level solutions, evaluates technology trade-offs, produces ADRs, and creates implementation roadmaps.",
|
|
729
|
-
permission: Permission.merge(
|
|
730
|
-
defaults,
|
|
731
|
-
Permission.fromConfig({
|
|
732
|
-
todowrite: "deny",
|
|
733
|
-
edit: "deny",
|
|
734
|
-
}),
|
|
735
|
-
user,
|
|
736
|
-
),
|
|
737
|
-
options: {},
|
|
738
|
-
mode: "subagent",
|
|
739
|
-
native: true,
|
|
740
|
-
prompt: PROMPT_ARCHITECT,
|
|
741
|
-
},
|
|
742
|
-
performance: {
|
|
743
|
-
name: "performance",
|
|
744
|
-
description: "Performance optimization specialist. Profiles and optimizes CPU, memory, I/O, network, rendering, and build bottlenecks with measured improvements.",
|
|
745
|
-
permission: Permission.merge(
|
|
746
|
-
defaults,
|
|
747
|
-
Permission.fromConfig({
|
|
748
|
-
todowrite: "deny",
|
|
749
|
-
edit: "deny", // advisory — changes via refactor/build agent
|
|
750
|
-
}),
|
|
751
|
-
user,
|
|
752
|
-
),
|
|
753
|
-
options: {},
|
|
754
|
-
mode: "subagent",
|
|
755
|
-
native: true,
|
|
756
|
-
prompt: PROMPT_PERFORMANCE,
|
|
757
|
-
},
|
|
758
|
-
"web-designer": {
|
|
759
|
-
name: "web-designer",
|
|
760
|
-
description: "Web design specialist. Creates polished UI with HTML, CSS, Tailwind, Three.js, glassmorphism, animations, and responsive layouts.",
|
|
761
|
-
permission: Permission.merge(
|
|
762
|
-
defaults,
|
|
763
|
-
Permission.fromConfig({
|
|
764
|
-
todowrite: "deny",
|
|
765
|
-
}),
|
|
766
|
-
user,
|
|
767
|
-
),
|
|
768
|
-
options: {},
|
|
769
|
-
mode: "subagent",
|
|
770
|
-
native: true,
|
|
771
|
-
prompt: PROMPT_WEB_DESIGNER,
|
|
772
|
-
},
|
|
773
|
-
}
|
|
774
|
-
|
|
775
|
-
for (const [key, value] of Object.entries(cfg.agent ?? {})) {
|
|
776
|
-
const migrated = ConfigMigrateV1.migrateAgent(value)
|
|
777
|
-
if (migrated.disabled) {
|
|
778
|
-
delete agents[key]
|
|
779
|
-
continue
|
|
780
|
-
}
|
|
781
|
-
let item = agents[key]
|
|
782
|
-
if (!item)
|
|
783
|
-
item = agents[key] = {
|
|
784
|
-
name: key,
|
|
785
|
-
mode: "all",
|
|
786
|
-
permission: Permission.merge(defaults, user),
|
|
787
|
-
options: {},
|
|
788
|
-
native: false,
|
|
789
|
-
}
|
|
790
|
-
if (migrated.model) item.model = Provider.parseModel(migrated.model)
|
|
791
|
-
item.variant = migrated.variant ?? item.variant
|
|
792
|
-
item.prompt = migrated.system ?? item.prompt
|
|
793
|
-
item.description = migrated.description ?? item.description
|
|
794
|
-
item.mode = migrated.mode ?? item.mode
|
|
795
|
-
item.color = migrated.color ?? item.color
|
|
796
|
-
item.hidden = migrated.hidden ?? item.hidden
|
|
797
|
-
item.name = value.name ?? item.name
|
|
798
|
-
item.steps = migrated.steps ?? item.steps
|
|
799
|
-
const body = migrated.request?.body ?? {}
|
|
800
|
-
const { temperature, top_p, ...options } = body
|
|
801
|
-
item.temperature = temperature ?? item.temperature
|
|
802
|
-
item.topP = top_p ?? item.topP
|
|
803
|
-
item.options = mergeDeep(item.options, options)
|
|
804
|
-
if (migrated.permissions) {
|
|
805
|
-
item.permission = Permission.merge(
|
|
806
|
-
item.permission,
|
|
807
|
-
migrated.permissions.map((rule) => ({
|
|
808
|
-
permission: rule.action,
|
|
809
|
-
pattern: rule.resource,
|
|
810
|
-
action: rule.effect,
|
|
811
|
-
})),
|
|
812
|
-
)
|
|
813
|
-
}
|
|
814
|
-
}
|
|
815
|
-
|
|
816
|
-
// Ensure Truncate.GLOB is allowed unless explicitly configured
|
|
817
|
-
for (const name in agents) {
|
|
818
|
-
const agent = agents[name]
|
|
819
|
-
const explicit = agent.permission.some((r) => {
|
|
820
|
-
if (r.permission !== "external_directory") return false
|
|
821
|
-
if (r.action !== "deny") return false
|
|
822
|
-
return r.pattern === Truncate.GLOB
|
|
823
|
-
})
|
|
824
|
-
if (explicit) continue
|
|
825
|
-
|
|
826
|
-
agents[name].permission = Permission.merge(
|
|
827
|
-
agents[name].permission,
|
|
828
|
-
Permission.fromConfig({ external_directory: { [Truncate.GLOB]: "allow" } }),
|
|
829
|
-
)
|
|
830
|
-
}
|
|
831
|
-
|
|
832
|
-
const get = Effect.fnUntraced(function* (agent: string) {
|
|
833
|
-
return agents[agent]
|
|
834
|
-
})
|
|
835
|
-
|
|
836
|
-
const list = Effect.fnUntraced(function* () {
|
|
837
|
-
const cfg = yield* config.get()
|
|
838
|
-
return pipe(
|
|
839
|
-
agents,
|
|
840
|
-
values(),
|
|
841
|
-
sortBy(
|
|
842
|
-
[(x) => (cfg.default_agent ? x.name === cfg.default_agent : x.name === "build"), "desc"],
|
|
843
|
-
[(x) => x.name, "asc"],
|
|
844
|
-
),
|
|
845
|
-
)
|
|
846
|
-
})
|
|
847
|
-
|
|
848
|
-
const defaultInfo = Effect.fnUntraced(function* () {
|
|
849
|
-
const c = yield* config.get()
|
|
850
|
-
if (c.default_agent) {
|
|
851
|
-
const agent = agents[c.default_agent]
|
|
852
|
-
if (!agent) throw new Error(`default agent "${c.default_agent}" not found`)
|
|
853
|
-
if (agent.mode === "subagent") throw new Error(`default agent "${c.default_agent}" is a subagent`)
|
|
854
|
-
if (agent.hidden === true) throw new Error(`default agent "${c.default_agent}" is hidden`)
|
|
855
|
-
return agent
|
|
856
|
-
}
|
|
857
|
-
const visible = Object.values(agents).find((a) => a.mode !== "subagent" && a.hidden !== true)
|
|
858
|
-
if (!visible) throw new Error("no primary visible agent found")
|
|
859
|
-
return visible
|
|
860
|
-
})
|
|
861
|
-
|
|
862
|
-
const defaultAgent = Effect.fnUntraced(function* () {
|
|
863
|
-
return (yield* defaultInfo()).name
|
|
864
|
-
})
|
|
865
|
-
|
|
866
|
-
return {
|
|
867
|
-
get,
|
|
868
|
-
list,
|
|
869
|
-
defaultInfo,
|
|
870
|
-
defaultAgent,
|
|
871
|
-
} satisfies State
|
|
872
|
-
}),
|
|
873
|
-
)
|
|
874
|
-
|
|
875
|
-
return Service.of({
|
|
876
|
-
get: Effect.fn("Agent.get")(function* (agent: string) {
|
|
877
|
-
return yield* InstanceState.useEffect(state, (s) => s.get(agent))
|
|
878
|
-
}),
|
|
879
|
-
list: Effect.fn("Agent.list")(function* () {
|
|
880
|
-
return yield* InstanceState.useEffect(state, (s) => s.list())
|
|
881
|
-
}),
|
|
882
|
-
defaultInfo: Effect.fn("Agent.defaultInfo")(function* () {
|
|
883
|
-
return yield* InstanceState.useEffect(state, (s) => s.defaultInfo())
|
|
884
|
-
}),
|
|
885
|
-
defaultAgent: Effect.fn("Agent.defaultAgent")(function* () {
|
|
886
|
-
return yield* InstanceState.useEffect(state, (s) => s.defaultAgent())
|
|
887
|
-
}),
|
|
888
|
-
generate: Effect.fn("Agent.generate")(function* (input: {
|
|
889
|
-
description: string
|
|
890
|
-
model?: { providerID: ProviderV2.ID; modelID: ModelV2.ID }
|
|
891
|
-
}) {
|
|
892
|
-
const cfg = yield* config.get()
|
|
893
|
-
const model = input.model ?? (yield* provider.defaultModel())
|
|
894
|
-
const resolved = yield* provider.getModel(model.providerID, model.modelID)
|
|
895
|
-
const language = yield* provider.getLanguage(resolved)
|
|
896
|
-
const tracer = cfg.experimental?.openTelemetry
|
|
897
|
-
? Option.getOrUndefined(yield* Effect.serviceOption(OtelTracer.OtelTracer))
|
|
898
|
-
: undefined
|
|
899
|
-
|
|
900
|
-
const system = [PROMPT_GENERATE]
|
|
901
|
-
yield* plugin.trigger("experimental.chat.system.transform", { model: resolved }, { system })
|
|
902
|
-
const existing = yield* InstanceState.useEffect(state, (s) => s.list())
|
|
903
|
-
|
|
904
|
-
// TODO: clean this up so provider specific logic doesnt bleed over
|
|
905
|
-
const authInfo = yield* auth.get(model.providerID).pipe(Effect.orDie)
|
|
906
|
-
const isOpenaiOauth = model.providerID === "openai" && authInfo?.type === "oauth"
|
|
907
|
-
|
|
908
|
-
const params = {
|
|
909
|
-
experimental_telemetry: {
|
|
910
|
-
isEnabled: cfg.experimental?.openTelemetry,
|
|
911
|
-
tracer,
|
|
912
|
-
metadata: {
|
|
913
|
-
userId: cfg.username ?? "unknown",
|
|
914
|
-
},
|
|
915
|
-
},
|
|
916
|
-
temperature: 0.3,
|
|
917
|
-
messages: [
|
|
918
|
-
...(isOpenaiOauth
|
|
919
|
-
? []
|
|
920
|
-
: system.map(
|
|
921
|
-
(item): ModelMessage => ({
|
|
922
|
-
role: "system",
|
|
923
|
-
content: item,
|
|
924
|
-
}),
|
|
925
|
-
)),
|
|
926
|
-
{
|
|
927
|
-
role: "user",
|
|
928
|
-
content: `Create an agent configuration based on this request: "${input.description}".\n\nIMPORTANT: The following identifiers already exist and must NOT be used: ${existing.map((i) => i.name).join(", ")}\n Return ONLY the JSON object, no other text, do not wrap in backticks`,
|
|
929
|
-
},
|
|
930
|
-
],
|
|
931
|
-
model: language,
|
|
932
|
-
schema: Object.assign(
|
|
933
|
-
Schema.toStandardSchemaV1(GeneratedAgent),
|
|
934
|
-
Schema.toStandardJSONSchemaV1(GeneratedAgent),
|
|
935
|
-
),
|
|
936
|
-
} satisfies Parameters<typeof generateObject>[0]
|
|
937
|
-
|
|
938
|
-
if (isOpenaiOauth) {
|
|
939
|
-
return yield* Effect.promise(async () => {
|
|
940
|
-
const result = streamObject({
|
|
941
|
-
...params,
|
|
942
|
-
providerOptions: ProviderTransform.providerOptions(resolved, {
|
|
943
|
-
instructions: system.join("\n"),
|
|
944
|
-
store: false,
|
|
945
|
-
}),
|
|
946
|
-
onError: () => {},
|
|
947
|
-
})
|
|
948
|
-
for await (const part of result.fullStream) {
|
|
949
|
-
if (part.type === "error") throw part.error
|
|
950
|
-
}
|
|
951
|
-
return result.object
|
|
952
|
-
})
|
|
953
|
-
}
|
|
954
|
-
|
|
955
|
-
return yield* Effect.promise(() => generateObject(params).then((r) => r.object))
|
|
956
|
-
}),
|
|
957
|
-
})
|
|
958
|
-
}),
|
|
959
|
-
)
|
|
960
|
-
|
|
961
|
-
const locationServiceMapNode = LayerNode.make({
|
|
962
|
-
service: LocationServiceMap.Service,
|
|
963
|
-
layer: locationServiceMapLayer,
|
|
964
|
-
deps: [],
|
|
965
|
-
})
|
|
966
|
-
|
|
967
|
-
export const node = LayerNode.make({
|
|
968
|
-
service: Service,
|
|
969
|
-
layer: layer,
|
|
970
|
-
deps: [Config.node, Auth.node, Plugin.node, Skill.node, Provider.node, locationServiceMapNode],
|
|
971
|
-
})
|
|
972
|
-
|
|
973
|
-
export * as Agent from "./agent"
|