@agentprojectcontext/apx 1.77.2 → 1.78.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/README.md +23 -9
- package/package.json +12 -12
- package/src/core/agent/build-agent-system.js +3 -2
- package/src/core/agent/constants.js +3 -2
- package/src/core/agent/loop/greeting-guard.js +55 -0
- package/src/core/agent/loop/side-effects.js +52 -0
- package/src/core/agent/prompt-builder.js +49 -8
- package/src/core/agent/run-agent.js +13 -48
- package/src/core/agent/security.js +1 -1
- package/src/core/agent/self-memory.js +4 -2
- package/src/core/agent/skills/index-store.js +2 -2
- package/src/core/agent/skills/loader.js +3 -22
- package/src/core/agent/super-agent.js +0 -2
- package/src/core/agent/tools/handlers/call-runtime.js +4 -4
- package/src/core/agent/tools/handlers/search-sessions.js +1 -1
- package/src/core/agent/tools/handlers/set-permission-mode.js +11 -4
- package/src/core/agent/tools/names.js +58 -0
- package/src/core/apc/context-copy.js +1 -1
- package/src/core/apc/frontmatter.js +85 -0
- package/src/core/apc/parser.js +9 -21
- package/src/core/apc/paths.js +8 -8
- package/src/core/apc/scaffold.js +5 -4
- package/src/core/channels/telegram/config.js +201 -0
- package/src/core/config/index.js +25 -183
- package/src/core/config/paths.js +54 -1
- package/src/core/confirmation/adapters/web.js +1 -1
- package/src/core/deck/manifest.js +12 -12
- package/src/core/desktop/autostart.js +3 -2
- package/src/core/desktop/process.js +4 -4
- package/src/core/engines/presets.js +2 -2
- package/src/core/http-tools/browser.js +1 -1
- package/src/core/http-tools/catalog.js +551 -0
- package/src/core/http-tools/fetch.js +1 -1
- package/src/core/http-tools/glob.js +3 -3
- package/src/core/http-tools/grep.js +2 -9
- package/src/core/http-tools/inline-handlers.js +59 -0
- package/src/core/http-tools/registry.js +31 -615
- package/src/core/http-tools/search.js +2 -2
- package/src/core/identity/self.js +6 -7
- package/src/core/identity/telegram.js +3 -3
- package/src/core/logging.js +6 -5
- package/src/core/mcp/sources.js +12 -16
- package/src/core/memory/indexer.js +2 -5
- package/src/core/profiles/lifecycle.js +0 -2
- package/src/core/profiles/store.js +2 -7
- package/src/core/routines/runner.js +1 -1
- package/src/core/runtime-skills/apx-agency-agents/SKILL.md +2 -2
- package/src/core/runtime-skills/apx-profile/SKILL.md +3 -3
- package/src/core/runtime-skills/apx-project/SKILL.md +1 -1
- package/src/core/runtime-skills/apx-task/SKILL.md +8 -8
- package/src/core/runtime-skills/apx-telegram/SKILL.md +4 -4
- package/src/core/runtime-skills/apx-voice/SKILL.md +4 -4
- package/src/core/runtimes/detect.js +2 -2
- package/src/core/sessions/index.js +800 -0
- package/src/core/stores/code-sessions.js +3 -14
- package/src/core/stores/engine-sessions.js +0 -4
- package/src/core/stores/messages.js +0 -5
- package/src/core/stores/organization.js +9 -11
- package/src/core/stores/routines.js +6 -11
- package/src/core/stores/runtime-callbacks.js +2 -1
- package/src/core/util/json-file.js +128 -0
- package/src/core/vars/sources.js +14 -21
- package/src/core/voice/stt-models.js +1 -1
- package/src/core/voice/tts.js +5 -4
- package/src/host/daemon/api/admin-config.js +5 -5
- package/src/host/daemon/api/admin.js +8 -7
- package/src/host/daemon/api/agents.js +16 -16
- package/src/host/daemon/api/artifact-preview.js +8 -8
- package/src/host/daemon/api/artifacts.js +7 -7
- package/src/host/daemon/api/code.js +8 -8
- package/src/host/daemon/api/config.js +6 -6
- package/src/host/daemon/api/confirm.js +2 -2
- package/src/host/daemon/api/connections.js +2 -2
- package/src/host/daemon/api/conversations.js +12 -12
- package/src/host/daemon/api/deck.js +6 -6
- package/src/host/daemon/api/desktop.js +8 -8
- package/src/host/daemon/api/embeddings.js +4 -4
- package/src/host/daemon/api/engines.js +8 -7
- package/src/host/daemon/api/exec.js +5 -4
- package/src/host/daemon/api/files-project.js +6 -6
- package/src/host/daemon/api/health.js +2 -2
- package/src/host/daemon/api/identity.js +3 -3
- package/src/host/daemon/api/inbox.js +2 -2
- package/src/host/daemon/api/integrations.js +23 -19
- package/src/host/daemon/api/mcps.js +16 -12
- package/src/host/daemon/api/messages.js +5 -5
- package/src/host/daemon/api/organization.js +8 -8
- package/src/host/daemon/api/pairing.js +10 -7
- package/src/host/daemon/api/plugins.js +3 -3
- package/src/host/daemon/api/prefix.js +20 -0
- package/src/host/daemon/api/profiles.js +9 -9
- package/src/host/daemon/api/projects.js +5 -5
- package/src/host/daemon/api/routines.js +8 -8
- package/src/host/daemon/api/run.js +2 -2
- package/src/host/daemon/api/runtimes.js +6 -6
- package/src/host/daemon/api/sessions-search.js +18 -11
- package/src/host/daemon/api/sessions.js +6 -6
- package/src/host/daemon/api/shared.js +59 -13
- package/src/host/daemon/api/skills.js +12 -12
- package/src/host/daemon/api/super-agent.js +4 -4
- package/src/host/daemon/api/tasks.js +11 -11
- package/src/host/daemon/api/telegram.js +19 -20
- package/src/host/daemon/api/tools.js +7 -7
- package/src/host/daemon/api/top-level.js +7 -7
- package/src/host/daemon/api/transcribe.js +6 -6
- package/src/host/daemon/api/tts.js +3 -3
- package/src/host/daemon/api/vars.js +11 -8
- package/src/host/daemon/api/voice.js +6 -6
- package/src/host/daemon/api/web.js +28 -32
- package/src/host/daemon/api.js +77 -48
- package/src/host/daemon/db.js +1 -1
- package/src/host/daemon/desktop-ws.js +7 -3
- package/src/host/daemon/index.js +11 -5
- package/src/host/daemon/plugins/desktop/index.js +1 -1
- package/src/host/daemon/plugins/telegram/index.js +1 -1
- package/src/host/daemon/stt-venv.js +20 -81
- package/src/host/daemon/wakeup.js +1 -1
- package/src/interfaces/acp/index.js +3 -3
- package/src/interfaces/acp/session.js +2 -2
- package/src/interfaces/cli/commands/a2a.js +2 -2
- package/src/interfaces/cli/commands/agent.js +3 -3
- package/src/interfaces/cli/commands/artifact.js +13 -13
- package/src/interfaces/cli/commands/chat.js +3 -3
- package/src/interfaces/cli/commands/command.js +2 -2
- package/src/interfaces/cli/commands/config.js +4 -4
- package/src/interfaces/cli/commands/daemon.js +17 -18
- package/src/interfaces/cli/commands/desktop.js +7 -14
- package/src/interfaces/cli/commands/exec.js +2 -2
- package/src/interfaces/cli/commands/log.js +3 -4
- package/src/interfaces/cli/commands/mcp.js +9 -9
- package/src/interfaces/cli/commands/memory.js +2 -2
- package/src/interfaces/cli/commands/messages.js +5 -5
- package/src/interfaces/cli/commands/model.js +0 -18
- package/src/interfaces/cli/commands/obsidian.js +5 -5
- package/src/interfaces/cli/commands/org.js +5 -5
- package/src/interfaces/cli/commands/pair.js +6 -6
- package/src/interfaces/cli/commands/plugins.js +2 -2
- package/src/interfaces/cli/commands/profile.js +10 -10
- package/src/interfaces/cli/commands/project-config.js +6 -6
- package/src/interfaces/cli/commands/project.js +10 -10
- package/src/interfaces/cli/commands/routine.js +8 -9
- package/src/interfaces/cli/commands/runtime.js +2 -2
- package/src/interfaces/cli/commands/search.js +0 -1
- package/src/interfaces/cli/commands/session.js +12 -40
- package/src/interfaces/cli/commands/sessions.js +21 -798
- package/src/interfaces/cli/commands/setup.js +16 -6
- package/src/interfaces/cli/commands/skills.js +1 -2
- package/src/interfaces/cli/commands/status.js +3 -3
- package/src/interfaces/cli/commands/task.js +8 -8
- package/src/interfaces/cli/commands/telegram.js +21 -21
- package/src/interfaces/cli/commands/voice.js +6 -6
- package/src/interfaces/cli/help/index.js +2245 -0
- package/src/interfaces/cli/http.js +9 -4
- package/src/interfaces/cli/index.js +14 -2857
- package/src/interfaces/cli/routes/acp.js +13 -0
- package/src/interfaces/cli/routes/agent.js +27 -0
- package/src/interfaces/cli/routes/artifact.js +28 -0
- package/src/interfaces/cli/routes/chat.js +11 -0
- package/src/interfaces/cli/routes/code.js +11 -0
- package/src/interfaces/cli/routes/command.js +21 -0
- package/src/interfaces/cli/routes/config.js +16 -0
- package/src/interfaces/cli/routes/connections.js +11 -0
- package/src/interfaces/cli/routes/conversations.js +21 -0
- package/src/interfaces/cli/routes/daemon.js +19 -0
- package/src/interfaces/cli/routes/desktop.js +20 -0
- package/src/interfaces/cli/routes/env.js +13 -0
- package/src/interfaces/cli/routes/exec.js +11 -0
- package/src/interfaces/cli/routes/identity.js +11 -0
- package/src/interfaces/cli/routes/index.js +71 -0
- package/src/interfaces/cli/routes/init.js +11 -0
- package/src/interfaces/cli/routes/log.js +20 -0
- package/src/interfaces/cli/routes/mcp.js +22 -0
- package/src/interfaces/cli/routes/memory.js +11 -0
- package/src/interfaces/cli/routes/messages.js +16 -0
- package/src/interfaces/cli/routes/model.js +11 -0
- package/src/interfaces/cli/routes/obsidian.js +17 -0
- package/src/interfaces/cli/routes/org.js +34 -0
- package/src/interfaces/cli/routes/overlay.js +10 -0
- package/src/interfaces/cli/routes/pair.js +17 -0
- package/src/interfaces/cli/routes/panel.js +16 -0
- package/src/interfaces/cli/routes/permission.js +11 -0
- package/src/interfaces/cli/routes/plugins.js +21 -0
- package/src/interfaces/cli/routes/profile.js +27 -0
- package/src/interfaces/cli/routes/project.js +41 -0
- package/src/interfaces/cli/routes/restart.js +15 -0
- package/src/interfaces/cli/routes/routine.js +28 -0
- package/src/interfaces/cli/routes/run.js +11 -0
- package/src/interfaces/cli/routes/search.js +11 -0
- package/src/interfaces/cli/routes/send.js +11 -0
- package/src/interfaces/cli/routes/session.js +26 -0
- package/src/interfaces/cli/routes/sessions.js +15 -0
- package/src/interfaces/cli/routes/setup.js +18 -0
- package/src/interfaces/cli/routes/skills.js +20 -0
- package/src/interfaces/cli/routes/status.js +12 -0
- package/src/interfaces/cli/routes/task.js +26 -0
- package/src/interfaces/cli/routes/telegram.js +39 -0
- package/src/interfaces/cli/routes/update.js +24 -0
- package/src/interfaces/cli/routes/voice.js +17 -0
- package/src/interfaces/desktop/main.js +6 -7
- package/src/interfaces/desktop/renderer.js +0 -5
- package/src/interfaces/mcp-server/index.js +15 -14
- package/src/interfaces/tui/_shims/globals.d.ts +8 -0
- package/src/interfaces/tui/tsconfig.json +4 -1
- package/src/interfaces/web/README.md +6 -6
- package/src/interfaces/web/dist/assets/index-CBR_-QyA.js +824 -0
- package/src/interfaces/web/dist/assets/index-CBR_-QyA.js.map +1 -0
- package/src/interfaces/web/dist/index.html +1 -1
- package/src/interfaces/web/src/components/AddProjectDialog.tsx +1 -1
- package/src/interfaces/web/src/components/agents/AgentFormFields.tsx +1 -1
- package/src/interfaces/web/src/components/chat/ChatList.tsx +2 -2
- package/src/interfaces/web/src/components/chat/SkillPicker.tsx +1 -1
- package/src/interfaces/web/src/components/code/CodeFileTree.tsx +1 -1
- package/src/interfaces/web/src/components/code/CodeTerminal.tsx +1 -1
- package/src/interfaces/web/src/components/desktop/DesktopStatusCard.tsx +1 -1
- package/src/interfaces/web/src/components/files/FileBrowser.tsx +2 -2
- package/src/interfaces/web/src/components/memory/MemoryBrowser.tsx +2 -2
- package/src/interfaces/web/src/components/routines/ExecutionsList.tsx +1 -1
- package/src/interfaces/web/src/components/routines/RoutineEditor.tsx +2 -2
- package/src/interfaces/web/src/components/settings/DesktopSettingsPanel.tsx +1 -1
- package/src/interfaces/web/src/components/settings/MemoryPanel.tsx +1 -1
- package/src/interfaces/web/src/components/settings/SkillsInspectorPanel.tsx +1 -1
- package/src/interfaces/web/src/components/settings/SkillsManager.tsx +2 -2
- package/src/interfaces/web/src/components/tasks/TaskDetailPanel.tsx +1 -1
- package/src/interfaces/web/src/hooks/useDaemonStatus.ts +1 -1
- package/src/interfaces/web/src/hooks/useDevices.ts +1 -1
- package/src/interfaces/web/src/hooks/useEngines.ts +1 -1
- package/src/interfaces/web/src/hooks/useGlobalConfig.ts +2 -2
- package/src/interfaces/web/src/hooks/useIdentity.ts +1 -1
- package/src/interfaces/web/src/hooks/useInbox.ts +1 -1
- package/src/interfaces/web/src/hooks/useProfiles.ts +3 -3
- package/src/interfaces/web/src/hooks/useProjects.ts +1 -1
- package/src/interfaces/web/src/hooks/useTelegram.ts +3 -3
- package/src/interfaces/web/src/hooks/useTokenBootstrap.ts +30 -7
- package/src/interfaces/web/src/lib/api/admin.ts +11 -11
- package/src/interfaces/web/src/lib/api/agents.ts +14 -14
- package/src/interfaces/web/src/lib/api/artifacts.ts +11 -11
- package/src/interfaces/web/src/lib/api/code.ts +1 -1
- package/src/interfaces/web/src/lib/api/conversations.ts +8 -8
- package/src/interfaces/web/src/lib/api/deck.ts +3 -3
- package/src/interfaces/web/src/lib/api/desktop.ts +8 -8
- package/src/interfaces/web/src/lib/api/embeddings.ts +3 -3
- package/src/interfaces/web/src/lib/api/engines.ts +3 -3
- package/src/interfaces/web/src/lib/api/filesystem.ts +2 -2
- package/src/interfaces/web/src/lib/api/health.ts +1 -1
- package/src/interfaces/web/src/lib/api/identity.ts +2 -2
- package/src/interfaces/web/src/lib/api/inbox.ts +1 -1
- package/src/interfaces/web/src/lib/api/integrations.ts +8 -8
- package/src/interfaces/web/src/lib/api/mcps.ts +6 -6
- package/src/interfaces/web/src/lib/api/messages.ts +3 -3
- package/src/interfaces/web/src/lib/api/organization.ts +7 -7
- package/src/interfaces/web/src/lib/api/profiles.ts +8 -8
- package/src/interfaces/web/src/lib/api/projectFiles.ts +5 -5
- package/src/interfaces/web/src/lib/api/projects.ts +12 -12
- package/src/interfaces/web/src/lib/api/routines.ts +7 -7
- package/src/interfaces/web/src/lib/api/sessions.ts +2 -2
- package/src/interfaces/web/src/lib/api/skills.ts +11 -11
- package/src/interfaces/web/src/lib/api/super_agent.ts +3 -3
- package/src/interfaces/web/src/lib/api/tasks.ts +12 -12
- package/src/interfaces/web/src/lib/api/telegram.ts +14 -14
- package/src/interfaces/web/src/lib/api/tools.ts +1 -1
- package/src/interfaces/web/src/lib/api/vars.ts +4 -4
- package/src/interfaces/web/src/lib/api/voice.ts +6 -6
- package/src/interfaces/web/src/screens/base/AgentDefaultsTab.tsx +1 -1
- package/src/interfaces/web/src/screens/base/GlobalTasksTab.tsx +1 -1
- package/src/interfaces/web/src/screens/base/LogsTab.tsx +3 -3
- package/src/interfaces/web/src/screens/base/SessionsTab.tsx +1 -1
- package/src/interfaces/web/src/screens/modules/CodeScreen.tsx +1 -1
- package/src/interfaces/web/src/screens/modules/DeckScreen.tsx +1 -1
- package/src/interfaces/web/src/screens/modules/DesktopScreen.tsx +1 -1
- package/src/interfaces/web/src/screens/modules/VoiceScreen.tsx +1 -1
- package/src/interfaces/web/src/screens/project/AgentDetailScreen.tsx +8 -8
- package/src/interfaces/web/src/screens/project/AgentsTab.tsx +2 -2
- package/src/interfaces/web/src/screens/project/ChatTab.tsx +3 -3
- package/src/interfaces/web/src/screens/project/ConfigTab.tsx +1 -1
- package/src/interfaces/web/src/screens/project/McpsTab.tsx +3 -3
- package/src/interfaces/web/src/screens/project/Overview.tsx +6 -6
- package/src/interfaces/web/src/screens/project/RoutinesTab.tsx +2 -2
- package/src/interfaces/web/src/screens/project/StructureTab.tsx +1 -1
- package/src/interfaces/web/src/screens/project/TasksTab.tsx +1 -1
- package/src/interfaces/web/src/screens/project/VarsTab.tsx +1 -1
- package/src/interfaces/web/vite.config.ts +13 -18
- package/src/interfaces/web/dist/assets/index-BWWpTTSd.js +0 -824
- package/src/interfaces/web/dist/assets/index-BWWpTTSd.js.map +0 -1
- package/src/skills/apc-context/SKILL.md +0 -159
- /package/src/{host/daemon → core}/runtimes/_spawn.js +0 -0
- /package/src/{host/daemon → core}/runtimes/aider.js +0 -0
- /package/src/{host/daemon → core}/runtimes/antigravity.js +0 -0
- /package/src/{host/daemon → core}/runtimes/claude-code.js +0 -0
- /package/src/{host/daemon → core}/runtimes/codex.js +0 -0
- /package/src/{host/daemon → core}/runtimes/cursor-agent.js +0 -0
- /package/src/{host/daemon → core}/runtimes/gemini-cli.js +0 -0
- /package/src/{host/daemon → core}/runtimes/index.js +0 -0
- /package/src/{host/daemon → core}/runtimes/opencode.js +0 -0
- /package/src/{host/daemon → core}/runtimes/qwen-code.js +0 -0
|
@@ -0,0 +1,551 @@
|
|
|
1
|
+
// The HTTP tool catalog — data, not code.
|
|
2
|
+
//
|
|
3
|
+
// 548 of registry.js's 738 lines were this array. Mixing a catalog with the
|
|
4
|
+
// index that reads it, the handlers that run it, and the router that serves it
|
|
5
|
+
// meant every edit to any of the four loaded all of them, and adding a tool
|
|
6
|
+
// looked like editing a 738-line module instead of appending to a list.
|
|
7
|
+
//
|
|
8
|
+
// Each entry is one tool: name, category, description, JSON-Schema parameters,
|
|
9
|
+
// examples, and either an `endpoint` (a daemon route that already implements
|
|
10
|
+
// it — no duplication) or nothing, in which case inline-handlers.js runs it.
|
|
11
|
+
//
|
|
12
|
+
// Kept as .js rather than .json on purpose: the section comments below are real
|
|
13
|
+
// orientation, JSON has no comments, and Object.freeze costs nothing here.
|
|
14
|
+
|
|
15
|
+
export const TOOL_DEFINITIONS = Object.freeze([
|
|
16
|
+
// NOTE: there is no `search_files` here. It pointed at GET /api/files/search,
|
|
17
|
+
// a route that has never existed, so the HTTP surface advertised a tool that
|
|
18
|
+
// always 404'd. Search by name with `glob`, by content with `grep` — both
|
|
19
|
+
// have real routes. The agent keeps its own native search_files handler
|
|
20
|
+
// (core/agent/tools/handlers/search-files.js), which is unaffected.
|
|
21
|
+
// ── file ──────────────────────────────────────────────────────────────────
|
|
22
|
+
{
|
|
23
|
+
name: "read_file",
|
|
24
|
+
category: "file",
|
|
25
|
+
description: "Read the contents of a file inside the project.",
|
|
26
|
+
endpoint: { method: "GET", path: "/api/files", query: ["path", "project"] },
|
|
27
|
+
parameters: {
|
|
28
|
+
type: "object",
|
|
29
|
+
properties: {
|
|
30
|
+
path: { type: "string", description: "Relative path inside the project" },
|
|
31
|
+
project: { type: "string", description: "Project ID or path (optional)" },
|
|
32
|
+
},
|
|
33
|
+
required: ["path"],
|
|
34
|
+
},
|
|
35
|
+
examples: [{ path: "src/index.js" }],
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: "write_file",
|
|
39
|
+
category: "file",
|
|
40
|
+
description: "Write or overwrite a file inside the project.",
|
|
41
|
+
endpoint: { method: "POST", path: "/api/files" },
|
|
42
|
+
parameters: {
|
|
43
|
+
type: "object",
|
|
44
|
+
properties: {
|
|
45
|
+
path: { type: "string" },
|
|
46
|
+
content: { type: "string" },
|
|
47
|
+
project: { type: "string" },
|
|
48
|
+
},
|
|
49
|
+
required: ["path", "content"],
|
|
50
|
+
},
|
|
51
|
+
examples: [{ path: "notes.md", content: "# Hello" }],
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: "list_files",
|
|
55
|
+
category: "file",
|
|
56
|
+
description: "List files and directories inside a project path.",
|
|
57
|
+
endpoint: { method: "GET", path: "/api/files" },
|
|
58
|
+
parameters: {
|
|
59
|
+
type: "object",
|
|
60
|
+
properties: {
|
|
61
|
+
path: { type: "string", description: "Sub-path to list (optional)" },
|
|
62
|
+
project: { type: "string" },
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
examples: [{ path: "src" }],
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
// ── shell ─────────────────────────────────────────────────────────────────
|
|
69
|
+
{
|
|
70
|
+
name: "run_command",
|
|
71
|
+
category: "shell",
|
|
72
|
+
description: "Execute a shell command in the project directory. Returns stdout, stderr, exit_code.",
|
|
73
|
+
endpoint: { method: "POST", path: "/api/run" },
|
|
74
|
+
parameters: {
|
|
75
|
+
type: "object",
|
|
76
|
+
properties: {
|
|
77
|
+
cmd: { type: "string", description: "Shell command to run" },
|
|
78
|
+
cwd: { type: "string", description: "Working directory override" },
|
|
79
|
+
project: { type: "string" },
|
|
80
|
+
timeout_ms: { type: "integer", default: 30000 },
|
|
81
|
+
},
|
|
82
|
+
required: ["cmd"],
|
|
83
|
+
},
|
|
84
|
+
examples: [{ cmd: "ls -la" }, { cmd: "git log --oneline -5" }],
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
// ── memory ────────────────────────────────────────────────────────────────
|
|
88
|
+
{
|
|
89
|
+
name: "memory_get",
|
|
90
|
+
category: "memory",
|
|
91
|
+
description: "Read the memory.md of the default agent in a project.",
|
|
92
|
+
endpoint: { method: "GET", path: "/api/memory" },
|
|
93
|
+
parameters: {
|
|
94
|
+
type: "object",
|
|
95
|
+
properties: {
|
|
96
|
+
project: { type: "string" },
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
examples: [{}],
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
name: "memory_set",
|
|
103
|
+
category: "memory",
|
|
104
|
+
description: "Overwrite the memory.md of the default agent in a project.",
|
|
105
|
+
endpoint: { method: "POST", path: "/api/memory" },
|
|
106
|
+
parameters: {
|
|
107
|
+
type: "object",
|
|
108
|
+
properties: {
|
|
109
|
+
body: { type: "string", description: "Full content to write" },
|
|
110
|
+
project: { type: "string" },
|
|
111
|
+
},
|
|
112
|
+
required: ["body"],
|
|
113
|
+
},
|
|
114
|
+
examples: [{ body: "# Agent Memory\n\n- Remember to greet the user." }],
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
name: "memory_append",
|
|
118
|
+
category: "memory",
|
|
119
|
+
description: "Append text to the agent memory.md (read-modify-write).",
|
|
120
|
+
endpoint: null, // implemented inline in the call handler
|
|
121
|
+
parameters: {
|
|
122
|
+
type: "object",
|
|
123
|
+
properties: {
|
|
124
|
+
text: { type: "string" },
|
|
125
|
+
project: { type: "string" },
|
|
126
|
+
},
|
|
127
|
+
required: ["text"],
|
|
128
|
+
},
|
|
129
|
+
examples: [{ text: "\n- New fact to remember." }],
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
name: "memory_list",
|
|
133
|
+
category: "memory",
|
|
134
|
+
description: "List all agents that have memory files in a project.",
|
|
135
|
+
endpoint: null,
|
|
136
|
+
parameters: {
|
|
137
|
+
type: "object",
|
|
138
|
+
properties: { project: { type: "string" } },
|
|
139
|
+
},
|
|
140
|
+
examples: [{}],
|
|
141
|
+
},
|
|
142
|
+
|
|
143
|
+
// ── session ───────────────────────────────────────────────────────────────
|
|
144
|
+
{
|
|
145
|
+
name: "session_list",
|
|
146
|
+
category: "session",
|
|
147
|
+
description: "List sessions for an agent in a project.",
|
|
148
|
+
endpoint: { method: "GET", path: "/api/projects/:pid/agents/:slug/sessions" },
|
|
149
|
+
parameters: {
|
|
150
|
+
type: "object",
|
|
151
|
+
properties: {
|
|
152
|
+
project: { type: "string", description: "Project ID" },
|
|
153
|
+
agent: { type: "string", description: "Agent slug" },
|
|
154
|
+
},
|
|
155
|
+
required: ["project", "agent"],
|
|
156
|
+
},
|
|
157
|
+
examples: [{ project: "1", agent: "sofia" }],
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
name: "session_get",
|
|
161
|
+
category: "session",
|
|
162
|
+
description: "Get a session by filename.",
|
|
163
|
+
endpoint: { method: "GET", path: "/api/projects/:pid/sessions/:sid" },
|
|
164
|
+
parameters: {
|
|
165
|
+
type: "object",
|
|
166
|
+
properties: {
|
|
167
|
+
project: { type: "string" },
|
|
168
|
+
session_id: { type: "string" },
|
|
169
|
+
},
|
|
170
|
+
required: ["project", "session_id"],
|
|
171
|
+
},
|
|
172
|
+
examples: [{ project: "1", session_id: "2026-05-01-planning.md" }],
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
name: "session_search",
|
|
176
|
+
category: "session",
|
|
177
|
+
description: "Search session content by text query across all agents in a project.",
|
|
178
|
+
endpoint: { method: "GET", path: "/api/sessions/search" },
|
|
179
|
+
parameters: {
|
|
180
|
+
type: "object",
|
|
181
|
+
properties: {
|
|
182
|
+
q: { type: "string", description: "Search query" },
|
|
183
|
+
project: { type: "string" },
|
|
184
|
+
limit: { type: "integer", default: 20 },
|
|
185
|
+
},
|
|
186
|
+
required: ["q"],
|
|
187
|
+
},
|
|
188
|
+
examples: [{ q: "authentication bug" }],
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
name: "session_compact",
|
|
192
|
+
category: "session",
|
|
193
|
+
description: "Compact (summarise and compress) a session conversation.",
|
|
194
|
+
endpoint: { method: "POST", path: "/api/sessions/:id/compact" },
|
|
195
|
+
parameters: {
|
|
196
|
+
type: "object",
|
|
197
|
+
properties: {
|
|
198
|
+
session_id: { type: "string" },
|
|
199
|
+
project: { type: "string" },
|
|
200
|
+
agent: { type: "string" },
|
|
201
|
+
model: { type: "string" },
|
|
202
|
+
},
|
|
203
|
+
required: ["project", "agent", "session_id"],
|
|
204
|
+
},
|
|
205
|
+
examples: [{ project: "1", agent: "sofia", session_id: "2026-05-01-planning.md" }],
|
|
206
|
+
},
|
|
207
|
+
|
|
208
|
+
// ── mcp ───────────────────────────────────────────────────────────────────
|
|
209
|
+
{
|
|
210
|
+
name: "mcp_list",
|
|
211
|
+
category: "mcp",
|
|
212
|
+
description: "List all MCP servers registered in a project.",
|
|
213
|
+
endpoint: { method: "GET", path: "/api/mcp" },
|
|
214
|
+
parameters: {
|
|
215
|
+
type: "object",
|
|
216
|
+
properties: { project: { type: "string" } },
|
|
217
|
+
},
|
|
218
|
+
examples: [{}],
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
name: "mcp_run",
|
|
222
|
+
category: "mcp",
|
|
223
|
+
description: "Call a tool on an MCP server.",
|
|
224
|
+
endpoint: { method: "POST", path: "/api/mcp/run" },
|
|
225
|
+
parameters: {
|
|
226
|
+
type: "object",
|
|
227
|
+
properties: {
|
|
228
|
+
name: { type: "string", description: "MCP server name" },
|
|
229
|
+
tool: { type: "string", description: "Tool name on that server" },
|
|
230
|
+
params: { type: "object" },
|
|
231
|
+
project: { type: "string" },
|
|
232
|
+
},
|
|
233
|
+
required: ["name", "tool"],
|
|
234
|
+
},
|
|
235
|
+
examples: [{ name: "filesystem", tool: "list_directory", params: { path: "/tmp" } }],
|
|
236
|
+
},
|
|
237
|
+
|
|
238
|
+
// ── glob / grep ───────────────────────────────────────────────────────────
|
|
239
|
+
{
|
|
240
|
+
name: "glob",
|
|
241
|
+
category: "file",
|
|
242
|
+
description: "List files matching a glob pattern (e.g. **/*.js). Uses native Node.js glob.",
|
|
243
|
+
endpoint: { method: "POST", path: "/api/tools/glob" },
|
|
244
|
+
parameters: {
|
|
245
|
+
type: "object",
|
|
246
|
+
properties: {
|
|
247
|
+
pattern: { type: "string", description: "Glob pattern, e.g. src/**/*.ts" },
|
|
248
|
+
cwd: { type: "string", description: "Base directory (absolute path)" },
|
|
249
|
+
dot: { type: "boolean", default: false, description: "Include dotfiles" },
|
|
250
|
+
absolute: { type: "boolean", default: false },
|
|
251
|
+
limit: { type: "integer", default: 500 },
|
|
252
|
+
},
|
|
253
|
+
required: ["pattern"],
|
|
254
|
+
},
|
|
255
|
+
examples: [
|
|
256
|
+
{ pattern: "**/*.js", cwd: "/my/project" },
|
|
257
|
+
{ pattern: "src/**/*.ts", cwd: "/my/project", limit: 100 },
|
|
258
|
+
],
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
name: "grep",
|
|
262
|
+
category: "file",
|
|
263
|
+
description: "Search file contents by regex pattern. Uses ripgrep when available, pure Node.js fallback.",
|
|
264
|
+
endpoint: { method: "POST", path: "/api/tools/grep" },
|
|
265
|
+
parameters: {
|
|
266
|
+
type: "object",
|
|
267
|
+
properties: {
|
|
268
|
+
pattern: { type: "string", description: "Regex to search for" },
|
|
269
|
+
path: { type: "string", description: "Directory or file to search in" },
|
|
270
|
+
glob: { type: "string", description: "Glob filter for files, e.g. *.ts" },
|
|
271
|
+
case_sensitive: { type: "boolean", default: false },
|
|
272
|
+
context: { type: "integer", default: 0, description: "Lines of context around matches" },
|
|
273
|
+
limit: { type: "integer", default: 100 },
|
|
274
|
+
},
|
|
275
|
+
required: ["pattern"],
|
|
276
|
+
},
|
|
277
|
+
examples: [
|
|
278
|
+
{ pattern: "export default", path: "/my/project/src", glob: "*.js" },
|
|
279
|
+
{ pattern: "TODO|FIXME", path: "/my/project", context: 2 },
|
|
280
|
+
],
|
|
281
|
+
},
|
|
282
|
+
|
|
283
|
+
// ── fetch (native HTTP, no browser) ───────────────────────────────────────
|
|
284
|
+
{
|
|
285
|
+
name: "http_get",
|
|
286
|
+
category: "fetch",
|
|
287
|
+
description: "Native HTTP GET — fast, no headless browser. Use for REST APIs, raw HTML, JSON endpoints.",
|
|
288
|
+
endpoint: { method: "POST", path: "/api/tools/fetch/get" },
|
|
289
|
+
parameters: {
|
|
290
|
+
type: "object",
|
|
291
|
+
properties: {
|
|
292
|
+
url: { type: "string" },
|
|
293
|
+
headers: { type: "object" },
|
|
294
|
+
timeout_ms: { type: "number", default: 30000 },
|
|
295
|
+
},
|
|
296
|
+
required: ["url"],
|
|
297
|
+
},
|
|
298
|
+
examples: [{ url: "https://api.github.com/repos/anthropics/anthropic-sdk-typescript" }],
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
name: "http_post",
|
|
302
|
+
category: "fetch",
|
|
303
|
+
description: "Native HTTP POST — sends body as JSON when body is an object. Use for REST APIs.",
|
|
304
|
+
endpoint: { method: "POST", path: "/api/tools/fetch/post" },
|
|
305
|
+
parameters: {
|
|
306
|
+
type: "object",
|
|
307
|
+
properties: {
|
|
308
|
+
url: { type: "string" },
|
|
309
|
+
body: { description: "Object → JSON-stringified. String → sent as-is." },
|
|
310
|
+
headers: { type: "object" },
|
|
311
|
+
timeout_ms: { type: "number", default: 30000 },
|
|
312
|
+
json: { type: "boolean", description: "Force JSON parsing of response body." },
|
|
313
|
+
},
|
|
314
|
+
required: ["url"],
|
|
315
|
+
},
|
|
316
|
+
examples: [{ url: "https://api.example.com/items", body: { name: "foo" } }],
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
name: "http_request",
|
|
320
|
+
category: "fetch",
|
|
321
|
+
description: "Generic HTTP request with full control over method, headers, body, timeout.",
|
|
322
|
+
endpoint: { method: "POST", path: "/api/tools/fetch/request" },
|
|
323
|
+
parameters: {
|
|
324
|
+
type: "object",
|
|
325
|
+
properties: {
|
|
326
|
+
url: { type: "string" },
|
|
327
|
+
method: { type: "string", default: "GET" },
|
|
328
|
+
headers: { type: "object" },
|
|
329
|
+
body: {},
|
|
330
|
+
timeout_ms: { type: "number", default: 30000 },
|
|
331
|
+
json: { type: "boolean" },
|
|
332
|
+
},
|
|
333
|
+
required: ["url"],
|
|
334
|
+
},
|
|
335
|
+
examples: [{ url: "https://api.example.com/x", method: "DELETE" }],
|
|
336
|
+
},
|
|
337
|
+
|
|
338
|
+
// ── browser (Puppeteer-backed — heavier, launches Chromium lazily) ────────
|
|
339
|
+
{
|
|
340
|
+
name: "browser_navigate",
|
|
341
|
+
category: "browser",
|
|
342
|
+
description: "Navigate the headless browser to a URL. Launches Chromium lazily on first call. Auto-retries and falls back to a more permissive wait strategy on redirect-heavy sites.",
|
|
343
|
+
endpoint: { method: "POST", path: "/api/tools/browser/navigate" },
|
|
344
|
+
parameters: {
|
|
345
|
+
type: "object",
|
|
346
|
+
properties: {
|
|
347
|
+
url: { type: "string" },
|
|
348
|
+
wait_until: {
|
|
349
|
+
type: "string",
|
|
350
|
+
enum: ["load", "domcontentloaded", "networkidle0", "networkidle2"],
|
|
351
|
+
description: "Puppeteer wait strategy (default networkidle2). Use 'domcontentloaded' for slow/redirect-heavy sites; navigate auto-falls back to it on failure anyway.",
|
|
352
|
+
},
|
|
353
|
+
launch_options: { type: "object", description: "Puppeteer launch overrides (headless, args, defaultViewport, etc.)." },
|
|
354
|
+
allow_dangerous: { type: "boolean", description: "Allow dangerous launch args (--no-sandbox, --single-process, etc.)." },
|
|
355
|
+
},
|
|
356
|
+
required: ["url"],
|
|
357
|
+
},
|
|
358
|
+
examples: [{ url: "https://example.com" }],
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
name: "browser_screenshot",
|
|
362
|
+
category: "browser",
|
|
363
|
+
description: "Take a screenshot of the current browser page (or an element via selector). Returns { base64, path?, bytes, url }. To send via Telegram, prefer `save_to_tmp: true` and pass the returned `path` to send_telegram({photo_path}); otherwise pass `base64` straight to send_telegram({photo_base64}). NEVER include the base64 in any text field — Telegram does not render it.",
|
|
364
|
+
endpoint: { method: "POST", path: "/api/tools/browser/screenshot" },
|
|
365
|
+
parameters: {
|
|
366
|
+
type: "object",
|
|
367
|
+
properties: {
|
|
368
|
+
selector: { type: "string", description: "CSS selector of element to capture. Omit for full viewport/page." },
|
|
369
|
+
full_page: { type: "boolean", default: false },
|
|
370
|
+
width: { type: "number", description: "Viewport width (capped at 1920)." },
|
|
371
|
+
height: { type: "number", description: "Viewport height (capped at 1080)." },
|
|
372
|
+
encoded: { type: "boolean", description: "Also return a data:image/png;base64 URI in response." },
|
|
373
|
+
save_path: { type: "string", description: "Absolute path to write the PNG. Returns it in `path`." },
|
|
374
|
+
save_to_tmp: { type: "boolean", description: "Auto-write to <os.tmpdir>/apx-screenshots/screenshot-<ts>.png. Returns the path." },
|
|
375
|
+
},
|
|
376
|
+
},
|
|
377
|
+
examples: [{}, { selector: "#hero" }, { save_to_tmp: true }],
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
name: "browser_click",
|
|
381
|
+
category: "browser",
|
|
382
|
+
description: "Click a CSS selector on the current browser page.",
|
|
383
|
+
endpoint: { method: "POST", path: "/api/tools/browser/click" },
|
|
384
|
+
parameters: {
|
|
385
|
+
type: "object",
|
|
386
|
+
properties: { selector: { type: "string" } },
|
|
387
|
+
required: ["selector"],
|
|
388
|
+
},
|
|
389
|
+
examples: [{ selector: "button#submit" }],
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
name: "browser_type",
|
|
393
|
+
category: "browser",
|
|
394
|
+
description: "Type text into a CSS selector. Uses focus + Ctrl+A + Backspace to clear, then types with realistic delay.",
|
|
395
|
+
endpoint: { method: "POST", path: "/api/tools/browser/type" },
|
|
396
|
+
parameters: {
|
|
397
|
+
type: "object",
|
|
398
|
+
properties: {
|
|
399
|
+
selector: { type: "string" },
|
|
400
|
+
text: { type: "string" },
|
|
401
|
+
clear: { type: "boolean", default: true },
|
|
402
|
+
},
|
|
403
|
+
required: ["selector", "text"],
|
|
404
|
+
},
|
|
405
|
+
examples: [{ selector: "input#search", text: "hello world" }],
|
|
406
|
+
},
|
|
407
|
+
{
|
|
408
|
+
name: "browser_select",
|
|
409
|
+
category: "browser",
|
|
410
|
+
description: "Choose an option in a <select> element by its value.",
|
|
411
|
+
endpoint: { method: "POST", path: "/api/tools/browser/select" },
|
|
412
|
+
parameters: {
|
|
413
|
+
type: "object",
|
|
414
|
+
properties: {
|
|
415
|
+
selector: { type: "string" },
|
|
416
|
+
value: { type: "string" },
|
|
417
|
+
},
|
|
418
|
+
required: ["selector", "value"],
|
|
419
|
+
},
|
|
420
|
+
examples: [{ selector: "select#country", value: "AR" }],
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
name: "browser_hover",
|
|
424
|
+
category: "browser",
|
|
425
|
+
description: "Hover the cursor over an element (triggers tooltips, dropdowns, hover states).",
|
|
426
|
+
endpoint: { method: "POST", path: "/api/tools/browser/hover" },
|
|
427
|
+
parameters: {
|
|
428
|
+
type: "object",
|
|
429
|
+
properties: { selector: { type: "string" } },
|
|
430
|
+
required: ["selector"],
|
|
431
|
+
},
|
|
432
|
+
examples: [{ selector: "nav .menu-item" }],
|
|
433
|
+
},
|
|
434
|
+
{
|
|
435
|
+
name: "browser_evaluate",
|
|
436
|
+
category: "browser",
|
|
437
|
+
description: "Execute JavaScript in the page context. Captures the script's console.log/info/warn/error output and returns it alongside the result.",
|
|
438
|
+
endpoint: { method: "POST", path: "/api/tools/browser/evaluate" },
|
|
439
|
+
parameters: {
|
|
440
|
+
type: "object",
|
|
441
|
+
properties: { code: { type: "string", description: "JS code to eval (function body)." } },
|
|
442
|
+
required: ["code"],
|
|
443
|
+
},
|
|
444
|
+
examples: [{ code: "return document.title;" }],
|
|
445
|
+
},
|
|
446
|
+
{
|
|
447
|
+
name: "browser_get_text",
|
|
448
|
+
category: "browser",
|
|
449
|
+
description: "Extract readable text from the current page (or a single element). Strips script/style/nav/header/footer.",
|
|
450
|
+
endpoint: { method: "POST", path: "/api/tools/browser/get_text" },
|
|
451
|
+
parameters: {
|
|
452
|
+
type: "object",
|
|
453
|
+
properties: { selector: { type: "string", description: "Optional CSS selector." } },
|
|
454
|
+
},
|
|
455
|
+
examples: [{}, { selector: "article" }],
|
|
456
|
+
},
|
|
457
|
+
{
|
|
458
|
+
name: "browser_get_content",
|
|
459
|
+
category: "browser",
|
|
460
|
+
description: "Return raw innerHTML of the page or a single element (truncated at 1MB).",
|
|
461
|
+
endpoint: { method: "POST", path: "/api/tools/browser/get_content" },
|
|
462
|
+
parameters: {
|
|
463
|
+
type: "object",
|
|
464
|
+
properties: { selector: { type: "string" } },
|
|
465
|
+
},
|
|
466
|
+
examples: [{}, { selector: "main" }],
|
|
467
|
+
},
|
|
468
|
+
{
|
|
469
|
+
name: "browser_wait_for_selector",
|
|
470
|
+
category: "browser",
|
|
471
|
+
description: "Wait until a CSS selector appears on the page.",
|
|
472
|
+
endpoint: { method: "POST", path: "/api/tools/browser/wait_for_selector" },
|
|
473
|
+
parameters: {
|
|
474
|
+
type: "object",
|
|
475
|
+
properties: {
|
|
476
|
+
selector: { type: "string" },
|
|
477
|
+
timeout: { type: "number", default: 30000 },
|
|
478
|
+
},
|
|
479
|
+
required: ["selector"],
|
|
480
|
+
},
|
|
481
|
+
examples: [{ selector: ".results-loaded" }],
|
|
482
|
+
},
|
|
483
|
+
{
|
|
484
|
+
name: "browser_close",
|
|
485
|
+
category: "browser",
|
|
486
|
+
description: "Close the headless browser and free resources.",
|
|
487
|
+
endpoint: { method: "POST", path: "/api/tools/browser/close" },
|
|
488
|
+
parameters: { type: "object", properties: {} },
|
|
489
|
+
examples: [{}],
|
|
490
|
+
},
|
|
491
|
+
|
|
492
|
+
// ── search ────────────────────────────────────────────────────────────────
|
|
493
|
+
{
|
|
494
|
+
name: "web_search",
|
|
495
|
+
category: "search",
|
|
496
|
+
description: "Search the web. Modes: auto (tries DDG → Brave → Browser), ddg, brave, browser.",
|
|
497
|
+
endpoint: { method: "POST", path: "/api/tools/search" },
|
|
498
|
+
parameters: {
|
|
499
|
+
type: "object",
|
|
500
|
+
properties: {
|
|
501
|
+
query: { type: "string" },
|
|
502
|
+
mode: { type: "string", enum: ["auto", "ddg", "brave", "browser"], default: "auto" },
|
|
503
|
+
limit: { type: "integer", default: 5 },
|
|
504
|
+
},
|
|
505
|
+
required: ["query"],
|
|
506
|
+
},
|
|
507
|
+
examples: [
|
|
508
|
+
{ query: "APC agent project context standard" },
|
|
509
|
+
{ query: "site:github.com puppeteer examples", mode: "ddg" },
|
|
510
|
+
],
|
|
511
|
+
},
|
|
512
|
+
|
|
513
|
+
// ── agents ────────────────────────────────────────────────────────────────
|
|
514
|
+
{
|
|
515
|
+
name: "agent_list",
|
|
516
|
+
category: "agents",
|
|
517
|
+
description: "List all agents in a project.",
|
|
518
|
+
endpoint: { method: "GET", path: "/api/projects/:pid/agents" },
|
|
519
|
+
parameters: {
|
|
520
|
+
type: "object",
|
|
521
|
+
properties: { project: { type: "string" } },
|
|
522
|
+
required: ["project"],
|
|
523
|
+
},
|
|
524
|
+
examples: [{ project: "1" }],
|
|
525
|
+
},
|
|
526
|
+
{
|
|
527
|
+
name: "agent_get",
|
|
528
|
+
category: "agents",
|
|
529
|
+
description: "Get details + memory for a specific agent.",
|
|
530
|
+
endpoint: { method: "GET", path: "/api/projects/:pid/agents/:slug" },
|
|
531
|
+
parameters: {
|
|
532
|
+
type: "object",
|
|
533
|
+
properties: {
|
|
534
|
+
project: { type: "string" },
|
|
535
|
+
agent: { type: "string" },
|
|
536
|
+
},
|
|
537
|
+
required: ["project", "agent"],
|
|
538
|
+
},
|
|
539
|
+
examples: [{ project: "1", agent: "sofia" }],
|
|
540
|
+
},
|
|
541
|
+
|
|
542
|
+
// ── project ───────────────────────────────────────────────────────────────
|
|
543
|
+
{
|
|
544
|
+
name: "project_info",
|
|
545
|
+
category: "project",
|
|
546
|
+
description: "List all registered projects and their metadata.",
|
|
547
|
+
endpoint: { method: "GET", path: "/api/projects" },
|
|
548
|
+
parameters: { type: "object", properties: {} },
|
|
549
|
+
examples: [{}],
|
|
550
|
+
},
|
|
551
|
+
]);
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
// Uses Node 18+ built-in fetch with a node-fetch fallback for older
|
|
7
7
|
// runtimes.
|
|
8
8
|
//
|
|
9
|
-
// Endpoints (mounted at /tools/fetch by api.js):
|
|
9
|
+
// Endpoints (mounted at /api/tools/fetch by api.js):
|
|
10
10
|
// POST /get { url, headers?, timeout_ms? }
|
|
11
11
|
// POST /post { url, body?, headers?, timeout_ms?, json? }
|
|
12
12
|
// POST /request { url, method?, headers?, body?, timeout_ms?, json? }
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
// 2. node:fs/promises glob (Node 22+) — built-in, no extra dep
|
|
5
5
|
// 3. Manual walk + regex — pure-JS fallback for older Node
|
|
6
6
|
//
|
|
7
|
-
// Endpoint: POST /tools/glob body: { pattern, cwd?, dot?, absolute?, ignore?, limit? }
|
|
8
|
-
// GET /tools/glob?pattern=**/*.js&cwd=/path
|
|
7
|
+
// Endpoint: POST /api/tools/glob body: { pattern, cwd?, dot?, absolute?, ignore?, limit? }
|
|
8
|
+
// GET /api/tools/glob?pattern=**/*.js&cwd=/path
|
|
9
9
|
|
|
10
10
|
import fs from "node:fs";
|
|
11
11
|
import path from "node:path";
|
|
@@ -15,7 +15,7 @@ import path from "node:path";
|
|
|
15
15
|
// ---------------------------------------------------------------------------
|
|
16
16
|
|
|
17
17
|
function globToRegex(pattern) {
|
|
18
|
-
|
|
18
|
+
const re = pattern
|
|
19
19
|
.replace(/[.+^${}()|[\]\\]/g, "\\$&")
|
|
20
20
|
.replace(/\*\*\//g, "(?:.+/)?")
|
|
21
21
|
.replace(/\*\*/g, ".*")
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Native Grep tool for APX — searches file contents by regex pattern.
|
|
2
2
|
// Tries ripgrep (rg) first for speed, falls back to pure Node.js walk.
|
|
3
3
|
//
|
|
4
|
-
// Endpoint: POST /tools/grep body: { pattern, path?, glob?, case_sensitive?, context?, limit? }
|
|
5
|
-
// GET /tools/grep?pattern=...&path=...
|
|
4
|
+
// Endpoint: POST /api/tools/grep body: { pattern, path?, glob?, case_sensitive?, context?, limit? }
|
|
5
|
+
// GET /api/tools/grep?pattern=...&path=...
|
|
6
6
|
|
|
7
7
|
import fs from "node:fs";
|
|
8
8
|
import path from "node:path";
|
|
@@ -16,13 +16,6 @@ const execFileAsync = promisify(execFile);
|
|
|
16
16
|
// ---------------------------------------------------------------------------
|
|
17
17
|
|
|
18
18
|
async function grepWithRg({ pattern, searchPath, glob, caseSensitive, context = 0, limit }) {
|
|
19
|
-
const args = [
|
|
20
|
-
"--json",
|
|
21
|
-
"--max-count", "1", // max matches per file
|
|
22
|
-
"--max-filesize", "1M",
|
|
23
|
-
"-l", // list matching files first? No, we want content
|
|
24
|
-
];
|
|
25
|
-
// Actually use full output mode
|
|
26
19
|
const fullArgs = [
|
|
27
20
|
"--json",
|
|
28
21
|
"--max-filesize", "1M",
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// Tools that have no dedicated daemon route, executed in-process.
|
|
2
|
+
//
|
|
3
|
+
// Everything else in the catalog points at an existing endpoint; these are the
|
|
4
|
+
// exceptions. Split out of registry.js so the router stays a router.
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
// ---------------------------------------------------------------------------
|
|
8
|
+
// Inline call handlers for tools without a dedicated HTTP endpoint
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
|
|
11
|
+
export function makeInlineHandlers({ projects }) {
|
|
12
|
+
return {
|
|
13
|
+
memory_append: async (body) => {
|
|
14
|
+
const { default: fetch } = await import("node-fetch");
|
|
15
|
+
const base = `http://localhost:${process.env.APX_PORT || 7430}`;
|
|
16
|
+
// GET current
|
|
17
|
+
const getRes = await fetch(`${base}/api/memory${body.project ? `?project=${body.project}` : ""}`);
|
|
18
|
+
if (!getRes.ok) throw new Error(`memory_get failed: ${getRes.status}`);
|
|
19
|
+
const { body: current } = await getRes.json();
|
|
20
|
+
// POST updated
|
|
21
|
+
const text = body.text || "";
|
|
22
|
+
const postRes = await fetch(`${base}/api/memory${body.project ? `?project=${body.project}` : ""}`, {
|
|
23
|
+
method: "POST",
|
|
24
|
+
headers: { "content-type": "application/json" },
|
|
25
|
+
body: JSON.stringify({ body: current + text }),
|
|
26
|
+
});
|
|
27
|
+
if (!postRes.ok) throw new Error(`memory_set failed: ${postRes.status}`);
|
|
28
|
+
return { ok: true, appended_chars: text.length };
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
memory_list: async (body) => {
|
|
32
|
+
const { default: fs } = await import("node:fs");
|
|
33
|
+
// These paths were "../parser.js" and "../agent-memory.js", neither of
|
|
34
|
+
// which exists — memory_list threw on every call. Dynamic imports are
|
|
35
|
+
// invisible to the linter and nothing tested this tool, so it stayed
|
|
36
|
+
// broken until a typecheck pass looked at it.
|
|
37
|
+
const { readAgents } = await import("../apc/parser.js");
|
|
38
|
+
const { agentMemoryPath } = await import("../agent/memory.js");
|
|
39
|
+
// Find the project
|
|
40
|
+
const all = projects.list();
|
|
41
|
+
let p = null;
|
|
42
|
+
if (body.project) {
|
|
43
|
+
const ref = String(body.project);
|
|
44
|
+
const found = all.find((x) => String(x.id) === ref || x.path === ref);
|
|
45
|
+
p = found ? projects.get(found.id) : null;
|
|
46
|
+
}
|
|
47
|
+
if (!p) p = projects.get(all.filter((x) => x.id !== 0)[0]?.id) || projects.get(0);
|
|
48
|
+
if (!p) throw new Error("no project registered");
|
|
49
|
+
const result = readAgents(p.path).map((agent) => {
|
|
50
|
+
const slug = agent.slug;
|
|
51
|
+
const memPath = agentMemoryPath(p, slug);
|
|
52
|
+
if (!fs.existsSync(memPath)) return null;
|
|
53
|
+
const stat = fs.statSync(memPath);
|
|
54
|
+
return { agent: slug, path: memPath, size: stat.size, mtime: stat.mtime };
|
|
55
|
+
}).filter(Boolean);
|
|
56
|
+
return { project: p.path, agents_with_memory: result };
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
}
|