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/plugin/install.ts
CHANGED
|
@@ -8,9 +8,9 @@ import {
|
|
|
8
8
|
} from "jsonc-parser"
|
|
9
9
|
|
|
10
10
|
import * as ConfigPaths from "@/config/paths"
|
|
11
|
-
import { Global } from "@
|
|
11
|
+
import { Global } from "@anymous-ai/core/global"
|
|
12
12
|
import { Filesystem } from "@/util/filesystem"
|
|
13
|
-
import { Flock } from "@
|
|
13
|
+
import { Flock } from "@anymous-ai/core/util/flock"
|
|
14
14
|
import { isRecord } from "@/util/record"
|
|
15
15
|
|
|
16
16
|
import { parsePluginSpecifier, readPackageThemes, readPluginPackage, resolvePluginTarget } from "./shared"
|
|
@@ -31,7 +31,7 @@ export type PatchDeps = {
|
|
|
31
31
|
readText: (file: string) => Promise<string>
|
|
32
32
|
write: (file: string, text: string) => Promise<void>
|
|
33
33
|
exists: (file: string) => Promise<boolean>
|
|
34
|
-
files: (dir: string, name: "
|
|
34
|
+
files: (dir: string, name: "anymous" | "tui") => string[]
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
export type PatchInput = {
|
|
@@ -334,11 +334,11 @@ function patchDir(input: PatchInput) {
|
|
|
334
334
|
if (input.global) return input.config ?? Global.Path.config
|
|
335
335
|
const git = input.vcs === "git" && input.worktree !== "/"
|
|
336
336
|
const root = git ? input.worktree : input.directory
|
|
337
|
-
return path.join(root, ".
|
|
337
|
+
return path.join(root, ".anymous")
|
|
338
338
|
}
|
|
339
339
|
|
|
340
|
-
function patchName(kind: Kind): "
|
|
341
|
-
if (kind === "server") return "
|
|
340
|
+
function patchName(kind: Kind): "anymous" | "tui" {
|
|
341
|
+
if (kind === "server") return "anymous"
|
|
342
342
|
return "tui"
|
|
343
343
|
}
|
|
344
344
|
|
package/src/plugin/loader.ts
CHANGED
|
@@ -9,8 +9,8 @@ import {
|
|
|
9
9
|
type PluginSource,
|
|
10
10
|
} from "./shared"
|
|
11
11
|
import { ConfigPlugin } from "@/config/plugin"
|
|
12
|
-
import { ConfigPluginV1 } from "@
|
|
13
|
-
import { InstallationVersion } from "@
|
|
12
|
+
import { ConfigPluginV1 } from "@anymous-ai/core/v1/config/plugin"
|
|
13
|
+
import { InstallationVersion } from "@anymous-ai/core/installation/version"
|
|
14
14
|
|
|
15
15
|
export namespace PluginLoader {
|
|
16
16
|
// A normalized plugin declaration derived from config before any filesystem or npm work happens.
|
|
@@ -120,7 +120,7 @@ export namespace PluginLoader {
|
|
|
120
120
|
},
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
// npm plugins can declare which
|
|
123
|
+
// npm plugins can declare which anymous versions they support; file plugins are treated
|
|
124
124
|
// as local development code and skip this compatibility gate.
|
|
125
125
|
if (base.source === "npm") {
|
|
126
126
|
try {
|
package/src/plugin/meta.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import path from "path"
|
|
2
2
|
import { fileURLToPath } from "url"
|
|
3
3
|
|
|
4
|
-
import { Flag } from "@
|
|
5
|
-
import { Global } from "@
|
|
4
|
+
import { Flag } from "@anymous-ai/core/flag/flag"
|
|
5
|
+
import { Global } from "@anymous-ai/core/global"
|
|
6
6
|
import { Filesystem } from "@/util/filesystem"
|
|
7
|
-
import { Flock } from "@
|
|
7
|
+
import { Flock } from "@anymous-ai/core/util/flock"
|
|
8
8
|
|
|
9
9
|
import { parsePluginSpecifier, pluginSource } from "./shared"
|
|
10
10
|
|
|
@@ -46,7 +46,7 @@ type Core = Omit<Entry, "first_time" | "last_time" | "time_changed" | "load_coun
|
|
|
46
46
|
type Row = Touch & { core: Core }
|
|
47
47
|
|
|
48
48
|
function storePath() {
|
|
49
|
-
return Flag.
|
|
49
|
+
return Flag.ANYMOUS_PLUGIN_META_FILE ?? path.join(Global.Path.state, "plugin-meta.json")
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
function lock(file: string) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# OpenAI Responses WebSocket
|
|
2
2
|
|
|
3
|
-
Enabled by default on `local`, `dev`, and `beta`. On `latest` and `prod`, set `
|
|
3
|
+
Enabled by default on `local`, `dev`, and `beta`. On `latest` and `prod`, set `ANYMOUS_EXPERIMENTAL_WEBSOCKETS=true`.
|
|
4
4
|
|
|
5
5
|
## Flow
|
|
6
6
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { Hooks, PluginInput } from "@
|
|
2
|
-
import { InstallationVersion } from "@
|
|
1
|
+
import type { Hooks, PluginInput } from "@anymous-ai/plugin"
|
|
2
|
+
import { InstallationVersion } from "@anymous-ai/core/installation/version"
|
|
3
3
|
import { OAUTH_DUMMY_KEY } from "../../auth"
|
|
4
4
|
import os from "os"
|
|
5
5
|
import { setTimeout as sleep } from "node:timers/promises"
|
|
6
6
|
import { createServer } from "http"
|
|
7
7
|
import { OpenAIWebSocketPool } from "./ws-pool"
|
|
8
|
-
import { OauthCallbackPage } from "@
|
|
8
|
+
import { OauthCallbackPage } from "@anymous-ai/core/oauth/page"
|
|
9
9
|
|
|
10
10
|
const CLIENT_ID = "app_EMoamEEZ73f0CkXaXp7hrann"
|
|
11
11
|
const ISSUER = "https://auth.openai.com"
|
|
@@ -86,7 +86,7 @@ function buildAuthorizeUrl(redirectUri: string, pkce: PkceCodes, state: string):
|
|
|
86
86
|
id_token_add_organizations: "true",
|
|
87
87
|
codex_cli_simplified_flow: "true",
|
|
88
88
|
state,
|
|
89
|
-
originator: "
|
|
89
|
+
originator: "anymous",
|
|
90
90
|
})
|
|
91
91
|
return `${ISSUER}/oauth/authorize?${params.toString()}`
|
|
92
92
|
}
|
|
@@ -465,7 +465,7 @@ export async function CodexAuthPlugin(input: PluginInput, options: CodexAuthPlug
|
|
|
465
465
|
method: "POST",
|
|
466
466
|
headers: {
|
|
467
467
|
"Content-Type": "application/json",
|
|
468
|
-
"User-Agent": `
|
|
468
|
+
"User-Agent": `anymous/${InstallationVersion}`,
|
|
469
469
|
},
|
|
470
470
|
body: JSON.stringify({ client_id: CLIENT_ID }),
|
|
471
471
|
})
|
|
@@ -489,7 +489,7 @@ export async function CodexAuthPlugin(input: PluginInput, options: CodexAuthPlug
|
|
|
489
489
|
method: "POST",
|
|
490
490
|
headers: {
|
|
491
491
|
"Content-Type": "application/json",
|
|
492
|
-
"User-Agent": `
|
|
492
|
+
"User-Agent": `anymous/${InstallationVersion}`,
|
|
493
493
|
},
|
|
494
494
|
body: JSON.stringify({
|
|
495
495
|
device_auth_id: deviceData.device_auth_id,
|
|
@@ -548,8 +548,8 @@ export async function CodexAuthPlugin(input: PluginInput, options: CodexAuthPlug
|
|
|
548
548
|
},
|
|
549
549
|
"chat.headers": async (input, output) => {
|
|
550
550
|
if (input.model.providerID !== "openai") return
|
|
551
|
-
output.headers.originator = "
|
|
552
|
-
output.headers["User-Agent"] = `
|
|
551
|
+
output.headers.originator = "anymous"
|
|
552
|
+
output.headers["User-Agent"] = `anymous/${InstallationVersion} (${os.platform()} ${os.release()}; ${os.arch()})`
|
|
553
553
|
output.headers["session-id"] = input.sessionID
|
|
554
554
|
// Temporary fetch-layer hack: title generation currently shares the conversation
|
|
555
555
|
// session ID, so the OpenAI plugin marks it for HTTP fallback until transport
|
|
@@ -3,7 +3,7 @@ import { ProviderError } from "@/provider/error"
|
|
|
3
3
|
import { isRecord } from "@/util/record"
|
|
4
4
|
import { OpenAIWebSocket } from "./ws"
|
|
5
5
|
|
|
6
|
-
export const TITLE_HEADER = "x-
|
|
6
|
+
export const TITLE_HEADER = "x-anymous-title"
|
|
7
7
|
|
|
8
8
|
export interface CreateWebSocketFetchOptions {
|
|
9
9
|
httpFetch?: typeof globalThis.fetch
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * as PluginPtyEnvironment from "./pty-environment"
|
|
2
2
|
|
|
3
|
-
import { PtyEnvironment } from "@
|
|
3
|
+
import { PtyEnvironment } from "@anymous-ai/server/pty-environment"
|
|
4
4
|
import { Effect, Layer } from "effect"
|
|
5
5
|
import { InstanceStore } from "@/project/instance-store"
|
|
6
6
|
import { Plugin } from "."
|
package/src/plugin/shared.ts
CHANGED
|
@@ -4,10 +4,10 @@ import npa from "npm-package-arg"
|
|
|
4
4
|
import semver from "semver"
|
|
5
5
|
import { Filesystem } from "@/util/filesystem"
|
|
6
6
|
import { isRecord } from "@/util/record"
|
|
7
|
-
import { Npm } from "@
|
|
7
|
+
import { Npm } from "@anymous-ai/core/npm"
|
|
8
8
|
|
|
9
9
|
// Old npm package names for plugins that are now built-in
|
|
10
|
-
export const DEPRECATED_PLUGIN_PACKAGES = ["
|
|
10
|
+
export const DEPRECATED_PLUGIN_PACKAGES = ["anymous-openai-codex-auth", "anymous-copilot-auth"]
|
|
11
11
|
|
|
12
12
|
export function isDeprecatedPlugin(spec: string) {
|
|
13
13
|
return DEPRECATED_PLUGIN_PACKAGES.some((pkg) => spec.includes(pkg))
|
|
@@ -191,16 +191,16 @@ export async function resolvePathPluginTarget(spec: string) {
|
|
|
191
191
|
throw new Error(`Plugin directory ${file} is missing package.json or index file`)
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
-
export async function checkPluginCompatibility(target: string,
|
|
195
|
-
if (!semver.valid(
|
|
194
|
+
export async function checkPluginCompatibility(target: string, anymousVersion: string, pkg?: PluginPackage) {
|
|
195
|
+
if (!semver.valid(anymousVersion) || semver.major(anymousVersion) === 0) return
|
|
196
196
|
const hit = pkg ?? (await readPluginPackage(target).catch(() => undefined))
|
|
197
197
|
if (!hit) return
|
|
198
198
|
const engines = hit.json.engines
|
|
199
199
|
if (!isRecord(engines)) return
|
|
200
|
-
const range = engines.
|
|
200
|
+
const range = engines.anymous
|
|
201
201
|
if (typeof range !== "string") return
|
|
202
|
-
if (!semver.satisfies(
|
|
203
|
-
throw new Error(`Plugin requires
|
|
202
|
+
if (!semver.satisfies(anymousVersion, range)) {
|
|
203
|
+
throw new Error(`Plugin requires anymous ${range} but running ${anymousVersion}`)
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
206
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Hooks, PluginInput } from "@
|
|
1
|
+
import type { Hooks, PluginInput } from "@anymous-ai/plugin"
|
|
2
2
|
import { OAUTH_DUMMY_KEY } from "../auth"
|
|
3
|
-
import { InstallationVersion } from "@
|
|
4
|
-
import { OauthCallbackPage } from "@
|
|
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
|
|
|
@@ -80,7 +80,7 @@ function authHeaders() {
|
|
|
80
80
|
return {
|
|
81
81
|
"Content-Type": "application/x-www-form-urlencoded",
|
|
82
82
|
Accept: "application/json",
|
|
83
|
-
"User-Agent": `
|
|
83
|
+
"User-Agent": `anymous/${InstallationVersion}`,
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
|
|
@@ -380,7 +380,7 @@ export async function SnowflakeCortexAuthPlugin(_input: PluginInput): Promise<Ho
|
|
|
380
380
|
}
|
|
381
381
|
}
|
|
382
382
|
headers.set("authorization", `Bearer ${currentOauth.access}`)
|
|
383
|
-
headers.set("User-Agent", `
|
|
383
|
+
headers.set("User-Agent", `anymous/${InstallationVersion}`)
|
|
384
384
|
|
|
385
385
|
let body = init?.body
|
|
386
386
|
if (body && typeof body === "string") {
|
|
@@ -475,7 +475,7 @@ export async function SnowflakeCortexAuthPlugin(_input: PluginInput): Promise<Ho
|
|
|
475
475
|
return {
|
|
476
476
|
url,
|
|
477
477
|
instructions:
|
|
478
|
-
"Complete Snowflake sign-in in your browser.
|
|
478
|
+
"Complete Snowflake sign-in in your browser. anymous will capture the OAuth callback and store the bearer token automatically.",
|
|
479
479
|
method: "auto" as const,
|
|
480
480
|
async callback() {
|
|
481
481
|
try {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createBuiltinPlugins, type BuiltinTuiPlugin } from "@
|
|
1
|
+
import { createBuiltinPlugins, type BuiltinTuiPlugin } from "@anymous-ai/tui/builtins"
|
|
2
2
|
import type { RuntimeFlags } from "@/effect/runtime-flags"
|
|
3
3
|
|
|
4
4
|
export type InternalTuiPlugin = BuiltinTuiPlugin
|
|
@@ -10,13 +10,13 @@ import {
|
|
|
10
10
|
type TuiPluginStatus,
|
|
11
11
|
type TuiSlotPlugin,
|
|
12
12
|
type TuiTheme,
|
|
13
|
-
} from "@
|
|
13
|
+
} from "@anymous-ai/plugin/tui"
|
|
14
14
|
import path from "path"
|
|
15
15
|
import { fileURLToPath } from "url"
|
|
16
16
|
import { TuiConfig } from "@/config/tui"
|
|
17
|
-
import { AppNodeBuilder } from "@
|
|
18
|
-
import { errorData, errorMessage } from "@
|
|
19
|
-
import { isRecord } from "@
|
|
17
|
+
import { AppNodeBuilder } from "@anymous-ai/core/effect/app-node-builder"
|
|
18
|
+
import { errorData, errorMessage } from "@anymous-ai/tui/util/error"
|
|
19
|
+
import { isRecord } from "@anymous-ai/tui/util/record"
|
|
20
20
|
import { resolveHostAttentionSoundPaths } from "@/config/tui-host-attention"
|
|
21
21
|
import {
|
|
22
22
|
readPackageThemes,
|
|
@@ -29,20 +29,20 @@ import {
|
|
|
29
29
|
import { PluginLoader } from "@/plugin/loader"
|
|
30
30
|
import { PluginMeta } from "@/plugin/meta"
|
|
31
31
|
import { installPlugin as installModulePlugin, patchPluginConfig, readPluginManifest } from "@/plugin/install"
|
|
32
|
-
import { hasTheme, upsertTheme } from "@
|
|
33
|
-
import { Global } from "@
|
|
32
|
+
import { hasTheme, upsertTheme } from "@anymous-ai/tui/context/theme"
|
|
33
|
+
import { Global } from "@anymous-ai/core/global"
|
|
34
34
|
import { Filesystem } from "@/util/filesystem"
|
|
35
35
|
import { Process } from "@/util/process"
|
|
36
|
-
import { Flock } from "@
|
|
37
|
-
import { Flag } from "@
|
|
36
|
+
import { Flock } from "@anymous-ai/core/util/flock"
|
|
37
|
+
import { Flag } from "@anymous-ai/core/flag/flag"
|
|
38
38
|
import { internalTuiPlugins, type InternalTuiPlugin } from "./internal"
|
|
39
|
-
import type { HostPluginApi, HostSlots } from "@
|
|
39
|
+
import type { HostPluginApi, HostSlots } from "@anymous-ai/tui/plugin/slots"
|
|
40
40
|
import { ConfigPlugin } from "@/config/plugin"
|
|
41
|
-
import { ConfigPluginV1 } from "@
|
|
42
|
-
import { createCommandShim } from "@
|
|
41
|
+
import { ConfigPluginV1 } from "@anymous-ai/core/v1/config/plugin"
|
|
42
|
+
import { createCommandShim } from "@anymous-ai/tui/plugin/command-shim"
|
|
43
43
|
import { RuntimeFlags } from "@/effect/runtime-flags"
|
|
44
44
|
import { Effect } from "effect"
|
|
45
|
-
import { createPluginRuntime, type PluginRuntime, type TuiPluginHost } from "@
|
|
45
|
+
import { createPluginRuntime, type PluginRuntime, type TuiPluginHost } from "@anymous-ai/tui/plugin/runtime"
|
|
46
46
|
|
|
47
47
|
ensureRuntimePluginSupport({ additional: keymapRuntimeModules })
|
|
48
48
|
|
|
@@ -253,9 +253,9 @@ function createThemeInstaller(
|
|
|
253
253
|
const name = path.basename(src, path.extname(src))
|
|
254
254
|
const source_dir = path.dirname(meta.source)
|
|
255
255
|
const local_dir =
|
|
256
|
-
path.basename(source_dir) === ".
|
|
256
|
+
path.basename(source_dir) === ".anymous"
|
|
257
257
|
? path.join(source_dir, "themes")
|
|
258
|
-
: path.join(source_dir, ".
|
|
258
|
+
: path.join(source_dir, ".anymous", "themes")
|
|
259
259
|
const dest_dir = meta.scope === "local" ? local_dir : path.join(Global.Path.config, "themes")
|
|
260
260
|
const dest = path.join(dest_dir, `${name}.json`)
|
|
261
261
|
const stat = await Filesystem.statAsync(src)
|
|
@@ -814,7 +814,7 @@ function defaultPluginOrigin(state: RuntimeState, spec: string): ConfigPlugin.Or
|
|
|
814
814
|
return {
|
|
815
815
|
spec,
|
|
816
816
|
scope: "local",
|
|
817
|
-
source: state.api.state.path.config || path.join(state.directory, ".
|
|
817
|
+
source: state.api.state.path.config || path.join(state.directory, ".anymous", "tui.json"),
|
|
818
818
|
}
|
|
819
819
|
}
|
|
820
820
|
|
|
@@ -1086,8 +1086,8 @@ async function load(input: {
|
|
|
1086
1086
|
}).pipe(Effect.provide(AppNodeBuilder.build(RuntimeFlags.node))),
|
|
1087
1087
|
)
|
|
1088
1088
|
const pluginOrigins = config.plugin_origins ?? (await TuiConfig.pluginOrigins())
|
|
1089
|
-
const records = Flag.
|
|
1090
|
-
if (Flag.
|
|
1089
|
+
const records = Flag.ANYMOUS_PURE ? [] : pluginOrigins
|
|
1090
|
+
if (Flag.ANYMOUS_PURE && pluginOrigins.length) {
|
|
1091
1091
|
}
|
|
1092
1092
|
|
|
1093
1093
|
for (const item of internalTuiPlugins(flags)) {
|
package/src/plugin/xai.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { Hooks, PluginInput } from "@
|
|
1
|
+
import type { Hooks, PluginInput } from "@anymous-ai/plugin"
|
|
2
2
|
import { OAUTH_DUMMY_KEY } from "../auth"
|
|
3
3
|
import { createServer } from "http"
|
|
4
|
-
import { InstallationVersion } from "@
|
|
5
|
-
import { OauthCallbackPage } from "@
|
|
4
|
+
import { InstallationVersion } from "@anymous-ai/core/installation/version"
|
|
5
|
+
import { OauthCallbackPage } from "@anymous-ai/core/oauth/page"
|
|
6
6
|
|
|
7
7
|
// Public Grok-CLI OAuth client. xAI's auth server rejects loopback OAuth from
|
|
8
8
|
// non-allowlisted clients, so we reuse the Grok-CLI client_id that xAI ships
|
|
@@ -88,7 +88,7 @@ function authHeaders() {
|
|
|
88
88
|
return {
|
|
89
89
|
"Content-Type": "application/x-www-form-urlencoded",
|
|
90
90
|
Accept: "application/json",
|
|
91
|
-
"User-Agent": `
|
|
91
|
+
"User-Agent": `anymous/${InstallationVersion}`,
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
|
|
@@ -123,7 +123,7 @@ export function buildAuthorizeUrl(
|
|
|
123
123
|
): string {
|
|
124
124
|
// `plan=generic` opts the consent screen into xAI's generic OAuth plan tier;
|
|
125
125
|
// without it, accounts.x.ai rejects loopback OAuth from non-allowlisted
|
|
126
|
-
// clients. `referrer=
|
|
126
|
+
// clients. `referrer=anymous` lets xAI attribute anymous-originated
|
|
127
127
|
// logins in their OAuth server logs (best-effort attribution while we
|
|
128
128
|
// continue to reuse the Grok-CLI client_id).
|
|
129
129
|
const params = new URLSearchParams({
|
|
@@ -136,7 +136,7 @@ export function buildAuthorizeUrl(
|
|
|
136
136
|
state,
|
|
137
137
|
nonce,
|
|
138
138
|
plan: "generic",
|
|
139
|
-
referrer: "
|
|
139
|
+
referrer: "anymous",
|
|
140
140
|
})
|
|
141
141
|
return `${options.authorizeUrl ?? AUTHORIZE_URL}?${params.toString()}`
|
|
142
142
|
}
|
|
@@ -396,7 +396,7 @@ async function startOAuthServer(): Promise<{ port: number; redirectUri: string }
|
|
|
396
396
|
// After listen() succeeds, install a permanent log-only listener so
|
|
397
397
|
// that subsequent server errors (e.g. accept() failures, socket-level
|
|
398
398
|
// errors) don't trip Node's default "unhandled error event = throw"
|
|
399
|
-
// behavior and crash the entire
|
|
399
|
+
// behavior and crash the entire anymous process. Matches the silent-
|
|
400
400
|
// swallow behavior the Codex plugin gets from its permanent
|
|
401
401
|
// `oauthServer!.on("error", reject)`.
|
|
402
402
|
resolve()
|
|
@@ -541,7 +541,7 @@ export async function XaiAuthPlugin(input: PluginInput, options: XaiAuthPluginOp
|
|
|
541
541
|
}
|
|
542
542
|
}
|
|
543
543
|
headers.set("authorization", `Bearer ${currentAuth.access}`)
|
|
544
|
-
headers.set("User-Agent", `
|
|
544
|
+
headers.set("User-Agent", `anymous/${InstallationVersion}`)
|
|
545
545
|
|
|
546
546
|
return fetch(requestInput, { ...init, headers })
|
|
547
547
|
},
|
|
@@ -4,6 +4,6 @@ export interface Interface {
|
|
|
4
4
|
readonly run: Effect.Effect<void>
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
export class Service extends Context.Service<Service, Interface>()("@
|
|
7
|
+
export class Service extends Context.Service<Service, Interface>()("@anymous/InstanceBootstrap") {}
|
|
8
8
|
|
|
9
9
|
export * as InstanceBootstrap from "./bootstrap-service"
|
package/src/project/bootstrap.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { LayerNode } from "@
|
|
2
|
-
import { makeGlobalNode, Node } from "@
|
|
1
|
+
import { LayerNode } from "@anymous-ai/core/effect/layer-node"
|
|
2
|
+
import { makeGlobalNode, Node } from "@anymous-ai/core/effect/app-node"
|
|
3
3
|
import { GlobalBus } from "@/bus/global"
|
|
4
|
-
import { serviceUse } from "@
|
|
4
|
+
import { serviceUse } from "@anymous-ai/core/effect/service-use"
|
|
5
5
|
import { WorkspaceContext } from "@/control-plane/workspace-context"
|
|
6
6
|
import { InstanceRef } from "@/effect/instance-ref"
|
|
7
7
|
import { disposeInstance as runDisposers } from "@/effect/instance-registry"
|
|
8
|
-
import { FSUtil } from "@
|
|
8
|
+
import { FSUtil } from "@anymous-ai/core/fs-util"
|
|
9
9
|
import { Context, Deferred, Duration, Effect, Exit, Layer, Scope } from "effect"
|
|
10
10
|
import { type InstanceContext } from "./instance-context"
|
|
11
11
|
import { InstanceBootstrap } from "./bootstrap-service"
|
|
@@ -26,7 +26,7 @@ export interface Interface {
|
|
|
26
26
|
readonly provide: <A, E, R>(input: LoadInput, effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
export class Service extends Context.Service<Service, Interface>()("@
|
|
29
|
+
export class Service extends Context.Service<Service, Interface>()("@anymous/InstanceStore") {}
|
|
30
30
|
|
|
31
31
|
export const use = serviceUse(Service)
|
|
32
32
|
|
package/src/project/project.ts
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { LayerNode } from "@
|
|
1
|
+
import { LayerNode } from "@anymous-ai/core/effect/layer-node"
|
|
2
2
|
import { and, eq, sql } from "drizzle-orm"
|
|
3
|
-
import { Database } from "@
|
|
4
|
-
import { ProjectDirectoryTable, ProjectTable } from "@
|
|
5
|
-
import { ProjectDirectories } from "@
|
|
6
|
-
import { SessionTable } from "@
|
|
7
|
-
import { WorkspaceTable } from "@
|
|
8
|
-
import { Flag } from "@
|
|
3
|
+
import { Database } from "@anymous-ai/core/database/database"
|
|
4
|
+
import { ProjectDirectoryTable, ProjectTable } from "@anymous-ai/core/project/sql"
|
|
5
|
+
import { ProjectDirectories } from "@anymous-ai/core/project/directories"
|
|
6
|
+
import { SessionTable } from "@anymous-ai/core/session/sql"
|
|
7
|
+
import { WorkspaceTable } from "@anymous-ai/core/control-plane/workspace.sql"
|
|
8
|
+
import { Flag } from "@anymous-ai/core/flag/flag"
|
|
9
9
|
import { GlobalBus } from "@/bus/global"
|
|
10
|
-
import { which } from "@
|
|
10
|
+
import { which } from "@anymous-ai/core/util/which"
|
|
11
11
|
import { Command } from "@/command"
|
|
12
12
|
import { InstanceState } from "@/effect/instance-state"
|
|
13
13
|
import { Effect, Layer, Scope, Context, Stream, Types, Schema } from "effect"
|
|
14
14
|
import { ChildProcess, ChildProcessSpawner } from "effect/unstable/process"
|
|
15
|
-
import { FSUtil } from "@
|
|
16
|
-
import { AppProcess } from "@
|
|
17
|
-
import { ProjectV2 } from "@
|
|
18
|
-
import { CrossSpawnSpawner } from "@
|
|
19
|
-
import { AbsolutePath } from "@
|
|
20
|
-
import { serviceUse } from "@
|
|
15
|
+
import { FSUtil } from "@anymous-ai/core/fs-util"
|
|
16
|
+
import { AppProcess } from "@anymous-ai/core/process"
|
|
17
|
+
import { ProjectV2 } from "@anymous-ai/core/project"
|
|
18
|
+
import { CrossSpawnSpawner } from "@anymous-ai/core/cross-spawn-spawner"
|
|
19
|
+
import { AbsolutePath } from "@anymous-ai/core/schema"
|
|
20
|
+
import { serviceUse } from "@anymous-ai/core/effect/service-use"
|
|
21
21
|
import { RuntimeFlags } from "@/effect/runtime-flags"
|
|
22
22
|
import { EventV2Bridge } from "@/event-v2-bridge"
|
|
23
|
-
import { EventV2 } from "@
|
|
24
|
-
import { Project } from "@
|
|
23
|
+
import { EventV2 } from "@anymous-ai/core/event"
|
|
24
|
+
import { Project } from "@anymous-ai/schema/project"
|
|
25
25
|
|
|
26
26
|
export const Info = Project.Info
|
|
27
27
|
export type Info = Types.DeepMutable<Schema.Schema.Type<typeof Info>>
|
|
@@ -99,7 +99,7 @@ export interface Interface {
|
|
|
99
99
|
readonly removeSandbox: (id: ProjectV2.ID, directory: string) => Effect.Effect<void>
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
export class Service extends Context.Service<Service, Interface>()("@
|
|
102
|
+
export class Service extends Context.Service<Service, Interface>()("@anymous/Project") {}
|
|
103
103
|
|
|
104
104
|
type GitResult = { code: number; text: string; stderr: string }
|
|
105
105
|
|
|
@@ -139,7 +139,7 @@ const layer = Layer.effect(
|
|
|
139
139
|
}),
|
|
140
140
|
)
|
|
141
141
|
|
|
142
|
-
const fakeVcs = Schema.decodeUnknownSync(Schema.optional(Project.Vcs))(Flag.
|
|
142
|
+
const fakeVcs = Schema.decodeUnknownSync(Schema.optional(Project.Vcs))(Flag.ANYMOUS_FAKE_VCS)
|
|
143
143
|
|
|
144
144
|
const scope = yield* Scope.Scope
|
|
145
145
|
|
package/src/project/vcs.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { LayerNode } from "@
|
|
1
|
+
import { LayerNode } from "@anymous-ai/core/effect/layer-node"
|
|
2
2
|
import { Effect, Layer, Context, Schema, Scope } from "effect"
|
|
3
3
|
import { formatPatch, structuredPatch } from "diff"
|
|
4
4
|
import { InstanceState } from "@/effect/instance-state"
|
|
5
|
-
import { Watcher } from "@
|
|
5
|
+
import { Watcher } from "@anymous-ai/core/filesystem/watcher"
|
|
6
6
|
import { Git } from "@/git"
|
|
7
7
|
import { EventV2Bridge } from "@/event-v2-bridge"
|
|
8
|
-
import { EventV2 } from "@
|
|
9
|
-
import { VcsEvent } from "@
|
|
8
|
+
import { EventV2 } from "@anymous-ai/core/event"
|
|
9
|
+
import { VcsEvent } from "@anymous-ai/schema/vcs-event"
|
|
10
10
|
|
|
11
11
|
const PATCH_CONTEXT_LINES = 2_147_483_647
|
|
12
12
|
const MAX_PATCH_BYTES = 10_000_000
|
|
@@ -293,7 +293,7 @@ interface State {
|
|
|
293
293
|
root: Git.Base | undefined
|
|
294
294
|
}
|
|
295
295
|
|
|
296
|
-
export class Service extends Context.Service<Service, Interface>()("@
|
|
296
|
+
export class Service extends Context.Service<Service, Interface>()("@anymous/Vcs") {}
|
|
297
297
|
|
|
298
298
|
const layer: Layer.Layer<Service, never, Git.Service | EventV2Bridge.Service> = Layer.effect(
|
|
299
299
|
Service,
|
package/src/provider/auth.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { LayerNode } from "@
|
|
2
|
-
import type { AuthOAuthResult, Hooks } from "@
|
|
3
|
-
import { serviceUse } from "@
|
|
1
|
+
import { LayerNode } from "@anymous-ai/core/effect/layer-node"
|
|
2
|
+
import type { AuthOAuthResult, Hooks } from "@anymous-ai/plugin"
|
|
3
|
+
import { serviceUse } from "@anymous-ai/core/effect/service-use"
|
|
4
4
|
import { Auth } from "@/auth"
|
|
5
5
|
import { InstanceState } from "@/effect/instance-state"
|
|
6
|
-
import { optional } from "@
|
|
6
|
+
import { optional } from "@anymous-ai/core/schema"
|
|
7
7
|
import { Plugin } from "../plugin"
|
|
8
|
-
import { ProviderV2 } from "@
|
|
8
|
+
import { ProviderV2 } from "@anymous-ai/core/provider"
|
|
9
9
|
import { Array as Arr, Effect, Layer, Record, Result, Context, Schema } from "effect"
|
|
10
10
|
|
|
11
11
|
const When = Schema.Struct({
|
|
@@ -102,7 +102,7 @@ interface State {
|
|
|
102
102
|
pending: Map<ProviderV2.ID, AuthOAuthResult>
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
export class Service extends Context.Service<Service, Interface>()("@
|
|
105
|
+
export class Service extends Context.Service<Service, Interface>()("@anymous/ProviderAuth") {}
|
|
106
106
|
|
|
107
107
|
export const use = serviceUse(Service)
|
|
108
108
|
|
package/src/provider/error.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { APICallError } from "ai"
|
|
2
2
|
import { STATUS_CODES } from "http"
|
|
3
3
|
import { iife } from "@/util/iife"
|
|
4
|
-
import type { ProviderV2 } from "@
|
|
5
|
-
import { isContextOverflow } from "@
|
|
4
|
+
import type { ProviderV2 } from "@anymous-ai/core/provider"
|
|
5
|
+
import { isContextOverflow } from "@anymous-ai/llm"
|
|
6
6
|
|
|
7
7
|
export class HeaderTimeoutError extends Error {
|
|
8
8
|
public override readonly name = "ProviderHeaderTimeoutError"
|
|
@@ -58,7 +58,7 @@ function message(providerID: ProviderV2.ID, e: APICallError) {
|
|
|
58
58
|
// provide a human-readable message instead of dumping raw markup
|
|
59
59
|
if (/^\s*<!doctype|^\s*<html/i.test(e.responseBody)) {
|
|
60
60
|
if (e.statusCode === 401) {
|
|
61
|
-
return "Unauthorized: request was blocked by a gateway or proxy. Your authentication token may be missing or expired — try running `
|
|
61
|
+
return "Unauthorized: request was blocked by a gateway or proxy. Your authentication token may be missing or expired — try running `anymous auth login <your provider URL>` to re-authenticate."
|
|
62
62
|
}
|
|
63
63
|
if (e.statusCode === 403) {
|
|
64
64
|
return "Forbidden: request was blocked by a gateway or proxy. You may not have permission to access this resource — check your account and provider settings."
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Schema } from "effect"
|
|
2
2
|
|
|
3
|
-
export { CatalogModelStatus } from "@
|
|
3
|
+
export { CatalogModelStatus } from "@anymous-ai/core/models-dev"
|
|
4
4
|
|
|
5
5
|
export const ModelStatus = Schema.Literals(["alpha", "beta", "deprecated", "active"])
|
|
6
6
|
export type ModelStatus = typeof ModelStatus.Type
|