@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
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
1
|
import { http } from "../http.js";
|
|
3
2
|
import { resolveProjectId } from "./project.js";
|
|
4
3
|
import { listRoutines } from "#core/stores/routines.js";
|
|
@@ -33,7 +32,7 @@ function parseSpec(args) {
|
|
|
33
32
|
|
|
34
33
|
export async function cmdRoutineList(args = {}) {
|
|
35
34
|
const pid = await resolveProjectId(args?.flags?.project);
|
|
36
|
-
const rows = await http.get(`/projects/${pid}/routines`);
|
|
35
|
+
const rows = await http.get(`/api/projects/${pid}/routines`);
|
|
37
36
|
if (rows.length === 0) {
|
|
38
37
|
console.log(`(no routines in project #${pid})`);
|
|
39
38
|
return;
|
|
@@ -58,7 +57,7 @@ export async function cmdRoutineGet(args) {
|
|
|
58
57
|
const name = args._[0];
|
|
59
58
|
if (!name) throw new Error("apx routine get: missing <name>");
|
|
60
59
|
const pid = await resolveProjectId(args?.flags?.project);
|
|
61
|
-
const r = await http.get(`/projects/${pid}/routines/${name}`);
|
|
60
|
+
const r = await http.get(`/api/projects/${pid}/routines/${name}`);
|
|
62
61
|
console.log(JSON.stringify(r, null, 2));
|
|
63
62
|
}
|
|
64
63
|
|
|
@@ -88,7 +87,7 @@ export async function cmdRoutineAdd(args) {
|
|
|
88
87
|
? args.flags["skip-prompt-on"]
|
|
89
88
|
: undefined;
|
|
90
89
|
const pid = await resolveProjectId(args?.flags?.project);
|
|
91
|
-
const r = await http.post(`/projects/${pid}/routines`, { name, kind, schedule, spec, permission_mode, allowed_tools, pre_commands, post_commands, skip_prompt_on });
|
|
90
|
+
const r = await http.post(`/api/projects/${pid}/routines`, { name, kind, schedule, spec, permission_mode, allowed_tools, pre_commands, post_commands, skip_prompt_on });
|
|
92
91
|
console.log(`added routine "${r.name}" (${r.kind}, ${r.schedule}) → next ${r.next_run_at}`);
|
|
93
92
|
if (r.pre_commands?.length) console.log(` pre: ${r.pre_commands.join(", ")}`);
|
|
94
93
|
if (r.post_commands?.length) console.log(` post: ${r.post_commands.join(", ")}`);
|
|
@@ -99,7 +98,7 @@ export async function cmdRoutineRemove(args) {
|
|
|
99
98
|
const name = args._[0];
|
|
100
99
|
if (!name) throw new Error("apx routine remove: missing <name>");
|
|
101
100
|
const pid = await resolveProjectId(args?.flags?.project);
|
|
102
|
-
await http.delete(`/projects/${pid}/routines/${name}`);
|
|
101
|
+
await http.delete(`/api/projects/${pid}/routines/${name}`);
|
|
103
102
|
console.log(`removed routine "${name}"`);
|
|
104
103
|
}
|
|
105
104
|
|
|
@@ -116,7 +115,7 @@ async function toggle(args, enabled) {
|
|
|
116
115
|
if (!name) throw new Error(`apx routine ${enabled ? "enable" : "disable"}: missing <name>`);
|
|
117
116
|
const pid = await resolveProjectId(args?.flags?.project);
|
|
118
117
|
await http.post(
|
|
119
|
-
`/projects/${pid}/routines/${name}/${enabled ? "enable" : "disable"}`
|
|
118
|
+
`/api/projects/${pid}/routines/${name}/${enabled ? "enable" : "disable"}`
|
|
120
119
|
);
|
|
121
120
|
console.log(`${enabled ? "enabled" : "disabled"} routine "${name}"`);
|
|
122
121
|
}
|
|
@@ -125,7 +124,7 @@ export async function cmdRoutineRun(args) {
|
|
|
125
124
|
const name = args._[0];
|
|
126
125
|
if (!name) throw new Error("apx routine run: missing <name>");
|
|
127
126
|
const pid = await resolveProjectId(args?.flags?.project);
|
|
128
|
-
const r = await http.post(`/projects/${pid}/routines/${name}/run`);
|
|
127
|
+
const r = await http.post(`/api/projects/${pid}/routines/${name}/run`);
|
|
129
128
|
console.log(JSON.stringify(r, null, 2));
|
|
130
129
|
}
|
|
131
130
|
|
|
@@ -134,7 +133,7 @@ export async function cmdRoutineRun(args) {
|
|
|
134
133
|
async function resolveRoutineRef(pid, refRaw) {
|
|
135
134
|
const ref = String(refRaw || "").trim();
|
|
136
135
|
if (!ref) throw new Error("missing <name|id>");
|
|
137
|
-
const projects = await http.get("/projects");
|
|
136
|
+
const projects = await http.get("/api/projects");
|
|
138
137
|
const project = projects.find((p) => String(p.id) === String(pid));
|
|
139
138
|
if (!project) throw new Error(`project #${pid} not found`);
|
|
140
139
|
const storagePath = project.storage_path || projectStorageRoot(project.apx_id);
|
|
@@ -183,7 +182,7 @@ export async function cmdRoutineHistory(args) {
|
|
|
183
182
|
if (!name) throw new Error("apx routine history: missing <name>");
|
|
184
183
|
const pid = await resolveProjectId(args?.flags?.project);
|
|
185
184
|
const limit = args.flags.n || args.flags.last || "50";
|
|
186
|
-
const rows = await http.get(`/projects/${pid}/messages?channel=routine&limit=${encodeURIComponent(limit)}`);
|
|
185
|
+
const rows = await http.get(`/api/projects/${pid}/messages?channel=routine&limit=${encodeURIComponent(limit)}`);
|
|
187
186
|
const filtered = rows
|
|
188
187
|
.filter((r) => r.meta?.routine === name)
|
|
189
188
|
.reverse();
|
|
@@ -31,7 +31,7 @@ export async function cmdRun(args) {
|
|
|
31
31
|
: undefined;
|
|
32
32
|
|
|
33
33
|
const result = await http.post(
|
|
34
|
-
`/projects/${pid}/agents/${slug}/runtime`,
|
|
34
|
+
`/api/projects/${pid}/agents/${slug}/runtime`,
|
|
35
35
|
{ runtime, prompt, timeoutMs }
|
|
36
36
|
);
|
|
37
37
|
|
|
@@ -47,7 +47,7 @@ export async function cmdRun(args) {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
export async function cmdEnvDetect() {
|
|
50
|
-
const probes = await http.get("/env/detect");
|
|
50
|
+
const probes = await http.get("/api/env/detect");
|
|
51
51
|
const groups = { runtime: [], engine: [], tool: [] };
|
|
52
52
|
for (const p of probes) {
|
|
53
53
|
(groups[p.category] || groups.tool).push(p);
|
|
@@ -4,7 +4,7 @@ import { spawn } from "node:child_process";
|
|
|
4
4
|
import { findApfRoot, readAgents } from "#core/apc/parser.js";
|
|
5
5
|
import { getOrCreateApxId } from "#core/apc/scaffold.js";
|
|
6
6
|
import { generateSessionId } from "#core/stores/sessions.js";
|
|
7
|
-
import { projectStorageRoot
|
|
7
|
+
import { projectStorageRoot } from "#core/config/index.js";
|
|
8
8
|
import { http } from "../http.js";
|
|
9
9
|
import { resolveProjectId } from "./project.js";
|
|
10
10
|
import {
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
findSessionAcrossEngines,
|
|
13
13
|
findSessionInEngine,
|
|
14
14
|
} from "./sessions.js";
|
|
15
|
+
import { parseFrontmatter, setFrontmatterField } from "#core/apc/frontmatter.js";
|
|
15
16
|
|
|
16
17
|
const STALE_HOURS = 1;
|
|
17
18
|
|
|
@@ -42,36 +43,7 @@ function readStdinSync() {
|
|
|
42
43
|
return chunks.join("");
|
|
43
44
|
}
|
|
44
45
|
|
|
45
|
-
function parseFrontmatter(text) {
|
|
46
|
-
if (!text.startsWith("---\n")) return { fm: {}, bodyStart: 0 };
|
|
47
|
-
const end = text.indexOf("\n---", 4);
|
|
48
|
-
if (end === -1) return { fm: {}, bodyStart: 0 };
|
|
49
|
-
const fmText = text.slice(4, end);
|
|
50
|
-
const fm = {};
|
|
51
|
-
for (const line of fmText.split("\n")) {
|
|
52
|
-
const m = line.match(/^([a-zA-Z_]+):\s*(.*)$/);
|
|
53
|
-
if (m) fm[m[1]] = m[2].trim();
|
|
54
|
-
}
|
|
55
|
-
return { fm, bodyStart: end + 4 };
|
|
56
|
-
}
|
|
57
46
|
|
|
58
|
-
function setFrontmatterField(text, field, value) {
|
|
59
|
-
if (!text.startsWith("---\n")) return text;
|
|
60
|
-
const end = text.indexOf("\n---", 4);
|
|
61
|
-
if (end === -1) return text;
|
|
62
|
-
const fmText = text.slice(4, end);
|
|
63
|
-
const lines = fmText.split("\n");
|
|
64
|
-
let found = false;
|
|
65
|
-
const out = lines.map((line) => {
|
|
66
|
-
if (line.match(new RegExp(`^${field}:`))) {
|
|
67
|
-
found = true;
|
|
68
|
-
return `${field}: ${value}`;
|
|
69
|
-
}
|
|
70
|
-
return line;
|
|
71
|
-
});
|
|
72
|
-
if (!found) out.push(`${field}: ${value}`);
|
|
73
|
-
return `---\n${out.join("\n")}\n---${text.slice(end + 4)}`;
|
|
74
|
-
}
|
|
75
47
|
|
|
76
48
|
function listAllSessions(root) {
|
|
77
49
|
const agentsDir = path.join(requireStorageRoot(root), "agents");
|
|
@@ -378,7 +350,7 @@ export function cmdSessionUpdate(args) {
|
|
|
378
350
|
|
|
379
351
|
let text = fs.readFileSync(s.path, "utf8");
|
|
380
352
|
const fields = ["status", "result", "title", "task_ref", "completed"];
|
|
381
|
-
|
|
353
|
+
const touched = [];
|
|
382
354
|
for (const k of fields) {
|
|
383
355
|
if (args.flags[k] !== undefined && args.flags[k] !== true) {
|
|
384
356
|
text = setFrontmatterField(text, k, args.flags[k]);
|
|
@@ -419,7 +391,7 @@ export function cmdSessionCheck() {
|
|
|
419
391
|
}
|
|
420
392
|
|
|
421
393
|
let active = 0;
|
|
422
|
-
|
|
394
|
+
const stale = [];
|
|
423
395
|
for (const s of sessions) {
|
|
424
396
|
const h = hoursSince(s.started);
|
|
425
397
|
if (h >= STALE_HOURS) {
|
|
@@ -576,7 +548,7 @@ async function summarizeSession(meta, args) {
|
|
|
576
548
|
if (meta.engine === "apx") {
|
|
577
549
|
const pid = await resolveProjectId(args?.flags?.project);
|
|
578
550
|
const r = await http.get(
|
|
579
|
-
`/projects/${pid}/sessions/${meta.id}/resume?summarize=true`
|
|
551
|
+
`/api/projects/${pid}/sessions/${meta.id}/resume?summarize=true`
|
|
580
552
|
);
|
|
581
553
|
return r.summary || null;
|
|
582
554
|
}
|
|
@@ -678,7 +650,7 @@ async function mapReduceSession(meta, { mapInstruction, reduceInstruction, oneSh
|
|
|
678
650
|
: MR_MAX_CHUNKS;
|
|
679
651
|
|
|
680
652
|
if (text.length <= MR_CHUNK_BYTES) {
|
|
681
|
-
const r = await http.post(`/super-agent/summarize`, {
|
|
653
|
+
const r = await http.post(`/api/super-agent/summarize`, {
|
|
682
654
|
prompt: `${oneShot(text)}`,
|
|
683
655
|
context_note: `${note} (one-shot) ${meta.engine}:${meta.id}`,
|
|
684
656
|
max_tokens: MR_MAX_OUTPUT_TOKENS,
|
|
@@ -692,7 +664,7 @@ async function mapReduceSession(meta, { mapInstruction, reduceInstruction, oneSh
|
|
|
692
664
|
|
|
693
665
|
const notes = [];
|
|
694
666
|
for (let i = 0; i < chunks.length; i++) {
|
|
695
|
-
const r = await http.post(`/super-agent/summarize`, {
|
|
667
|
+
const r = await http.post(`/api/super-agent/summarize`, {
|
|
696
668
|
prompt: mapInstruction(chunks[i], i + 1, chunks.length),
|
|
697
669
|
context_note: `${note} map ${i + 1}/${chunks.length} ${meta.engine}:${meta.id}`,
|
|
698
670
|
max_tokens: MR_MAX_OUTPUT_TOKENS,
|
|
@@ -705,7 +677,7 @@ async function mapReduceSession(meta, { mapInstruction, reduceInstruction, oneSh
|
|
|
705
677
|
return { text: "(no relevant content found in the transcript)", chunks: chunks.length, truncated };
|
|
706
678
|
}
|
|
707
679
|
|
|
708
|
-
const r = await http.post(`/super-agent/summarize`, {
|
|
680
|
+
const r = await http.post(`/api/super-agent/summarize`, {
|
|
709
681
|
prompt: reduceInstruction(notes),
|
|
710
682
|
context_note: `${note} reduce ${meta.engine}:${meta.id}`,
|
|
711
683
|
max_tokens: MR_MAX_OUTPUT_TOKENS,
|
|
@@ -783,13 +755,13 @@ function spawnContinueSpec(meta) {
|
|
|
783
755
|
// Create a new APX session whose body is the summary of an existing session.
|
|
784
756
|
// Used by `apx session resume <id> --into apx[:slug]`. Picks a sensible
|
|
785
757
|
// default agent slug when none is given.
|
|
786
|
-
function createApxFollowupSession(meta, slugArg, summary,
|
|
758
|
+
function createApxFollowupSession(meta, slugArg, summary, _args) {
|
|
787
759
|
const root = requireRoot();
|
|
788
760
|
const agents = readAgents(root);
|
|
789
761
|
if (agents.length === 0) {
|
|
790
762
|
throw new Error("no agents in AGENTS.md — `apx agent add <slug>` first");
|
|
791
763
|
}
|
|
792
|
-
|
|
764
|
+
const slug = slugArg || meta.agentSlug || agents[0].slug;
|
|
793
765
|
if (!agents.find((a) => a.slug === slug)) {
|
|
794
766
|
throw new Error(
|
|
795
767
|
`agent "${slug}" not in AGENTS.md (known: ${agents.map((a) => a.slug).join(", ")})`
|
|
@@ -870,8 +842,8 @@ export async function cmdSessionCompact(args) {
|
|
|
870
842
|
const pid = await resolveProjectId(args?.flags?.project);
|
|
871
843
|
|
|
872
844
|
const url = convId
|
|
873
|
-
? `/projects/${pid}/agents/${slug}/conversations/${convId}/compact`
|
|
874
|
-
: `/projects/${pid}/agents/${slug}/compact`;
|
|
845
|
+
? `/api/projects/${pid}/agents/${slug}/conversations/${convId}/compact`
|
|
846
|
+
: `/api/projects/${pid}/agents/${slug}/compact`;
|
|
875
847
|
|
|
876
848
|
const body = model ? { model } : {};
|
|
877
849
|
|