anymous 1.0.4 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/bin/anymous.cjs +45 -45
- package/package.json +1 -1
- package/{script/postinstall.mjs → postinstall.mjs} +5 -5
- package/src/account/account.ts +5 -5
- package/src/account/repo.ts +5 -5
- package/src/acp/agent.ts +2 -2
- package/src/acp/content.ts +1 -1
- package/src/acp/directory.ts +5 -5
- package/src/acp/event.ts +4 -4
- package/src/acp/permission.ts +2 -2
- package/src/acp/profile.ts +1 -1
- package/src/acp/service.ts +24 -24
- package/src/acp/session.ts +5 -5
- package/src/acp/usage.ts +11 -11
- package/src/agent/agent.ts +13 -13
- package/src/agent/prompt/debug-tools.txt +40 -40
- package/src/agent/prompt/exe-extractor.txt +39 -39
- package/src/agent/prompt/memory-dump.txt +37 -37
- package/src/agent/prompt/reverser-automator.txt +38 -38
- package/src/agent/prompt/reverser-binary.txt +39 -39
- package/src/agent/prompt/reverser-dynamic.txt +36 -36
- package/src/agent/prompt/reverser-source.txt +38 -38
- package/src/agent/prompt/reverser-static.txt +35 -35
- package/src/agent/subagent-permissions.ts +1 -1
- package/src/auth/index.ts +8 -8
- package/src/background/job.ts +3 -3
- package/src/cli/cmd/account.ts +1 -1
- package/src/cli/cmd/acp.ts +3 -3
- package/src/cli/cmd/agent.ts +2 -2
- package/src/cli/cmd/attach.ts +3 -3
- package/src/cli/cmd/db.ts +1 -1
- package/src/cli/cmd/debug/agent.handler.ts +2 -2
- package/src/cli/cmd/debug/file.ts +4 -4
- package/src/cli/cmd/debug/index.ts +5 -5
- package/src/cli/cmd/debug/ripgrep.ts +1 -1
- package/src/cli/cmd/debug/scrap.ts +2 -2
- package/src/cli/cmd/debug/v2.ts +4 -4
- package/src/cli/cmd/export.ts +1 -1
- package/src/cli/cmd/generate.ts +2 -2
- package/src/cli/cmd/github.handler.ts +27 -27
- package/src/cli/cmd/github.shared.ts +1 -1
- package/src/cli/cmd/import.ts +5 -5
- package/src/cli/cmd/mcp.ts +13 -13
- package/src/cli/cmd/models.ts +6 -6
- package/src/cli/cmd/plug.ts +2 -2
- package/src/cli/cmd/pr.ts +6 -6
- package/src/cli/cmd/prompt-display.ts +1 -1
- package/src/cli/cmd/providers.ts +12 -12
- package/src/cli/cmd/run/demo.ts +3 -3
- package/src/cli/cmd/run/footer.command.tsx +2 -2
- package/src/cli/cmd/run/footer.permission.tsx +3 -3
- package/src/cli/cmd/run/footer.prompt.tsx +9 -9
- package/src/cli/cmd/run/footer.question.tsx +1 -1
- package/src/cli/cmd/run/footer.subagent.tsx +3 -3
- package/src/cli/cmd/run/footer.ts +2 -2
- package/src/cli/cmd/run/footer.view.tsx +9 -9
- package/src/cli/cmd/run/permission.shared.ts +3 -3
- package/src/cli/cmd/run/question.shared.ts +1 -1
- package/src/cli/cmd/run/runtime.boot.ts +2 -2
- package/src/cli/cmd/run/runtime.lifecycle.ts +4 -4
- package/src/cli/cmd/run/runtime.ts +6 -6
- package/src/cli/cmd/run/session-data.ts +1 -1
- package/src/cli/cmd/run/session-replay.ts +1 -1
- package/src/cli/cmd/run/splash.ts +13 -5
- package/src/cli/cmd/run/stream.transport.ts +3 -3
- package/src/cli/cmd/run/subagent-data.ts +1 -1
- package/src/cli/cmd/run/theme.ts +2 -2
- package/src/cli/cmd/run/tool.ts +2 -2
- package/src/cli/cmd/run/trace.ts +4 -4
- package/src/cli/cmd/run/types.ts +13 -13
- package/src/cli/cmd/run/variant.shared.ts +5 -5
- package/src/cli/cmd/run.ts +22 -22
- package/src/cli/cmd/serve.ts +4 -4
- package/src/cli/cmd/session.ts +4 -4
- package/src/cli/cmd/stats.ts +2 -2
- package/src/cli/cmd/tui.ts +7 -7
- package/src/cli/cmd/uninstall.ts +21 -21
- package/src/cli/cmd/upgrade.ts +14 -14
- package/src/cli/cmd/web.ts +4 -4
- package/src/cli/error.ts +1 -1
- package/src/cli/heap.ts +3 -3
- package/src/cli/logo.ts +1 -1
- package/src/cli/network.ts +1 -1
- package/src/cli/tui/layer.ts +3 -3
- package/src/cli/tui/validate-session.ts +2 -2
- package/src/cli/ui.ts +12 -9
- package/src/cli/upgrade.ts +11 -11
- package/src/command/index.ts +3 -3
- package/src/command/template/initialize.txt +3 -3
- package/src/config/agent.ts +2 -2
- package/src/config/command.ts +3 -3
- package/src/config/config.ts +49 -49
- package/src/config/managed.ts +6 -6
- package/src/config/markdown.ts +2 -2
- package/src/config/parse.ts +2 -2
- package/src/config/paths.ts +7 -7
- package/src/config/plugin.ts +2 -2
- package/src/config/tui-host-attention.ts +2 -2
- package/src/config/tui-migrate.ts +12 -12
- package/src/config/tui.ts +23 -23
- package/src/config/variable.ts +1 -1
- package/src/control-plane/adapters/index.ts +1 -1
- package/src/control-plane/dev/README.md +5 -5
- package/src/control-plane/dev/debug-workspace-plugin.ts +2 -2
- package/src/control-plane/types.ts +3 -3
- package/src/control-plane/workspace-context.ts +1 -1
- package/src/control-plane/workspace.ts +17 -17
- package/src/effect/app-node-builder-v1.ts +2 -2
- package/src/effect/app-runtime.ts +9 -9
- package/src/effect/bootstrap-runtime.ts +4 -4
- package/src/effect/bridge.ts +1 -1
- package/src/effect/config-service.ts +3 -3
- package/src/effect/instance-ref.ts +3 -3
- package/src/effect/instance-state.ts +1 -1
- package/src/effect/run-service.ts +2 -2
- package/src/effect/runtime-flags.ts +34 -34
- package/src/env/index.ts +3 -3
- package/src/event-manifest.ts +1 -1
- package/src/event-v2-bridge.ts +7 -7
- package/src/format/formatter.ts +2 -2
- package/src/format/index.ts +4 -4
- package/src/git/index.ts +3 -3
- package/src/ide/index.ts +4 -4
- package/src/image/image.ts +4 -4
- package/src/index.ts +1 -1
- package/src/installation/index.ts +32 -32
- package/src/lsp/lsp.ts +5 -5
- package/src/lsp/server.ts +5 -5
- package/src/mcp/auth.ts +6 -6
- package/src/mcp/browser.ts +2 -2
- package/src/mcp/index.ts +17 -17
- package/src/mcp/oauth-callback.ts +1 -1
- package/src/mcp/oauth-provider.ts +2 -2
- package/src/node.ts +1 -1
- package/src/patch/index.ts +1 -1
- package/src/permission/index.ts +5 -5
- package/src/plugin/azure.ts +1 -1
- package/src/plugin/cloudflare.ts +1 -1
- package/src/plugin/digitalocean.ts +6 -6
- package/src/plugin/github-copilot/copilot.ts +7 -7
- package/src/plugin/github-copilot/models.ts +2 -2
- package/src/plugin/index.ts +7 -7
- package/src/plugin/install.ts +6 -6
- package/src/plugin/loader.ts +3 -3
- package/src/plugin/meta.ts +4 -4
- package/src/plugin/openai/README.md +1 -1
- package/src/plugin/openai/codex.ts +8 -8
- package/src/plugin/openai/ws-pool.ts +1 -1
- package/src/plugin/pty-environment.ts +1 -1
- package/src/plugin/shared.ts +7 -7
- package/src/plugin/snowflake-cortex.ts +6 -6
- package/src/plugin/tui/internal.ts +1 -1
- package/src/plugin/tui/runtime.ts +17 -17
- package/src/plugin/xai.ts +8 -8
- package/src/project/bootstrap-service.ts +1 -1
- package/src/project/bootstrap.ts +1 -1
- package/src/project/instance-context.ts +1 -1
- package/src/project/instance-store.ts +5 -5
- package/src/project/project.ts +18 -18
- package/src/project/vcs.ts +5 -5
- package/src/provider/auth.ts +6 -6
- package/src/provider/error.ts +3 -3
- package/src/provider/model-status.ts +1 -1
- package/src/provider/provider.ts +38 -38
- package/src/provider/transform.ts +4 -4
- package/src/question/index.ts +3 -3
- package/src/question/schema.ts +1 -1
- package/src/server/auth.ts +6 -6
- package/src/server/event.ts +1 -1
- package/src/server/mdns.ts +2 -2
- package/src/server/proxy-util.ts +2 -2
- package/src/server/routes/instance/httpapi/api.ts +10 -10
- package/src/server/routes/instance/httpapi/groups/config.ts +4 -4
- package/src/server/routes/instance/httpapi/groups/control-plane.ts +1 -1
- package/src/server/routes/instance/httpapi/groups/control.ts +1 -1
- package/src/server/routes/instance/httpapi/groups/experimental.ts +7 -7
- package/src/server/routes/instance/httpapi/groups/file.ts +3 -3
- package/src/server/routes/instance/httpapi/groups/global.ts +10 -10
- package/src/server/routes/instance/httpapi/groups/instance.ts +6 -6
- package/src/server/routes/instance/httpapi/groups/mcp.ts +2 -2
- package/src/server/routes/instance/httpapi/groups/permission.ts +2 -2
- package/src/server/routes/instance/httpapi/groups/project-copy.ts +1 -1
- package/src/server/routes/instance/httpapi/groups/project.ts +4 -4
- package/src/server/routes/instance/httpapi/groups/provider.ts +2 -2
- package/src/server/routes/instance/httpapi/groups/pty.ts +5 -5
- package/src/server/routes/instance/httpapi/groups/question.ts +1 -1
- package/src/server/routes/instance/httpapi/groups/session.ts +8 -8
- package/src/server/routes/instance/httpapi/groups/sync.ts +3 -3
- package/src/server/routes/instance/httpapi/groups/tui.ts +1 -1
- package/src/server/routes/instance/httpapi/groups/workspace.ts +1 -1
- package/src/server/routes/instance/httpapi/handlers/control-plane.ts +2 -2
- package/src/server/routes/instance/httpapi/handlers/control.ts +1 -1
- package/src/server/routes/instance/httpapi/handlers/event.ts +1 -1
- package/src/server/routes/instance/httpapi/handlers/file.ts +6 -6
- package/src/server/routes/instance/httpapi/handlers/global.ts +2 -2
- package/src/server/routes/instance/httpapi/handlers/instance.ts +1 -1
- package/src/server/routes/instance/httpapi/handlers/permission.ts +1 -1
- package/src/server/routes/instance/httpapi/handlers/project-copy.ts +2 -2
- package/src/server/routes/instance/httpapi/handlers/project.ts +1 -1
- package/src/server/routes/instance/httpapi/handlers/provider.ts +2 -2
- package/src/server/routes/instance/httpapi/handlers/pty.ts +9 -9
- package/src/server/routes/instance/httpapi/handlers/session.ts +3 -3
- package/src/server/routes/instance/httpapi/handlers/sync.ts +3 -3
- package/src/server/routes/instance/httpapi/middleware/authorization.ts +3 -3
- package/src/server/routes/instance/httpapi/middleware/error.ts +2 -2
- package/src/server/routes/instance/httpapi/middleware/fence.ts +3 -3
- package/src/server/routes/instance/httpapi/middleware/instance-context.ts +1 -1
- package/src/server/routes/instance/httpapi/middleware/schema-error.ts +1 -1
- package/src/server/routes/instance/httpapi/middleware/workspace-routing.ts +6 -6
- package/src/server/routes/instance/httpapi/public.ts +6 -6
- package/src/server/routes/instance/httpapi/server.ts +27 -27
- package/src/server/routes/instance/httpapi/websocket-tracker.ts +2 -2
- package/src/server/server.ts +3 -3
- package/src/server/shared/fence.ts +4 -4
- package/src/server/shared/pty-ticket.ts +1 -1
- package/src/server/shared/ui.ts +3 -3
- package/src/server/tui-event.ts +1 -1
- package/src/session/compaction.ts +9 -9
- package/src/session/instruction.ts +9 -9
- package/src/session/llm/AGENTS.md +12 -12
- package/src/session/llm/ai-sdk.ts +2 -2
- package/src/session/llm/native-request.ts +4 -4
- package/src/session/llm/native-runtime.ts +7 -7
- package/src/session/llm/request.ts +10 -10
- package/src/session/llm.ts +12 -12
- package/src/session/message-error.ts +1 -1
- package/src/session/message-v2.ts +7 -7
- package/src/session/message.ts +3 -3
- package/src/session/overflow.ts +2 -2
- package/src/session/processor.ts +6 -6
- package/src/session/prompt/anthropic.txt +2 -11
- package/src/session/prompt/beast.txt +147 -147
- package/src/session/prompt/codex.txt +1 -1
- package/src/session/prompt/copilot-gpt-5.txt +1 -1
- package/src/session/prompt/default.txt +1 -7
- package/src/session/prompt/gemini.txt +1 -1
- package/src/session/prompt/gpt.txt +1 -1
- package/src/session/prompt/kimi.txt +1 -1
- package/src/session/prompt/meta.txt +3 -4
- package/src/session/prompt/trinity.txt +1 -1
- package/src/session/prompt.ts +14 -14
- package/src/session/reminders.ts +2 -2
- package/src/session/retry.ts +5 -5
- package/src/session/revert.ts +3 -3
- package/src/session/run-state.ts +3 -3
- package/src/session/schema.ts +2 -2
- package/src/session/session.ts +22 -22
- package/src/session/status.ts +3 -3
- package/src/session/summary.ts +3 -3
- package/src/session/system.ts +7 -7
- package/src/session/todo.ts +5 -5
- package/src/session/tools.ts +3 -3
- package/src/share/session.ts +2 -2
- package/src/share/share-next.ts +11 -11
- package/src/skill/discovery.ts +7 -7
- package/src/skill/index.ts +21 -21
- package/src/snapshot/index.ts +7 -7
- package/src/storage/schema.ts +5 -5
- package/src/storage/storage.ts +5 -5
- package/src/sync/schema.ts +1 -1
- package/src/temporary.ts +4 -4
- package/src/tool/apply_patch.ts +3 -3
- package/src/tool/code-mode.ts +1 -1
- package/src/tool/edit.ts +3 -3
- package/src/tool/external-directory.ts +1 -1
- package/src/tool/glob.ts +2 -2
- package/src/tool/grep.ts +2 -2
- package/src/tool/lsp.ts +1 -1
- package/src/tool/lsp.txt +1 -1
- package/src/tool/plan.ts +1 -1
- package/src/tool/read.ts +2 -2
- package/src/tool/registry.ts +13 -13
- package/src/tool/schema.ts +1 -1
- package/src/tool/shell/id.ts +1 -1
- package/src/tool/shell/prompt.ts +2 -2
- package/src/tool/shell.ts +2 -2
- package/src/tool/skill.ts +1 -1
- package/src/tool/task.ts +3 -3
- package/src/tool/tool.ts +2 -2
- package/src/tool/truncate.ts +4 -4
- package/src/tool/truncation-dir.ts +1 -1
- package/src/tool/webfetch.ts +1 -1
- package/src/tool/websearch.ts +4 -4
- package/src/tool/write.ts +3 -3
- package/src/util/bom.ts +1 -1
- package/src/util/error.ts +1 -1
- package/src/util/filesystem.ts +2 -2
- package/src/util/locale.ts +2 -2
- package/src/util/process.ts +1 -1
- package/src/util/record.ts +1 -1
- package/src/util/repository.ts +2 -2
- package/src/util/token.ts +1 -1
- package/src/worktree/index.ts +12 -12
|
@@ -66,7 +66,7 @@ export const InstanceApi = HttpApi.make("instance")
|
|
|
66
66
|
OpenApi.annotations({
|
|
67
67
|
identifier: "instance.dispose",
|
|
68
68
|
summary: "Dispose instance",
|
|
69
|
-
description: "Clean up and dispose the current
|
|
69
|
+
description: "Clean up and dispose the current anymous instance, releasing all resources.",
|
|
70
70
|
}),
|
|
71
71
|
),
|
|
72
72
|
HttpApiEndpoint.get("path", InstancePaths.path, {
|
|
@@ -77,7 +77,7 @@ export const InstanceApi = HttpApi.make("instance")
|
|
|
77
77
|
identifier: "path.get",
|
|
78
78
|
summary: "Get paths",
|
|
79
79
|
description:
|
|
80
|
-
"Retrieve the current working directory and related path information for the
|
|
80
|
+
"Retrieve the current working directory and related path information for the anymous instance.",
|
|
81
81
|
}),
|
|
82
82
|
),
|
|
83
83
|
HttpApiEndpoint.get("vcs", InstancePaths.vcs, {
|
|
@@ -143,7 +143,7 @@ export const InstanceApi = HttpApi.make("instance")
|
|
|
143
143
|
OpenApi.annotations({
|
|
144
144
|
identifier: "command.list",
|
|
145
145
|
summary: "List commands",
|
|
146
|
-
description: "Get a list of all available commands in the
|
|
146
|
+
description: "Get a list of all available commands in the anymous system.",
|
|
147
147
|
}),
|
|
148
148
|
),
|
|
149
149
|
HttpApiEndpoint.get("agent", InstancePaths.agent, {
|
|
@@ -153,7 +153,7 @@ export const InstanceApi = HttpApi.make("instance")
|
|
|
153
153
|
OpenApi.annotations({
|
|
154
154
|
identifier: "app.agents",
|
|
155
155
|
summary: "List agents",
|
|
156
|
-
description: "Get a list of all available AI agents in the
|
|
156
|
+
description: "Get a list of all available AI agents in the anymous system.",
|
|
157
157
|
}),
|
|
158
158
|
),
|
|
159
159
|
HttpApiEndpoint.get("skill", InstancePaths.skill, {
|
|
@@ -163,7 +163,7 @@ export const InstanceApi = HttpApi.make("instance")
|
|
|
163
163
|
OpenApi.annotations({
|
|
164
164
|
identifier: "app.skills",
|
|
165
165
|
summary: "List skills",
|
|
166
|
-
description: "Get a list of all available skills in the
|
|
166
|
+
description: "Get a list of all available skills in the anymous system.",
|
|
167
167
|
}),
|
|
168
168
|
),
|
|
169
169
|
HttpApiEndpoint.get("lsp", InstancePaths.lsp, {
|
|
@@ -199,7 +199,7 @@ export const InstanceApi = HttpApi.make("instance")
|
|
|
199
199
|
)
|
|
200
200
|
.annotateMerge(
|
|
201
201
|
OpenApi.annotations({
|
|
202
|
-
title: "
|
|
202
|
+
title: "anymous experimental HttpApi",
|
|
203
203
|
version: "0.0.1",
|
|
204
204
|
description: "Experimental HttpApi surface for selected instance routes.",
|
|
205
205
|
}),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MCP } from "@/mcp"
|
|
2
|
-
import { ConfigMCPV1 } from "@
|
|
2
|
+
import { ConfigMCPV1 } from "@anymous-ai/core/v1/config/mcp"
|
|
3
3
|
import { Schema } from "effect"
|
|
4
4
|
import { HttpApi, HttpApiEndpoint, HttpApiError, HttpApiGroup, OpenApi } from "effect/unstable/httpapi"
|
|
5
5
|
import { McpServerNotFoundError } from "../errors"
|
|
@@ -149,7 +149,7 @@ export const McpApi = HttpApi.make("mcp")
|
|
|
149
149
|
)
|
|
150
150
|
.annotateMerge(
|
|
151
151
|
OpenApi.annotations({
|
|
152
|
-
title: "
|
|
152
|
+
title: "anymous experimental HttpApi",
|
|
153
153
|
version: "0.0.1",
|
|
154
154
|
description: "Experimental HttpApi surface for selected instance routes.",
|
|
155
155
|
}),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PermissionV1 } from "@
|
|
1
|
+
import { PermissionV1 } from "@anymous-ai/core/v1/permission"
|
|
2
2
|
import { Permission } from "@/permission"
|
|
3
3
|
import { Schema } from "effect"
|
|
4
4
|
import { HttpApi, HttpApiEndpoint, HttpApiError, HttpApiGroup, OpenApi } from "effect/unstable/httpapi"
|
|
@@ -54,7 +54,7 @@ export const PermissionApi = HttpApi.make("permission")
|
|
|
54
54
|
)
|
|
55
55
|
.annotateMerge(
|
|
56
56
|
OpenApi.annotations({
|
|
57
|
-
title: "
|
|
57
|
+
title: "anymous experimental HttpApi",
|
|
58
58
|
version: "0.0.1",
|
|
59
59
|
description: "Experimental HttpApi surface for selected instance routes.",
|
|
60
60
|
}),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ProjectV2 } from "@
|
|
1
|
+
import { ProjectV2 } from "@anymous-ai/core/project"
|
|
2
2
|
import { Schema } from "effect"
|
|
3
3
|
import { HttpApi, HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/unstable/httpapi"
|
|
4
4
|
import { Authorization } from "../middleware/authorization"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Project } from "@/project/project"
|
|
2
|
-
import { ProjectV2 } from "@
|
|
2
|
+
import { ProjectV2 } from "@anymous-ai/core/project"
|
|
3
3
|
import { Schema } from "effect"
|
|
4
4
|
import { HttpApi, HttpApiEndpoint, HttpApiError, HttpApiGroup, OpenApi } from "effect/unstable/httpapi"
|
|
5
5
|
import { ProjectNotFoundError } from "../errors"
|
|
@@ -26,7 +26,7 @@ export const ProjectApi = HttpApi.make("project")
|
|
|
26
26
|
OpenApi.annotations({
|
|
27
27
|
identifier: "project.list",
|
|
28
28
|
summary: "List all projects",
|
|
29
|
-
description: "Get a list of projects that have been opened with
|
|
29
|
+
description: "Get a list of projects that have been opened with anymous.",
|
|
30
30
|
}),
|
|
31
31
|
),
|
|
32
32
|
HttpApiEndpoint.get("current", `${root}/current`, {
|
|
@@ -36,7 +36,7 @@ export const ProjectApi = HttpApi.make("project")
|
|
|
36
36
|
OpenApi.annotations({
|
|
37
37
|
identifier: "project.current",
|
|
38
38
|
summary: "Get current project",
|
|
39
|
-
description: "Retrieve the currently active project that
|
|
39
|
+
description: "Retrieve the currently active project that anymous is working with.",
|
|
40
40
|
}),
|
|
41
41
|
),
|
|
42
42
|
HttpApiEndpoint.post("initGit", `${root}/git/init`, {
|
|
@@ -86,7 +86,7 @@ export const ProjectApi = HttpApi.make("project")
|
|
|
86
86
|
)
|
|
87
87
|
.annotateMerge(
|
|
88
88
|
OpenApi.annotations({
|
|
89
|
-
title: "
|
|
89
|
+
title: "anymous experimental HttpApi",
|
|
90
90
|
version: "0.0.1",
|
|
91
91
|
description: "Experimental HttpApi surface for selected instance routes.",
|
|
92
92
|
}),
|
|
@@ -7,7 +7,7 @@ import { Authorization } from "../middleware/authorization"
|
|
|
7
7
|
import { InstanceContextMiddleware } from "../middleware/instance-context"
|
|
8
8
|
import { WorkspaceRoutingMiddleware, WorkspaceRoutingQuery } from "../middleware/workspace-routing"
|
|
9
9
|
import { described } from "./metadata"
|
|
10
|
-
import { ProviderV2 } from "@
|
|
10
|
+
import { ProviderV2 } from "@anymous-ai/core/provider"
|
|
11
11
|
|
|
12
12
|
const root = "/provider"
|
|
13
13
|
|
|
@@ -94,7 +94,7 @@ export const ProviderApi = HttpApi.make("provider")
|
|
|
94
94
|
)
|
|
95
95
|
.annotateMerge(
|
|
96
96
|
OpenApi.annotations({
|
|
97
|
-
title: "
|
|
97
|
+
title: "anymous experimental HttpApi",
|
|
98
98
|
version: "0.0.1",
|
|
99
99
|
description: "Experimental HttpApi surface for selected instance routes.",
|
|
100
100
|
}),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Pty } from "@
|
|
2
|
-
import { PtyTicket } from "@
|
|
3
|
-
import { PtyID } from "@
|
|
1
|
+
import { Pty } from "@anymous-ai/core/pty"
|
|
2
|
+
import { PtyTicket } from "@anymous-ai/core/pty/ticket"
|
|
3
|
+
import { PtyID } from "@anymous-ai/core/pty/schema"
|
|
4
4
|
import { PTY_CONNECT_TICKET_QUERY } from "@/server/shared/pty-ticket"
|
|
5
5
|
import { Schema } from "effect"
|
|
6
6
|
import { HttpApi, HttpApiEndpoint, HttpApiError, HttpApiGroup, OpenApi } from "effect/unstable/httpapi"
|
|
@@ -58,7 +58,7 @@ export const PtyApi = HttpApi.make("pty")
|
|
|
58
58
|
OpenApi.annotations({
|
|
59
59
|
identifier: "pty.list",
|
|
60
60
|
summary: "List PTY sessions",
|
|
61
|
-
description: "Get a list of all active pseudo-terminal (PTY) sessions managed by
|
|
61
|
+
description: "Get a list of all active pseudo-terminal (PTY) sessions managed by anymous.",
|
|
62
62
|
}),
|
|
63
63
|
),
|
|
64
64
|
HttpApiEndpoint.post("create", PtyPaths.create, {
|
|
@@ -130,7 +130,7 @@ export const PtyApi = HttpApi.make("pty")
|
|
|
130
130
|
)
|
|
131
131
|
.annotateMerge(
|
|
132
132
|
OpenApi.annotations({
|
|
133
|
-
title: "
|
|
133
|
+
title: "anymous experimental HttpApi",
|
|
134
134
|
version: "0.0.1",
|
|
135
135
|
description: "Experimental HttpApi surface for selected instance routes.",
|
|
136
136
|
}),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { PermissionV1 } from "@
|
|
1
|
+
import { PermissionV1 } from "@anymous-ai/core/v1/permission"
|
|
2
2
|
import { Permission } from "@/permission"
|
|
3
|
-
import { SessionV1 } from "@
|
|
3
|
+
import { SessionV1 } from "@anymous-ai/core/v1/session"
|
|
4
4
|
|
|
5
5
|
import { Session } from "@/session/session"
|
|
6
6
|
import { MessageV2 } from "@/session/message-v2"
|
|
@@ -23,8 +23,8 @@ import {
|
|
|
23
23
|
import { ApiNotFoundError, PermissionNotFoundError, SessionBusyError } from "../errors"
|
|
24
24
|
import { described } from "./metadata"
|
|
25
25
|
import { QueryBoolean } from "./query"
|
|
26
|
-
import { ProviderV2 } from "@
|
|
27
|
-
import { ModelV2 } from "@
|
|
26
|
+
import { ProviderV2 } from "@anymous-ai/core/provider"
|
|
27
|
+
import { ModelV2 } from "@anymous-ai/core/model"
|
|
28
28
|
|
|
29
29
|
const root = "/session"
|
|
30
30
|
export const ListQuery = Schema.Struct({
|
|
@@ -115,7 +115,7 @@ export const SessionApi = HttpApi.make("session")
|
|
|
115
115
|
OpenApi.annotations({
|
|
116
116
|
identifier: "session.list",
|
|
117
117
|
summary: "List sessions",
|
|
118
|
-
description: "Get a list of all
|
|
118
|
+
description: "Get a list of all anymous sessions, sorted by most recently updated.",
|
|
119
119
|
}),
|
|
120
120
|
),
|
|
121
121
|
HttpApiEndpoint.get("status", SessionPaths.status, {
|
|
@@ -138,7 +138,7 @@ export const SessionApi = HttpApi.make("session")
|
|
|
138
138
|
OpenApi.annotations({
|
|
139
139
|
identifier: "session.get",
|
|
140
140
|
summary: "Get session",
|
|
141
|
-
description: "Retrieve detailed information about a specific
|
|
141
|
+
description: "Retrieve detailed information about a specific anymous session.",
|
|
142
142
|
}),
|
|
143
143
|
),
|
|
144
144
|
HttpApiEndpoint.get("children", SessionPaths.children, {
|
|
@@ -209,7 +209,7 @@ export const SessionApi = HttpApi.make("session")
|
|
|
209
209
|
OpenApi.annotations({
|
|
210
210
|
identifier: "session.create",
|
|
211
211
|
summary: "Create session",
|
|
212
|
-
description: "Create a new
|
|
212
|
+
description: "Create a new anymous session for interacting with AI assistants and managing conversations.",
|
|
213
213
|
}),
|
|
214
214
|
),
|
|
215
215
|
HttpApiEndpoint.delete("remove", SessionPaths.remove, {
|
|
@@ -455,7 +455,7 @@ export const SessionApi = HttpApi.make("session")
|
|
|
455
455
|
)
|
|
456
456
|
.annotateMerge(
|
|
457
457
|
OpenApi.annotations({
|
|
458
|
-
title: "
|
|
458
|
+
title: "anymous experimental HttpApi",
|
|
459
459
|
version: "0.0.1",
|
|
460
460
|
description: "Experimental HttpApi surface for selected instance routes.",
|
|
461
461
|
}),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { NonNegativeInt } from "@
|
|
2
|
-
import { EventV2 } from "@
|
|
1
|
+
import { NonNegativeInt } from "@anymous-ai/core/schema"
|
|
2
|
+
import { EventV2 } from "@anymous-ai/core/event"
|
|
3
3
|
import { SessionID } from "@/session/schema"
|
|
4
4
|
import { Schema } from "effect"
|
|
5
5
|
import { HttpApi, HttpApiEndpoint, HttpApiError, HttpApiGroup, OpenApi } from "effect/unstable/httpapi"
|
|
@@ -106,7 +106,7 @@ export const SyncApi = HttpApi.make("sync")
|
|
|
106
106
|
)
|
|
107
107
|
.annotateMerge(
|
|
108
108
|
OpenApi.annotations({
|
|
109
|
-
title: "
|
|
109
|
+
title: "anymous experimental HttpApi",
|
|
110
110
|
version: "0.0.1",
|
|
111
111
|
description: "Experimental HttpApi surface for selected instance routes.",
|
|
112
112
|
}),
|
|
@@ -201,7 +201,7 @@ export const TuiApi = HttpApi.make("tui")
|
|
|
201
201
|
)
|
|
202
202
|
.annotateMerge(
|
|
203
203
|
OpenApi.annotations({
|
|
204
|
-
title: "
|
|
204
|
+
title: "anymous experimental HttpApi",
|
|
205
205
|
version: "0.0.1",
|
|
206
206
|
description: "Experimental HttpApi surface for selected instance routes.",
|
|
207
207
|
}),
|
|
@@ -134,7 +134,7 @@ export const WorkspaceApi = HttpApi.make("workspace")
|
|
|
134
134
|
)
|
|
135
135
|
.annotateMerge(
|
|
136
136
|
OpenApi.annotations({
|
|
137
|
-
title: "
|
|
137
|
+
title: "anymous experimental HttpApi",
|
|
138
138
|
version: "0.0.1",
|
|
139
139
|
description: "Experimental HttpApi surface for selected instance routes.",
|
|
140
140
|
}),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { MoveSession } from "@
|
|
2
|
-
import { SessionV2 } from "@
|
|
1
|
+
import { MoveSession } from "@anymous-ai/core/control-plane/move-session"
|
|
2
|
+
import { SessionV2 } from "@anymous-ai/core/session"
|
|
3
3
|
import { Effect } from "effect"
|
|
4
4
|
import { HttpApiBuilder } from "effect/unstable/httpapi"
|
|
5
5
|
import { RootHttpApi } from "../api"
|
|
@@ -4,7 +4,7 @@ import { Effect } from "effect"
|
|
|
4
4
|
import { HttpApiBuilder } from "effect/unstable/httpapi"
|
|
5
5
|
import { RootHttpApi } from "../api"
|
|
6
6
|
import { LogInput } from "../groups/control"
|
|
7
|
-
import { ProviderV2 } from "@
|
|
7
|
+
import { ProviderV2 } from "@anymous-ai/core/provider"
|
|
8
8
|
|
|
9
9
|
export const controlHandlers = HttpApiBuilder.group(RootHttpApi, "control", (handlers) =>
|
|
10
10
|
Effect.gen(function* () {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EventV2Bridge } from "@/event-v2-bridge"
|
|
2
2
|
import { InstanceState } from "@/effect/instance-state"
|
|
3
3
|
import { GlobalBus } from "@/bus/global"
|
|
4
|
-
import { EventV2 } from "@
|
|
4
|
+
import { EventV2 } from "@anymous-ai/core/event"
|
|
5
5
|
import { Effect, Queue } from "effect"
|
|
6
6
|
import * as Stream from "effect/Stream"
|
|
7
7
|
import { HttpServerResponse } from "effect/unstable/http"
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as InstanceState from "@/effect/instance-state"
|
|
2
|
-
import { FileSystem } from "@
|
|
3
|
-
import { LocationServiceMap, locationServiceMapLayer } from "@
|
|
4
|
-
import { Ripgrep } from "@
|
|
5
|
-
import { FSUtil } from "@
|
|
6
|
-
import { Location } from "@
|
|
7
|
-
import { AbsolutePath, RelativePath } from "@
|
|
2
|
+
import { FileSystem } from "@anymous-ai/core/filesystem"
|
|
3
|
+
import { LocationServiceMap, locationServiceMapLayer } from "@anymous-ai/core/location-services"
|
|
4
|
+
import { Ripgrep } from "@anymous-ai/core/ripgrep"
|
|
5
|
+
import { FSUtil } from "@anymous-ai/core/fs-util"
|
|
6
|
+
import { Location } from "@anymous-ai/core/location"
|
|
7
|
+
import { AbsolutePath, RelativePath } from "@anymous-ai/core/schema"
|
|
8
8
|
import { Effect, Layer, Option } from "effect"
|
|
9
9
|
import ignore from "ignore"
|
|
10
10
|
import path from "path"
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Config } from "@/config/config"
|
|
2
2
|
import { GlobalBus, type GlobalEvent as GlobalBusEvent } from "@/bus/global"
|
|
3
3
|
import { EffectBridge } from "@/effect/bridge"
|
|
4
|
-
import { EventV2 } from "@
|
|
4
|
+
import { EventV2 } from "@anymous-ai/core/event"
|
|
5
5
|
import { Installation } from "@/installation"
|
|
6
6
|
import { disposeAllInstancesAndEmitGlobalDisposed } from "@/server/global-lifecycle"
|
|
7
|
-
import { InstallationVersion } from "@
|
|
7
|
+
import { InstallationVersion } from "@anymous-ai/core/installation/version"
|
|
8
8
|
import { Effect, Queue, Schema } from "effect"
|
|
9
9
|
import * as Stream from "effect/Stream"
|
|
10
10
|
import { HttpServerRequest, HttpServerResponse } from "effect/unstable/http"
|
|
@@ -2,7 +2,7 @@ import { Agent } from "@/agent/agent"
|
|
|
2
2
|
import { Command } from "@/command"
|
|
3
3
|
import * as InstanceState from "@/effect/instance-state"
|
|
4
4
|
import { Format } from "@/format"
|
|
5
|
-
import { Global } from "@
|
|
5
|
+
import { Global } from "@anymous-ai/core/global"
|
|
6
6
|
import { LSP } from "@/lsp/lsp"
|
|
7
7
|
import { Vcs } from "@/project/vcs"
|
|
8
8
|
import { Skill } from "@/skill"
|
|
@@ -2,8 +2,8 @@ import { Agent } from "@/agent/agent"
|
|
|
2
2
|
import { Provider } from "@/provider/provider"
|
|
3
3
|
import { LLM } from "@/session/llm"
|
|
4
4
|
import { MessageID, SessionID } from "@/session/schema"
|
|
5
|
-
import { Slug } from "@
|
|
6
|
-
import { LLMEvent } from "@
|
|
5
|
+
import { Slug } from "@anymous-ai/core/util/slug"
|
|
6
|
+
import { LLMEvent } from "@anymous-ai/llm"
|
|
7
7
|
import { Effect, Stream } from "effect"
|
|
8
8
|
import { HttpApiBuilder } from "effect/unstable/httpapi"
|
|
9
9
|
import { InstanceHttpApi } from "../api"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as InstanceState from "@/effect/instance-state"
|
|
2
2
|
import { Project } from "@/project/project"
|
|
3
|
-
import { ProjectV2 } from "@
|
|
3
|
+
import { ProjectV2 } from "@anymous-ai/core/project"
|
|
4
4
|
import { Effect } from "effect"
|
|
5
5
|
import { HttpApiBuilder } from "effect/unstable/httpapi"
|
|
6
6
|
import { InstanceHttpApi } from "../api"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ProviderAuth } from "@/provider/auth"
|
|
2
2
|
import { Config } from "@/config/config"
|
|
3
|
-
import { ModelsDev } from "@
|
|
3
|
+
import { ModelsDev } from "@anymous-ai/core/models-dev"
|
|
4
4
|
import { Provider } from "@/provider/provider"
|
|
5
5
|
|
|
6
6
|
import { mapValues } from "remeda"
|
|
@@ -9,7 +9,7 @@ import { HttpServerRequest, HttpServerResponse } from "effect/unstable/http"
|
|
|
9
9
|
import { HttpApiBuilder } from "effect/unstable/httpapi"
|
|
10
10
|
import { InstanceHttpApi } from "../api"
|
|
11
11
|
import { ProviderAuthApiError } from "../groups/provider"
|
|
12
|
-
import { ProviderV2 } from "@
|
|
12
|
+
import { ProviderV2 } from "@anymous-ai/core/provider"
|
|
13
13
|
|
|
14
14
|
function mapProviderAuthError<A, R>(self: Effect.Effect<A, ProviderAuth.Error, R>) {
|
|
15
15
|
return self.pipe(
|
|
@@ -2,15 +2,15 @@ import * as InstanceState from "@/effect/instance-state"
|
|
|
2
2
|
import { registerDisposer } from "@/effect/instance-registry"
|
|
3
3
|
import { InstanceRef, WorkspaceRef } from "@/effect/instance-ref"
|
|
4
4
|
import { Plugin } from "@/plugin"
|
|
5
|
-
import { Pty } from "@
|
|
6
|
-
import { PtyProtocol } from "@
|
|
7
|
-
import { PtyID } from "@
|
|
8
|
-
import { PtyTicket } from "@
|
|
9
|
-
import { LocationServiceMap, locationServiceMapLayer } from "@
|
|
10
|
-
import { Location } from "@
|
|
11
|
-
import { AbsolutePath } from "@
|
|
12
|
-
import { Shell } from "@
|
|
13
|
-
import { CorsConfig, isAllowedRequestOrigin, type CorsOptions } from "@
|
|
5
|
+
import { Pty } from "@anymous-ai/core/pty"
|
|
6
|
+
import { PtyProtocol } from "@anymous-ai/core/pty/protocol"
|
|
7
|
+
import { PtyID } from "@anymous-ai/core/pty/schema"
|
|
8
|
+
import { PtyTicket } from "@anymous-ai/core/pty/ticket"
|
|
9
|
+
import { LocationServiceMap, locationServiceMapLayer } from "@anymous-ai/core/location-services"
|
|
10
|
+
import { Location } from "@anymous-ai/core/location"
|
|
11
|
+
import { AbsolutePath } from "@anymous-ai/core/schema"
|
|
12
|
+
import { Shell } from "@anymous-ai/core/shell"
|
|
13
|
+
import { CorsConfig, isAllowedRequestOrigin, type CorsOptions } from "@anymous-ai/server/cors"
|
|
14
14
|
import {
|
|
15
15
|
PTY_CONNECT_TICKET_QUERY,
|
|
16
16
|
PTY_CONNECT_TOKEN_HEADER,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { PermissionV1 } from "@
|
|
1
|
+
import { PermissionV1 } from "@anymous-ai/core/v1/permission"
|
|
2
2
|
import { Agent } from "@/agent/agent"
|
|
3
|
-
import { SessionV1 } from "@
|
|
3
|
+
import { SessionV1 } from "@anymous-ai/core/v1/session"
|
|
4
4
|
import { EventV2Bridge } from "@/event-v2-bridge"
|
|
5
5
|
import { Command } from "@/command"
|
|
6
6
|
import { Permission } from "@/permission"
|
|
@@ -15,7 +15,7 @@ import { SessionStatus } from "@/session/status"
|
|
|
15
15
|
import { SessionSummary } from "@/session/summary"
|
|
16
16
|
import { Todo } from "@/session/todo"
|
|
17
17
|
import { MessageID, PartID, SessionID } from "@/session/schema"
|
|
18
|
-
import { NamedError } from "@
|
|
18
|
+
import { NamedError } from "@anymous-ai/core/util/error"
|
|
19
19
|
import { Cause, Effect, Option, Schema, Scope } from "effect"
|
|
20
20
|
import * as Stream from "effect/Stream"
|
|
21
21
|
import { InstanceState } from "@/effect/instance-state"
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Workspace } from "@/control-plane/workspace"
|
|
2
2
|
import * as InstanceState from "@/effect/instance-state"
|
|
3
3
|
import { Session } from "@/session/session"
|
|
4
|
-
import { Database } from "@
|
|
5
|
-
import { EventV2 } from "@
|
|
4
|
+
import { Database } from "@anymous-ai/core/database/database"
|
|
5
|
+
import { EventV2 } from "@anymous-ai/core/event"
|
|
6
6
|
import { EventV2Bridge } from "@/event-v2-bridge"
|
|
7
|
-
import { EventTable } from "@
|
|
7
|
+
import { EventTable } from "@anymous-ai/core/event/sql"
|
|
8
8
|
import { asc } from "drizzle-orm"
|
|
9
9
|
import { and } from "drizzle-orm"
|
|
10
10
|
import { eq } from "drizzle-orm"
|
|
@@ -7,7 +7,7 @@ import { isPublicUIPath } from "@/server/shared/public-ui"
|
|
|
7
7
|
export {
|
|
8
8
|
Authorization as ServerAuthorization,
|
|
9
9
|
authorizationLayer as serverAuthorizationLayer,
|
|
10
|
-
} from "@
|
|
10
|
+
} from "@anymous-ai/server/middleware/authorization"
|
|
11
11
|
|
|
12
12
|
const AUTH_TOKEN_QUERY = "auth_token"
|
|
13
13
|
const UNAUTHORIZED = 401
|
|
@@ -17,14 +17,14 @@ const WWW_AUTHENTICATE = 'Basic realm="Secure Area"'
|
|
|
17
17
|
// full handler, so a downstream failure can make the next auth alternative run
|
|
18
18
|
// and remap an authorized NotFound into Unauthorized.
|
|
19
19
|
export class Authorization extends HttpApiMiddleware.Service<Authorization>()(
|
|
20
|
-
"@
|
|
20
|
+
"@anymous/ExperimentalHttpApiAuthorization",
|
|
21
21
|
{
|
|
22
22
|
error: HttpApiError.UnauthorizedNoContent,
|
|
23
23
|
},
|
|
24
24
|
) {}
|
|
25
25
|
|
|
26
26
|
export class PtyConnectAuthorization extends HttpApiMiddleware.Service<PtyConnectAuthorization>()(
|
|
27
|
-
"@
|
|
27
|
+
"@anymous/ExperimentalHttpApiPtyConnectAuthorization",
|
|
28
28
|
{
|
|
29
29
|
error: HttpApiError.UnauthorizedNoContent,
|
|
30
30
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { NamedError } from "@
|
|
2
|
-
import { ConfigErrorV1 } from "@
|
|
1
|
+
import { NamedError } from "@anymous-ai/core/util/error"
|
|
2
|
+
import { ConfigErrorV1 } from "@anymous-ai/core/v1/config/error"
|
|
3
3
|
import { Cause, Effect } from "effect"
|
|
4
4
|
import { HttpRouter, HttpServerError, HttpServerRespondable, HttpServerResponse } from "effect/unstable/http"
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Flag } from "@
|
|
2
|
-
import { Database } from "@
|
|
1
|
+
import { Flag } from "@anymous-ai/core/flag/flag"
|
|
2
|
+
import { Database } from "@anymous-ai/core/database/database"
|
|
3
3
|
import { Effect } from "effect"
|
|
4
4
|
import { HttpRouter, HttpServerRequest, HttpServerResponse } from "effect/unstable/http"
|
|
5
5
|
import * as Fence from "@/server/shared/fence"
|
|
@@ -12,7 +12,7 @@ export const fenceLayer = HttpRouter.middleware<{ requires: Database.Service; ha
|
|
|
12
12
|
return (effect) =>
|
|
13
13
|
Effect.gen(function* () {
|
|
14
14
|
const request = yield* HttpServerRequest.HttpServerRequest
|
|
15
|
-
if (!Flag.
|
|
15
|
+
if (!Flag.ANYMOUS_WORKSPACE_ID || ignoredMethods.has(request.method)) return yield* effect
|
|
16
16
|
|
|
17
17
|
const previous = yield* Fence.load(db)
|
|
18
18
|
const response = yield* effect
|
|
@@ -10,7 +10,7 @@ export class InstanceContextMiddleware extends HttpApiMiddleware.Service<
|
|
|
10
10
|
{
|
|
11
11
|
requires: WorkspaceRouteContext
|
|
12
12
|
}
|
|
13
|
-
>()("@
|
|
13
|
+
>()("@anymous/ExperimentalHttpApiInstanceContext") {}
|
|
14
14
|
|
|
15
15
|
function decode(input: string): string {
|
|
16
16
|
try {
|
|
@@ -16,7 +16,7 @@ function truncateReason(reason: string) {
|
|
|
16
16
|
// Default Respondable returns an empty 400 body. Match the NamedError shape
|
|
17
17
|
// used by other 4xx/5xx so the SDK's `wrapClientError` extracts `.data.message`.
|
|
18
18
|
export class SchemaErrorMiddleware extends HttpApiMiddleware.Service<SchemaErrorMiddleware>()(
|
|
19
|
-
"@
|
|
19
|
+
"@anymous/HttpApiSchemaError",
|
|
20
20
|
{
|
|
21
21
|
error: InvalidRequestError,
|
|
22
22
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WorkspaceV2 } from "@
|
|
1
|
+
import { WorkspaceV2 } from "@anymous-ai/core/workspace"
|
|
2
2
|
import type { Target } from "@/control-plane/types"
|
|
3
3
|
import { Workspace } from "@/control-plane/workspace"
|
|
4
4
|
import { WorkspaceAdapterRuntime } from "@/control-plane/workspace-adapter-runtime"
|
|
@@ -7,7 +7,7 @@ import { HttpApiProxy } from "./proxy"
|
|
|
7
7
|
import * as Fence from "@/server/shared/fence"
|
|
8
8
|
import { getWorkspaceRouteSessionID, isLocalWorkspaceRoute, workspaceProxyURL } from "@/server/shared/workspace-routing"
|
|
9
9
|
import { NotFoundError } from "@/storage/storage"
|
|
10
|
-
import { Flag } from "@
|
|
10
|
+
import { Flag } from "@anymous-ai/core/flag/flag"
|
|
11
11
|
import { Context, Data, Effect, Layer, Option, Schema } from "effect"
|
|
12
12
|
import { HttpClient, HttpServerRequest, HttpServerResponse } from "effect/unstable/http"
|
|
13
13
|
import { HttpApiMiddleware } from "effect/unstable/httpapi"
|
|
@@ -48,7 +48,7 @@ export class WorkspaceRouteContext extends Context.Service<
|
|
|
48
48
|
readonly directory: string
|
|
49
49
|
readonly workspaceID?: WorkspaceV2.ID
|
|
50
50
|
}
|
|
51
|
-
>()("@
|
|
51
|
+
>()("@anymous/ExperimentalHttpApiWorkspaceRouteContext") {}
|
|
52
52
|
|
|
53
53
|
export class WorkspaceRoutingMiddleware extends HttpApiMiddleware.Service<
|
|
54
54
|
WorkspaceRoutingMiddleware,
|
|
@@ -56,14 +56,14 @@ export class WorkspaceRoutingMiddleware extends HttpApiMiddleware.Service<
|
|
|
56
56
|
provides: WorkspaceRouteContext
|
|
57
57
|
requires: Session.Service
|
|
58
58
|
}
|
|
59
|
-
>()("@
|
|
59
|
+
>()("@anymous/ExperimentalHttpApiWorkspaceRouting") {}
|
|
60
60
|
|
|
61
61
|
function requestURL(request: HttpServerRequest.HttpServerRequest): URL {
|
|
62
62
|
return new URL(request.url, "http://localhost")
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
function configuredWorkspaceID(): WorkspaceV2.ID | undefined {
|
|
66
|
-
return Flag.
|
|
66
|
+
return Flag.ANYMOUS_WORKSPACE_ID ? WorkspaceV2.ID.make(Flag.ANYMOUS_WORKSPACE_ID) : undefined
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
function selectedWorkspaceID(url: URL, sessionWorkspaceID?: WorkspaceV2.ID): WorkspaceV2.ID | undefined {
|
|
@@ -84,7 +84,7 @@ function selectedV2WorkspaceID(
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
function defaultDirectory(request: HttpServerRequest.HttpServerRequest, url: URL): string {
|
|
87
|
-
return url.searchParams.get("directory") || request.headers["x-
|
|
87
|
+
return url.searchParams.get("directory") || request.headers["x-anymous-directory"] || process.cwd()
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
function shouldStayOnControlPlane(request: HttpServerRequest.HttpServerRequest, url: URL): boolean {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OpenApi } from "effect/unstable/httpapi"
|
|
2
|
-
import {
|
|
2
|
+
import { anymousHttpApi } from "./api"
|
|
3
3
|
import { QueryBooleanOpenApi } from "./groups/query"
|
|
4
4
|
|
|
5
5
|
type OpenApiParameter = {
|
|
@@ -75,7 +75,7 @@ const QueryParameterSchemas: Record<string, OpenApiSchema> = {
|
|
|
75
75
|
|
|
76
76
|
const LegacyComponentDescriptions: Record<string, string> = {
|
|
77
77
|
LogLevel: "Log level",
|
|
78
|
-
ServerConfig: "Server configuration for
|
|
78
|
+
ServerConfig: "Server configuration for anymous serve and web commands",
|
|
79
79
|
LayoutConfig: "@deprecated Always uses stretch layout.",
|
|
80
80
|
}
|
|
81
81
|
|
|
@@ -449,7 +449,7 @@ function fixSelfReferencingComponents(spec: OpenApiSpec) {
|
|
|
449
449
|
}
|
|
450
450
|
}
|
|
451
451
|
// Simplest fix: generate the raw spec (without transform) to get correct schemas
|
|
452
|
-
const raw: OpenApiSpec = OpenApi.fromApi(
|
|
452
|
+
const raw: OpenApiSpec = OpenApi.fromApi(anymousHttpApi)
|
|
453
453
|
const rawSchemas = raw.components?.schemas
|
|
454
454
|
if (!rawSchemas) return
|
|
455
455
|
for (const name of selfRefs) {
|
|
@@ -527,11 +527,11 @@ function normalizeParameter(param: OpenApiParameter, route: string) {
|
|
|
527
527
|
param.schema = stripOptionalNull(param.schema)
|
|
528
528
|
}
|
|
529
529
|
|
|
530
|
-
export const PublicApi =
|
|
530
|
+
export const PublicApi = anymousHttpApi.annotateMerge(
|
|
531
531
|
OpenApi.annotations({
|
|
532
|
-
title: "
|
|
532
|
+
title: "anymous",
|
|
533
533
|
version: "1.0.0",
|
|
534
|
-
description: "
|
|
534
|
+
description: "anymous api",
|
|
535
535
|
transform: matchLegacyOpenApi,
|
|
536
536
|
}),
|
|
537
537
|
)
|