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/cli/cmd/run/trace.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Dev-only JSONL event trace for direct interactive mode.
|
|
2
2
|
//
|
|
3
|
-
// Enable with
|
|
4
|
-
// ~/.local/share/
|
|
3
|
+
// Enable with ANYMOUS_DIRECT_TRACE=1. Writes one JSON line per event to
|
|
4
|
+
// ~/.local/share/anymous/log/direct/<timestamp>-<pid>.jsonl. Also writes
|
|
5
5
|
// a latest.json pointer so you can quickly find the most recent trace.
|
|
6
6
|
//
|
|
7
7
|
// The trace captures the full closed loop: outbound prompts, inbound SDK
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
// active based on the env var, and subsequent calls return the cached result.
|
|
14
14
|
import fs from "fs"
|
|
15
15
|
import path from "path"
|
|
16
|
-
import { Global } from "@
|
|
16
|
+
import { Global } from "@anymous-ai/core/global"
|
|
17
17
|
|
|
18
18
|
export type Trace = {
|
|
19
19
|
write(type: string, data?: unknown): void
|
|
@@ -55,7 +55,7 @@ export function trace(): Trace | undefined {
|
|
|
55
55
|
return state || undefined
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
if (!process.env.
|
|
58
|
+
if (!process.env.ANYMOUS_DIRECT_TRACE) {
|
|
59
59
|
state = false
|
|
60
60
|
return undefined
|
|
61
61
|
}
|
package/src/cli/cmd/run/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Shared type vocabulary for the direct interactive mode (`
|
|
1
|
+
// Shared type vocabulary for the direct interactive mode (`anymous --mini`).
|
|
2
2
|
//
|
|
3
3
|
// Direct mode uses a split-footer terminal layout: immutable scrollback for the
|
|
4
4
|
// session transcript, and a mutable footer for prompt input, status, and
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
// → stream.ts bridges to footer API
|
|
12
12
|
// → footer.ts queues commits and patches the footer view
|
|
13
13
|
// → OpenTUI split-footer renderer writes to terminal
|
|
14
|
-
import type {
|
|
15
|
-
import type { TuiConfig } from "@
|
|
14
|
+
import type { anymousClient, PermissionRequest, QuestionRequest, ToolPart } from "@anymous-ai/sdk/v2"
|
|
15
|
+
import type { TuiConfig } from "@anymous-ai/tui/config"
|
|
16
16
|
|
|
17
17
|
export type RunFilePart = {
|
|
18
18
|
type: "file"
|
|
@@ -21,14 +21,14 @@ export type RunFilePart = {
|
|
|
21
21
|
mime: string
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
type PromptModel = Parameters<
|
|
25
|
-
type PromptInput = Parameters<
|
|
24
|
+
type PromptModel = Parameters<anymousClient["session"]["prompt"]>[0]["model"]
|
|
25
|
+
type PromptInput = Parameters<anymousClient["session"]["prompt"]>[0]
|
|
26
26
|
|
|
27
27
|
export type RunPromptPart = NonNullable<PromptInput["parts"]>[number]
|
|
28
28
|
|
|
29
|
-
export type RunCommand = NonNullable<Awaited<ReturnType<
|
|
29
|
+
export type RunCommand = NonNullable<Awaited<ReturnType<anymousClient["command"]["list"]>>["data"]>[number]
|
|
30
30
|
|
|
31
|
-
export type RunProvider = NonNullable<Awaited<ReturnType<
|
|
31
|
+
export type RunProvider = NonNullable<Awaited<ReturnType<anymousClient["provider"]["list"]>>["data"]>["all"][number]
|
|
32
32
|
|
|
33
33
|
export type RunPrompt = {
|
|
34
34
|
messageID?: string
|
|
@@ -48,14 +48,14 @@ export type FooterQueuedPrompt = {
|
|
|
48
48
|
prompt: RunPrompt
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
export type RunAgent = NonNullable<Awaited<ReturnType<
|
|
51
|
+
export type RunAgent = NonNullable<Awaited<ReturnType<anymousClient["app"]["agents"]>>["data"]>[number]
|
|
52
52
|
|
|
53
|
-
type RunResourceMap = NonNullable<Awaited<ReturnType<
|
|
53
|
+
type RunResourceMap = NonNullable<Awaited<ReturnType<anymousClient["experimental"]["resource"]["list"]>>["data"]>
|
|
54
54
|
|
|
55
55
|
export type RunResource = RunResourceMap[string]
|
|
56
56
|
|
|
57
57
|
export type RunInput = {
|
|
58
|
-
sdk:
|
|
58
|
+
sdk: anymousClient
|
|
59
59
|
directory: string
|
|
60
60
|
sessionID: string
|
|
61
61
|
sessionTitle?: string
|
|
@@ -280,11 +280,11 @@ export type FooterEvent =
|
|
|
280
280
|
state: FooterSubagentState
|
|
281
281
|
}
|
|
282
282
|
|
|
283
|
-
export type PermissionReply = Parameters<
|
|
283
|
+
export type PermissionReply = Parameters<anymousClient["permission"]["reply"]>[0]
|
|
284
284
|
|
|
285
|
-
export type QuestionReply = Parameters<
|
|
285
|
+
export type QuestionReply = Parameters<anymousClient["question"]["reply"]>[0]
|
|
286
286
|
|
|
287
|
-
export type QuestionReject = Parameters<
|
|
287
|
+
export type QuestionReject = Parameters<anymousClient["question"]["reject"]>[0]
|
|
288
288
|
|
|
289
289
|
export type RunTuiConfig = Pick<TuiConfig.Resolved, "keybinds" | "leader_timeout" | "diff_style">
|
|
290
290
|
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
// Variants are provider-specific reasoning effort levels (e.g., "high", "max").
|
|
4
4
|
// Resolution priority: CLI --variant flag > saved preference > session history.
|
|
5
5
|
//
|
|
6
|
-
// The saved variant persists across sessions in ~/.local/state/
|
|
6
|
+
// The saved variant persists across sessions in ~/.local/state/anymous/model.json
|
|
7
7
|
// so your last-used variant sticks. Cycling (ctrl+t) updates both the active
|
|
8
8
|
// variant and the persisted file.
|
|
9
9
|
import path from "path"
|
|
10
|
-
import { FSUtil } from "@
|
|
11
|
-
import { AppNodeBuilder } from "@
|
|
10
|
+
import { FSUtil } from "@anymous-ai/core/fs-util"
|
|
11
|
+
import { AppNodeBuilder } from "@anymous-ai/core/effect/app-node-builder"
|
|
12
12
|
import { Context, Effect, Layer } from "effect"
|
|
13
13
|
import { makeRuntime } from "@/effect/run-service"
|
|
14
|
-
import { Global } from "@
|
|
14
|
+
import { Global } from "@anymous-ai/core/global"
|
|
15
15
|
import { isRecord } from "@/util/record"
|
|
16
16
|
import { createSession, sessionVariant, type RunSession, type SessionMessages } from "./session.shared"
|
|
17
17
|
import type { RunInput, RunProvider } from "./types"
|
|
@@ -30,7 +30,7 @@ type VariantRuntime = {
|
|
|
30
30
|
saveVariant(model: RunInput["model"], variant: string | undefined): Promise<void>
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
class Service extends Context.Service<Service, VariantService>()("@
|
|
33
|
+
class Service extends Context.Service<Service, VariantService>()("@anymous/RunVariant") {}
|
|
34
34
|
|
|
35
35
|
function modelKey(provider: string, model: string): string {
|
|
36
36
|
return `${provider}/${model}`
|
package/src/cli/cmd/run.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type { PermissionV1 } from "@
|
|
2
|
-
import { FSUtil } from "@
|
|
3
|
-
// CLI entry point for `
|
|
1
|
+
import type { PermissionV1 } from "@anymous-ai/core/v1/permission"
|
|
2
|
+
import { FSUtil } from "@anymous-ai/core/fs-util"
|
|
3
|
+
// CLI entry point for `anymous run` and `anymous --mini`.
|
|
4
4
|
//
|
|
5
5
|
// Handles three modes:
|
|
6
6
|
// 1. Non-interactive (default): sends a single prompt, streams events to
|
|
7
7
|
// stdout, and exits when the session goes idle.
|
|
8
|
-
// 2. Interactive local (`
|
|
8
|
+
// 2. Interactive local (`anymous --mini`): boots the split-footer direct mode
|
|
9
9
|
// with an in-process server (no external HTTP).
|
|
10
|
-
// 3. Interactive attach (`
|
|
11
|
-
//
|
|
10
|
+
// 3. Interactive attach (`anymous --mini --attach`): connects to a running
|
|
11
|
+
// anymous server and runs interactive mode against it.
|
|
12
12
|
//
|
|
13
13
|
// Also supports `--command` for slash-command execution, `--format json` for
|
|
14
14
|
// raw event streaming, `--continue` / `--session` for session resumption,
|
|
@@ -22,11 +22,11 @@ import { UI } from "../ui"
|
|
|
22
22
|
import { effectCmd } from "../effect-cmd"
|
|
23
23
|
import { EOL } from "os"
|
|
24
24
|
import { Filesystem } from "@/util/filesystem"
|
|
25
|
-
import {
|
|
25
|
+
import { createanymousClient, type anymousClient, type ToolPart } from "@anymous-ai/sdk/v2"
|
|
26
26
|
import { FormatError, FormatUnknownError } from "../error"
|
|
27
27
|
import { INTERACTIVE_INPUT_ERROR, resolveInteractiveStdin } from "./run/runtime.stdin"
|
|
28
28
|
|
|
29
|
-
type ModelInput = Parameters<
|
|
29
|
+
type ModelInput = Parameters<anymousClient["session"]["prompt"]>[0]["model"]
|
|
30
30
|
|
|
31
31
|
function pick(value: string | undefined): ModelInput | undefined {
|
|
32
32
|
if (!value) return undefined
|
|
@@ -194,12 +194,12 @@ export const RunCommand = effectCmd({
|
|
|
194
194
|
.option("password", {
|
|
195
195
|
alias: ["p"],
|
|
196
196
|
type: "string",
|
|
197
|
-
describe: "basic auth password (defaults to
|
|
197
|
+
describe: "basic auth password (defaults to ANYMOUS_SERVER_PASSWORD)",
|
|
198
198
|
})
|
|
199
199
|
.option("username", {
|
|
200
200
|
alias: ["u"],
|
|
201
201
|
type: "string",
|
|
202
|
-
describe: "basic auth username (defaults to
|
|
202
|
+
describe: "basic auth username (defaults to ANYMOUS_SERVER_USERNAME or 'anymous')",
|
|
203
203
|
})
|
|
204
204
|
.option("dir", {
|
|
205
205
|
type: "string",
|
|
@@ -347,7 +347,7 @@ export const RunCommand = effectCmd({
|
|
|
347
347
|
? ServerAuth.headers({ password: args.password, username: args.username })
|
|
348
348
|
: undefined
|
|
349
349
|
const attachSDK = (dir?: string) => {
|
|
350
|
-
return
|
|
350
|
+
return createanymousClient({
|
|
351
351
|
baseUrl: args.attach!,
|
|
352
352
|
directory: dir,
|
|
353
353
|
headers: attachHeaders,
|
|
@@ -453,7 +453,7 @@ export const RunCommand = effectCmd({
|
|
|
453
453
|
return message.slice(0, 50) + (message.length > 50 ? "..." : "")
|
|
454
454
|
}
|
|
455
455
|
|
|
456
|
-
async function session(sdk:
|
|
456
|
+
async function session(sdk: anymousClient): Promise<SessionInfo | undefined> {
|
|
457
457
|
if (args.session) {
|
|
458
458
|
const current = await sdk.session
|
|
459
459
|
.get({
|
|
@@ -532,7 +532,7 @@ export const RunCommand = effectCmd({
|
|
|
532
532
|
}
|
|
533
533
|
}
|
|
534
534
|
|
|
535
|
-
async function share(sdk:
|
|
535
|
+
async function share(sdk: anymousClient, sessionID: string) {
|
|
536
536
|
const cfg = await sdk.config.get()
|
|
537
537
|
if (!cfg.data) return
|
|
538
538
|
if (cfg.data.share !== "auto" && !flags.autoShare && !args.share) return
|
|
@@ -548,7 +548,7 @@ export const RunCommand = effectCmd({
|
|
|
548
548
|
}
|
|
549
549
|
|
|
550
550
|
async function createFreshSession(
|
|
551
|
-
sdk:
|
|
551
|
+
sdk: anymousClient,
|
|
552
552
|
input: { agent: string | undefined; model: ModelInput | undefined; variant: string | undefined },
|
|
553
553
|
): Promise<SessionInfo> {
|
|
554
554
|
const result = await sdk.session.create({
|
|
@@ -575,7 +575,7 @@ export const RunCommand = effectCmd({
|
|
|
575
575
|
}
|
|
576
576
|
}
|
|
577
577
|
|
|
578
|
-
async function current(sdk:
|
|
578
|
+
async function current(sdk: anymousClient): Promise<string> {
|
|
579
579
|
if (!args.attach) {
|
|
580
580
|
return directory ?? root
|
|
581
581
|
}
|
|
@@ -618,7 +618,7 @@ export const RunCommand = effectCmd({
|
|
|
618
618
|
return name
|
|
619
619
|
}
|
|
620
620
|
|
|
621
|
-
async function attachAgent(sdk:
|
|
621
|
+
async function attachAgent(sdk: anymousClient) {
|
|
622
622
|
if (!args.agent) return undefined
|
|
623
623
|
const name = args.agent
|
|
624
624
|
|
|
@@ -658,7 +658,7 @@ export const RunCommand = effectCmd({
|
|
|
658
658
|
return name
|
|
659
659
|
}
|
|
660
660
|
|
|
661
|
-
async function pickAgent(sdk:
|
|
661
|
+
async function pickAgent(sdk: anymousClient) {
|
|
662
662
|
if (!args.agent) return undefined
|
|
663
663
|
if (args.attach) {
|
|
664
664
|
return attachAgent(sdk)
|
|
@@ -667,7 +667,7 @@ export const RunCommand = effectCmd({
|
|
|
667
667
|
return localAgent()
|
|
668
668
|
}
|
|
669
669
|
|
|
670
|
-
async function execute(sdk:
|
|
670
|
+
async function execute(sdk: anymousClient) {
|
|
671
671
|
const sess = await session(sdk)
|
|
672
672
|
if (!sess?.id) {
|
|
673
673
|
UI.error("Session not found")
|
|
@@ -694,7 +694,7 @@ export const RunCommand = effectCmd({
|
|
|
694
694
|
// to stdout/UI. `client` is passed explicitly because attach mode may
|
|
695
695
|
// rebind the SDK to the session's directory after the subscription is
|
|
696
696
|
// created, and replies issued from inside the loop must use that client.
|
|
697
|
-
async function loop(client:
|
|
697
|
+
async function loop(client: anymousClient, events: Awaited<ReturnType<typeof sdk.event.subscribe>>) {
|
|
698
698
|
const toggles = new Map<string, boolean>()
|
|
699
699
|
let error: string | undefined
|
|
700
700
|
|
|
@@ -948,8 +948,8 @@ export const RunCommand = effectCmd({
|
|
|
948
948
|
if (auth) headers.set("Authorization", auth)
|
|
949
949
|
return Server.Default().app.fetch(new Request(request, { headers }))
|
|
950
950
|
}) as typeof globalThis.fetch
|
|
951
|
-
const sdk =
|
|
952
|
-
baseUrl: "http://
|
|
951
|
+
const sdk = createanymousClient({
|
|
952
|
+
baseUrl: "http://anymous.internal",
|
|
953
953
|
fetch: fetchFn,
|
|
954
954
|
directory,
|
|
955
955
|
})
|
|
@@ -977,7 +977,7 @@ type MiniCommandInput = {
|
|
|
977
977
|
export async function runMini(input: MiniCommandInput) {
|
|
978
978
|
if (!RunCommand.handler) throw new Error("Mini command handler is unavailable")
|
|
979
979
|
await RunCommand.handler({
|
|
980
|
-
$0: "
|
|
980
|
+
$0: "anymous",
|
|
981
981
|
_: ["mini"],
|
|
982
982
|
message: input.prompt ? [input.prompt] : [],
|
|
983
983
|
command: undefined,
|
package/src/cli/cmd/serve.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { Effect } from "effect"
|
|
2
2
|
import { effectCmd } from "../effect-cmd"
|
|
3
3
|
import { withNetworkOptions, resolveNetworkOptions } from "../network"
|
|
4
|
-
import { Flag } from "@
|
|
4
|
+
import { Flag } from "@anymous-ai/core/flag/flag"
|
|
5
5
|
|
|
6
6
|
export const ServeCommand = effectCmd({
|
|
7
7
|
command: "serve",
|
|
8
8
|
builder: (yargs) => withNetworkOptions(yargs),
|
|
9
9
|
describe: "starts a headless Anymous server",
|
|
10
|
-
// Server loads instances per-request via x-
|
|
10
|
+
// Server loads instances per-request via x-anymous-directory header — no
|
|
11
11
|
// need for an ambient project InstanceContext at startup.
|
|
12
12
|
instance: false,
|
|
13
13
|
handler: Effect.fn("Cli.serve")(function* (args) {
|
|
14
14
|
const { Server } = yield* Effect.promise(() => import("../../server/server"))
|
|
15
|
-
if (!Flag.
|
|
16
|
-
console.log("Warning:
|
|
15
|
+
if (!Flag.ANYMOUS_SERVER_PASSWORD) {
|
|
16
|
+
console.log("Warning: ANYMOUS_SERVER_PASSWORD is not set; server is unsecured.")
|
|
17
17
|
}
|
|
18
18
|
const opts = yield* resolveNetworkOptions(args)
|
|
19
19
|
const server = yield* Effect.promise(() => Server.listen(opts))
|
package/src/cli/cmd/session.ts
CHANGED
|
@@ -6,13 +6,13 @@ import { Session } from "@/session/session"
|
|
|
6
6
|
import { SessionID } from "../../session/schema"
|
|
7
7
|
import { UI } from "../ui"
|
|
8
8
|
import { Locale } from "@/util/locale"
|
|
9
|
-
import { Flag } from "@
|
|
9
|
+
import { Flag } from "@anymous-ai/core/flag/flag"
|
|
10
10
|
import { Filesystem } from "@/util/filesystem"
|
|
11
11
|
import { Process } from "@/util/process"
|
|
12
12
|
import { NotFoundError } from "@/storage/storage"
|
|
13
13
|
import { EOL } from "os"
|
|
14
14
|
import path from "path"
|
|
15
|
-
import { which } from "@
|
|
15
|
+
import { which } from "@anymous-ai/core/util/which"
|
|
16
16
|
|
|
17
17
|
function pagerCmd(): string[] {
|
|
18
18
|
const lessOptions = ["-R", "-S"]
|
|
@@ -26,8 +26,8 @@ function pagerCmd(): string[] {
|
|
|
26
26
|
if (Filesystem.stat(lessOnPath)?.size) return [lessOnPath, ...lessOptions]
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
if (Flag.
|
|
30
|
-
const less = path.join(Flag.
|
|
29
|
+
if (Flag.ANYMOUS_GIT_BASH_PATH) {
|
|
30
|
+
const less = path.join(Flag.ANYMOUS_GIT_BASH_PATH, "..", "..", "usr", "bin", "less.exe")
|
|
31
31
|
if (Filesystem.stat(less)?.size) return [less, ...lessOptions]
|
|
32
32
|
}
|
|
33
33
|
|
package/src/cli/cmd/stats.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { Effect } from "effect"
|
|
|
2
2
|
import { effectCmd } from "../effect-cmd"
|
|
3
3
|
import { Session } from "@/session/session"
|
|
4
4
|
import { NotFoundError } from "@/storage/storage"
|
|
5
|
-
import { Database } from "@
|
|
6
|
-
import { SessionTable } from "@
|
|
5
|
+
import { Database } from "@anymous-ai/core/database/database"
|
|
6
|
+
import { SessionTable } from "@anymous-ai/core/session/sql"
|
|
7
7
|
import { Project } from "@/project/project"
|
|
8
8
|
import { InstanceRef } from "@/effect/instance-ref"
|
|
9
9
|
|
package/src/cli/cmd/tui.ts
CHANGED
|
@@ -4,19 +4,19 @@ import { type rpc } from "../tui/worker"
|
|
|
4
4
|
import path from "path"
|
|
5
5
|
import { fileURLToPath } from "url"
|
|
6
6
|
import { UI } from "@/cli/ui"
|
|
7
|
-
import { errorMessage } from "@
|
|
7
|
+
import { errorMessage } from "@anymous-ai/tui/util/error"
|
|
8
8
|
import { withTimeout } from "@/util/timeout"
|
|
9
9
|
import { withNetworkOptions, resolveNetworkOptionsNoConfig, hasArg } from "@/cli/network"
|
|
10
10
|
import { Filesystem } from "@/util/filesystem"
|
|
11
|
-
import type { GlobalEvent } from "@
|
|
12
|
-
import type { EventSource } from "@
|
|
11
|
+
import type { GlobalEvent } from "@anymous-ai/sdk/v2"
|
|
12
|
+
import type { EventSource } from "@anymous-ai/tui/context/sdk"
|
|
13
13
|
import { writeHeapSnapshot } from "v8"
|
|
14
14
|
import { ServerAuth } from "@/server/auth"
|
|
15
15
|
import { validateSession } from "../tui/validate-session"
|
|
16
|
-
import { win32InstallCtrlCGuard } from "@
|
|
16
|
+
import { win32InstallCtrlCGuard } from "@anymous-ai/tui/terminal-win32"
|
|
17
17
|
|
|
18
18
|
declare global {
|
|
19
|
-
const
|
|
19
|
+
const ANYMOUS_WORKER_PATH: string
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
type RpcClient = ReturnType<typeof Rpc.client<typeof rpc>>
|
|
@@ -50,7 +50,7 @@ function createEventSource(client: RpcClient): EventSource {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
async function target() {
|
|
53
|
-
if (typeof
|
|
53
|
+
if (typeof ANYMOUS_WORKER_PATH !== "undefined") return ANYMOUS_WORKER_PATH
|
|
54
54
|
const dist = new URL("./cli/tui/worker.js", import.meta.url)
|
|
55
55
|
if (await Filesystem.exists(fileURLToPath(dist))) return dist
|
|
56
56
|
return new URL("../tui/worker.ts", import.meta.url)
|
|
@@ -243,7 +243,7 @@ export const TuiThreadCommand = cmd({
|
|
|
243
243
|
headers,
|
|
244
244
|
}
|
|
245
245
|
: {
|
|
246
|
-
url: "http://
|
|
246
|
+
url: "http://anymous.internal",
|
|
247
247
|
fetch: createWorkerFetch(client),
|
|
248
248
|
events: createEventSource(client),
|
|
249
249
|
}
|
package/src/cli/cmd/uninstall.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { Argv } from "yargs"
|
|
|
2
2
|
import { UI } from "../ui"
|
|
3
3
|
import * as prompts from "@clack/prompts"
|
|
4
4
|
import { Installation } from "../../installation"
|
|
5
|
-
import { Global } from "@
|
|
5
|
+
import { Global } from "@anymous-ai/core/global"
|
|
6
6
|
import fs from "fs/promises"
|
|
7
7
|
import path from "path"
|
|
8
8
|
import os from "os"
|
|
@@ -55,7 +55,7 @@ export const UninstallCommand = {
|
|
|
55
55
|
UI.empty()
|
|
56
56
|
UI.println(UI.logo(" "))
|
|
57
57
|
UI.empty()
|
|
58
|
-
prompts.intro("Uninstall
|
|
58
|
+
prompts.intro("Uninstall anymous")
|
|
59
59
|
|
|
60
60
|
const method = await Installation.method()
|
|
61
61
|
prompts.log.info(`Installation method: ${method}`)
|
|
@@ -129,10 +129,10 @@ async function showRemovalSummary(targets: RemovalTargets, method: Installation.
|
|
|
129
129
|
|
|
130
130
|
if (method !== "curl" && method !== "unknown") {
|
|
131
131
|
const cmds: Record<string, string> = {
|
|
132
|
-
npm: "npm uninstall -g
|
|
133
|
-
pnpm: "pnpm uninstall -g
|
|
134
|
-
bun: "bun remove -g
|
|
135
|
-
yarn: "yarn global remove
|
|
132
|
+
npm: "npm uninstall -g anymous-ai",
|
|
133
|
+
pnpm: "pnpm uninstall -g anymous-ai",
|
|
134
|
+
bun: "bun remove -g anymous-ai",
|
|
135
|
+
yarn: "yarn global remove anymous-ai",
|
|
136
136
|
brew: "brew uninstall anymous",
|
|
137
137
|
choco: "choco uninstall anymous",
|
|
138
138
|
scoop: "scoop uninstall anymous",
|
|
@@ -180,19 +180,19 @@ async function executeUninstall(method: Installation.Method, targets: RemovalTar
|
|
|
180
180
|
|
|
181
181
|
if (method !== "curl" && method !== "unknown") {
|
|
182
182
|
const cmds: Record<string, string[]> = {
|
|
183
|
-
npm: ["npm", "uninstall", "-g", "
|
|
184
|
-
pnpm: ["pnpm", "uninstall", "-g", "
|
|
185
|
-
bun: ["bun", "remove", "-g", "
|
|
186
|
-
yarn: ["yarn", "global", "remove", "
|
|
187
|
-
brew: ["brew", "uninstall", "
|
|
188
|
-
choco: ["choco", "uninstall", "
|
|
189
|
-
scoop: ["scoop", "uninstall", "
|
|
183
|
+
npm: ["npm", "uninstall", "-g", "anymous-ai"],
|
|
184
|
+
pnpm: ["pnpm", "uninstall", "-g", "anymous-ai"],
|
|
185
|
+
bun: ["bun", "remove", "-g", "anymous-ai"],
|
|
186
|
+
yarn: ["yarn", "global", "remove", "anymous-ai"],
|
|
187
|
+
brew: ["brew", "uninstall", "anymous"],
|
|
188
|
+
choco: ["choco", "uninstall", "anymous"],
|
|
189
|
+
scoop: ["scoop", "uninstall", "anymous"],
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
const cmd = cmds[method]
|
|
193
193
|
if (cmd) {
|
|
194
194
|
spinner.start(`Running ${cmd.join(" ")}...`)
|
|
195
|
-
const result = await Process.run(method === "choco" ? ["choco", "uninstall", "
|
|
195
|
+
const result = await Process.run(method === "choco" ? ["choco", "uninstall", "anymous", "-y", "-r"] : cmd, {
|
|
196
196
|
nothrow: true,
|
|
197
197
|
})
|
|
198
198
|
if (result.code !== 0) {
|
|
@@ -215,7 +215,7 @@ async function executeUninstall(method: Installation.Method, targets: RemovalTar
|
|
|
215
215
|
prompts.log.info(` rm "${targets.binary}"`)
|
|
216
216
|
|
|
217
217
|
const binDir = path.dirname(targets.binary)
|
|
218
|
-
if (binDir.includes(".
|
|
218
|
+
if (binDir.includes(".anymous")) {
|
|
219
219
|
prompts.log.info(` rmdir "${binDir}" 2>/dev/null`)
|
|
220
220
|
}
|
|
221
221
|
}
|
|
@@ -229,7 +229,7 @@ async function executeUninstall(method: Installation.Method, targets: RemovalTar
|
|
|
229
229
|
}
|
|
230
230
|
|
|
231
231
|
UI.empty()
|
|
232
|
-
prompts.log.success("Thank you for using
|
|
232
|
+
prompts.log.success("Thank you for using anymous!")
|
|
233
233
|
}
|
|
234
234
|
|
|
235
235
|
async function getShellConfigFile(): Promise<string | null> {
|
|
@@ -266,7 +266,7 @@ async function getShellConfigFile(): Promise<string | null> {
|
|
|
266
266
|
if (!exists) continue
|
|
267
267
|
|
|
268
268
|
const content = await Filesystem.readText(file).catch(() => "")
|
|
269
|
-
if (content.includes("#
|
|
269
|
+
if (content.includes("# anymous") || content.includes(".anymous/bin")) {
|
|
270
270
|
return file
|
|
271
271
|
}
|
|
272
272
|
}
|
|
@@ -284,21 +284,21 @@ async function cleanShellConfig(file: string) {
|
|
|
284
284
|
for (const line of lines) {
|
|
285
285
|
const trimmed = line.trim()
|
|
286
286
|
|
|
287
|
-
if (trimmed === "#
|
|
287
|
+
if (trimmed === "# anymous") {
|
|
288
288
|
skip = true
|
|
289
289
|
continue
|
|
290
290
|
}
|
|
291
291
|
|
|
292
292
|
if (skip) {
|
|
293
293
|
skip = false
|
|
294
|
-
if (trimmed.includes(".
|
|
294
|
+
if (trimmed.includes(".anymous/bin") || trimmed.includes("fish_add_path")) {
|
|
295
295
|
continue
|
|
296
296
|
}
|
|
297
297
|
}
|
|
298
298
|
|
|
299
299
|
if (
|
|
300
|
-
(trimmed.startsWith("export PATH=") && trimmed.includes(".
|
|
301
|
-
(trimmed.startsWith("fish_add_path") && trimmed.includes(".
|
|
300
|
+
(trimmed.startsWith("export PATH=") && trimmed.includes(".anymous/bin")) ||
|
|
301
|
+
(trimmed.startsWith("fish_add_path") && trimmed.includes(".anymous"))
|
|
302
302
|
) {
|
|
303
303
|
continue
|
|
304
304
|
}
|
package/src/cli/cmd/upgrade.ts
CHANGED
|
@@ -2,13 +2,13 @@ import type { Argv } from "yargs"
|
|
|
2
2
|
import { UI } from "../ui"
|
|
3
3
|
import * as prompts from "@clack/prompts"
|
|
4
4
|
import { Installation } from "../../installation"
|
|
5
|
-
import { InstallationVersion } from "@
|
|
5
|
+
import { InstallationVersion } from "@anymous-ai/core/installation/version"
|
|
6
6
|
|
|
7
|
-
const
|
|
7
|
+
const ANYMOUS_RELEASES = "https://api.github.com/repos/anymousdark/anymous/releases/latest"
|
|
8
8
|
|
|
9
|
-
async function
|
|
9
|
+
async function checkanymousUpdate(): Promise<string | null> {
|
|
10
10
|
try {
|
|
11
|
-
const resp = await fetch(
|
|
11
|
+
const resp = await fetch(ANYMOUS_RELEASES, { headers: { "User-Agent": "anymous" } })
|
|
12
12
|
if (!resp.ok) return null
|
|
13
13
|
const data: any = await resp.json()
|
|
14
14
|
return (data.tag_name as string).replace(/^v/, "")
|
|
@@ -34,7 +34,7 @@ export const UpgradeCommand = {
|
|
|
34
34
|
})
|
|
35
35
|
.option("sync", {
|
|
36
36
|
alias: "s",
|
|
37
|
-
describe: "sync with latest
|
|
37
|
+
describe: "sync with latest anymous release before upgrading",
|
|
38
38
|
type: "boolean",
|
|
39
39
|
default: false,
|
|
40
40
|
})
|
|
@@ -45,22 +45,22 @@ export const UpgradeCommand = {
|
|
|
45
45
|
UI.empty()
|
|
46
46
|
prompts.intro("Upgrade")
|
|
47
47
|
|
|
48
|
-
// Check for
|
|
49
|
-
const
|
|
50
|
-
if (
|
|
51
|
-
prompts.log.info(`
|
|
48
|
+
// Check for anymous updates
|
|
49
|
+
const anymousLatest = await checkanymousUpdate()
|
|
50
|
+
if (anymousLatest && anymousLatest !== InstallationVersion) {
|
|
51
|
+
prompts.log.info(`anymous v${anymousLatest} disponível (atual: v${InstallationVersion})`)
|
|
52
52
|
if (args.sync) {
|
|
53
|
-
prompts.log.info("Sincronizando com
|
|
54
|
-
prompts.log.info(`Execute: bun run script/sync-
|
|
53
|
+
prompts.log.info("Sincronizando com anymous...")
|
|
54
|
+
prompts.log.info(`Execute: bun run script/sync-anymous.ts --version=${anymousLatest}`)
|
|
55
55
|
} else {
|
|
56
56
|
const sync = await prompts.confirm({
|
|
57
|
-
message: `Sincronizar com
|
|
57
|
+
message: `Sincronizar com anymous v${anymousLatest}?`,
|
|
58
58
|
initialValue: false,
|
|
59
59
|
})
|
|
60
60
|
if (sync) {
|
|
61
61
|
prompts.log.info(`Execute para sincronizar:`)
|
|
62
|
-
prompts.log.info(` bun run script/sync-
|
|
63
|
-
prompts.log.info(`Depois: cd packages/
|
|
62
|
+
prompts.log.info(` bun run script/sync-anymous.ts --version=${anymousLatest}`)
|
|
63
|
+
prompts.log.info(`Depois: cd packages/anymous/dist-npm && npm publish --access public`)
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
}
|
package/src/cli/cmd/web.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Effect } from "effect"
|
|
|
2
2
|
import { UI } from "../ui"
|
|
3
3
|
import { effectCmd } from "../effect-cmd"
|
|
4
4
|
import { withNetworkOptions, resolveNetworkOptions } from "../network"
|
|
5
|
-
import { Flag } from "@
|
|
5
|
+
import { Flag } from "@anymous-ai/core/flag/flag"
|
|
6
6
|
import open from "open"
|
|
7
7
|
import { networkInterfaces } from "os"
|
|
8
8
|
|
|
@@ -32,13 +32,13 @@ export const WebCommand = effectCmd({
|
|
|
32
32
|
command: "web",
|
|
33
33
|
builder: (yargs) => withNetworkOptions(yargs),
|
|
34
34
|
describe: "start Anymous server and open web interface",
|
|
35
|
-
// Server loads instances per-request via x-
|
|
35
|
+
// Server loads instances per-request via x-anymous-directory header — no
|
|
36
36
|
// ambient project InstanceContext needed at startup.
|
|
37
37
|
instance: false,
|
|
38
38
|
handler: Effect.fn("Cli.web")(function* (args) {
|
|
39
39
|
const { Server } = yield* Effect.promise(() => import("../../server/server"))
|
|
40
|
-
if (!Flag.
|
|
41
|
-
UI.println(UI.Style.TEXT_WARNING_BOLD + "!
|
|
40
|
+
if (!Flag.ANYMOUS_SERVER_PASSWORD) {
|
|
41
|
+
UI.println(UI.Style.TEXT_WARNING_BOLD + "! ANYMOUS_SERVER_PASSWORD is not set; server is unsecured.")
|
|
42
42
|
}
|
|
43
43
|
const opts = yield* resolveNetworkOptions(args)
|
|
44
44
|
const server = yield* Effect.promise(() => Server.listen(opts))
|
package/src/cli/error.ts
CHANGED
package/src/cli/heap.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path from "path"
|
|
2
2
|
import { writeHeapSnapshot } from "node:v8"
|
|
3
|
-
import { Flag } from "@
|
|
4
|
-
import { Global } from "@
|
|
3
|
+
import { Flag } from "@anymous-ai/core/flag/flag"
|
|
4
|
+
import { Global } from "@anymous-ai/core/global"
|
|
5
5
|
const MINUTE = 60_000
|
|
6
6
|
const LIMIT = 2 * 1024 * 1024 * 1024
|
|
7
7
|
|
|
@@ -10,7 +10,7 @@ let lock = false
|
|
|
10
10
|
let armed = true
|
|
11
11
|
|
|
12
12
|
export function start() {
|
|
13
|
-
if (!Flag.
|
|
13
|
+
if (!Flag.ANYMOUS_AUTO_HEAP_SNAPSHOT) return
|
|
14
14
|
if (timer) return
|
|
15
15
|
|
|
16
16
|
const run = async () => {
|
package/src/cli/logo.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "@
|
|
1
|
+
export * from "@anymous-ai/tui/logo"
|
package/src/cli/network.ts
CHANGED
package/src/cli/tui/layer.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { run as runTui, type TuiInput } from "@
|
|
2
|
-
import { Global } from "@
|
|
3
|
-
import { AppNodeBuilder } from "@
|
|
1
|
+
import { run as runTui, type TuiInput } from "@anymous-ai/tui"
|
|
2
|
+
import { Global } from "@anymous-ai/core/global"
|
|
3
|
+
import { AppNodeBuilder } from "@anymous-ai/core/effect/app-node-builder"
|
|
4
4
|
import { Effect } from "effect"
|
|
5
5
|
|
|
6
6
|
export function run(input: TuiInput) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createanymousClient } from "@anymous-ai/sdk/v2"
|
|
2
2
|
import { SessionID } from "@/session/schema"
|
|
3
3
|
import { Schema } from "effect"
|
|
4
4
|
|
|
@@ -20,7 +20,7 @@ export async function validateSession(input: {
|
|
|
20
20
|
throw new Error(`Invalid session ID: ${error instanceof Error ? error.message : "unknown error"}`, { cause: error })
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
await
|
|
23
|
+
await createanymousClient({
|
|
24
24
|
baseUrl: input.url,
|
|
25
25
|
directory: input.directory,
|
|
26
26
|
fetch: input.fetch,
|