anymous 1.0.5 → 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 +1 -1
- 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 +1 -1
- 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 +19 -19
- 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.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/storage/schema.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { AccountTable, AccountStateTable, ControlAccountTable } from "@
|
|
2
|
-
export { ProjectTable } from "@
|
|
3
|
-
export { SessionTable, MessageTable, PartTable, TodoTable } from "@
|
|
4
|
-
export { SessionShareTable } from "@
|
|
5
|
-
export { WorkspaceTable } from "@
|
|
1
|
+
export { AccountTable, AccountStateTable, ControlAccountTable } from "@anymous-ai/core/account/sql"
|
|
2
|
+
export { ProjectTable } from "@anymous-ai/core/project/sql"
|
|
3
|
+
export { SessionTable, MessageTable, PartTable, TodoTable } from "@anymous-ai/core/session/sql"
|
|
4
|
+
export { SessionShareTable } from "@anymous-ai/core/share/sql"
|
|
5
|
+
export { WorkspaceTable } from "@anymous-ai/core/control-plane/workspace.sql"
|
package/src/storage/storage.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { LayerNode } from "@
|
|
1
|
+
import { LayerNode } from "@anymous-ai/core/effect/layer-node"
|
|
2
2
|
import path from "path"
|
|
3
|
-
import { Global } from "@
|
|
4
|
-
import { FSUtil } from "@
|
|
3
|
+
import { Global } from "@anymous-ai/core/global"
|
|
4
|
+
import { FSUtil } from "@anymous-ai/core/fs-util"
|
|
5
5
|
import { Effect, Exit, Layer, Option, RcMap, Schema, Context, TxReentrantLock } from "effect"
|
|
6
|
-
import { NonNegativeInt } from "@
|
|
6
|
+
import { NonNegativeInt } from "@anymous-ai/core/schema"
|
|
7
7
|
import { Git } from "@/git"
|
|
8
8
|
|
|
9
9
|
type Migration = (dir: string, fs: FSUtil.Interface, git: Git.Interface) => Effect.Effect<void, FSUtil.Error>
|
|
@@ -58,7 +58,7 @@ export interface Interface {
|
|
|
58
58
|
readonly list: (prefix: string[]) => Effect.Effect<string[][], FSUtil.Error>
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
export class Service extends Context.Service<Service, Interface>()("@
|
|
61
|
+
export class Service extends Context.Service<Service, Interface>()("@anymous/Storage") {}
|
|
62
62
|
|
|
63
63
|
function file(dir: string, key: string[]) {
|
|
64
64
|
return path.join(dir, ...key) + ".json"
|
package/src/sync/schema.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Schema } from "effect"
|
|
2
2
|
|
|
3
3
|
import { Identifier } from "@/id/id"
|
|
4
|
-
import { statics } from "@
|
|
4
|
+
import { statics } from "@anymous-ai/core/schema"
|
|
5
5
|
|
|
6
6
|
export const EventID = Schema.String.check(Schema.isStartsWith("evt")).pipe(
|
|
7
7
|
Schema.brand("EventID"),
|
package/src/temporary.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import yargs from "yargs"
|
|
2
2
|
import { TuiThreadCommand } from "./cli/cmd/tui"
|
|
3
|
-
import { InstallationVersion } from "@
|
|
3
|
+
import { InstallationVersion } from "@anymous-ai/core/installation/version"
|
|
4
4
|
import { hideBin } from "yargs/helpers"
|
|
5
5
|
const cli = yargs(hideBin(process.argv))
|
|
6
6
|
.parserConfiguration({ "populate--": true })
|
|
7
|
-
.scriptName("
|
|
7
|
+
.scriptName("anymous")
|
|
8
8
|
.wrap(100)
|
|
9
9
|
.help("help", "show help")
|
|
10
10
|
.alias("help", "h")
|
|
@@ -24,8 +24,8 @@ const cli = yargs(hideBin(process.argv))
|
|
|
24
24
|
type: "boolean",
|
|
25
25
|
})
|
|
26
26
|
.middleware((opts) => {
|
|
27
|
-
if (opts.printLogs) process.env.
|
|
28
|
-
if (opts.logLevel) process.env.
|
|
27
|
+
if (opts.printLogs) process.env.ANYMOUS_PRINT_LOGS = "1"
|
|
28
|
+
if (opts.logLevel) process.env.ANYMOUS_LOG_LEVEL = opts.logLevel
|
|
29
29
|
})
|
|
30
30
|
.command(TuiThreadCommand)
|
|
31
31
|
.parse()
|
package/src/tool/apply_patch.ts
CHANGED
|
@@ -2,16 +2,16 @@ import * as path from "path"
|
|
|
2
2
|
import { Effect, Schema } from "effect"
|
|
3
3
|
import * as Tool from "./tool"
|
|
4
4
|
import { EventV2Bridge } from "@/event-v2-bridge"
|
|
5
|
-
import { Watcher } from "@
|
|
5
|
+
import { Watcher } from "@anymous-ai/core/filesystem/watcher"
|
|
6
6
|
import { InstanceState } from "@/effect/instance-state"
|
|
7
7
|
import { Patch } from "../patch"
|
|
8
8
|
import { createTwoFilesPatch, diffLines } from "diff"
|
|
9
9
|
import { assertExternalDirectoryEffect } from "./external-directory"
|
|
10
10
|
import { trimDiff } from "./edit"
|
|
11
11
|
import { LSP } from "@/lsp/lsp"
|
|
12
|
-
import { FSUtil } from "@
|
|
12
|
+
import { FSUtil } from "@anymous-ai/core/fs-util"
|
|
13
13
|
import DESCRIPTION from "./apply_patch.txt"
|
|
14
|
-
import { FileSystem } from "@
|
|
14
|
+
import { FileSystem } from "@anymous-ai/core/filesystem"
|
|
15
15
|
import { Format } from "../format"
|
|
16
16
|
import * as Bom from "@/util/bom"
|
|
17
17
|
|
package/src/tool/code-mode.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as Tool from "./tool"
|
|
2
2
|
import { CallToolResultSchema, type CallToolResult } from "@modelcontextprotocol/sdk/types.js"
|
|
3
3
|
import { Cause, Effect, Schema } from "effect"
|
|
4
|
-
import { CodeMode, Tool as SandboxTool, toolError } from "@
|
|
4
|
+
import { CodeMode, Tool as SandboxTool, toolError } from "@anymous-ai/codemode"
|
|
5
5
|
import { MCP } from "@/mcp"
|
|
6
6
|
import { McpCatalog } from "@/mcp/catalog"
|
|
7
7
|
import { Agent } from "@/agent/agent"
|
package/src/tool/edit.ts
CHANGED
|
@@ -9,14 +9,14 @@ import * as Tool from "./tool"
|
|
|
9
9
|
import { LSP } from "@/lsp/lsp"
|
|
10
10
|
import { createTwoFilesPatch, diffLines } from "diff"
|
|
11
11
|
import DESCRIPTION from "./edit.txt"
|
|
12
|
-
import { FileSystem } from "@
|
|
13
|
-
import { Watcher } from "@
|
|
12
|
+
import { FileSystem } from "@anymous-ai/core/filesystem"
|
|
13
|
+
import { Watcher } from "@anymous-ai/core/filesystem/watcher"
|
|
14
14
|
import { EventV2Bridge } from "@/event-v2-bridge"
|
|
15
15
|
import { Format } from "../format"
|
|
16
16
|
import { InstanceState } from "@/effect/instance-state"
|
|
17
17
|
import { Snapshot } from "@/snapshot"
|
|
18
18
|
import { assertExternalDirectoryEffect } from "./external-directory"
|
|
19
|
-
import { FSUtil } from "@
|
|
19
|
+
import { FSUtil } from "@anymous-ai/core/fs-util"
|
|
20
20
|
import * as Bom from "@/util/bom"
|
|
21
21
|
|
|
22
22
|
function normalizeLineEndings(text: string): string {
|
|
@@ -3,7 +3,7 @@ import { Effect } from "effect"
|
|
|
3
3
|
import { InstanceState } from "@/effect/instance-state"
|
|
4
4
|
import type * as Tool from "./tool"
|
|
5
5
|
import { containsPath } from "../project/instance-context"
|
|
6
|
-
import { FSUtil } from "@
|
|
6
|
+
import { FSUtil } from "@anymous-ai/core/fs-util"
|
|
7
7
|
|
|
8
8
|
type Kind = "file" | "directory"
|
|
9
9
|
|
package/src/tool/glob.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import path from "path"
|
|
2
2
|
import { Effect, Schema } from "effect"
|
|
3
3
|
import { InstanceState } from "@/effect/instance-state"
|
|
4
|
-
import { FSUtil } from "@
|
|
5
|
-
import { Ripgrep } from "@
|
|
4
|
+
import { FSUtil } from "@anymous-ai/core/fs-util"
|
|
5
|
+
import { Ripgrep } from "@anymous-ai/core/ripgrep"
|
|
6
6
|
import { assertExternalDirectoryEffect } from "./external-directory"
|
|
7
7
|
import DESCRIPTION from "./glob.txt"
|
|
8
8
|
import * as Tool from "./tool"
|
package/src/tool/grep.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import path from "path"
|
|
2
2
|
import { Effect, Schema } from "effect"
|
|
3
3
|
import { InstanceState } from "@/effect/instance-state"
|
|
4
|
-
import { FSUtil } from "@
|
|
5
|
-
import { Ripgrep } from "@
|
|
4
|
+
import { FSUtil } from "@anymous-ai/core/fs-util"
|
|
5
|
+
import { Ripgrep } from "@anymous-ai/core/ripgrep"
|
|
6
6
|
import { assertExternalDirectoryEffect } from "./external-directory"
|
|
7
7
|
import DESCRIPTION from "./grep.txt"
|
|
8
8
|
import * as Tool from "./tool"
|
package/src/tool/lsp.ts
CHANGED
|
@@ -6,7 +6,7 @@ import DESCRIPTION from "./lsp.txt"
|
|
|
6
6
|
import { InstanceState } from "@/effect/instance-state"
|
|
7
7
|
import { pathToFileURL } from "url"
|
|
8
8
|
import { assertExternalDirectoryEffect } from "./external-directory"
|
|
9
|
-
import { FSUtil } from "@
|
|
9
|
+
import { FSUtil } from "@anymous-ai/core/fs-util"
|
|
10
10
|
|
|
11
11
|
const operations = [
|
|
12
12
|
"goToDefinition",
|
package/src/tool/lsp.txt
CHANGED
|
@@ -19,6 +19,6 @@ All operations require:
|
|
|
19
19
|
workspaceSymbol also accepts:
|
|
20
20
|
- query: A query string to filter symbols by. Empty string requests all symbols.
|
|
21
21
|
|
|
22
|
-
For workspaceSymbol, filePath is not sent in the LSP workspace/symbol request. It is used by
|
|
22
|
+
For workspaceSymbol, filePath is not sent in the LSP workspace/symbol request. It is used by anymous to select and start the matching LSP server.
|
|
23
23
|
|
|
24
24
|
Note: LSP servers must be configured for the file type. If no server is available, an error will be returned.
|
package/src/tool/plan.ts
CHANGED
package/src/tool/read.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Effect, Option, Schema, Scope, Stream } from "effect"
|
|
2
|
-
import { NonNegativeInt } from "@
|
|
2
|
+
import { NonNegativeInt } from "@anymous-ai/core/schema"
|
|
3
3
|
import * as path from "path"
|
|
4
4
|
import * as Tool from "./tool"
|
|
5
|
-
import { FSUtil } from "@
|
|
5
|
+
import { FSUtil } from "@anymous-ai/core/fs-util"
|
|
6
6
|
import { LSP } from "@/lsp/lsp"
|
|
7
7
|
import DESCRIPTION from "./read.txt"
|
|
8
8
|
import { InstanceState } from "@/effect/instance-state"
|
package/src/tool/registry.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { LayerNode } from "@
|
|
2
|
-
import { httpClient } from "@
|
|
3
|
-
import { Ripgrep } from "@
|
|
1
|
+
import { LayerNode } from "@anymous-ai/core/effect/layer-node"
|
|
2
|
+
import { httpClient } from "@anymous-ai/core/effect/app-node-platform"
|
|
3
|
+
import { Ripgrep } from "@anymous-ai/core/ripgrep"
|
|
4
4
|
import { PlanExitTool } from "./plan"
|
|
5
5
|
import { Session } from "@/session/session"
|
|
6
6
|
import { QuestionTool } from "./question"
|
|
@@ -10,7 +10,7 @@ import { GlobTool } from "./glob"
|
|
|
10
10
|
import { GrepTool } from "./grep"
|
|
11
11
|
import { ReadTool } from "./read"
|
|
12
12
|
import { TaskTool } from "./task"
|
|
13
|
-
import { Database } from "@
|
|
13
|
+
import { Database } from "@anymous-ai/core/database/database"
|
|
14
14
|
import { TodoWriteTool } from "./todo"
|
|
15
15
|
import { WebFetchTool } from "./webfetch"
|
|
16
16
|
import { WriteTool } from "./write"
|
|
@@ -18,7 +18,7 @@ import { InvalidTool } from "./invalid"
|
|
|
18
18
|
import { SkillTool } from "./skill"
|
|
19
19
|
import * as Tool from "./tool"
|
|
20
20
|
import { Config } from "@/config/config"
|
|
21
|
-
import { type ToolContext as PluginToolContext, type ToolDefinition } from "@
|
|
21
|
+
import { type ToolContext as PluginToolContext, type ToolDefinition } from "@anymous-ai/plugin"
|
|
22
22
|
import type { JSONSchema7, JSONSchema7Definition } from "@ai-sdk/provider"
|
|
23
23
|
import { Schema } from "effect"
|
|
24
24
|
import z from "zod"
|
|
@@ -29,12 +29,12 @@ import { WebSearchTool } from "./websearch"
|
|
|
29
29
|
import { LspTool } from "./lsp"
|
|
30
30
|
import * as Truncate from "./truncate"
|
|
31
31
|
import { ApplyPatchTool } from "./apply_patch"
|
|
32
|
-
import { Glob } from "@
|
|
32
|
+
import { Glob } from "@anymous-ai/core/util/glob"
|
|
33
33
|
import path from "path"
|
|
34
34
|
import { pathToFileURL } from "url"
|
|
35
35
|
import { Effect, Layer, Context } from "effect"
|
|
36
36
|
import { ChildProcessSpawner } from "effect/unstable/process/ChildProcessSpawner"
|
|
37
|
-
import { CrossSpawnSpawner } from "@
|
|
37
|
+
import { CrossSpawnSpawner } from "@anymous-ai/core/cross-spawn-spawner"
|
|
38
38
|
import { Format } from "../format"
|
|
39
39
|
import { InstanceState } from "@/effect/instance-state"
|
|
40
40
|
import { EffectBridge } from "@/effect/bridge"
|
|
@@ -42,21 +42,21 @@ import { Question } from "../question"
|
|
|
42
42
|
import { Todo } from "../session/todo"
|
|
43
43
|
import { LSP } from "@/lsp/lsp"
|
|
44
44
|
import { Instruction } from "../session/instruction"
|
|
45
|
-
import { FSUtil } from "@
|
|
45
|
+
import { FSUtil } from "@anymous-ai/core/fs-util"
|
|
46
46
|
import { EventV2Bridge } from "@/event-v2-bridge"
|
|
47
47
|
import { Agent } from "../agent/agent"
|
|
48
48
|
import { Skill } from "../skill"
|
|
49
49
|
import { Permission } from "@/permission"
|
|
50
50
|
import { BackgroundJob } from "@/background/job"
|
|
51
51
|
import { RuntimeFlags } from "@/effect/runtime-flags"
|
|
52
|
-
import { ProviderV2 } from "@
|
|
53
|
-
import { ModelV2 } from "@
|
|
52
|
+
import { ProviderV2 } from "@anymous-ai/core/provider"
|
|
53
|
+
import { ModelV2 } from "@anymous-ai/core/model"
|
|
54
54
|
import { MCP } from "@/mcp"
|
|
55
|
-
import { PermissionV1 } from "@
|
|
55
|
+
import { PermissionV1 } from "@anymous-ai/core/v1/permission"
|
|
56
56
|
import { McpCatalog } from "@/mcp/catalog"
|
|
57
57
|
|
|
58
58
|
export function webSearchEnabled(providerID: ProviderV2.ID, flags = { exa: false, parallel: false }) {
|
|
59
|
-
return providerID === ProviderV2.ID.
|
|
59
|
+
return providerID === ProviderV2.ID.anymous || flags.exa || flags.parallel
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
type TaskDef = Tool.InferDef<typeof TaskTool>
|
|
@@ -81,7 +81,7 @@ export interface Interface {
|
|
|
81
81
|
}) => Effect.Effect<Tool.Def[]>
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
export class Service extends Context.Service<Service, Interface>()("@
|
|
84
|
+
export class Service extends Context.Service<Service, Interface>()("@anymous/ToolRegistry") {}
|
|
85
85
|
|
|
86
86
|
const layer = Layer.effect(
|
|
87
87
|
Service,
|
package/src/tool/schema.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Schema } from "effect"
|
|
2
2
|
|
|
3
3
|
import { Identifier } from "@/id/id"
|
|
4
|
-
import { statics } from "@
|
|
4
|
+
import { statics } from "@anymous-ai/core/schema"
|
|
5
5
|
|
|
6
6
|
const toolIdSchema = Schema.String.check(Schema.isStartsWith("tool")).pipe(Schema.brand("ToolID"))
|
|
7
7
|
|
package/src/tool/shell/id.ts
CHANGED
|
@@ -12,7 +12,7 @@ export function toKind(value: string): Kind {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
// Keep the exposed tool ID and permission key as "bash" for compatibility with
|
|
15
|
-
// existing plugins, users, and saved permissions. Rename with
|
|
15
|
+
// existing plugins, users, and saved permissions. Rename with anymous 2.0.
|
|
16
16
|
export const ToolID = "bash"
|
|
17
17
|
export type ToolID = typeof ToolID
|
|
18
18
|
|
package/src/tool/shell/prompt.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Schema } from "effect"
|
|
2
2
|
import DESCRIPTION from "./shell.txt"
|
|
3
|
-
import { PositiveInt } from "@
|
|
4
|
-
import { Global } from "@
|
|
3
|
+
import { PositiveInt } from "@anymous-ai/core/schema"
|
|
4
|
+
import { Global } from "@anymous-ai/core/global"
|
|
5
5
|
import { ShellID } from "./id"
|
|
6
6
|
|
|
7
7
|
const PS = new Set(["powershell", "pwsh"])
|
package/src/tool/shell.ts
CHANGED
|
@@ -8,11 +8,11 @@ import { InstanceState } from "@/effect/instance-state"
|
|
|
8
8
|
import { lazy } from "@/util/lazy"
|
|
9
9
|
import { Language, type Node } from "web-tree-sitter"
|
|
10
10
|
|
|
11
|
-
import { FSUtil } from "@
|
|
11
|
+
import { FSUtil } from "@anymous-ai/core/fs-util"
|
|
12
12
|
import { fileURLToPath } from "url"
|
|
13
13
|
import { Config } from "@/config/config"
|
|
14
14
|
import { RuntimeFlags } from "@/effect/runtime-flags"
|
|
15
|
-
import { Shell } from "@
|
|
15
|
+
import { Shell } from "@anymous-ai/core/shell"
|
|
16
16
|
import { ShellID } from "./shell/id"
|
|
17
17
|
|
|
18
18
|
import * as Truncate from "./truncate"
|
package/src/tool/skill.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from "path"
|
|
2
2
|
import { Effect, Schema } from "effect"
|
|
3
|
-
import { Ripgrep } from "@
|
|
3
|
+
import { Ripgrep } from "@anymous-ai/core/ripgrep"
|
|
4
4
|
import { Skill } from "../skill"
|
|
5
5
|
import * as Tool from "./tool"
|
|
6
6
|
import DESCRIPTION from "./skill.txt"
|
package/src/tool/task.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as Tool from "./tool"
|
|
2
2
|
import DESCRIPTION from "./task.txt"
|
|
3
3
|
import { ToolJsonSchema } from "./json-schema"
|
|
4
|
-
import { SessionV1 } from "@
|
|
4
|
+
import { SessionV1 } from "@anymous-ai/core/v1/session"
|
|
5
5
|
import { BackgroundJob } from "@/background/job"
|
|
6
6
|
import { Session } from "@/session/session"
|
|
7
7
|
import { SessionID, MessageID } from "../session/schema"
|
|
@@ -13,7 +13,7 @@ import { Config } from "@/config/config"
|
|
|
13
13
|
import { Effect, Exit, Schema, Scope } from "effect"
|
|
14
14
|
import { EffectBridge } from "@/effect/bridge"
|
|
15
15
|
import { RuntimeFlags } from "@/effect/runtime-flags"
|
|
16
|
-
import { Database } from "@
|
|
16
|
+
import { Database } from "@anymous-ai/core/database/database"
|
|
17
17
|
|
|
18
18
|
export interface TaskPromptOps {
|
|
19
19
|
cancel(sessionID: SessionID): Effect.Effect<void>
|
|
@@ -97,7 +97,7 @@ export const TaskTool = Tool.define(
|
|
|
97
97
|
const runInBackground = params.background === true
|
|
98
98
|
if (runInBackground && !flags.experimentalBackgroundSubagents) {
|
|
99
99
|
return yield* Effect.fail(
|
|
100
|
-
new Error("Background subagents require
|
|
100
|
+
new Error("Background subagents require ANYMOUS_EXPERIMENTAL_BACKGROUND_SUBAGENTS=true"),
|
|
101
101
|
)
|
|
102
102
|
}
|
|
103
103
|
|
package/src/tool/tool.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { PermissionV1 } from "@
|
|
1
|
+
import { PermissionV1 } from "@anymous-ai/core/v1/permission"
|
|
2
2
|
import { Effect, Schema } from "effect"
|
|
3
|
-
import { SessionV1 } from "@
|
|
3
|
+
import { SessionV1 } from "@anymous-ai/core/v1/session"
|
|
4
4
|
import type { JSONSchema7 } from "@ai-sdk/provider"
|
|
5
5
|
import type { MessageV2 } from "../session/message-v2"
|
|
6
6
|
import type { Permission } from "../permission"
|
package/src/tool/truncate.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { LayerNode } from "@
|
|
1
|
+
import { LayerNode } from "@anymous-ai/core/effect/layer-node"
|
|
2
2
|
import { NodePath } from "@effect/platform-node"
|
|
3
3
|
import { Cause, Duration, Effect, Layer, Option, Schedule, Context } from "effect"
|
|
4
4
|
import path from "path"
|
|
5
5
|
import type { Agent } from "../agent/agent"
|
|
6
|
-
import { FSUtil } from "@
|
|
6
|
+
import { FSUtil } from "@anymous-ai/core/fs-util"
|
|
7
7
|
import { evaluate } from "@/permission/evaluate"
|
|
8
8
|
import { Config } from "@/config/config"
|
|
9
9
|
import { Identifier } from "../id/id"
|
|
@@ -39,12 +39,12 @@ export interface Interface {
|
|
|
39
39
|
*/
|
|
40
40
|
readonly output: (text: string, options?: Options, agent?: Agent.Info) => Effect.Effect<Result>
|
|
41
41
|
/**
|
|
42
|
-
* Resolved truncation limits: values from `tool_output` in
|
|
42
|
+
* Resolved truncation limits: values from `tool_output` in anymous config, or MAX_LINES / MAX_BYTES if unset.
|
|
43
43
|
*/
|
|
44
44
|
readonly limits: () => Effect.Effect<{ maxLines: number; maxBytes: number }>
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
export class Service extends Context.Service<Service, Interface>()("@
|
|
47
|
+
export class Service extends Context.Service<Service, Interface>()("@anymous/Truncate") {}
|
|
48
48
|
|
|
49
49
|
const layer = Layer.effect(
|
|
50
50
|
Service,
|
package/src/tool/webfetch.ts
CHANGED
|
@@ -85,7 +85,7 @@ export const WebFetchTool = Tool.define(
|
|
|
85
85
|
() =>
|
|
86
86
|
httpOk.execute(
|
|
87
87
|
HttpClientRequest.get(params.url).pipe(
|
|
88
|
-
HttpClientRequest.setHeaders({ ...headers, "User-Agent": "
|
|
88
|
+
HttpClientRequest.setHeaders({ ...headers, "User-Agent": "anymous" }),
|
|
89
89
|
),
|
|
90
90
|
),
|
|
91
91
|
),
|
package/src/tool/websearch.ts
CHANGED
|
@@ -3,8 +3,8 @@ import { HttpClient } from "effect/unstable/http"
|
|
|
3
3
|
import * as Tool from "./tool"
|
|
4
4
|
import * as McpWebSearch from "./mcp-websearch"
|
|
5
5
|
import DESCRIPTION from "./websearch.txt"
|
|
6
|
-
import { checksum } from "@
|
|
7
|
-
import { InstallationVersion } from "@
|
|
6
|
+
import { checksum } from "@anymous-ai/core/util/encode"
|
|
7
|
+
import { InstallationVersion } from "@anymous-ai/core/installation/version"
|
|
8
8
|
import { RuntimeFlags } from "@/effect/runtime-flags"
|
|
9
9
|
|
|
10
10
|
export const Parameters = Schema.Struct({
|
|
@@ -28,7 +28,7 @@ const WebSearchProviderSchema = Schema.Literals(["exa", "parallel"])
|
|
|
28
28
|
export type WebSearchProvider = Schema.Schema.Type<typeof WebSearchProviderSchema>
|
|
29
29
|
|
|
30
30
|
export function selectWebSearchProvider(sessionID: string, flags = { exa: false, parallel: false }): WebSearchProvider {
|
|
31
|
-
const override = process.env.
|
|
31
|
+
const override = process.env.ANYMOUS_WEBSEARCH_PROVIDER
|
|
32
32
|
if (override === "exa" || override === "parallel") return override
|
|
33
33
|
if (flags.parallel) return "parallel"
|
|
34
34
|
if (flags.exa) return "exa"
|
|
@@ -52,7 +52,7 @@ export function webSearchModelName(extra: Tool.Context["extra"]) {
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
function parallelAuthHeaders() {
|
|
55
|
-
const headers = { "User-Agent": `
|
|
55
|
+
const headers = { "User-Agent": `anymous/${InstallationVersion}` }
|
|
56
56
|
if (!process.env.PARALLEL_API_KEY) return headers
|
|
57
57
|
return { ...headers, Authorization: `Bearer ${process.env.PARALLEL_API_KEY}` }
|
|
58
58
|
}
|
package/src/tool/write.ts
CHANGED
|
@@ -6,10 +6,10 @@ import { LSP } from "@/lsp/lsp"
|
|
|
6
6
|
import { createTwoFilesPatch } from "diff"
|
|
7
7
|
import DESCRIPTION from "./write.txt"
|
|
8
8
|
import { EventV2Bridge } from "@/event-v2-bridge"
|
|
9
|
-
import { FileSystem } from "@
|
|
10
|
-
import { Watcher } from "@
|
|
9
|
+
import { FileSystem } from "@anymous-ai/core/filesystem"
|
|
10
|
+
import { Watcher } from "@anymous-ai/core/filesystem/watcher"
|
|
11
11
|
import { Format } from "../format"
|
|
12
|
-
import { FSUtil } from "@
|
|
12
|
+
import { FSUtil } from "@anymous-ai/core/fs-util"
|
|
13
13
|
import { InstanceState } from "@/effect/instance-state"
|
|
14
14
|
import { trimDiff } from "./edit"
|
|
15
15
|
import { assertExternalDirectoryEffect } from "./external-directory"
|
package/src/util/bom.ts
CHANGED
package/src/util/error.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "@
|
|
1
|
+
export * from "@anymous-ai/tui/util/error"
|
package/src/util/filesystem.ts
CHANGED
|
@@ -4,8 +4,8 @@ import { realpathSync } from "fs"
|
|
|
4
4
|
import { dirname, isAbsolute, join, resolve as pathResolve, win32 } from "path"
|
|
5
5
|
import { Readable } from "stream"
|
|
6
6
|
import { pipeline } from "stream/promises"
|
|
7
|
-
import { Glob } from "@
|
|
8
|
-
import { FSUtil } from "@
|
|
7
|
+
import { Glob } from "@anymous-ai/core/util/glob"
|
|
8
|
+
import { FSUtil } from "@anymous-ai/core/fs-util"
|
|
9
9
|
import { fileURLToPath } from "url"
|
|
10
10
|
|
|
11
11
|
// Fast sync version for metadata checks
|
package/src/util/locale.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "@
|
|
2
|
-
export { Locale } from "@
|
|
1
|
+
export * from "@anymous-ai/tui/util/locale"
|
|
2
|
+
export { Locale } from "@anymous-ai/tui/util/locale"
|
package/src/util/process.ts
CHANGED
|
@@ -145,7 +145,7 @@ export async function run(cmd: string[], opts: RunOptions = {}): Promise<Result>
|
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
// Duplicated in `packages/sdk/js/src/process.ts` because the SDK cannot import
|
|
148
|
-
// `
|
|
148
|
+
// `anymous` without creating a cycle. Keep both copies in sync.
|
|
149
149
|
export async function stop(proc: ChildProcess) {
|
|
150
150
|
if (proc.exitCode !== null || proc.signalCode !== null) return
|
|
151
151
|
|
package/src/util/record.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "@
|
|
1
|
+
export * from "@anymous-ai/tui/util/record"
|
package/src/util/repository.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path from "path"
|
|
2
2
|
import { fileURLToPath } from "url"
|
|
3
3
|
import { Schema } from "effect"
|
|
4
|
-
import { Global } from "@
|
|
4
|
+
import { Global } from "@anymous-ai/core/global"
|
|
5
5
|
|
|
6
6
|
type BaseReference = {
|
|
7
7
|
host: string
|
|
@@ -97,7 +97,7 @@ function withSlash(input: string) {
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
function githubRemote(pathname: string) {
|
|
100
|
-
const base = process.env.
|
|
100
|
+
const base = process.env.ANYMOUS_REPO_CLONE_GITHUB_BASE_URL
|
|
101
101
|
if (!base) return `https://github.com/${pathname}.git`
|
|
102
102
|
return new URL(`${pathname}.git`, withSlash(base)).href
|
|
103
103
|
}
|
package/src/util/token.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Token, estimate } from "@
|
|
1
|
+
export { Token, estimate } from "@anymous-ai/core/util/token"
|
package/src/worktree/index.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { LayerNode } from "@
|
|
2
|
-
import { path } from "@
|
|
3
|
-
import { Global } from "@
|
|
1
|
+
import { LayerNode } from "@anymous-ai/core/effect/layer-node"
|
|
2
|
+
import { path } from "@anymous-ai/core/effect/app-node-platform"
|
|
3
|
+
import { Global } from "@anymous-ai/core/global"
|
|
4
4
|
import { InstanceStore } from "@/project/instance-store"
|
|
5
5
|
import { Project } from "@/project/project"
|
|
6
|
-
import { Database } from "@
|
|
6
|
+
import { Database } from "@anymous-ai/core/database/database"
|
|
7
7
|
import { eq } from "drizzle-orm"
|
|
8
|
-
import { ProjectTable } from "@
|
|
9
|
-
import type { ProjectV2 } from "@
|
|
10
|
-
import { Slug } from "@
|
|
8
|
+
import { ProjectTable } from "@anymous-ai/core/project/sql"
|
|
9
|
+
import type { ProjectV2 } from "@anymous-ai/core/project"
|
|
10
|
+
import { Slug } from "@anymous-ai/core/util/slug"
|
|
11
11
|
import { errorMessage } from "../util/error"
|
|
12
12
|
import { GlobalBus } from "@/bus/global"
|
|
13
13
|
import { Git } from "@/git"
|
|
14
14
|
import { Effect, Layer, Path, Schema, Scope, Context } from "effect"
|
|
15
15
|
import { ChildProcess } from "effect/unstable/process"
|
|
16
|
-
import { FSUtil } from "@
|
|
17
|
-
import { AppProcess } from "@
|
|
16
|
+
import { FSUtil } from "@anymous-ai/core/fs-util"
|
|
17
|
+
import { AppProcess } from "@anymous-ai/core/process"
|
|
18
18
|
import { InstanceState } from "@/effect/instance-state"
|
|
19
|
-
import { WorktreeEvent } from "@
|
|
19
|
+
import { WorktreeEvent } from "@anymous-ai/schema/worktree-event"
|
|
20
20
|
|
|
21
21
|
export const Event = WorktreeEvent
|
|
22
22
|
|
|
@@ -125,7 +125,7 @@ export interface Interface {
|
|
|
125
125
|
readonly reset: (input: ResetInput) => Effect.Effect<boolean, Error>
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
export class Service extends Context.Service<Service, Interface>()("@
|
|
128
|
+
export class Service extends Context.Service<Service, Interface>()("@anymous/Worktree") {}
|
|
129
129
|
|
|
130
130
|
type GitResult = { code: number; text: string; stderr: string }
|
|
131
131
|
|
|
@@ -180,7 +180,7 @@ const layer: Layer.Layer<
|
|
|
180
180
|
const ctx = yield* InstanceState.context
|
|
181
181
|
for (const attempt of Array.from({ length: MAX_NAME_ATTEMPTS }, (_, i) => i)) {
|
|
182
182
|
const name = input.name ? (attempt === 0 ? input.name : `${input.name}-${Slug.create()}`) : Slug.create()
|
|
183
|
-
const branch = input.detached ? undefined : `
|
|
183
|
+
const branch = input.detached ? undefined : `anymous/${name}`
|
|
184
184
|
const directory = pathSvc.join(input.root, name)
|
|
185
185
|
|
|
186
186
|
if (yield* fs.exists(directory).pipe(Effect.orDie)) continue
|