@agentprojectcontext/apx 1.77.3 → 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 +6 -6
- 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-BptlbKjU.js → index-CBR_-QyA.js} +52 -52
- 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 +3 -3
- 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-BptlbKjU.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
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
// Guides the user through provider, model, channels, and language.
|
|
3
3
|
// Starts the daemon and sends a fun wake-up message when done.
|
|
4
4
|
|
|
5
|
-
import fs from "node:fs";
|
|
6
5
|
import https from "node:https";
|
|
7
6
|
import http from "node:http";
|
|
8
7
|
import readline from "node:readline";
|
|
@@ -11,7 +10,9 @@ import { readConfig, writeConfig } from "#core/config/index.js";
|
|
|
11
10
|
import { ENGINE_PRESETS } from "#core/engines/presets.js";
|
|
12
11
|
import { mascot } from "#core/mascot.js";
|
|
13
12
|
import { setupClaudePermissions } from "../claude-permissions.js";
|
|
14
|
-
import {
|
|
13
|
+
import { DEFAULT_PERMISSION_MODE } from "#core/constants/permissions.js";
|
|
14
|
+
import { DEFAULT_PROJECT_ID } from "#core/config/paths.js";
|
|
15
|
+
import { http as daemonHttp } from "../http.js";
|
|
15
16
|
|
|
16
17
|
// ── ANSI helpers ──────────────────────────────────────────────────────────────
|
|
17
18
|
const c = {
|
|
@@ -390,7 +391,7 @@ export async function cmdSetup() {
|
|
|
390
391
|
|
|
391
392
|
// Send a fun wake-up message via Telegram using super-agent.
|
|
392
393
|
// The prompt is in English so the model knows to reply in the user's language.
|
|
393
|
-
async function sendTelegramWakeup({ botToken, chatId, language
|
|
394
|
+
async function sendTelegramWakeup({ botToken, chatId, language }) {
|
|
394
395
|
const prompt =
|
|
395
396
|
`You are APX, an AI agent assistant that just came online for the first time. ` +
|
|
396
397
|
`Write a short, enthusiastic wake-up message in the language with ISO 639-1 code "${language}". ` +
|
|
@@ -400,12 +401,21 @@ async function sendTelegramWakeup({ botToken, chatId, language, model }) {
|
|
|
400
401
|
`3) Ask the user for their own name or what you should call them. ` +
|
|
401
402
|
`Be warm and playful. Do NOT mention configuration or setup.`;
|
|
402
403
|
|
|
403
|
-
// Ask the daemon's super-agent
|
|
404
|
+
// Ask the daemon's super-agent to write it.
|
|
405
|
+
//
|
|
406
|
+
// This used to GET a `/super-agent/ask` route that does not exist — and a GET
|
|
407
|
+
// cannot carry a body, so the prompt above was built and thrown away. The
|
|
408
|
+
// wake-up always silently fell through to the canned languageFallback()
|
|
409
|
+
// string. Post the prompt to the real blocking chat route instead, so the
|
|
410
|
+
// first thing the user hears is model-authored, not a template.
|
|
404
411
|
let text;
|
|
405
412
|
try {
|
|
406
|
-
const res = await
|
|
413
|
+
const res = await daemonHttp.post(
|
|
414
|
+
`/api/projects/${DEFAULT_PROJECT_ID}/super-agent/chat`,
|
|
415
|
+
{ prompt }
|
|
416
|
+
);
|
|
407
417
|
text = res?.text;
|
|
408
|
-
} catch {}
|
|
418
|
+
} catch { /* daemon unreachable — the fallback below covers it */ }
|
|
409
419
|
|
|
410
420
|
// Fallback: generate a simple message without daemon
|
|
411
421
|
if (!text) {
|
|
@@ -10,7 +10,6 @@ import {
|
|
|
10
10
|
IDE_TARGETS,
|
|
11
11
|
installIdeSkills,
|
|
12
12
|
installGlobalSkills,
|
|
13
|
-
listBundledSkillSlugs,
|
|
14
13
|
listBundledSkills,
|
|
15
14
|
listEngineSkills,
|
|
16
15
|
listLegacyPruneSlugs,
|
|
@@ -210,7 +209,7 @@ export async function cmdSkillsList(args = {}) {
|
|
|
210
209
|
if (args?.flags?.all) {
|
|
211
210
|
const root = findApfRoot();
|
|
212
211
|
const params = root ? `?project_path=${encodeURIComponent(root)}` : "";
|
|
213
|
-
const out = await http.get(`/skills${params}`);
|
|
212
|
+
const out = await http.get(`/api/skills${params}`);
|
|
214
213
|
if (!out.count) {
|
|
215
214
|
console.log("(no skills available)");
|
|
216
215
|
return;
|
|
@@ -28,7 +28,7 @@ export async function cmdStatus() {
|
|
|
28
28
|
let daemonOk = false;
|
|
29
29
|
let daemonInfo = {};
|
|
30
30
|
try {
|
|
31
|
-
daemonInfo = await http.get("/health");
|
|
31
|
+
daemonInfo = await http.get("/api/health");
|
|
32
32
|
daemonOk = true;
|
|
33
33
|
} catch {}
|
|
34
34
|
|
|
@@ -94,7 +94,7 @@ export async function cmdStatus() {
|
|
|
94
94
|
const tg = cfg.telegram || {};
|
|
95
95
|
let tgLive = null;
|
|
96
96
|
if (daemonOk) {
|
|
97
|
-
try { tgLive = await http.get("/telegram/status"); } catch {}
|
|
97
|
+
try { tgLive = await http.get("/api/telegram/status"); } catch {}
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
if (tgLive) {
|
|
@@ -130,7 +130,7 @@ export async function cmdStatus() {
|
|
|
130
130
|
console.log(sec("Projects"));
|
|
131
131
|
let projects = [];
|
|
132
132
|
if (daemonOk) {
|
|
133
|
-
try { projects = await http.get("/projects"); } catch {}
|
|
133
|
+
try { projects = await http.get("/api/projects"); } catch {}
|
|
134
134
|
} else {
|
|
135
135
|
projects = (cfg.projects || []).map((p, i) => ({ id: i + 1, path: p.path, name: p.path?.split("/").pop() || "?", agents: "?" }));
|
|
136
136
|
}
|
|
@@ -108,7 +108,7 @@ export async function cmdTaskAdd(args) {
|
|
|
108
108
|
source: args.flags?.source || "cli",
|
|
109
109
|
tags: asArray(args.flags?.tag).filter(Boolean),
|
|
110
110
|
};
|
|
111
|
-
const task = await http.post(`/projects/${pid}/tasks`, body);
|
|
111
|
+
const task = await http.post(`/api/projects/${pid}/tasks`, body);
|
|
112
112
|
console.log(`added task ${task.id}: ${task.title}`);
|
|
113
113
|
}
|
|
114
114
|
|
|
@@ -137,8 +137,8 @@ export async function cmdTaskList(args) {
|
|
|
137
137
|
// project it came from. Without it, behaviour is exactly as before.
|
|
138
138
|
const all = !!args.flags?.all;
|
|
139
139
|
const path = all
|
|
140
|
-
? `/tasks${qs ? "?" + qs : ""}`
|
|
141
|
-
: `/projects/${await resolveProjectId(args?.flags?.project)}/tasks${qs ? "?" + qs : ""}`;
|
|
140
|
+
? `/api/tasks${qs ? "?" + qs : ""}`
|
|
141
|
+
: `/api/projects/${await resolveProjectId(args?.flags?.project)}/tasks${qs ? "?" + qs : ""}`;
|
|
142
142
|
|
|
143
143
|
const { rows, meta } = unwrap(await http.get(path));
|
|
144
144
|
renderTable(rows, { showProject: all });
|
|
@@ -154,7 +154,7 @@ export async function cmdTaskShow(args) {
|
|
|
154
154
|
const id = (args._ || [])[0];
|
|
155
155
|
if (!id) return fail("show", "id required");
|
|
156
156
|
const pid = await resolveProjectId(args?.flags?.project);
|
|
157
|
-
const t = await http.get(`/projects/${pid}/tasks/${encodeURIComponent(id)}`);
|
|
157
|
+
const t = await http.get(`/api/projects/${pid}/tasks/${encodeURIComponent(id)}`);
|
|
158
158
|
renderDetail(t);
|
|
159
159
|
}
|
|
160
160
|
|
|
@@ -164,7 +164,7 @@ export async function cmdTaskDone(args) {
|
|
|
164
164
|
if (!id) return fail("done", "id required");
|
|
165
165
|
const pid = await resolveProjectId(args?.flags?.project);
|
|
166
166
|
const t = await http.post(
|
|
167
|
-
`/projects/${pid}/tasks/${encodeURIComponent(id)}/done`,
|
|
167
|
+
`/api/projects/${pid}/tasks/${encodeURIComponent(id)}/done`,
|
|
168
168
|
{ by: args.flags?.by || null }
|
|
169
169
|
);
|
|
170
170
|
console.log(`done: ${t.id} — ${t.title}`);
|
|
@@ -176,7 +176,7 @@ export async function cmdTaskDrop(args) {
|
|
|
176
176
|
if (!id) return fail("drop", "id required");
|
|
177
177
|
const pid = await resolveProjectId(args?.flags?.project);
|
|
178
178
|
const t = await http.post(
|
|
179
|
-
`/projects/${pid}/tasks/${encodeURIComponent(id)}/drop`,
|
|
179
|
+
`/api/projects/${pid}/tasks/${encodeURIComponent(id)}/drop`,
|
|
180
180
|
{ by: args.flags?.by || null }
|
|
181
181
|
);
|
|
182
182
|
console.log(`dropped: ${t.id} — ${t.title}`);
|
|
@@ -187,7 +187,7 @@ export async function cmdTaskReopen(args) {
|
|
|
187
187
|
const id = (args._ || [])[0];
|
|
188
188
|
if (!id) return fail("reopen", "id required");
|
|
189
189
|
const pid = await resolveProjectId(args?.flags?.project);
|
|
190
|
-
const t = await http.post(`/projects/${pid}/tasks/${encodeURIComponent(id)}/reopen`);
|
|
190
|
+
const t = await http.post(`/api/projects/${pid}/tasks/${encodeURIComponent(id)}/reopen`);
|
|
191
191
|
console.log(`reopened: ${t.id} — ${t.title}`);
|
|
192
192
|
}
|
|
193
193
|
|
|
@@ -205,6 +205,6 @@ export async function cmdTaskPatch(args) {
|
|
|
205
205
|
if (Object.keys(patch).length === 0) {
|
|
206
206
|
return fail("patch", "at least one --title|--body|--due|--agent|--tag required");
|
|
207
207
|
}
|
|
208
|
-
const t = await http.patch(`/projects/${pid}/tasks/${encodeURIComponent(id)}`, { patch });
|
|
208
|
+
const t = await http.patch(`/api/projects/${pid}/tasks/${encodeURIComponent(id)}`, { patch });
|
|
209
209
|
renderDetail(t);
|
|
210
210
|
}
|
|
@@ -7,7 +7,7 @@ export async function cmdTelegramSend(args) {
|
|
|
7
7
|
const chat_id = args.flags.chat === true ? undefined : args.flags.chat;
|
|
8
8
|
// --interrupt / --force: send immediately bypassing any pending agent queue
|
|
9
9
|
const interrupt = !!(args.flags.interrupt || args.flags.force);
|
|
10
|
-
const result = await http.post("/telegram/send", { chat_id, text, interrupt });
|
|
10
|
+
const result = await http.post("/api/telegram/send", { chat_id, text, interrupt });
|
|
11
11
|
if (interrupt) {
|
|
12
12
|
console.log(`⚡ sent (interrupt, message_id=${result.message_id})`);
|
|
13
13
|
} else {
|
|
@@ -16,7 +16,7 @@ export async function cmdTelegramSend(args) {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export async function cmdTelegramStatus() {
|
|
19
|
-
const s = await http.get("/telegram/status");
|
|
19
|
+
const s = await http.get("/api/telegram/status");
|
|
20
20
|
console.log(`enabled: ${s.enabled}`);
|
|
21
21
|
if (!s.channels || s.channels.length === 0) {
|
|
22
22
|
console.log("(no channels configured)");
|
|
@@ -38,7 +38,7 @@ export async function cmdTelegramStatus() {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
export async function cmdTelegramStart() {
|
|
41
|
-
const r = await http.post("/telegram/start", {});
|
|
41
|
+
const r = await http.post("/api/telegram/start", {});
|
|
42
42
|
const channels = r.status?.channels || [];
|
|
43
43
|
const polling = channels.filter((c) => c.polling).length;
|
|
44
44
|
if (channels.length === 0) {
|
|
@@ -56,7 +56,7 @@ export async function cmdTelegramStart() {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
export async function cmdTelegramStop() {
|
|
59
|
-
await http.post("/telegram/stop", {});
|
|
59
|
+
await http.post("/api/telegram/stop", {});
|
|
60
60
|
console.log("⏹ telegram polling stopped (config unchanged — apx telegram start to resume)");
|
|
61
61
|
}
|
|
62
62
|
|
|
@@ -71,7 +71,7 @@ function ask(rl, prompt) {
|
|
|
71
71
|
|
|
72
72
|
async function reloadDaemon() {
|
|
73
73
|
try {
|
|
74
|
-
await http.post("/admin/reload", {});
|
|
74
|
+
await http.post("/api/admin/reload", {});
|
|
75
75
|
} catch (e) {
|
|
76
76
|
console.log(`⚠️ reload failed: ${e.message} (changes saved, restart daemon to apply)`);
|
|
77
77
|
}
|
|
@@ -79,7 +79,7 @@ async function reloadDaemon() {
|
|
|
79
79
|
|
|
80
80
|
async function listProjects() {
|
|
81
81
|
try {
|
|
82
|
-
return await http.get("/projects");
|
|
82
|
+
return await http.get("/api/projects");
|
|
83
83
|
} catch {
|
|
84
84
|
return [];
|
|
85
85
|
}
|
|
@@ -87,7 +87,7 @@ async function listProjects() {
|
|
|
87
87
|
|
|
88
88
|
async function listAgentsForProject(projectId) {
|
|
89
89
|
try {
|
|
90
|
-
const ags = await http.get(`/projects/${projectId}/agents`);
|
|
90
|
+
const ags = await http.get(`/api/projects/${projectId}/agents`);
|
|
91
91
|
return Array.isArray(ags) ? ags : (ags?.agents || []);
|
|
92
92
|
} catch {
|
|
93
93
|
return [];
|
|
@@ -113,7 +113,7 @@ function printChannelLine(c) {
|
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
export async function cmdTelegramChannelList() {
|
|
116
|
-
const { channels } = await http.get("/telegram/channels");
|
|
116
|
+
const { channels } = await http.get("/api/telegram/channels");
|
|
117
117
|
if (!channels || channels.length === 0) {
|
|
118
118
|
console.log("(no channels configured — try `apx telegram channel add`)");
|
|
119
119
|
return;
|
|
@@ -125,7 +125,7 @@ export async function cmdTelegramChannelList() {
|
|
|
125
125
|
export async function cmdTelegramChannelShow(args) {
|
|
126
126
|
const name = args._[0];
|
|
127
127
|
if (!name) throw new Error("apx telegram channel show: missing <name>");
|
|
128
|
-
const { channels } = await http.get("/telegram/channels");
|
|
128
|
+
const { channels } = await http.get("/api/telegram/channels");
|
|
129
129
|
const ch = (channels || []).find((c) => c.name === name);
|
|
130
130
|
if (!ch) throw new Error(`no such channel: ${name}`);
|
|
131
131
|
console.log(JSON.stringify(ch, null, 2));
|
|
@@ -144,7 +144,7 @@ export async function cmdTelegramChannelAdd(args) {
|
|
|
144
144
|
const b = parseBool(args.flags["respond-engine"]);
|
|
145
145
|
if (b !== null) patch.respond_with_engine = b;
|
|
146
146
|
}
|
|
147
|
-
const result = await http.post("/telegram/channels", patch);
|
|
147
|
+
const result = await http.post("/api/telegram/channels", patch);
|
|
148
148
|
await reloadDaemon();
|
|
149
149
|
console.log(`${result.created ? "✅ created" : "ℹ️ updated"} channel "${name}"`);
|
|
150
150
|
return;
|
|
@@ -201,7 +201,7 @@ export async function cmdTelegramChannelAdd(args) {
|
|
|
201
201
|
if (agent) patch.route_to_agent = agent;
|
|
202
202
|
patch.respond_with_engine = respond;
|
|
203
203
|
|
|
204
|
-
const result = await http.post("/telegram/channels", patch);
|
|
204
|
+
const result = await http.post("/api/telegram/channels", patch);
|
|
205
205
|
await reloadDaemon();
|
|
206
206
|
console.log(`\n${result.created ? "✅ created" : "ℹ️ updated"} channel "${channelName}"`);
|
|
207
207
|
} finally {
|
|
@@ -225,7 +225,7 @@ export async function cmdTelegramChannelSet(args) {
|
|
|
225
225
|
if (Object.keys(patch).length === 0) {
|
|
226
226
|
throw new Error("apx telegram channel set: nothing to update (use --project / --agent / --respond-engine / --bot-token / --chat-id)");
|
|
227
227
|
}
|
|
228
|
-
await http.patch(`/telegram/channels/${encodeURIComponent(name)}`, patch);
|
|
228
|
+
await http.patch(`/api/telegram/channels/${encodeURIComponent(name)}`, patch);
|
|
229
229
|
await reloadDaemon();
|
|
230
230
|
console.log(`✅ updated channel "${name}"`);
|
|
231
231
|
}
|
|
@@ -243,7 +243,7 @@ export async function cmdTelegramChannelUnset(args) {
|
|
|
243
243
|
throw new Error("apx telegram channel unset: specify at least one of --project --agent --bot-token --chat-id");
|
|
244
244
|
}
|
|
245
245
|
const body = Object.fromEntries(fields.map((f) => [f, null]));
|
|
246
|
-
await http.patch(`/telegram/channels/${encodeURIComponent(name)}`, body);
|
|
246
|
+
await http.patch(`/api/telegram/channels/${encodeURIComponent(name)}`, body);
|
|
247
247
|
await reloadDaemon();
|
|
248
248
|
console.log(`✅ cleared ${fields.join(", ")} on "${name}"`);
|
|
249
249
|
}
|
|
@@ -251,7 +251,7 @@ export async function cmdTelegramChannelUnset(args) {
|
|
|
251
251
|
export async function cmdTelegramChannelRemove(args) {
|
|
252
252
|
const name = args._[0];
|
|
253
253
|
if (!name) throw new Error("apx telegram channel remove: missing <name>");
|
|
254
|
-
await http.delete(`/telegram/channels/${encodeURIComponent(name)}`);
|
|
254
|
+
await http.delete(`/api/telegram/channels/${encodeURIComponent(name)}`);
|
|
255
255
|
await reloadDaemon();
|
|
256
256
|
console.log(`🗑 removed channel "${name}"`);
|
|
257
257
|
}
|
|
@@ -268,7 +268,7 @@ function roleTag(c, owners) {
|
|
|
268
268
|
}
|
|
269
269
|
|
|
270
270
|
export async function cmdTelegramContacts() {
|
|
271
|
-
const { contacts, channel_owners = [] } = await http.get("/telegram/contacts");
|
|
271
|
+
const { contacts, channel_owners = [] } = await http.get("/api/telegram/contacts");
|
|
272
272
|
if (!contacts || contacts.length === 0) {
|
|
273
273
|
console.log("(no contacts yet — they're recorded automatically when people message a bot)");
|
|
274
274
|
return;
|
|
@@ -289,14 +289,14 @@ export async function cmdTelegramRole(args) {
|
|
|
289
289
|
if (!userId || !role) {
|
|
290
290
|
throw new Error("apx telegram role <user_id> <role> (e.g. apx telegram role 123 editor)");
|
|
291
291
|
}
|
|
292
|
-
const r = await http.patch(`/telegram/contacts/${encodeURIComponent(userId)}`, { role });
|
|
292
|
+
const r = await http.patch(`/api/telegram/contacts/${encodeURIComponent(userId)}`, { role });
|
|
293
293
|
console.log(`✅ ${r.contact?.name || userId} → role "${role}"`);
|
|
294
294
|
}
|
|
295
295
|
|
|
296
296
|
export async function cmdTelegramContactRemove(args) {
|
|
297
297
|
const userId = args._[0];
|
|
298
298
|
if (!userId) throw new Error("apx telegram contact rm <user_id>");
|
|
299
|
-
await http.delete(`/telegram/contacts/${encodeURIComponent(userId)}`);
|
|
299
|
+
await http.delete(`/api/telegram/contacts/${encodeURIComponent(userId)}`);
|
|
300
300
|
console.log(`🗑 removed contact ${userId}`);
|
|
301
301
|
}
|
|
302
302
|
|
|
@@ -306,7 +306,7 @@ export async function cmdTelegramOwner(args) {
|
|
|
306
306
|
if (!channel || !userId) {
|
|
307
307
|
throw new Error("apx telegram owner <channel> <user_id>");
|
|
308
308
|
}
|
|
309
|
-
await http.patch(`/telegram/channels/${encodeURIComponent(channel)}`, {
|
|
309
|
+
await http.patch(`/api/telegram/channels/${encodeURIComponent(channel)}`, {
|
|
310
310
|
owner_user_id: /^\d+$/.test(String(userId)) ? Number(userId) : userId,
|
|
311
311
|
});
|
|
312
312
|
await reloadDaemon();
|
|
@@ -322,19 +322,19 @@ export async function cmdTelegramRoles(args) {
|
|
|
322
322
|
let tools = [];
|
|
323
323
|
if (raw === "*" || raw === true) tools = "*";
|
|
324
324
|
else if (typeof raw === "string") tools = raw.split(",").map((s) => s.trim()).filter(Boolean);
|
|
325
|
-
await http.put(`/telegram/roles/${encodeURIComponent(name)}`, { tools });
|
|
325
|
+
await http.put(`/api/telegram/roles/${encodeURIComponent(name)}`, { tools });
|
|
326
326
|
console.log(`✅ role "${name}" → tools ${tools === "*" ? "*" : `[${tools.join(", ")}]`}`);
|
|
327
327
|
return;
|
|
328
328
|
}
|
|
329
329
|
if (sub === "rm" || sub === "remove") {
|
|
330
330
|
const name = args._[1];
|
|
331
331
|
if (!name) throw new Error("apx telegram roles rm <name>");
|
|
332
|
-
await http.delete(`/telegram/roles/${encodeURIComponent(name)}`);
|
|
332
|
+
await http.delete(`/api/telegram/roles/${encodeURIComponent(name)}`);
|
|
333
333
|
console.log(`🗑 removed role "${name}"`);
|
|
334
334
|
return;
|
|
335
335
|
}
|
|
336
336
|
// default: list
|
|
337
|
-
const { roles } = await http.get("/telegram/roles");
|
|
337
|
+
const { roles } = await http.get("/api/telegram/roles");
|
|
338
338
|
const names = Object.keys(roles || {});
|
|
339
339
|
if (names.length === 0) {
|
|
340
340
|
console.log("(no roles defined)");
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
// themselves.
|
|
11
11
|
|
|
12
12
|
import fs from "node:fs";
|
|
13
|
-
import os from "node:os";
|
|
14
13
|
import path from "node:path";
|
|
14
|
+
import { RECORDINGS_TMP_DIR } from "#core/config/paths.js";
|
|
15
15
|
import { spawn, spawnSync, execFileSync } from "node:child_process";
|
|
16
16
|
import { http } from "../http.js";
|
|
17
17
|
|
|
@@ -78,7 +78,7 @@ function recordToFile(outPath, { seconds, recorder }) {
|
|
|
78
78
|
// the recorder cleanly (we forward SIGINT to the child).
|
|
79
79
|
return new Promise((resolve, reject) => {
|
|
80
80
|
let args;
|
|
81
|
-
|
|
81
|
+
const bin = recorder.bin;
|
|
82
82
|
if (bin === "rec" || bin === "sox") {
|
|
83
83
|
// SoX:
|
|
84
84
|
// rec -q -c 1 -r 16000 out.wav silence 1 0.1 1% 1 1.5 1%
|
|
@@ -152,7 +152,7 @@ export async function cmdVoiceSay(args) {
|
|
|
152
152
|
process.stdout.write(` ${fmt.d("Synthesizing…")} `);
|
|
153
153
|
let result;
|
|
154
154
|
try {
|
|
155
|
-
result = await http.post("/tts/say", { text, provider, voice });
|
|
155
|
+
result = await http.post("/api/tts/say", { text, provider, voice });
|
|
156
156
|
} catch (e) {
|
|
157
157
|
console.log(fmt.r("failed"));
|
|
158
158
|
console.error(` ${fmt.r("✗")} ${e.message}\n`);
|
|
@@ -183,7 +183,7 @@ export async function cmdVoiceListen(args) {
|
|
|
183
183
|
process.exit(1);
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
-
const tmpDir =
|
|
186
|
+
const tmpDir = RECORDINGS_TMP_DIR;
|
|
187
187
|
fs.mkdirSync(tmpDir, { recursive: true });
|
|
188
188
|
const inFile = path.join(tmpDir, `listen-${Date.now()}.wav`);
|
|
189
189
|
|
|
@@ -212,7 +212,7 @@ export async function cmdVoiceListen(args) {
|
|
|
212
212
|
const audioB64 = fs.readFileSync(inFile).toString("base64");
|
|
213
213
|
let result;
|
|
214
214
|
try {
|
|
215
|
-
result = await http.post("/voice/turn", {
|
|
215
|
+
result = await http.post("/api/voice/turn", {
|
|
216
216
|
audio: audioB64,
|
|
217
217
|
format: "wav",
|
|
218
218
|
provider,
|
|
@@ -240,7 +240,7 @@ export async function cmdVoiceListen(args) {
|
|
|
240
240
|
export async function cmdVoiceProviders() {
|
|
241
241
|
let info;
|
|
242
242
|
try {
|
|
243
|
-
info = await http.get("/tts/providers");
|
|
243
|
+
info = await http.get("/api/tts/providers");
|
|
244
244
|
} catch (e) {
|
|
245
245
|
console.error(`\n ${fmt.r("✗")} ${e.message}\n`);
|
|
246
246
|
process.exit(1);
|