@agentprojectcontext/apx 1.77.3 → 1.79.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 +43 -53
- 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/tool-summary.js +65 -0
- package/src/core/agent/tools/handlers/call-runtime.js +4 -4
- package/src/core/agent/tools/handlers/list-commitments.js +80 -0
- package/src/core/agent/tools/handlers/list-tasks.js +66 -27
- package/src/core/agent/tools/handlers/record-commitment.js +68 -0
- package/src/core/agent/tools/handlers/search-sessions.js +1 -1
- package/src/core/agent/tools/handlers/send-telegram.js +68 -2
- package/src/core/agent/tools/handlers/set-permission-mode.js +11 -4
- package/src/core/agent/tools/names.js +64 -0
- package/src/core/agent/tools/registry.js +9 -0
- package/src/core/agent/tools/tool-call-parser.js +70 -1
- 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/ask-callbacks.js +35 -0
- package/src/core/channels/telegram/config.js +201 -0
- package/src/core/channels/telegram/dispatch.js +3 -0
- package/src/core/channels/telegram/reply.js +30 -5
- package/src/core/config/index.js +25 -183
- package/src/core/config/paths.js +57 -1
- package/src/core/config/redact.js +22 -0
- package/src/core/confirmation/adapters/web.js +1 -1
- package/src/core/daemon/service.js +238 -0
- 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/gemini.js +322 -60
- package/src/core/engines/openai-compatible.js +21 -2
- 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/consolidate.js +225 -0
- package/src/core/memory/indexer.js +2 -5
- package/src/core/nudge/index.js +192 -0
- package/src/core/nudge/policy.js +143 -0
- package/src/core/nudge/store.js +141 -0
- package/src/core/profiles/bundled/secretary/PROFILE.md +8 -9
- package/src/core/profiles/bundled/secretary/config.schema.json +33 -3
- package/src/core/profiles/bundled/secretary/routines/day-close.json +7 -3
- package/src/core/profiles/bundled/secretary/routines/day-open.json +7 -3
- package/src/core/profiles/bundled/secretary/routines/watch.json +13 -0
- package/src/core/profiles/lifecycle.js +0 -2
- package/src/core/profiles/store.js +2 -7
- package/src/core/routines/runner.js +103 -4
- package/src/core/routines/signals.js +270 -0
- 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/commitments.js +331 -0
- package/src/core/stores/engine-sessions.js +0 -4
- package/src/core/stores/messages.js +4 -5
- package/src/core/stores/organization.js +9 -11
- package/src/core/stores/routines.js +23 -14
- package/src/core/stores/runtime-callbacks.js +2 -1
- package/src/core/util/json-file.js +128 -0
- package/src/core/util/thinking.js +51 -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/commitments.js +135 -0
- 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/nudges.js +112 -0
- 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 +32 -8
- package/src/host/daemon/api/run.js +2 -2
- package/src/host/daemon/api/runtimes.js +6 -6
- package/src/host/daemon/api/self-memory.js +50 -0
- 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 +61 -24
- 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 +9 -7
- package/src/host/daemon/api/web.js +28 -32
- package/src/host/daemon/api.js +83 -48
- package/src/host/daemon/callback-reconciler.js +16 -0
- 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 +8 -2
- package/src/host/daemon/plugins/telegram/index.js +7 -2
- package/src/host/daemon/stt-venv.js +20 -81
- package/src/host/daemon/wakeup.js +18 -4
- 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/commitment.js +154 -0
- package/src/interfaces/cli/commands/config.js +4 -4
- package/src/interfaces/cli/commands/daemon.js +74 -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 +75 -2
- package/src/interfaces/cli/commands/messages.js +5 -5
- package/src/interfaces/cli/commands/model.js +0 -18
- package/src/interfaces/cli/commands/nudge.js +130 -0
- 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/commitment.js +19 -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 +25 -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 +75 -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 +19 -0
- package/src/interfaces/cli/routes/messages.js +16 -0
- package/src/interfaces/cli/routes/model.js +11 -0
- package/src/interfaces/cli/routes/nudge.js +17 -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-CvEoGtTf.js +849 -0
- package/src/interfaces/web/dist/assets/index-CvEoGtTf.js.map +1 -0
- package/src/interfaces/web/dist/assets/index-DzBBXFaO.css +1 -0
- package/src/interfaces/web/dist/index.html +2 -2
- package/src/interfaces/web/package-lock.json +11 -10
- package/src/interfaces/web/src/components/AddProjectDialog.tsx +1 -1
- package/src/interfaces/web/src/components/Section.tsx +18 -3
- 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/MessageBubble.tsx +13 -0
- 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/cron/CronPicker.tsx +196 -0
- 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/inbox/InboxList.tsx +145 -0
- package/src/interfaces/web/src/components/memory/MemoryBrowser.tsx +36 -6
- package/src/interfaces/web/src/components/routines/ExecutionsList.tsx +1 -1
- package/src/interfaces/web/src/components/routines/RoutineDetail.tsx +16 -4
- package/src/interfaces/web/src/components/routines/RoutineEditor.tsx +14 -4
- package/src/interfaces/web/src/components/routines/shared.ts +14 -5
- 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/NudgePanel.tsx +183 -0
- package/src/interfaces/web/src/components/settings/ProfilePanel.tsx +36 -12
- 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/components/ui/filter-chips.tsx +47 -0
- package/src/interfaces/web/src/components/ui.tsx +1 -0
- package/src/interfaces/web/src/constants/index.ts +1 -0
- package/src/interfaces/web/src/hooks/useChat.ts +5 -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/useNudges.ts +38 -0
- 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/i18n/en.ts +127 -0
- package/src/interfaces/web/src/i18n/es.ts +127 -0
- 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/commitments.ts +57 -0
- 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/notebook.ts +23 -0
- package/src/interfaces/web/src/lib/api/nudges.ts +53 -0
- 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/lib/cron.ts +196 -0
- package/src/interfaces/web/src/lib/when.ts +32 -0
- package/src/interfaces/web/src/screens/InboxScreen.tsx +107 -77
- package/src/interfaces/web/src/screens/ProjectScreen.tsx +5 -2
- package/src/interfaces/web/src/screens/SettingsScreen.tsx +17 -3
- package/src/interfaces/web/src/screens/base/AgentDefaultsTab.tsx +1 -1
- package/src/interfaces/web/src/screens/base/CommitmentsTab.tsx +239 -0
- package/src/interfaces/web/src/screens/base/GlobalTasksTab.tsx +103 -20
- package/src/interfaces/web/src/screens/base/LogsTab.tsx +18 -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 +24 -6
- 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 +15 -13
- 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/src/types/daemon.ts +10 -1
- package/src/interfaces/web/vite.config.ts +13 -18
- package/src/interfaces/web/dist/assets/index-BptlbKjU.js +0 -824
- package/src/interfaces/web/dist/assets/index-BptlbKjU.js.map +0 -1
- package/src/interfaces/web/dist/assets/index-D_EJEA1n.css +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,135 @@
|
|
|
1
|
+
// Commitments — what you promised, to whom, by when. Backed by
|
|
2
|
+
// core/stores/commitments.js (JSONL event log, sibling of tasks).
|
|
3
|
+
//
|
|
4
|
+
// GET /commitments cross-project
|
|
5
|
+
// ?state=open|kept|missed|all
|
|
6
|
+
// &counterparty=X&overdue=1
|
|
7
|
+
// &due_before=ISO&due_after=ISO
|
|
8
|
+
// &sort=due|newest&limit=N&offset=N
|
|
9
|
+
// GET /projects/:pid/commitments same filters, one project
|
|
10
|
+
// POST /projects/:pid/commitments { counterparty, body, due?, … }
|
|
11
|
+
// GET /projects/:pid/commitments/:id (id or prefix)
|
|
12
|
+
// PATCH /projects/:pid/commitments/:id { patch: {...} }
|
|
13
|
+
// POST /projects/:pid/commitments/:id/kept { note? }
|
|
14
|
+
// POST /projects/:pid/commitments/:id/missed { note? }
|
|
15
|
+
// POST /projects/:pid/commitments/:id/renegotiate { due, note? }
|
|
16
|
+
// GET /projects/:pid/commitments-summary
|
|
17
|
+
import {
|
|
18
|
+
createCommitment,
|
|
19
|
+
listCommitments,
|
|
20
|
+
listCommitmentsAcrossProjects,
|
|
21
|
+
getCommitment,
|
|
22
|
+
patchCommitment,
|
|
23
|
+
keepCommitment,
|
|
24
|
+
missCommitment,
|
|
25
|
+
renegotiateCommitment,
|
|
26
|
+
countCommitments,
|
|
27
|
+
} from "#core/stores/commitments.js";
|
|
28
|
+
import { pageEnvelope } from "./shared.js";
|
|
29
|
+
|
|
30
|
+
/** Shared filter parsing so the cross-project and per-project views cannot drift. */
|
|
31
|
+
function filtersFrom(query) {
|
|
32
|
+
const { state, counterparty, due_before, due_after, overdue, updated_since, sort } = query;
|
|
33
|
+
return {
|
|
34
|
+
state: state === "all" ? "all" : (state || undefined),
|
|
35
|
+
counterparty: counterparty || undefined,
|
|
36
|
+
due_before: due_before || undefined,
|
|
37
|
+
due_after: due_after || undefined,
|
|
38
|
+
overdue: overdue === "1" || overdue === "true" || undefined,
|
|
39
|
+
updated_since: updated_since || undefined,
|
|
40
|
+
sort: sort === "newest" ? "newest" : "due",
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function register(api, { project, projects }) {
|
|
45
|
+
api.get("/commitments", (req, res) => {
|
|
46
|
+
const entries = [];
|
|
47
|
+
for (const entry of projects.list()) {
|
|
48
|
+
const p = projects.get(entry.id);
|
|
49
|
+
if (!p?.storagePath) continue;
|
|
50
|
+
entries.push({
|
|
51
|
+
id: entry.id,
|
|
52
|
+
name: entry.name || entry.path,
|
|
53
|
+
path: entry.path,
|
|
54
|
+
storagePath: p.storagePath,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const { commitments, skipped } = listCommitmentsAcrossProjects(entries, filtersFrom(req.query));
|
|
59
|
+
const envelope = pageEnvelope(commitments, req.query);
|
|
60
|
+
if (skipped.length) envelope.meta = { ...(envelope.meta || {}), skipped };
|
|
61
|
+
res.json(envelope);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
api.get("/projects/:pid/commitments", (req, res) => {
|
|
65
|
+
const p = project(req, res);
|
|
66
|
+
if (!p) return;
|
|
67
|
+
res.json(pageEnvelope(listCommitments(p.storagePath, filtersFrom(req.query)), req.query));
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
api.post("/projects/:pid/commitments", (req, res) => {
|
|
71
|
+
const p = project(req, res);
|
|
72
|
+
if (!p) return;
|
|
73
|
+
try {
|
|
74
|
+
res.status(201).json(createCommitment(p.storagePath, req.body || {}));
|
|
75
|
+
} catch (e) {
|
|
76
|
+
res.status(400).json({ error: e.message });
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
api.get("/projects/:pid/commitments/:id", (req, res) => {
|
|
81
|
+
const p = project(req, res);
|
|
82
|
+
if (!p) return;
|
|
83
|
+
const row = getCommitment(p.storagePath, req.params.id);
|
|
84
|
+
if (!row) return res.status(404).json({ error: "commitment not found" });
|
|
85
|
+
res.json(row);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
api.patch("/projects/:pid/commitments/:id", (req, res) => {
|
|
89
|
+
const p = project(req, res);
|
|
90
|
+
if (!p) return;
|
|
91
|
+
const { patch } = req.body || {};
|
|
92
|
+
if (!patch || typeof patch !== "object") {
|
|
93
|
+
return res.status(400).json({ error: "patch object required" });
|
|
94
|
+
}
|
|
95
|
+
const updated = patchCommitment(p.storagePath, req.params.id, patch);
|
|
96
|
+
if (!updated) return res.status(404).json({ error: "commitment not found" });
|
|
97
|
+
res.json(updated);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
api.post("/projects/:pid/commitments/:id/kept", (req, res) => {
|
|
101
|
+
const p = project(req, res);
|
|
102
|
+
if (!p) return;
|
|
103
|
+
const updated = keepCommitment(p.storagePath, req.params.id, req.body?.note || null);
|
|
104
|
+
if (!updated) return res.status(404).json({ error: "commitment not found" });
|
|
105
|
+
res.json(updated);
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
api.post("/projects/:pid/commitments/:id/missed", (req, res) => {
|
|
109
|
+
const p = project(req, res);
|
|
110
|
+
if (!p) return;
|
|
111
|
+
const updated = missCommitment(p.storagePath, req.params.id, req.body?.note || null);
|
|
112
|
+
if (!updated) return res.status(404).json({ error: "commitment not found" });
|
|
113
|
+
res.json(updated);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
api.post("/projects/:pid/commitments/:id/renegotiate", (req, res) => {
|
|
117
|
+
const p = project(req, res);
|
|
118
|
+
if (!p) return;
|
|
119
|
+
const { due, note } = req.body || {};
|
|
120
|
+
if (!due) return res.status(400).json({ error: "a new due date is required" });
|
|
121
|
+
try {
|
|
122
|
+
const updated = renegotiateCommitment(p.storagePath, req.params.id, due, note || null);
|
|
123
|
+
if (!updated) return res.status(404).json({ error: "commitment not found" });
|
|
124
|
+
res.json(updated);
|
|
125
|
+
} catch (e) {
|
|
126
|
+
res.status(400).json({ error: e.message });
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
api.get("/projects/:pid/commitments-summary", (req, res) => {
|
|
131
|
+
const p = project(req, res);
|
|
132
|
+
if (!p) return;
|
|
133
|
+
res.json(countCommitments(p.storagePath));
|
|
134
|
+
});
|
|
135
|
+
}
|
|
@@ -27,8 +27,8 @@ function writeProjectJson(root, body) {
|
|
|
27
27
|
fs.writeFileSync(p, JSON.stringify(body, null, 2) + "\n");
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
export function register(
|
|
31
|
-
|
|
30
|
+
export function register(api, { projects, project }) {
|
|
31
|
+
api.get("/projects/:pid/config", (req, res) => {
|
|
32
32
|
const p = project(req, res);
|
|
33
33
|
if (!p) return;
|
|
34
34
|
// Redact secrets (engine api_keys, telegram bot tokens) the same way the
|
|
@@ -43,7 +43,7 @@ export function register(app, { projects, project }) {
|
|
|
43
43
|
});
|
|
44
44
|
});
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
api.put("/projects/:pid/config", (req, res) => {
|
|
47
47
|
const p = project(req, res);
|
|
48
48
|
if (!p) return;
|
|
49
49
|
const body = req.body || {};
|
|
@@ -57,7 +57,7 @@ export function register(app, { projects, project }) {
|
|
|
57
57
|
res.json({ ok: true });
|
|
58
58
|
});
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
api.patch("/projects/:pid/config", (req, res) => {
|
|
61
61
|
const p = project(req, res);
|
|
62
62
|
if (!p) return;
|
|
63
63
|
const { set, unset } = req.body || {};
|
|
@@ -78,7 +78,7 @@ export function register(app, { projects, project }) {
|
|
|
78
78
|
res.json({ ok: true, project_only: redactConfig(cfg) });
|
|
79
79
|
});
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
api.put("/projects/:pid/apc-project", (req, res) => {
|
|
82
82
|
const p = project(req, res);
|
|
83
83
|
if (!p) return;
|
|
84
84
|
const body = req.body || {};
|
|
@@ -93,7 +93,7 @@ export function register(app, { projects, project }) {
|
|
|
93
93
|
}
|
|
94
94
|
});
|
|
95
95
|
|
|
96
|
-
|
|
96
|
+
api.patch("/projects/:pid/apc-project", (req, res) => {
|
|
97
97
|
const p = project(req, res);
|
|
98
98
|
if (!p) return;
|
|
99
99
|
try {
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
|
|
11
11
|
import { getConfirmationStore } from "#core/confirmation/pending-store.js";
|
|
12
12
|
|
|
13
|
-
export function register(
|
|
14
|
-
|
|
13
|
+
export function register(api) {
|
|
14
|
+
api.post("/super-agent/confirm/:correlationId", async (req, res) => {
|
|
15
15
|
const { correlationId } = req.params;
|
|
16
16
|
const { confirmed } = req.body;
|
|
17
17
|
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
import { readAgents } from "#core/apc/parser.js";
|
|
4
4
|
import { readProjectMessages } from "#core/stores/messages.js";
|
|
5
5
|
|
|
6
|
-
export function register(
|
|
7
|
-
|
|
6
|
+
export function register(api, { project }) {
|
|
7
|
+
api.get("/projects/:pid/agents/:slug/connections", (req, res) => {
|
|
8
8
|
const p = project(req, res);
|
|
9
9
|
if (!p) return;
|
|
10
10
|
const agents = readAgents(p.path);
|
|
@@ -11,9 +11,9 @@ import { listConversations, readConversation, deleteConversation } from "#core/s
|
|
|
11
11
|
import { listGlobalThreads, readGlobalThread, deleteGlobalThread } from "#core/stores/messages.js";
|
|
12
12
|
import { compactConversation } from "#core/stores/conversations-compactor.js";
|
|
13
13
|
import { replyAsAgent } from "#core/agent/a2a/reply.js";
|
|
14
|
-
import { nowIso } from "./shared.js";
|
|
14
|
+
import { nowIso, asyncRoute } from "./shared.js";
|
|
15
15
|
|
|
16
|
-
export function register(
|
|
16
|
+
export function register(api, { project, config }) {
|
|
17
17
|
// The super-agent (default name "apx") is a pseudo-agent: it owns
|
|
18
18
|
// conversations per project but is NOT listed in AGENTS.md. Resolve its slug
|
|
19
19
|
// so `apx conversations list` (which defaults to the super-agent) works
|
|
@@ -22,7 +22,7 @@ export function register(app, { project, config }) {
|
|
|
22
22
|
const agentResolvable = (p, slug) =>
|
|
23
23
|
slug === superAgentSlug() || readAgents(p.path).some((a) => a.slug === slug);
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
api.get("/projects/:pid/agents/:slug/conversations", (req, res) => {
|
|
26
26
|
const p = project(req, res);
|
|
27
27
|
if (!p) return;
|
|
28
28
|
if (!agentResolvable(p, req.params.slug))
|
|
@@ -30,7 +30,7 @@ export function register(app, { project, config }) {
|
|
|
30
30
|
res.json(listConversations(p.storagePath, req.params.slug));
|
|
31
31
|
});
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
api.get("/projects/:pid/agents/:slug/conversations/:id", (req, res) => {
|
|
34
34
|
const p = project(req, res);
|
|
35
35
|
if (!p) return;
|
|
36
36
|
const conv = readConversation(p.storagePath, req.params.slug, req.params.id);
|
|
@@ -51,7 +51,7 @@ export function register(app, { project, config }) {
|
|
|
51
51
|
});
|
|
52
52
|
});
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
api.delete("/projects/:pid/agents/:slug/conversations/:id", (req, res) => {
|
|
55
55
|
const p = project(req, res);
|
|
56
56
|
if (!p) return;
|
|
57
57
|
if (!agentResolvable(p, req.params.slug))
|
|
@@ -66,13 +66,13 @@ export function register(app, { project, config }) {
|
|
|
66
66
|
// in the global per-channel ledger, not in per-agent conversation files.
|
|
67
67
|
// These endpoints surface that ledger as day-threads so the web Chats
|
|
68
68
|
// sidebar can list and reopen them.
|
|
69
|
-
|
|
69
|
+
api.get("/projects/:pid/super-agent/threads", (req, res) => {
|
|
70
70
|
const p = project(req, res);
|
|
71
71
|
if (!p) return;
|
|
72
72
|
res.json(listGlobalThreads());
|
|
73
73
|
});
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
api.get("/projects/:pid/super-agent/threads/:channel/:id", (req, res) => {
|
|
76
76
|
const p = project(req, res);
|
|
77
77
|
if (!p) return;
|
|
78
78
|
const thread = readGlobalThread({
|
|
@@ -83,7 +83,7 @@ export function register(app, { project, config }) {
|
|
|
83
83
|
res.json(thread);
|
|
84
84
|
});
|
|
85
85
|
|
|
86
|
-
|
|
86
|
+
api.delete("/projects/:pid/super-agent/threads/:channel/:id", (req, res) => {
|
|
87
87
|
const p = project(req, res);
|
|
88
88
|
if (!p) return;
|
|
89
89
|
const ok = deleteGlobalThread({ channel: req.params.channel, date: req.params.id });
|
|
@@ -113,17 +113,17 @@ export function register(app, { project, config }) {
|
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
|
|
116
|
+
api.post("/projects/:pid/agents/:slug/compact", (req, res) =>
|
|
117
117
|
handleCompact(req, res, null)
|
|
118
118
|
);
|
|
119
119
|
|
|
120
|
-
|
|
120
|
+
api.post(
|
|
121
121
|
"/projects/:pid/agents/:slug/conversations/:id/compact",
|
|
122
122
|
(req, res) => handleCompact(req, res, req.params.id)
|
|
123
123
|
);
|
|
124
124
|
|
|
125
125
|
// ---- Agent-to-agent routing ----
|
|
126
|
-
|
|
126
|
+
api.post("/projects/:pid/send", asyncRoute(async (req, res) => {
|
|
127
127
|
const p = project(req, res);
|
|
128
128
|
if (!p) return;
|
|
129
129
|
const { from, to, body, deliver = false, _depth = 0 } = req.body || {};
|
|
@@ -199,5 +199,5 @@ export function register(app, { project, config }) {
|
|
|
199
199
|
}
|
|
200
200
|
|
|
201
201
|
res.json({ from, to, body, ts, reply });
|
|
202
|
-
});
|
|
202
|
+
}));
|
|
203
203
|
}
|
|
@@ -30,8 +30,8 @@ function safeProjects(projects) {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
export function register(
|
|
34
|
-
|
|
33
|
+
export function register(api, ctx) {
|
|
34
|
+
api.get("/deck/manifest", (_req, res) => {
|
|
35
35
|
const overrides =
|
|
36
36
|
(ctx.config?.deck && typeof ctx.config.deck === "object" && ctx.config.deck.widget_overrides) || {};
|
|
37
37
|
res.json(
|
|
@@ -51,7 +51,7 @@ export function register(app, ctx) {
|
|
|
51
51
|
// Persists the user's enable/disable choice for an external widget into the
|
|
52
52
|
// global config under `deck.widget_overrides[id]`. No-op for unknown widget
|
|
53
53
|
// ids so the deck UI can stay forward-compatible.
|
|
54
|
-
|
|
54
|
+
api.patch("/deck/widgets/:id", async (req, res) => {
|
|
55
55
|
const id = req.params.id;
|
|
56
56
|
if (!TOGGLEABLE_WIDGETS.has(id)) {
|
|
57
57
|
return res.status(404).json({ error: `unknown widget: ${id}` });
|
|
@@ -92,7 +92,7 @@ export function register(app, ctx) {
|
|
|
92
92
|
//
|
|
93
93
|
// Reads the project's AGENTS.md + .apc/memory.md, concatenates them with a
|
|
94
94
|
// small header per file, and ships the result to the daemon-host clipboard.
|
|
95
|
-
|
|
95
|
+
api.post("/projects/:pid/context/copy", async (req, res) => {
|
|
96
96
|
const project = ctx.project ? ctx.project(req, res) : null;
|
|
97
97
|
if (!project) return; // project() already 404'd
|
|
98
98
|
try {
|
|
@@ -106,7 +106,7 @@ export function register(app, ctx) {
|
|
|
106
106
|
});
|
|
107
107
|
|
|
108
108
|
// POST /projects/:pid/notes body: { body: "...", title?: "..." }
|
|
109
|
-
|
|
109
|
+
api.post("/projects/:pid/notes", async (req, res) => {
|
|
110
110
|
const project = ctx.project ? ctx.project(req, res) : null;
|
|
111
111
|
if (!project) return;
|
|
112
112
|
const { body, title } = req.body || {};
|
|
@@ -129,7 +129,7 @@ export function register(app, ctx) {
|
|
|
129
129
|
// Light-touch action runner for the deck buttons. Companion clients can't
|
|
130
130
|
// shell out arbitrary commands — body picks from a whitelist of "intent"
|
|
131
131
|
// verbs and the server picks the OS command. See deck-exec.js for the kinds.
|
|
132
|
-
|
|
132
|
+
api.post("/deck/exec", async (req, res) => {
|
|
133
133
|
const { kind, target, app: appHint, text } = req.body || {};
|
|
134
134
|
if (!kind || typeof kind !== "string") {
|
|
135
135
|
return res.status(400).json({ error: "kind required" });
|
|
@@ -25,8 +25,8 @@ import {
|
|
|
25
25
|
stopDesktop,
|
|
26
26
|
} from "#core/desktop/process.js";
|
|
27
27
|
|
|
28
|
-
export function register(
|
|
29
|
-
|
|
28
|
+
export function register(api, { plugins, config }) {
|
|
29
|
+
api.get("/desktop/status", (_req, res) => {
|
|
30
30
|
// `running` is the live Electron process (pid file) — the source of truth
|
|
31
31
|
// for the Start/Stop/Restart controls. `connected_clients` is how many of
|
|
32
32
|
// those windows have an open WS to the daemon (a window can be running but
|
|
@@ -41,7 +41,7 @@ export function register(app, { plugins, config }) {
|
|
|
41
41
|
|
|
42
42
|
// POST /desktop/start — launch the floating window (detached Electron). Same
|
|
43
43
|
// helper the CLI's `apx desktop start` uses. No-op-safe if already running.
|
|
44
|
-
|
|
44
|
+
api.post("/desktop/start", async (_req, res) => {
|
|
45
45
|
try {
|
|
46
46
|
const r = await startDesktopDetached({ port: config?.port });
|
|
47
47
|
if (!r.ok) return res.status(500).json({ ok: false, error: r.error });
|
|
@@ -53,7 +53,7 @@ export function register(app, { plugins, config }) {
|
|
|
53
53
|
|
|
54
54
|
// POST /desktop/stop — terminate the running window (SIGTERM). `stopped` is
|
|
55
55
|
// false when nothing was running.
|
|
56
|
-
|
|
56
|
+
api.post("/desktop/stop", (_req, res) => {
|
|
57
57
|
const r = stopDesktop();
|
|
58
58
|
if (!r.ok) return res.status(500).json({ ok: false, error: r.error });
|
|
59
59
|
res.json({ ok: true, stopped: r.stopped });
|
|
@@ -66,7 +66,7 @@ export function register(app, { plugins, config }) {
|
|
|
66
66
|
// the renderer (main.js repositions + reloads webContents), NOT a process
|
|
67
67
|
// kill — the Electron app keeps its tray/shortcut. Returns how many windows
|
|
68
68
|
// were signalled so the UI can tell "reloaded" from "nothing connected".
|
|
69
|
-
|
|
69
|
+
api.post("/desktop/restart", (_req, res) => {
|
|
70
70
|
import("../desktop-ws.js")
|
|
71
71
|
.then(({ desktopClients, broadcastDesktop }) => {
|
|
72
72
|
const reloaded = desktopClients.size;
|
|
@@ -76,7 +76,7 @@ export function register(app, { plugins, config }) {
|
|
|
76
76
|
.catch((e) => res.status(500).json({ ok: false, error: e.message }));
|
|
77
77
|
});
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
api.post("/desktop/message", async (req, res) => {
|
|
80
80
|
const { text, previousMessages = [] } = req.body || {};
|
|
81
81
|
if (!text) return res.status(400).json({ error: "text required" });
|
|
82
82
|
// Respond immediately — the real reply goes over WebSocket.
|
|
@@ -101,11 +101,11 @@ export function register(app, { plugins, config }) {
|
|
|
101
101
|
// `apx desktop install/uninstall` CLI commands manage. Web admin uses
|
|
102
102
|
// these so the user can flip the setting without dropping to a terminal.
|
|
103
103
|
|
|
104
|
-
|
|
104
|
+
api.get("/desktop/autostart", (_req, res) => {
|
|
105
105
|
res.json({ ok: true, enabled: autostartIsOn(), platform: process.platform });
|
|
106
106
|
});
|
|
107
107
|
|
|
108
|
-
|
|
108
|
+
api.post("/desktop/autostart", (req, res) => {
|
|
109
109
|
const { enable } = req.body || {};
|
|
110
110
|
if (typeof enable !== "boolean") {
|
|
111
111
|
return res.status(400).json({ ok: false, error: "body.enable must be a boolean" });
|
|
@@ -18,8 +18,8 @@ import {
|
|
|
18
18
|
import { embedOne } from "#core/memory/embeddings.js";
|
|
19
19
|
import { reindexMemory } from "#core/memory/index.js";
|
|
20
20
|
|
|
21
|
-
export function register(
|
|
22
|
-
|
|
21
|
+
export function register(api) {
|
|
22
|
+
api.get("/embeddings/providers", async (_req, res) => {
|
|
23
23
|
try {
|
|
24
24
|
const cfg = readConfig();
|
|
25
25
|
const embedCfg = embeddingsConfig(cfg);
|
|
@@ -34,7 +34,7 @@ export function register(app) {
|
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
api.post("/embeddings/test", async (req, res) => {
|
|
38
38
|
try {
|
|
39
39
|
const { text, provider } = req.body || {};
|
|
40
40
|
const sample = typeof text === "string" && text.trim()
|
|
@@ -54,7 +54,7 @@ export function register(app) {
|
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
api.post("/embeddings/reindex", async (_req, res) => {
|
|
58
58
|
try {
|
|
59
59
|
const result = await reindexMemory({ config: readConfig() });
|
|
60
60
|
res.json({ ok: true, ...result });
|
|
@@ -5,15 +5,16 @@
|
|
|
5
5
|
import { ENGINE_IDS } from "#core/engines/index.js";
|
|
6
6
|
import { listModels } from "#core/engines/catalog.js";
|
|
7
7
|
import { ENGINE_PRESETS } from "#core/engines/presets.js";
|
|
8
|
+
import { asyncRoute } from "./shared.js";
|
|
8
9
|
|
|
9
|
-
export function register(
|
|
10
|
-
|
|
10
|
+
export function register(api, { config }) {
|
|
11
|
+
api.get("/engines", (_req, res) => res.json({ engines: ENGINE_IDS }));
|
|
11
12
|
|
|
12
13
|
// Curated fallback catalog shared with the CLI wizard. The web hydrates its
|
|
13
14
|
// provider forms from here so model lists never drift between surfaces.
|
|
14
|
-
|
|
15
|
+
api.get("/engines/presets", (_req, res) => res.json({ presets: ENGINE_PRESETS }));
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
api.post("/engines/models", asyncRoute(async (req, res) => {
|
|
17
18
|
const b = req.body || {};
|
|
18
19
|
const engine = String(b.engine || "").toLowerCase();
|
|
19
20
|
if (!engine) return res.status(400).json({ models: [], error: "engine requerido" });
|
|
@@ -25,13 +26,13 @@ export function register(app, { config }) {
|
|
|
25
26
|
const out = await listModels(engine, b.base_url, apiKey);
|
|
26
27
|
if (out.error) return res.status(502).json({ engine, models: [], error: out.error });
|
|
27
28
|
res.json({ engine, models: out.models.sort((x, y) => x.localeCompare(y)) });
|
|
28
|
-
});
|
|
29
|
+
}));
|
|
29
30
|
|
|
30
31
|
// Legacy GET (Ollama, no auth) — kept for back-compat.
|
|
31
|
-
|
|
32
|
+
api.get("/engines/models", asyncRoute(async (req, res) => {
|
|
32
33
|
const engine = String(req.query.engine || "").toLowerCase();
|
|
33
34
|
const out = await listModels(engine, String(req.query.base_url || ""), "");
|
|
34
35
|
if (out.error) return res.status(502).json({ engine, models: [], error: out.error });
|
|
35
36
|
res.json({ engine, models: out.models });
|
|
36
|
-
});
|
|
37
|
+
}));
|
|
37
38
|
}
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
readConversation,
|
|
15
15
|
setStatus,
|
|
16
16
|
} from "#core/stores/conversations.js";
|
|
17
|
+
import { asyncRoute } from "./shared.js";
|
|
17
18
|
|
|
18
19
|
// Pick a model for a direct agent chat: explicit override → agent's own model →
|
|
19
20
|
// super-agent default (resolved via the same router the super-agent uses, so
|
|
@@ -29,8 +30,8 @@ async function pickAgentModel({ modelOverride, agent, config }) {
|
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
32
|
|
|
32
|
-
export function register(
|
|
33
|
-
|
|
33
|
+
export function register(api, { projects, project, config }) {
|
|
34
|
+
api.post("/projects/:pid/agents/:slug/exec", async (req, res) => {
|
|
34
35
|
const p = project(req, res);
|
|
35
36
|
if (!p) return;
|
|
36
37
|
const {
|
|
@@ -107,7 +108,7 @@ export function register(app, { projects, project, config }) {
|
|
|
107
108
|
}
|
|
108
109
|
});
|
|
109
110
|
|
|
110
|
-
|
|
111
|
+
api.post("/projects/:pid/agents/:slug/chat", asyncRoute(async (req, res) => {
|
|
111
112
|
const p = project(req, res);
|
|
112
113
|
if (!p) return;
|
|
113
114
|
const {
|
|
@@ -206,5 +207,5 @@ export function register(app, { projects, project, config }) {
|
|
|
206
207
|
} catch (e) {
|
|
207
208
|
res.status(500).json({ error: e.message });
|
|
208
209
|
}
|
|
209
|
-
});
|
|
210
|
+
}));
|
|
210
211
|
}
|
|
@@ -27,8 +27,8 @@ function scopeOpts(p, scope) {
|
|
|
27
27
|
return { subdir: "", scope: "project" };
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
export function register(
|
|
31
|
-
|
|
30
|
+
export function register(api, { project }) {
|
|
31
|
+
api.get("/projects/:pid/fs/tree", (req, res) => {
|
|
32
32
|
const p = project(req, res);
|
|
33
33
|
if (!p) return;
|
|
34
34
|
const { subdir, scope } = scopeOpts(p, req.query?.scope);
|
|
@@ -39,7 +39,7 @@ export function register(app, { project }) {
|
|
|
39
39
|
}
|
|
40
40
|
});
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
api.get("/projects/:pid/fs/file", (req, res) => {
|
|
43
43
|
const p = project(req, res);
|
|
44
44
|
if (!p) return;
|
|
45
45
|
const rel = req.query?.path;
|
|
@@ -54,7 +54,7 @@ export function register(app, { project }) {
|
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
api.put("/projects/:pid/fs/file", (req, res) => {
|
|
58
58
|
const p = project(req, res);
|
|
59
59
|
if (!p) return;
|
|
60
60
|
const { path: rel, content, scope } = req.body || {};
|
|
@@ -69,7 +69,7 @@ export function register(app, { project }) {
|
|
|
69
69
|
}
|
|
70
70
|
});
|
|
71
71
|
|
|
72
|
-
|
|
72
|
+
api.post("/projects/:pid/fs/dir", (req, res) => {
|
|
73
73
|
const p = project(req, res);
|
|
74
74
|
if (!p) return;
|
|
75
75
|
const { path: rel, scope } = req.body || {};
|
|
@@ -82,7 +82,7 @@ export function register(app, { project }) {
|
|
|
82
82
|
}
|
|
83
83
|
});
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
api.delete("/projects/:pid/fs/entry", (req, res) => {
|
|
86
86
|
const p = project(req, res);
|
|
87
87
|
if (!p) return;
|
|
88
88
|
const rel = req.query?.path;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// GET /health — unauthenticated; everything else requires the bearer token.
|
|
2
|
-
export function register(
|
|
3
|
-
|
|
2
|
+
export function register(api, { version, startedAt }) {
|
|
3
|
+
api.get("/health", (_req, res) => {
|
|
4
4
|
res.json({
|
|
5
5
|
status: "ok",
|
|
6
6
|
version,
|
|
@@ -11,12 +11,12 @@ const ALLOWED_KEYS = new Set([
|
|
|
11
11
|
"timezone",
|
|
12
12
|
]);
|
|
13
13
|
|
|
14
|
-
export function register(
|
|
15
|
-
|
|
14
|
+
export function register(api) {
|
|
15
|
+
api.get("/identity", (_req, res) => {
|
|
16
16
|
res.json(readIdentity() || {});
|
|
17
17
|
});
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
api.patch("/identity", (req, res) => {
|
|
20
20
|
const body = req.body || {};
|
|
21
21
|
const patch = {};
|
|
22
22
|
for (const [k, v] of Object.entries(body)) {
|
|
@@ -8,8 +8,8 @@ import { readConfig } from "#core/config/index.js";
|
|
|
8
8
|
import { resolveAgentName } from "#core/identity/index.js";
|
|
9
9
|
import { pageEnvelope } from "./shared.js";
|
|
10
10
|
|
|
11
|
-
export function register(
|
|
12
|
-
|
|
11
|
+
export function register(api, { projects }) {
|
|
12
|
+
api.get("/inbox", (req, res) => {
|
|
13
13
|
try {
|
|
14
14
|
const entries = [];
|
|
15
15
|
for (const entry of projects.list()) {
|