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
package/src/image/image.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { LayerNode } from "@
|
|
1
|
+
import { LayerNode } from "@anymous-ai/core/effect/layer-node"
|
|
2
2
|
import { Config } from "@/config/config"
|
|
3
|
-
import { SessionV1 } from "@
|
|
3
|
+
import { SessionV1 } from "@anymous-ai/core/v1/session"
|
|
4
4
|
import type { MessageV2 } from "@/session/message-v2"
|
|
5
5
|
import photonWasm from "@silvia-odwyer/photon-node/photon_rs_bg.wasm" with { type: "file" }
|
|
6
6
|
import { Context, Effect, Layer, Schema } from "effect"
|
|
@@ -54,7 +54,7 @@ export interface Interface {
|
|
|
54
54
|
readonly normalize: (input: SessionV1.FilePart) => Effect.Effect<SessionV1.FilePart, Error>
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
export class Service extends Context.Service<Service, Interface>()("@
|
|
57
|
+
export class Service extends Context.Service<Service, Interface>()("@anymous/Image") {}
|
|
58
58
|
|
|
59
59
|
const layer = Layer.effect(
|
|
60
60
|
Service,
|
|
@@ -63,7 +63,7 @@ const layer = Layer.effect(
|
|
|
63
63
|
const loadPhoton = yield* Effect.cached(
|
|
64
64
|
Effect.sync(() => {
|
|
65
65
|
// Patched photon-node reads this during module init so Bun compiled binaries use the embedded wasm path.
|
|
66
|
-
;(globalThis as typeof globalThis & {
|
|
66
|
+
;(globalThis as typeof globalThis & { __ANYMOUS_PHOTON_WASM_PATH?: string }).__ANYMOUS_PHOTON_WASM_PATH =
|
|
67
67
|
path.isAbsolute(photonWasm) ? photonWasm : fileURLToPath(new URL(photonWasm, import.meta.url))
|
|
68
68
|
}).pipe(
|
|
69
69
|
Effect.andThen(() => Effect.tryPromise(() => import("@silvia-odwyer/photon-node"))),
|
package/src/index.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { UpgradeCommand } from "./cli/cmd/upgrade"
|
|
|
9
9
|
import { UninstallCommand } from "./cli/cmd/uninstall"
|
|
10
10
|
import { ModelsCommand } from "./cli/cmd/models"
|
|
11
11
|
import { UI } from "./cli/ui"
|
|
12
|
-
import { InstallationVersion } from "@
|
|
12
|
+
import { InstallationVersion } from "@anymous-ai/core/installation/version"
|
|
13
13
|
import { FormatError } from "./cli/error"
|
|
14
14
|
import { ServeCommand } from "./cli/cmd/serve"
|
|
15
15
|
import { DebugCommand } from "./cli/cmd/debug"
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { LayerNode } from "@
|
|
2
|
-
import { AppNodeBuilder } from "@
|
|
3
|
-
import { httpClient } from "@
|
|
1
|
+
import { LayerNode } from "@anymous-ai/core/effect/layer-node"
|
|
2
|
+
import { AppNodeBuilder } from "@anymous-ai/core/effect/app-node-builder"
|
|
3
|
+
import { httpClient } from "@anymous-ai/core/effect/app-node-platform"
|
|
4
4
|
import { Effect, Layer, Schema, Context, Stream } from "effect"
|
|
5
|
-
import { serviceUse } from "@
|
|
5
|
+
import { serviceUse } from "@anymous-ai/core/effect/service-use"
|
|
6
6
|
import { HttpClient, HttpClientRequest, HttpClientResponse } from "effect/unstable/http"
|
|
7
7
|
import { withTransientReadRetry } from "@/util/effect-http-client"
|
|
8
8
|
import { errorMessage } from "@/util/error"
|
|
9
9
|
import { ChildProcess } from "effect/unstable/process"
|
|
10
|
-
import { AppProcess } from "@
|
|
10
|
+
import { AppProcess } from "@anymous-ai/core/process"
|
|
11
11
|
import path from "path"
|
|
12
|
-
import { makeRuntime } from "@
|
|
12
|
+
import { makeRuntime } from "@anymous-ai/core/effect/runtime"
|
|
13
13
|
import semver from "semver"
|
|
14
|
-
import { InstallationChannel, InstallationVersion } from "@
|
|
15
|
-
import { NpmConfig } from "@
|
|
16
|
-
import { InstallationEvent } from "@
|
|
14
|
+
import { InstallationChannel, InstallationVersion } from "@anymous-ai/core/installation/version"
|
|
15
|
+
import { NpmConfig } from "@anymous-ai/core/npm-config"
|
|
16
|
+
import { InstallationEvent } from "@anymous-ai/schema/installation-event"
|
|
17
17
|
|
|
18
18
|
export type Method = "curl" | "npm" | "yarn" | "pnpm" | "bun" | "brew" | "scoop" | "choco" | "unknown"
|
|
19
19
|
|
|
@@ -39,7 +39,7 @@ export const Info = Schema.Struct({
|
|
|
39
39
|
export type Info = Schema.Schema.Type<typeof Info>
|
|
40
40
|
|
|
41
41
|
export function userAgent(client = "cli") {
|
|
42
|
-
return `
|
|
42
|
+
return `anymous/${InstallationChannel}/${InstallationVersion}/${client}`
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
export const USER_AGENT = userAgent()
|
|
@@ -79,7 +79,7 @@ export interface Interface {
|
|
|
79
79
|
readonly upgrade: (method: Method, target: string) => Effect.Effect<void, UpgradeFailedError>
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
export class Service extends Context.Service<Service, Interface>()("@
|
|
82
|
+
export class Service extends Context.Service<Service, Interface>()("@anymous/Installation") {}
|
|
83
83
|
|
|
84
84
|
export const use = serviceUse(Service)
|
|
85
85
|
|
|
@@ -123,11 +123,11 @@ const layer: Layer.Layer<Service, never, HttpClient.HttpClient | AppProcess.Serv
|
|
|
123
123
|
)
|
|
124
124
|
|
|
125
125
|
const getBrewFormula = Effect.fnUntraced(function* () {
|
|
126
|
-
const tapFormula = yield* text(["brew", "list", "--formula", "anomalyco/tap/
|
|
127
|
-
if (tapFormula.includes("
|
|
128
|
-
const coreFormula = yield* text(["brew", "list", "--formula", "
|
|
129
|
-
if (coreFormula.includes("
|
|
130
|
-
return "
|
|
126
|
+
const tapFormula = yield* text(["brew", "list", "--formula", "anomalyco/tap/anymous"])
|
|
127
|
+
if (tapFormula.includes("anymous")) return "anomalyco/tap/anymous"
|
|
128
|
+
const coreFormula = yield* text(["brew", "list", "--formula", "anymous"])
|
|
129
|
+
if (coreFormula.includes("anymous")) return "anymous"
|
|
130
|
+
return "anymous"
|
|
131
131
|
})
|
|
132
132
|
|
|
133
133
|
const upgradeFailure = (method: Method, result?: { code: number; stdout: string; stderr: string }) => {
|
|
@@ -144,7 +144,7 @@ const layer: Layer.Layer<Service, never, HttpClient.HttpClient | AppProcess.Serv
|
|
|
144
144
|
|
|
145
145
|
const upgradeCurl = Effect.fnUntraced(
|
|
146
146
|
function* (target: string) {
|
|
147
|
-
const response = yield* httpOk.execute(HttpClientRequest.get("https://
|
|
147
|
+
const response = yield* httpOk.execute(HttpClientRequest.get("https://anymous-cli.vercel.app/install"))
|
|
148
148
|
const body = yield* response.text
|
|
149
149
|
const bodyBytes = new TextEncoder().encode(body)
|
|
150
150
|
const shell = yield* upgradeScriptShell()
|
|
@@ -172,7 +172,7 @@ const layer: Layer.Layer<Service, never, HttpClient.HttpClient | AppProcess.Serv
|
|
|
172
172
|
}
|
|
173
173
|
}),
|
|
174
174
|
method: Effect.fn("Installation.method")(function* () {
|
|
175
|
-
if (process.execPath.includes(path.join(".
|
|
175
|
+
if (process.execPath.includes(path.join(".anymous", "bin"))) return "curl" as Method
|
|
176
176
|
if (process.execPath.includes(path.join(".local", "bin"))) return "curl" as Method
|
|
177
177
|
const exec = process.execPath.toLowerCase()
|
|
178
178
|
|
|
@@ -181,9 +181,9 @@ const layer: Layer.Layer<Service, never, HttpClient.HttpClient | AppProcess.Serv
|
|
|
181
181
|
{ name: "yarn", command: () => text(["yarn", "global", "list"]) },
|
|
182
182
|
{ name: "pnpm", command: () => text(["pnpm", "list", "-g", "--depth=0"]) },
|
|
183
183
|
{ name: "bun", command: () => text(["bun", "pm", "ls", "-g"]) },
|
|
184
|
-
{ name: "brew", command: () => text(["brew", "list", "--formula", "
|
|
185
|
-
{ name: "scoop", command: () => text(["scoop", "list", "
|
|
186
|
-
{ name: "choco", command: () => text(["choco", "list", "--limit-output", "
|
|
184
|
+
{ name: "brew", command: () => text(["brew", "list", "--formula", "anymous"]) },
|
|
185
|
+
{ name: "scoop", command: () => text(["scoop", "list", "anymous"]) },
|
|
186
|
+
{ name: "choco", command: () => text(["choco", "list", "--limit-output", "anymous"]) },
|
|
187
187
|
]
|
|
188
188
|
|
|
189
189
|
checks.sort((a, b) => {
|
|
@@ -197,7 +197,7 @@ const layer: Layer.Layer<Service, never, HttpClient.HttpClient | AppProcess.Serv
|
|
|
197
197
|
for (const check of checks) {
|
|
198
198
|
const output = yield* check.command()
|
|
199
199
|
const installedName =
|
|
200
|
-
check.name === "brew" || check.name === "choco" || check.name === "scoop" ? "
|
|
200
|
+
check.name === "brew" || check.name === "choco" || check.name === "scoop" ? "anymous" : "anymous-ai"
|
|
201
201
|
if (output.includes(installedName)) {
|
|
202
202
|
return check.name
|
|
203
203
|
}
|
|
@@ -216,7 +216,7 @@ const layer: Layer.Layer<Service, never, HttpClient.HttpClient | AppProcess.Serv
|
|
|
216
216
|
return info.formulae[0].versions.stable
|
|
217
217
|
}
|
|
218
218
|
const response = yield* httpOk.execute(
|
|
219
|
-
HttpClientRequest.get("https://
|
|
219
|
+
HttpClientRequest.get("https://").pipe(
|
|
220
220
|
HttpClientRequest.acceptJson,
|
|
221
221
|
),
|
|
222
222
|
)
|
|
@@ -227,7 +227,7 @@ const layer: Layer.Layer<Service, never, HttpClient.HttpClient | AppProcess.Serv
|
|
|
227
227
|
if (detectedMethod === "npm" || detectedMethod === "bun" || detectedMethod === "pnpm") {
|
|
228
228
|
const response = yield* httpOk.execute(
|
|
229
229
|
HttpClientRequest.get(
|
|
230
|
-
`${yield* NpmConfig.registry(process.cwd())}/
|
|
230
|
+
`${yield* NpmConfig.registry(process.cwd())}/anymous-ai/${InstallationChannel}`,
|
|
231
231
|
).pipe(HttpClientRequest.acceptJson),
|
|
232
232
|
)
|
|
233
233
|
const data = yield* HttpClientResponse.schemaBodyJson(NpmPackage)(response)
|
|
@@ -237,7 +237,7 @@ const layer: Layer.Layer<Service, never, HttpClient.HttpClient | AppProcess.Serv
|
|
|
237
237
|
if (detectedMethod === "choco") {
|
|
238
238
|
const response = yield* httpOk.execute(
|
|
239
239
|
HttpClientRequest.get(
|
|
240
|
-
"https://community.chocolatey.org/api/v2/Packages?$filter=Id%20eq%20%
|
|
240
|
+
"https://community.chocolatey.org/api/v2/Packages?$filter=Id%20eq%20%27anymous%27%20and%20IsLatestVersion&$select=Version",
|
|
241
241
|
).pipe(HttpClientRequest.setHeaders({ Accept: "application/json;odata=verbose" })),
|
|
242
242
|
)
|
|
243
243
|
const data = yield* HttpClientResponse.schemaBodyJson(ChocoPackage)(response)
|
|
@@ -247,7 +247,7 @@ const layer: Layer.Layer<Service, never, HttpClient.HttpClient | AppProcess.Serv
|
|
|
247
247
|
if (detectedMethod === "scoop") {
|
|
248
248
|
const response = yield* httpOk.execute(
|
|
249
249
|
HttpClientRequest.get(
|
|
250
|
-
"https://raw.githubusercontent.com/ScoopInstaller/Main/master/bucket/
|
|
250
|
+
"https://raw.githubusercontent.com/ScoopInstaller/Main/master/bucket/anymous.json",
|
|
251
251
|
).pipe(HttpClientRequest.setHeaders({ Accept: "application/json" })),
|
|
252
252
|
)
|
|
253
253
|
const data = yield* HttpClientResponse.schemaBodyJson(ScoopManifest)(response)
|
|
@@ -255,7 +255,7 @@ const layer: Layer.Layer<Service, never, HttpClient.HttpClient | AppProcess.Serv
|
|
|
255
255
|
}
|
|
256
256
|
|
|
257
257
|
const response = yield* httpOk.execute(
|
|
258
|
-
HttpClientRequest.get("https://api.github.com/repos/
|
|
258
|
+
HttpClientRequest.get("https://api.github.com/repos/anymousdark/anymous/releases/latest").pipe(
|
|
259
259
|
HttpClientRequest.acceptJson,
|
|
260
260
|
),
|
|
261
261
|
)
|
|
@@ -269,13 +269,13 @@ const layer: Layer.Layer<Service, never, HttpClient.HttpClient | AppProcess.Serv
|
|
|
269
269
|
upgradeResult = yield* upgradeCurl(target)
|
|
270
270
|
break
|
|
271
271
|
case "npm":
|
|
272
|
-
upgradeResult = yield* run(["npm", "install", "-g", `
|
|
272
|
+
upgradeResult = yield* run(["npm", "install", "-g", `anymous-ai@${target}`])
|
|
273
273
|
break
|
|
274
274
|
case "pnpm":
|
|
275
|
-
upgradeResult = yield* run(["pnpm", "install", "-g", `
|
|
275
|
+
upgradeResult = yield* run(["pnpm", "install", "-g", `anymous-ai@${target}`])
|
|
276
276
|
break
|
|
277
277
|
case "bun":
|
|
278
|
-
upgradeResult = yield* run(["bun", "install", "-g", `
|
|
278
|
+
upgradeResult = yield* run(["bun", "install", "-g", `anymous-ai@${target}`])
|
|
279
279
|
break
|
|
280
280
|
case "brew": {
|
|
281
281
|
const formula = yield* getBrewFormula()
|
|
@@ -300,10 +300,10 @@ const layer: Layer.Layer<Service, never, HttpClient.HttpClient | AppProcess.Serv
|
|
|
300
300
|
break
|
|
301
301
|
}
|
|
302
302
|
case "choco":
|
|
303
|
-
upgradeResult = yield* run(["choco", "upgrade", "
|
|
303
|
+
upgradeResult = yield* run(["choco", "upgrade", "anymous", `--version=${target}`, "-y"])
|
|
304
304
|
break
|
|
305
305
|
case "scoop":
|
|
306
|
-
upgradeResult = yield* run(["scoop", "install", `
|
|
306
|
+
upgradeResult = yield* run(["scoop", "install", `anymous@${target}`])
|
|
307
307
|
break
|
|
308
308
|
default:
|
|
309
309
|
return yield* new UpgradeFailedError({ stderr: `Unknown installation method: ${m}` })
|
package/src/lsp/lsp.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { LayerNode } from "@
|
|
2
|
-
import { FSUtil } from "@
|
|
1
|
+
import { LayerNode } from "@anymous-ai/core/effect/layer-node"
|
|
2
|
+
import { FSUtil } from "@anymous-ai/core/fs-util"
|
|
3
3
|
import { EventV2Bridge } from "@/event-v2-bridge"
|
|
4
4
|
import * as LSPClient from "./client"
|
|
5
5
|
import path from "path"
|
|
@@ -11,9 +11,9 @@ import { spawn as lspspawn } from "./launch"
|
|
|
11
11
|
import { Effect, Layer, Context, Schema } from "effect"
|
|
12
12
|
import { InstanceState } from "@/effect/instance-state"
|
|
13
13
|
import { containsPath } from "@/project/instance-context"
|
|
14
|
-
import { NonNegativeInt } from "@
|
|
14
|
+
import { NonNegativeInt } from "@anymous-ai/core/schema"
|
|
15
15
|
import { RuntimeFlags } from "@/effect/runtime-flags"
|
|
16
|
-
import { LspEvent } from "@
|
|
16
|
+
import { LspEvent } from "@anymous-ai/schema/lsp-event"
|
|
17
17
|
|
|
18
18
|
export const Event = LspEvent
|
|
19
19
|
|
|
@@ -133,7 +133,7 @@ export interface Interface {
|
|
|
133
133
|
readonly outgoingCalls: (input: LocInput) => Effect.Effect<any[]>
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
export class Service extends Context.Service<Service, Interface>()("@
|
|
136
|
+
export class Service extends Context.Service<Service, Interface>()("@anymous/LSP") {}
|
|
137
137
|
|
|
138
138
|
const layer = Layer.effect(
|
|
139
139
|
Service,
|
package/src/lsp/server.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import type { ChildProcessWithoutNullStreams } from "child_process"
|
|
2
2
|
import path from "path"
|
|
3
3
|
import os from "os"
|
|
4
|
-
import { Global } from "@
|
|
4
|
+
import { Global } from "@anymous-ai/core/global"
|
|
5
5
|
import { text } from "node:stream/consumers"
|
|
6
6
|
import fs from "fs/promises"
|
|
7
7
|
import { Filesystem } from "@/util/filesystem"
|
|
8
8
|
import type { InstanceContext } from "../project/instance-context"
|
|
9
9
|
import { Archive } from "@/util/archive"
|
|
10
10
|
import { Process } from "@/util/process"
|
|
11
|
-
import { which } from "@
|
|
12
|
-
import { Module } from "@
|
|
11
|
+
import { which } from "@anymous-ai/core/util/which"
|
|
12
|
+
import { Module } from "@anymous-ai/core/util/module"
|
|
13
13
|
import { spawn } from "./launch"
|
|
14
|
-
import { Npm } from "@
|
|
14
|
+
import { Npm } from "@anymous-ai/core/npm"
|
|
15
15
|
import type { RuntimeFlags } from "@/effect/runtime-flags"
|
|
16
16
|
|
|
17
17
|
const pathExists = async (p: string) =>
|
|
@@ -1243,7 +1243,7 @@ export const JDTLS: Info = {
|
|
|
1243
1243
|
}
|
|
1244
1244
|
})(),
|
|
1245
1245
|
)
|
|
1246
|
-
const dataDir = await fs.mkdtemp(path.join(os.tmpdir(), "
|
|
1246
|
+
const dataDir = await fs.mkdtemp(path.join(os.tmpdir(), "anymous-jdtls-data"))
|
|
1247
1247
|
return {
|
|
1248
1248
|
process: spawn(
|
|
1249
1249
|
java,
|
package/src/mcp/auth.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { LayerNode } from "@
|
|
1
|
+
import { LayerNode } from "@anymous-ai/core/effect/layer-node"
|
|
2
2
|
import path from "path"
|
|
3
|
-
import { serviceUse } from "@
|
|
4
|
-
import { Global } from "@
|
|
3
|
+
import { serviceUse } from "@anymous-ai/core/effect/service-use"
|
|
4
|
+
import { Global } from "@anymous-ai/core/global"
|
|
5
5
|
import { Effect, Layer, Context, Option, Schema } from "effect"
|
|
6
|
-
import { FSUtil } from "@
|
|
7
|
-
import { EffectFlock } from "@
|
|
6
|
+
import { FSUtil } from "@anymous-ai/core/fs-util"
|
|
7
|
+
import { EffectFlock } from "@anymous-ai/core/util/effect-flock"
|
|
8
8
|
|
|
9
9
|
export const Tokens = Schema.Struct({
|
|
10
10
|
accessToken: Schema.mutableKey(Schema.String),
|
|
@@ -52,7 +52,7 @@ export interface Interface {
|
|
|
52
52
|
readonly clearOAuthState: (mcpName: string) => Effect.Effect<void>
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
export class Service extends Context.Service<Service, Interface>()("@
|
|
55
|
+
export class Service extends Context.Service<Service, Interface>()("@anymous/McpAuth") {}
|
|
56
56
|
|
|
57
57
|
export const use = serviceUse(Service)
|
|
58
58
|
|
package/src/mcp/browser.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LayerNode } from "@
|
|
1
|
+
import { LayerNode } from "@anymous-ai/core/effect/layer-node"
|
|
2
2
|
import { Context, Effect, Layer } from "effect"
|
|
3
3
|
import open from "open"
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@ export interface Interface {
|
|
|
6
6
|
readonly open: (url: string) => Effect.Effect<void, Error>
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
export class Service extends Context.Service<Service, Interface>()("@
|
|
9
|
+
export class Service extends Context.Service<Service, Interface>()("@anymous/McpBrowser") {}
|
|
10
10
|
|
|
11
11
|
const layer = Layer.succeed(
|
|
12
12
|
Service,
|
package/src/mcp/index.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import path from "node:path"
|
|
2
2
|
import { pathToFileURL } from "node:url"
|
|
3
|
-
import { LayerNode } from "@
|
|
4
|
-
import { ConfigV1 } from "@
|
|
5
|
-
import { serviceUse } from "@
|
|
3
|
+
import { LayerNode } from "@anymous-ai/core/effect/layer-node"
|
|
4
|
+
import { ConfigV1 } from "@anymous-ai/core/v1/config/config"
|
|
5
|
+
import { serviceUse } from "@anymous-ai/core/effect/service-use"
|
|
6
6
|
import { Client, type ClientOptions } from "@modelcontextprotocol/sdk/client/index.js"
|
|
7
7
|
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
|
|
8
8
|
import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js"
|
|
@@ -16,11 +16,11 @@ import {
|
|
|
16
16
|
ToolListChangedNotificationSchema,
|
|
17
17
|
} from "@modelcontextprotocol/sdk/types.js"
|
|
18
18
|
import { Config } from "@/config/config"
|
|
19
|
-
import { ConfigMCPV1 } from "@
|
|
20
|
-
import { NamedError } from "@
|
|
21
|
-
import { InstallationVersion } from "@
|
|
19
|
+
import { ConfigMCPV1 } from "@anymous-ai/core/v1/config/mcp"
|
|
20
|
+
import { NamedError } from "@anymous-ai/core/util/error"
|
|
21
|
+
import { InstallationVersion } from "@anymous-ai/core/installation/version"
|
|
22
22
|
import { withTimeout } from "@/util/timeout"
|
|
23
|
-
import { FSUtil } from "@
|
|
23
|
+
import { FSUtil } from "@anymous-ai/core/fs-util"
|
|
24
24
|
import { McpOAuthPendingProvider, McpOAuthProvider, OAUTH_CALLBACK_PATH } from "./oauth-provider"
|
|
25
25
|
import { McpOAuthCallback } from "./oauth-callback"
|
|
26
26
|
import { McpAuth } from "./auth"
|
|
@@ -30,21 +30,21 @@ import { Cause, Effect, Exit, Layer, Context, Schema, Stream } from "effect"
|
|
|
30
30
|
import { EffectBridge } from "@/effect/bridge"
|
|
31
31
|
import { InstanceState } from "@/effect/instance-state"
|
|
32
32
|
import { ChildProcess, ChildProcessSpawner } from "effect/unstable/process"
|
|
33
|
-
import { CrossSpawnSpawner } from "@
|
|
33
|
+
import { CrossSpawnSpawner } from "@anymous-ai/core/cross-spawn-spawner"
|
|
34
34
|
import { McpCatalog } from "./catalog"
|
|
35
|
-
import { McpEvent } from "@
|
|
35
|
+
import { McpEvent } from "@anymous-ai/schema/mcp-event"
|
|
36
36
|
import { McpBrowser } from "./browser"
|
|
37
37
|
|
|
38
38
|
const DEFAULT_TIMEOUT = 30_000
|
|
39
39
|
const CLIENT_OPTIONS = {
|
|
40
40
|
capabilities: {
|
|
41
|
-
// https://github.com/
|
|
41
|
+
// https://github.com/anymousdark/anymous/issues/11948
|
|
42
42
|
// sampling: {},
|
|
43
|
-
// https://github.com/
|
|
43
|
+
// https://github.com/anymousdark/anymous/issues/23066
|
|
44
44
|
// elicitation: {},
|
|
45
|
-
// https://github.com/
|
|
45
|
+
// https://github.com/anymousdark/anymous/issues/2308
|
|
46
46
|
roots: {},
|
|
47
|
-
// https://github.com/
|
|
47
|
+
// https://github.com/anymousdark/anymous/issues/28567
|
|
48
48
|
// tasks: {},
|
|
49
49
|
},
|
|
50
50
|
} satisfies ClientOptions
|
|
@@ -73,7 +73,7 @@ export class NotFoundError extends Schema.TaggedErrorClass<NotFoundError>()("MCP
|
|
|
73
73
|
type MCPClient = Client
|
|
74
74
|
|
|
75
75
|
function createClient(directory: string) {
|
|
76
|
-
const client = new Client({ name: "
|
|
76
|
+
const client = new Client({ name: "anymous", version: InstallationVersion }, CLIENT_OPTIONS)
|
|
77
77
|
client.setRequestHandler(ListRootsRequestSchema, () =>
|
|
78
78
|
Promise.resolve({ roots: [{ uri: pathToFileURL(directory).href }] }),
|
|
79
79
|
)
|
|
@@ -197,7 +197,7 @@ export interface Interface {
|
|
|
197
197
|
readonly getAuthStatus: (mcpName: string) => Effect.Effect<AuthStatus>
|
|
198
198
|
}
|
|
199
199
|
|
|
200
|
-
export class Service extends Context.Service<Service, Interface>()("@
|
|
200
|
+
export class Service extends Context.Service<Service, Interface>()("@anymous/MCP") {}
|
|
201
201
|
|
|
202
202
|
export const use = serviceUse(Service)
|
|
203
203
|
|
|
@@ -314,7 +314,7 @@ const layer = Layer.effect(
|
|
|
314
314
|
return events
|
|
315
315
|
.publish(TuiEvent.ToastShow, {
|
|
316
316
|
title: "MCP Authentication Required",
|
|
317
|
-
message: `Server "${key}" requires authentication. Run:
|
|
317
|
+
message: `Server "${key}" requires authentication. Run: anymous mcp auth ${key}`,
|
|
318
318
|
variant: "warning",
|
|
319
319
|
duration: 8000,
|
|
320
320
|
})
|
|
@@ -351,7 +351,7 @@ const layer = Layer.effect(
|
|
|
351
351
|
cwd,
|
|
352
352
|
env: {
|
|
353
353
|
...process.env,
|
|
354
|
-
...(cmd === "
|
|
354
|
+
...(cmd === "anymous" ? { BUN_BE_BUN: "1" } : {}),
|
|
355
355
|
...mcp.environment,
|
|
356
356
|
},
|
|
357
357
|
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createConnection } from "net"
|
|
2
2
|
import { createServer } from "http"
|
|
3
|
-
import { OauthCallbackPage } from "@
|
|
3
|
+
import { OauthCallbackPage } from "@anymous-ai/core/oauth/page"
|
|
4
4
|
import { OAUTH_CALLBACK_PORT, OAUTH_CALLBACK_PATH, parseRedirectUri } from "./oauth-provider"
|
|
5
5
|
|
|
6
6
|
const OAUTH_CALLBACK_HOST = "127.0.0.1"
|
|
@@ -43,8 +43,8 @@ export class McpOAuthProvider implements OAuthClientProvider {
|
|
|
43
43
|
get clientMetadata(): OAuthClientMetadata {
|
|
44
44
|
return {
|
|
45
45
|
redirect_uris: [this.redirectUrl],
|
|
46
|
-
client_name: "
|
|
47
|
-
client_uri: "https://
|
|
46
|
+
client_name: "anymous",
|
|
47
|
+
client_uri: "https://anymous-cli.vercel.app",
|
|
48
48
|
grant_types: ["authorization_code", "refresh_token"],
|
|
49
49
|
response_types: ["code"],
|
|
50
50
|
token_endpoint_auth_method: this.config.clientSecret ? "client_secret_post" : "none",
|
package/src/node.ts
CHANGED
package/src/patch/index.ts
CHANGED
package/src/permission/index.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { LayerNode } from "@
|
|
2
|
-
import { ConfigPermissionV1 } from "@
|
|
1
|
+
import { LayerNode } from "@anymous-ai/core/effect/layer-node"
|
|
2
|
+
import { ConfigPermissionV1 } from "@anymous-ai/core/v1/config/permission"
|
|
3
3
|
import { InstanceState } from "@/effect/instance-state"
|
|
4
|
-
import { Wildcard } from "@
|
|
4
|
+
import { Wildcard } from "@anymous-ai/core/util/wildcard"
|
|
5
5
|
import { Deferred, Effect, Layer, Context } from "effect"
|
|
6
6
|
import os from "os"
|
|
7
|
-
import { PermissionV1 } from "@
|
|
7
|
+
import { PermissionV1 } from "@anymous-ai/core/v1/permission"
|
|
8
8
|
import { EventV2Bridge } from "@/event-v2-bridge"
|
|
9
9
|
|
|
10
10
|
export const Event = PermissionV1.Event
|
|
@@ -41,7 +41,7 @@ export function evaluate(permission: string, pattern: string, ...rulesets: Permi
|
|
|
41
41
|
)
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
export class Service extends Context.Service<Service, Interface>()("@
|
|
44
|
+
export class Service extends Context.Service<Service, Interface>()("@anymous/Permission") {}
|
|
45
45
|
|
|
46
46
|
const layer = Layer.effect(
|
|
47
47
|
Service,
|
package/src/plugin/azure.ts
CHANGED
package/src/plugin/cloudflare.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Hooks, PluginInput } from "@
|
|
2
|
-
import type { Model } from "@
|
|
3
|
-
import { InstallationVersion } from "@
|
|
4
|
-
import { OauthCallbackPage } from "@
|
|
1
|
+
import type { Hooks, PluginInput } from "@anymous-ai/plugin"
|
|
2
|
+
import type { Model } from "@anymous-ai/sdk/v2"
|
|
3
|
+
import { InstallationVersion } from "@anymous-ai/core/installation/version"
|
|
4
|
+
import { OauthCallbackPage } from "@anymous-ai/core/oauth/page"
|
|
5
5
|
import { createServer } from "http"
|
|
6
6
|
import open from "open"
|
|
7
7
|
|
|
@@ -171,7 +171,7 @@ async function listRouters(
|
|
|
171
171
|
headers: {
|
|
172
172
|
Authorization: `Bearer ${bearer}`,
|
|
173
173
|
Accept: "application/json",
|
|
174
|
-
"User-Agent": `
|
|
174
|
+
"User-Agent": `anymous/${InstallationVersion}`,
|
|
175
175
|
},
|
|
176
176
|
signal: AbortSignal.timeout(10_000),
|
|
177
177
|
}).catch(() => undefined)
|
|
@@ -283,7 +283,7 @@ export async function DigitalOceanAuthPlugin(input: PluginInput): Promise<Hooks>
|
|
|
283
283
|
return {
|
|
284
284
|
url,
|
|
285
285
|
instructions:
|
|
286
|
-
"Sign in to DigitalOcean in your browser.
|
|
286
|
+
"Sign in to DigitalOcean in your browser. anymous will use your DigitalOcean API token directly for inference and load your Inference Routers. Re-run /connect to refresh routers later.",
|
|
287
287
|
method: "auto" as const,
|
|
288
288
|
async callback() {
|
|
289
289
|
try {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Hooks, PluginInput } from "@
|
|
2
|
-
import type { Model } from "@
|
|
3
|
-
import { InstallationVersion } from "@
|
|
1
|
+
import type { Hooks, PluginInput } from "@anymous-ai/plugin"
|
|
2
|
+
import type { Model } from "@anymous-ai/sdk/v2"
|
|
3
|
+
import { InstallationVersion } from "@anymous-ai/core/installation/version"
|
|
4
4
|
import { iife } from "@/util/iife"
|
|
5
5
|
import { setTimeout as sleep } from "node:timers/promises"
|
|
6
6
|
import { CopilotModels } from "./models"
|
|
@@ -72,7 +72,7 @@ export async function CopilotAuthPlugin(input: PluginInput): Promise<Hooks> {
|
|
|
72
72
|
{
|
|
73
73
|
...(provider.options?.headers as Record<string, string> | undefined),
|
|
74
74
|
Authorization: `Bearer ${auth.refresh}`,
|
|
75
|
-
"User-Agent": `
|
|
75
|
+
"User-Agent": `anymous/${InstallationVersion}`,
|
|
76
76
|
"X-GitHub-Api-Version": API_VERSION,
|
|
77
77
|
},
|
|
78
78
|
provider.models,
|
|
@@ -160,7 +160,7 @@ export async function CopilotAuthPlugin(input: PluginInput): Promise<Hooks> {
|
|
|
160
160
|
const headers: Record<string, string> = {
|
|
161
161
|
"x-initiator": isAgent ? "agent" : "user",
|
|
162
162
|
...(init?.headers as Record<string, string>),
|
|
163
|
-
"User-Agent": `
|
|
163
|
+
"User-Agent": `anymous/${InstallationVersion}`,
|
|
164
164
|
Authorization: `Bearer ${info.refresh}`,
|
|
165
165
|
"Openai-Intent": "conversation-edits",
|
|
166
166
|
}
|
|
@@ -236,7 +236,7 @@ export async function CopilotAuthPlugin(input: PluginInput): Promise<Hooks> {
|
|
|
236
236
|
headers: {
|
|
237
237
|
Accept: "application/json",
|
|
238
238
|
"Content-Type": "application/json",
|
|
239
|
-
"User-Agent": `
|
|
239
|
+
"User-Agent": `anymous/${InstallationVersion}`,
|
|
240
240
|
},
|
|
241
241
|
body: JSON.stringify({
|
|
242
242
|
client_id: CLIENT_ID,
|
|
@@ -266,7 +266,7 @@ export async function CopilotAuthPlugin(input: PluginInput): Promise<Hooks> {
|
|
|
266
266
|
headers: {
|
|
267
267
|
Accept: "application/json",
|
|
268
268
|
"Content-Type": "application/json",
|
|
269
|
-
"User-Agent": `
|
|
269
|
+
"User-Agent": `anymous/${InstallationVersion}`,
|
|
270
270
|
},
|
|
271
271
|
body: JSON.stringify({
|
|
272
272
|
client_id: CLIENT_ID,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Model } from "@
|
|
1
|
+
import type { Model } from "@anymous-ai/sdk/v2"
|
|
2
2
|
import { Option, Schema } from "effect"
|
|
3
3
|
|
|
4
4
|
const item = Schema.Struct({
|
|
@@ -98,7 +98,7 @@ function build(key: string, remote: SelectableItem, url: string, prev?: Model):
|
|
|
98
98
|
? "chat"
|
|
99
99
|
: undefined
|
|
100
100
|
const prices = remote.billing?.token_prices
|
|
101
|
-
// Copilot prices are AIC per billing batch;
|
|
101
|
+
// Copilot prices are AIC per billing batch; anymous stores USD per million tokens.
|
|
102
102
|
const usdPerMillion = prices && prices.batch_size > 0 ? 10_000 / prices.batch_size : 0
|
|
103
103
|
|
|
104
104
|
const model: CopilotModel = {
|
package/src/plugin/index.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { LayerNode } from "@
|
|
1
|
+
import { LayerNode } from "@anymous-ai/core/effect/layer-node"
|
|
2
2
|
import type {
|
|
3
3
|
Hooks,
|
|
4
4
|
PluginInput,
|
|
5
5
|
Plugin as PluginInstance,
|
|
6
6
|
PluginModule,
|
|
7
7
|
WorkspaceAdapter as PluginWorkspaceAdapter,
|
|
8
|
-
} from "@
|
|
8
|
+
} from "@anymous-ai/plugin"
|
|
9
9
|
import { Config } from "@/config/config"
|
|
10
|
-
import {
|
|
10
|
+
import { createanymousClient } from "@anymous-ai/sdk"
|
|
11
11
|
import { ServerAuth } from "@/server/auth"
|
|
12
12
|
import { CodexAuthPlugin } from "./openai/codex"
|
|
13
13
|
import { Session } from "@/session/session"
|
|
14
|
-
import { NamedError } from "@
|
|
14
|
+
import { NamedError } from "@anymous-ai/core/util/error"
|
|
15
15
|
import { CopilotAuthPlugin } from "./github-copilot/copilot"
|
|
16
16
|
import { gitlabAuthPlugin as GitlabAuthPlugin } from "opencode-gitlab-auth"
|
|
17
17
|
import { PoeAuthPlugin } from "opencode-poe-auth"
|
|
@@ -30,7 +30,7 @@ import { registerAdapter } from "@/control-plane/adapters"
|
|
|
30
30
|
import type { WorkspaceAdapter } from "@/control-plane/types"
|
|
31
31
|
import { RuntimeFlags } from "@/effect/runtime-flags"
|
|
32
32
|
import { EventV2Bridge } from "@/event-v2-bridge"
|
|
33
|
-
import { InstallationChannel } from "@
|
|
33
|
+
import { InstallationChannel } from "@anymous-ai/core/installation/version"
|
|
34
34
|
|
|
35
35
|
type State = {
|
|
36
36
|
hooks: Hooks[]
|
|
@@ -55,7 +55,7 @@ export interface Interface {
|
|
|
55
55
|
readonly init: () => Effect.Effect<void>
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
export class Service extends Context.Service<Service, Interface>()("@
|
|
58
|
+
export class Service extends Context.Service<Service, Interface>()("@anymous/Plugin") {}
|
|
59
59
|
|
|
60
60
|
export function experimentalWebSocketsEnabled(input: { enabled: boolean; channel?: string }) {
|
|
61
61
|
return input.enabled || ["local", "dev", "beta"].includes(input.channel ?? InstallationChannel)
|
|
@@ -139,7 +139,7 @@ const layer = Layer.effect(
|
|
|
139
139
|
const { Server } = yield* Effect.promise(() => import("../server/server"))
|
|
140
140
|
|
|
141
141
|
const serverUrl = Server.url
|
|
142
|
-
const client =
|
|
142
|
+
const client = createanymousClient({
|
|
143
143
|
baseUrl: serverUrl?.toString() ?? "http://localhost:4096",
|
|
144
144
|
directory: ctx.directory,
|
|
145
145
|
headers: ServerAuth.headers(),
|