@agentprojectcontext/apx 1.25.0 → 1.27.2
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/package.json +42 -12
- package/skills/apx/SKILL.md +50 -119
- package/skills/apx-agency-agents/SKILL.md +141 -0
- package/skills/apx-agent/SKILL.md +100 -0
- package/skills/apx-mcp/SKILL.md +114 -0
- package/skills/apx-mcp-builder/SKILL.md +186 -0
- package/skills/apx-project/SKILL.md +100 -0
- package/skills/apx-routine/SKILL.md +138 -0
- package/skills/apx-runtime/SKILL.md +115 -0
- package/skills/apx-sessions/SKILL.md +281 -0
- package/skills/apx-skill-builder/SKILL.md +149 -0
- package/skills/apx-task/SKILL.md +95 -0
- package/skills/apx-telegram/SKILL.md +115 -0
- package/skills/apx-voice/SKILL.md +135 -0
- package/src/core/agent/constants.js +3 -0
- package/src/core/agent/ghost-guard.js +24 -0
- package/src/core/agent/index.js +35 -0
- package/src/core/agent/model-router.js +257 -0
- package/src/core/agent/prompt-builder.js +313 -0
- package/src/core/agent/prompts/channels/api.md +7 -0
- package/src/core/agent/prompts/channels/cli.md +6 -0
- package/src/core/agent/prompts/channels/code.md +20 -0
- package/src/core/agent/prompts/channels/deck.md +6 -0
- package/src/core/agent/prompts/channels/desktop.md +24 -0
- package/src/core/agent/prompts/channels/routine.md +9 -0
- package/src/core/agent/prompts/channels/telegram.md +9 -0
- package/src/core/agent/prompts/channels/terminal.md +16 -0
- package/src/core/agent/prompts/channels/web.md +7 -0
- package/src/core/agent/prompts/channels/web_sidebar.md +7 -0
- package/src/core/agent/prompts/modes/voice.md +4 -0
- package/src/core/agent/prompts/super-agent-base.md +42 -0
- package/src/core/agent/pseudo-tools.js +40 -0
- package/src/core/agent/retry.js +85 -0
- package/src/core/agent/run-agent.js +423 -0
- package/src/core/agent/self-memory.js +155 -0
- package/src/{daemon → core/agent}/tool-call-parser.js +83 -10
- package/src/core/agent/tools-overlap.js +66 -0
- package/src/core/apc-skill-sync.js +97 -0
- package/src/core/code-sessions-store.js +150 -0
- package/src/core/config.js +473 -11
- package/src/core/desktop/autostart.js +162 -0
- package/src/core/engines/_health.js +63 -0
- package/src/{daemon → core}/engines/anthropic.js +16 -0
- package/src/core/engines/gemini.js +168 -0
- package/src/core/engines/groq.js +8 -0
- package/src/{daemon → core}/engines/index.js +3 -1
- package/src/{daemon → core}/engines/mock.js +22 -0
- package/src/{daemon → core}/engines/ollama.js +35 -0
- package/src/core/engines/openai-compatible.js +145 -0
- package/src/core/engines/openai.js +8 -0
- package/src/core/engines/openrouter.js +8 -0
- package/src/core/git-baseline.js +147 -0
- package/src/core/identity.js +21 -0
- package/src/core/logging.js +1 -1
- package/src/core/mcp/index.js +14 -0
- package/src/{daemon/mcp-runner.js → core/mcp/runner.js} +18 -6
- package/src/core/mcp/sources.js +246 -0
- package/src/core/memory/active-threads.js +124 -0
- package/src/core/memory/broker.js +144 -0
- package/src/core/memory/compactor.js +186 -0
- package/src/core/memory/embed-engines/gemini.js +62 -0
- package/src/core/memory/embed-engines/index.js +148 -0
- package/src/core/memory/embed-engines/ollama.js +55 -0
- package/src/core/memory/embed-engines/openai.js +64 -0
- package/src/core/memory/embed-engines/tf.js +20 -0
- package/src/core/memory/embeddings.js +132 -0
- package/src/core/memory/index.js +161 -0
- package/src/core/memory/indexer.js +257 -0
- package/src/core/memory/store.js +231 -0
- package/src/core/messages-store.js +143 -25
- package/src/core/parser.js +78 -16
- package/src/core/scaffold.js +175 -79
- package/src/core/tasks-store.js +264 -0
- package/src/core/telegram-identity.js +126 -0
- package/src/core/tools/index.js +6 -0
- package/src/core/voice/engines/elevenlabs.js +96 -0
- package/src/core/voice/engines/gemini.js +148 -0
- package/src/core/voice/engines/index.js +144 -0
- package/src/core/voice/engines/mock.js +59 -0
- package/src/core/voice/engines/openai.js +82 -0
- package/src/core/voice/engines/piper.js +93 -0
- package/src/core/voice/index.js +3 -0
- package/src/core/voice/tts.js +89 -0
- package/src/{daemon → host/daemon}/apc-runtime-context.js +1 -1
- package/src/host/daemon/api/admin-config.js +159 -0
- package/src/host/daemon/api/admin.js +72 -0
- package/src/host/daemon/api/agents.js +284 -0
- package/src/host/daemon/api/artifacts.js +52 -0
- package/src/host/daemon/api/code.js +351 -0
- package/src/host/daemon/api/config.js +104 -0
- package/src/host/daemon/api/connections.js +42 -0
- package/src/host/daemon/api/conversations.js +161 -0
- package/src/host/daemon/api/deck.js +511 -0
- package/src/host/daemon/api/desktop.js +71 -0
- package/src/host/daemon/api/embeddings.js +65 -0
- package/src/host/daemon/api/engines.js +80 -0
- package/src/host/daemon/api/exec.js +193 -0
- package/src/host/daemon/api/health.js +10 -0
- package/src/host/daemon/api/identity.js +36 -0
- package/src/host/daemon/api/mcps.js +205 -0
- package/src/host/daemon/api/messages.js +83 -0
- package/src/host/daemon/api/pairing.js +194 -0
- package/src/host/daemon/api/plugins.js +19 -0
- package/src/host/daemon/api/projects.js +35 -0
- package/src/host/daemon/api/routines.js +84 -0
- package/src/host/daemon/api/run.js +55 -0
- package/src/host/daemon/api/runtimes.js +219 -0
- package/src/host/daemon/api/sessions-search.js +177 -0
- package/src/host/daemon/api/sessions.js +115 -0
- package/src/host/daemon/api/shared.js +217 -0
- package/src/host/daemon/api/super-agent.js +208 -0
- package/src/host/daemon/api/tasks.js +118 -0
- package/src/host/daemon/api/telegram.js +325 -0
- package/src/host/daemon/api/tools.js +21 -0
- package/src/host/daemon/api/top-level.js +131 -0
- package/src/host/daemon/api/transcribe.js +35 -0
- package/src/host/daemon/api/tts.js +44 -0
- package/src/host/daemon/api/voice.js +519 -0
- package/src/host/daemon/api/web.js +123 -0
- package/src/host/daemon/api.js +152 -0
- package/src/{daemon → host/daemon}/compact.js +1 -1
- package/src/{daemon → host/daemon}/db.js +19 -5
- package/src/{daemon/overlay-ws.js → host/daemon/desktop-ws.js} +7 -7
- package/src/host/daemon/engine-sessions.js +245 -0
- package/src/{daemon → host/daemon}/index.js +27 -10
- package/src/{daemon/plugins/overlay.js → host/daemon/plugins/desktop.js} +36 -28
- package/src/{daemon → host/daemon}/plugins/index.js +2 -2
- package/src/{daemon → host/daemon}/plugins/telegram.js +165 -33
- package/src/{daemon → host/daemon}/project-config.js +31 -7
- package/src/{daemon → host/daemon}/routines.js +27 -8
- package/src/{daemon → host/daemon}/skills-loader.js +4 -2
- package/src/{daemon → host/daemon}/smoke.js +9 -5
- package/src/{daemon → host/daemon}/super-agent-tools/helpers.js +1 -1
- package/src/host/daemon/super-agent-tools/index.js +157 -0
- package/src/{daemon → host/daemon}/super-agent-tools/registry-bridge.js +1 -1
- package/src/{daemon → host/daemon}/super-agent-tools/tools/add-project.js +2 -2
- package/src/{daemon → host/daemon}/super-agent-tools/tools/ask-questions.js +4 -0
- package/src/{daemon → host/daemon}/super-agent-tools/tools/call-agent.js +5 -2
- package/src/{daemon → host/daemon}/super-agent-tools/tools/call-runtime.js +117 -8
- package/src/host/daemon/super-agent-tools/tools/create-task.js +52 -0
- package/src/{daemon → host/daemon}/super-agent-tools/tools/import-agent.js +2 -3
- package/src/{daemon → host/daemon}/super-agent-tools/tools/list-agents.js +1 -1
- package/src/host/daemon/super-agent-tools/tools/list-tasks.js +52 -0
- package/src/{daemon → host/daemon}/super-agent-tools/tools/list-vault-agents.js +1 -1
- package/src/host/daemon/super-agent-tools/tools/read-self-memory.js +21 -0
- package/src/host/daemon/super-agent-tools/tools/remember.js +40 -0
- package/src/{daemon → host/daemon}/super-agent-tools/tools/search-messages.js +1 -1
- package/src/host/daemon/super-agent-tools/tools/search-sessions.js +134 -0
- package/src/{daemon → host/daemon}/super-agent-tools/tools/send-telegram.js +2 -2
- package/src/{daemon → host/daemon}/super-agent-tools/tools/set-identity.js +1 -1
- package/src/{daemon → host/daemon}/super-agent-tools/tools/set-permission-mode.js +1 -1
- package/src/{daemon → host/daemon}/super-agent-tools/tools/tail-messages.js +1 -1
- package/src/host/daemon/super-agent.js +129 -0
- package/src/host/daemon/token-store.js +118 -0
- package/src/host/daemon/tool-call-parser.js +2 -0
- package/src/{daemon → host/daemon}/transcription.js +1 -1
- package/src/{daemon → host/daemon}/wakeup.js +2 -2
- package/src/interfaces/cli/claude-permissions.js +33 -0
- package/src/{cli → interfaces/cli}/commands/agent.js +43 -8
- package/src/{cli → interfaces/cli}/commands/command.js +1 -1
- package/src/{cli → interfaces/cli}/commands/config.js +1 -1
- package/src/{cli → interfaces/cli}/commands/daemon.js +67 -0
- package/src/interfaces/cli/commands/desktop.js +335 -0
- package/src/interfaces/cli/commands/exec.js +92 -0
- package/src/{cli → interfaces/cli}/commands/identity.js +6 -63
- package/src/{cli → interfaces/cli}/commands/init.js +1 -1
- package/src/{cli → interfaces/cli}/commands/mcp.js +69 -10
- package/src/{cli → interfaces/cli}/commands/memory.js +2 -2
- package/src/interfaces/cli/commands/model.js +136 -0
- package/src/interfaces/cli/commands/pair.js +170 -0
- package/src/interfaces/cli/commands/project-config.js +131 -0
- package/src/{cli → interfaces/cli}/commands/project.js +1 -1
- package/src/{cli → interfaces/cli}/commands/search.js +1 -1
- package/src/interfaces/cli/commands/session.js +892 -0
- package/src/interfaces/cli/commands/sessions.js +997 -0
- package/src/{cli → interfaces/cli}/commands/setup.js +98 -4
- package/src/{cli → interfaces/cli}/commands/skills.js +117 -9
- package/src/{cli → interfaces/cli}/commands/status.js +9 -1
- package/src/{cli → interfaces/cli}/commands/sys.js +96 -17
- package/src/interfaces/cli/commands/task.js +179 -0
- package/src/interfaces/cli/commands/telegram.js +366 -0
- package/src/{cli → interfaces/cli}/commands/update.js +1 -1
- package/src/interfaces/cli/commands/voice.js +258 -0
- package/src/{cli → interfaces/cli}/http.js +6 -2
- package/src/{cli → interfaces/cli}/index.js +955 -63
- package/src/interfaces/cli/postinstall.js +34 -0
- package/src/interfaces/desktop/assets/app-icon-180.png +0 -0
- package/src/interfaces/desktop/assets/app-icon-32.png +0 -0
- package/src/interfaces/desktop/assets/app-icon.png +0 -0
- package/src/interfaces/desktop/assets/apx-logo.png +0 -0
- package/src/interfaces/desktop/assets/superagent.png +0 -0
- package/src/interfaces/desktop/assets/tray-icon.png +0 -0
- package/src/interfaces/desktop/index.html +18 -0
- package/src/interfaces/desktop/main.js +652 -0
- package/src/interfaces/desktop/preload.js +48 -0
- package/src/interfaces/desktop/renderer.js +1006 -0
- package/src/interfaces/desktop/style.css +400 -0
- package/src/{mcp → interfaces/mcp-server}/index.js +2 -2
- package/src/interfaces/tui/_shims/util-which.ts +53 -0
- package/src/{tui → interfaces/tui}/app.tsx +2 -2
- package/src/{tui → interfaces/tui}/component/prompt/index.tsx +4 -1
- package/src/{tui → interfaces/tui}/context/sdk-apx.tsx +84 -16
- package/src/interfaces/tui/context/sync-apx.tsx +398 -0
- package/src/interfaces/tui/routes/session/index.tsx +368 -0
- package/src/interfaces/tui/routes/session/message-actions.tsx +58 -0
- package/src/interfaces/tui/routes/session/sidebar-apx.tsx +114 -0
- package/src/{tui → interfaces/tui}/tsconfig.json +1 -0
- package/src/{tui → interfaces/tui}/util/clipboard.ts +1 -1
- package/src/interfaces/web/README.md +102 -0
- package/src/interfaces/web/coming-soon.html +65 -0
- package/src/interfaces/web/components.json +25 -0
- package/src/interfaces/web/dist/assets/index-BDUsA6L6.css +1 -0
- package/src/interfaces/web/dist/assets/index-CfWyjPBa.js +548 -0
- package/src/interfaces/web/dist/assets/index-CfWyjPBa.js.map +1 -0
- package/src/interfaces/web/dist/favicon/dark/android-chrome-192x192.png +0 -0
- package/src/interfaces/web/dist/favicon/dark/android-chrome-512x512.png +0 -0
- package/src/interfaces/web/dist/favicon/dark/apple-touch-icon.png +0 -0
- package/src/interfaces/web/dist/favicon/dark/favicon-16x16.png +0 -0
- package/src/interfaces/web/dist/favicon/dark/favicon-32x32.png +0 -0
- package/src/interfaces/web/dist/favicon/dark/favicon-48x48.png +0 -0
- package/src/interfaces/web/dist/favicon/dark/favicon.ico +0 -0
- package/src/interfaces/web/dist/favicon/dark/favicon.webp +0 -0
- package/src/interfaces/web/dist/favicon/dark/site.webmanifest +18 -0
- package/src/interfaces/web/dist/favicon/white/android-chrome-192x192.png +0 -0
- package/src/interfaces/web/dist/favicon/white/android-chrome-512x512.png +0 -0
- package/src/interfaces/web/dist/favicon/white/apple-touch-icon.png +0 -0
- package/src/interfaces/web/dist/favicon/white/favicon-16x16.png +0 -0
- package/src/interfaces/web/dist/favicon/white/favicon-32x32.png +0 -0
- package/src/interfaces/web/dist/favicon/white/favicon-48x48.png +0 -0
- package/src/interfaces/web/dist/favicon/white/favicon.ico +0 -0
- package/src/interfaces/web/dist/favicon/white/favicon.webp +0 -0
- package/src/interfaces/web/dist/favicon/white/site.webmanifest +18 -0
- package/src/interfaces/web/dist/index.html +27 -0
- package/src/interfaces/web/dist/logo/logo_dark.webp +0 -0
- package/src/interfaces/web/dist/logo/logo_only_dark.webp +0 -0
- package/src/interfaces/web/dist/logo/logo_only_white.webp +0 -0
- package/src/interfaces/web/dist/logo/logo_vertical_dark.webp +0 -0
- package/src/interfaces/web/dist/logo/logo_vertical_white.webp +0 -0
- package/src/interfaces/web/dist/logo/logo_white.webp +0 -0
- package/src/interfaces/web/dist/modules/superagent.png +0 -0
- package/src/interfaces/web/index.html +26 -0
- package/src/interfaces/web/package-lock.json +4253 -0
- package/src/interfaces/web/package.json +55 -0
- package/src/interfaces/web/playwright.config.ts +45 -0
- package/src/interfaces/web/pnpm-lock.yaml +2946 -0
- package/src/interfaces/web/public/favicon/dark/android-chrome-192x192.png +0 -0
- package/src/interfaces/web/public/favicon/dark/android-chrome-512x512.png +0 -0
- package/src/interfaces/web/public/favicon/dark/apple-touch-icon.png +0 -0
- package/src/interfaces/web/public/favicon/dark/favicon-16x16.png +0 -0
- package/src/interfaces/web/public/favicon/dark/favicon-32x32.png +0 -0
- package/src/interfaces/web/public/favicon/dark/favicon-48x48.png +0 -0
- package/src/interfaces/web/public/favicon/dark/favicon.ico +0 -0
- package/src/interfaces/web/public/favicon/dark/favicon.webp +0 -0
- package/src/interfaces/web/public/favicon/dark/site.webmanifest +18 -0
- package/src/interfaces/web/public/favicon/white/android-chrome-192x192.png +0 -0
- package/src/interfaces/web/public/favicon/white/android-chrome-512x512.png +0 -0
- package/src/interfaces/web/public/favicon/white/apple-touch-icon.png +0 -0
- package/src/interfaces/web/public/favicon/white/favicon-16x16.png +0 -0
- package/src/interfaces/web/public/favicon/white/favicon-32x32.png +0 -0
- package/src/interfaces/web/public/favicon/white/favicon-48x48.png +0 -0
- package/src/interfaces/web/public/favicon/white/favicon.ico +0 -0
- package/src/interfaces/web/public/favicon/white/favicon.webp +0 -0
- package/src/interfaces/web/public/favicon/white/site.webmanifest +18 -0
- package/src/interfaces/web/public/logo/logo_dark.webp +0 -0
- package/src/interfaces/web/public/logo/logo_only_dark.webp +0 -0
- package/src/interfaces/web/public/logo/logo_only_white.webp +0 -0
- package/src/interfaces/web/public/logo/logo_vertical_dark.webp +0 -0
- package/src/interfaces/web/public/logo/logo_vertical_white.webp +0 -0
- package/src/interfaces/web/public/logo/logo_white.webp +0 -0
- package/src/interfaces/web/public/modules/superagent.png +0 -0
- package/src/interfaces/web/src/App.tsx +199 -0
- package/src/interfaces/web/src/components/AddProjectDialog.tsx +121 -0
- package/src/interfaces/web/src/components/ModelCombobox.tsx +96 -0
- package/src/interfaces/web/src/components/RobyBubble.tsx +213 -0
- package/src/interfaces/web/src/components/Section.tsx +44 -0
- package/src/interfaces/web/src/components/TelegramChannelDialog.tsx +97 -0
- package/src/interfaces/web/src/components/TelegramSendDialog.tsx +48 -0
- package/src/interfaces/web/src/components/Toast.tsx +84 -0
- package/src/interfaces/web/src/components/UiSelect.tsx +74 -0
- package/src/interfaces/web/src/components/chat/Composer.tsx +43 -0
- package/src/interfaces/web/src/components/chat/ContextBar.tsx +111 -0
- package/src/interfaces/web/src/components/chat/MessageBubble.tsx +95 -0
- package/src/interfaces/web/src/components/chat/MessageList.tsx +35 -0
- package/src/interfaces/web/src/components/chat/ModelPicker.tsx +145 -0
- package/src/interfaces/web/src/components/chat/ToolCall.tsx +141 -0
- package/src/interfaces/web/src/components/code/CodeChangesTab.tsx +87 -0
- package/src/interfaces/web/src/components/code/CodeComposer.tsx +87 -0
- package/src/interfaces/web/src/components/code/CodeContextTab.tsx +83 -0
- package/src/interfaces/web/src/components/code/CodeProjectPicker.tsx +39 -0
- package/src/interfaces/web/src/components/code/CodeSessionList.tsx +97 -0
- package/src/interfaces/web/src/components/code/CodeSidePanel.tsx +44 -0
- package/src/interfaces/web/src/components/code/CodeToolTrail.tsx +29 -0
- package/src/interfaces/web/src/components/code/DiffView.tsx +67 -0
- package/src/interfaces/web/src/components/common/Qr.tsx +27 -0
- package/src/interfaces/web/src/components/common/TabLayout.tsx +46 -0
- package/src/interfaces/web/src/components/common/TabNav.tsx +113 -0
- package/src/interfaces/web/src/components/config/ConfigTabsEditor.tsx +202 -0
- package/src/interfaces/web/src/components/config/GlobalConfigEditor.tsx +42 -0
- package/src/interfaces/web/src/components/config/global-config-sections.ts +60 -0
- package/src/interfaces/web/src/components/config/project-config-sections.ts +58 -0
- package/src/interfaces/web/src/components/deck/DaemonCard.tsx +58 -0
- package/src/interfaces/web/src/components/deck/DesktopGroup.tsx +33 -0
- package/src/interfaces/web/src/components/deck/WidgetRow.tsx +100 -0
- package/src/interfaces/web/src/components/layout/Logo.tsx +59 -0
- package/src/interfaces/web/src/components/layout/ProjectAvatar.tsx +116 -0
- package/src/interfaces/web/src/components/layout/ProjectSidebar.tsx +151 -0
- package/src/interfaces/web/src/components/settings/AdvancedPanel.tsx +45 -0
- package/src/interfaces/web/src/components/settings/AppearancePanel.tsx +72 -0
- package/src/interfaces/web/src/components/settings/DefaultRouterCard.tsx +232 -0
- package/src/interfaces/web/src/components/settings/DevicesPanel.tsx +60 -0
- package/src/interfaces/web/src/components/settings/EnginesPanel.tsx +127 -0
- package/src/interfaces/web/src/components/settings/IdentityPanel.tsx +69 -0
- package/src/interfaces/web/src/components/settings/MemoryPanel.tsx +226 -0
- package/src/interfaces/web/src/components/settings/PairDeviceDialog.tsx +175 -0
- package/src/interfaces/web/src/components/settings/SuperAgentPanel.tsx +93 -0
- package/src/interfaces/web/src/components/settings/TelegramChannelsPanel.tsx +90 -0
- package/src/interfaces/web/src/components/settings/TelegramContactsPanel.tsx +101 -0
- package/src/interfaces/web/src/components/settings/TelegramGlobalPanel.tsx +100 -0
- package/src/interfaces/web/src/components/settings/TelegramRolesPanel.tsx +108 -0
- package/src/interfaces/web/src/components/settings/TelegramSettingsTabs.tsx +55 -0
- package/src/interfaces/web/src/components/settings/providers/ProviderCard.tsx +95 -0
- package/src/interfaces/web/src/components/settings/providers/ProviderModal.tsx +405 -0
- package/src/interfaces/web/src/components/settings/providers/typeStyles.ts +155 -0
- package/src/interfaces/web/src/components/settings/providers/types.ts +26 -0
- package/src/interfaces/web/src/components/ui/accordion.tsx +72 -0
- package/src/interfaces/web/src/components/ui/alert-dialog.tsx +187 -0
- package/src/interfaces/web/src/components/ui/alert.tsx +76 -0
- package/src/interfaces/web/src/components/ui/aspect-ratio.tsx +22 -0
- package/src/interfaces/web/src/components/ui/avatar.tsx +107 -0
- package/src/interfaces/web/src/components/ui/badge.tsx +52 -0
- package/src/interfaces/web/src/components/ui/breadcrumb.tsx +125 -0
- package/src/interfaces/web/src/components/ui/button-group.tsx +87 -0
- package/src/interfaces/web/src/components/ui/button.tsx +58 -0
- package/src/interfaces/web/src/components/ui/calendar.tsx +221 -0
- package/src/interfaces/web/src/components/ui/card.tsx +103 -0
- package/src/interfaces/web/src/components/ui/carousel.tsx +242 -0
- package/src/interfaces/web/src/components/ui/chart.tsx +371 -0
- package/src/interfaces/web/src/components/ui/chat-input.tsx +122 -0
- package/src/interfaces/web/src/components/ui/checkbox.tsx +29 -0
- package/src/interfaces/web/src/components/ui/collapsible.tsx +19 -0
- package/src/interfaces/web/src/components/ui/combobox.tsx +295 -0
- package/src/interfaces/web/src/components/ui/command.tsx +196 -0
- package/src/interfaces/web/src/components/ui/context-menu.tsx +271 -0
- package/src/interfaces/web/src/components/ui/dialog.tsx +158 -0
- package/src/interfaces/web/src/components/ui/direction.tsx +4 -0
- package/src/interfaces/web/src/components/ui/drawer.tsx +134 -0
- package/src/interfaces/web/src/components/ui/dropdown-menu.tsx +266 -0
- package/src/interfaces/web/src/components/ui/empty.tsx +104 -0
- package/src/interfaces/web/src/components/ui/field.tsx +236 -0
- package/src/interfaces/web/src/components/ui/hover-card.tsx +51 -0
- package/src/interfaces/web/src/components/ui/input-group.tsx +158 -0
- package/src/interfaces/web/src/components/ui/input-otp.tsx +85 -0
- package/src/interfaces/web/src/components/ui/input.tsx +20 -0
- package/src/interfaces/web/src/components/ui/item.tsx +201 -0
- package/src/interfaces/web/src/components/ui/kbd.tsx +26 -0
- package/src/interfaces/web/src/components/ui/label.tsx +20 -0
- package/src/interfaces/web/src/components/ui/menubar.tsx +280 -0
- package/src/interfaces/web/src/components/ui/native-select.tsx +61 -0
- package/src/interfaces/web/src/components/ui/navigation-menu.tsx +168 -0
- package/src/interfaces/web/src/components/ui/pagination.tsx +130 -0
- package/src/interfaces/web/src/components/ui/popover.tsx +88 -0
- package/src/interfaces/web/src/components/ui/progress.tsx +83 -0
- package/src/interfaces/web/src/components/ui/radio-group.tsx +36 -0
- package/src/interfaces/web/src/components/ui/resizable.tsx +50 -0
- package/src/interfaces/web/src/components/ui/scroll-area.tsx +53 -0
- package/src/interfaces/web/src/components/ui/select.tsx +201 -0
- package/src/interfaces/web/src/components/ui/separator.tsx +23 -0
- package/src/interfaces/web/src/components/ui/sheet.tsx +138 -0
- package/src/interfaces/web/src/components/ui/sidebar.tsx +723 -0
- package/src/interfaces/web/src/components/ui/skeleton.tsx +13 -0
- package/src/interfaces/web/src/components/ui/slider.tsx +52 -0
- package/src/interfaces/web/src/components/ui/sonner.tsx +49 -0
- package/src/interfaces/web/src/components/ui/spinner.tsx +10 -0
- package/src/interfaces/web/src/components/ui/switch.tsx +30 -0
- package/src/interfaces/web/src/components/ui/table.tsx +116 -0
- package/src/interfaces/web/src/components/ui/tabs.tsx +72 -0
- package/src/interfaces/web/src/components/ui/textarea.tsx +18 -0
- package/src/interfaces/web/src/components/ui/tip.tsx +21 -0
- package/src/interfaces/web/src/components/ui/toggle-group.tsx +87 -0
- package/src/interfaces/web/src/components/ui/toggle.tsx +45 -0
- package/src/interfaces/web/src/components/ui/tooltip.tsx +64 -0
- package/src/interfaces/web/src/components/ui.tsx +211 -0
- package/src/interfaces/web/src/components/voice/VoiceProviderList.tsx +197 -0
- package/src/interfaces/web/src/components/voice/VoiceProviderModal.tsx +213 -0
- package/src/interfaces/web/src/components/voice/VoiceSttCard.tsx +72 -0
- package/src/interfaces/web/src/components/voice/VoiceTestCard.tsx +112 -0
- package/src/interfaces/web/src/components/voice/useTtsPlayer.ts +59 -0
- package/src/interfaces/web/src/constants/index.ts +91 -0
- package/src/interfaces/web/src/hooks/use-mobile.ts +19 -0
- package/src/interfaces/web/src/hooks/useChat.ts +276 -0
- package/src/interfaces/web/src/hooks/useDaemonStatus.ts +12 -0
- package/src/interfaces/web/src/hooks/useDevices.ts +12 -0
- package/src/interfaces/web/src/hooks/useEngines.ts +10 -0
- package/src/interfaces/web/src/hooks/useGlobalConfig.ts +24 -0
- package/src/interfaces/web/src/hooks/useIdentity.ts +16 -0
- package/src/interfaces/web/src/hooks/useProjects.ts +27 -0
- package/src/interfaces/web/src/hooks/useTelegram.ts +35 -0
- package/src/interfaces/web/src/hooks/useTheme.tsx +57 -0
- package/src/interfaces/web/src/hooks/useTokenBootstrap.ts +122 -0
- package/src/interfaces/web/src/i18n/en.ts +767 -0
- package/src/interfaces/web/src/i18n/es.ts +770 -0
- package/src/interfaces/web/src/i18n/index.ts +86 -0
- package/src/interfaces/web/src/lib/api/admin.ts +30 -0
- package/src/interfaces/web/src/lib/api/agents.ts +46 -0
- package/src/interfaces/web/src/lib/api/code.ts +122 -0
- package/src/interfaces/web/src/lib/api/conversations.ts +16 -0
- package/src/interfaces/web/src/lib/api/deck.ts +106 -0
- package/src/interfaces/web/src/lib/api/desktop.ts +54 -0
- package/src/interfaces/web/src/lib/api/embeddings.ts +44 -0
- package/src/interfaces/web/src/lib/api/engines.ts +17 -0
- package/src/interfaces/web/src/lib/api/filesystem.ts +12 -0
- package/src/interfaces/web/src/lib/api/health.ts +6 -0
- package/src/interfaces/web/src/lib/api/identity.ts +7 -0
- package/src/interfaces/web/src/lib/api/mcps.ts +29 -0
- package/src/interfaces/web/src/lib/api/messages.ts +24 -0
- package/src/interfaces/web/src/lib/api/projects.ts +29 -0
- package/src/interfaces/web/src/lib/api/routines.ts +14 -0
- package/src/interfaces/web/src/lib/api/sessions.ts +16 -0
- package/src/interfaces/web/src/lib/api/super_agent.ts +29 -0
- package/src/interfaces/web/src/lib/api/tasks.ts +19 -0
- package/src/interfaces/web/src/lib/api/telegram.ts +57 -0
- package/src/interfaces/web/src/lib/api/tools.ts +13 -0
- package/src/interfaces/web/src/lib/api/voice.ts +169 -0
- package/src/interfaces/web/src/lib/api.ts +48 -0
- package/src/interfaces/web/src/lib/cn.ts +6 -0
- package/src/interfaces/web/src/lib/code-context.ts +83 -0
- package/src/interfaces/web/src/lib/config-values.ts +29 -0
- package/src/interfaces/web/src/lib/device.ts +10 -0
- package/src/interfaces/web/src/lib/http.ts +104 -0
- package/src/interfaces/web/src/lib/secrets.ts +15 -0
- package/src/interfaces/web/src/lib/utils.ts +6 -0
- package/src/interfaces/web/src/main.tsx +16 -0
- package/src/interfaces/web/src/screens/ApxAdminScreen.tsx +174 -0
- package/src/interfaces/web/src/screens/PairingScreen.tsx +105 -0
- package/src/interfaces/web/src/screens/ProjectScreen.tsx +178 -0
- package/src/interfaces/web/src/screens/SettingsScreen.tsx +111 -0
- package/src/interfaces/web/src/screens/base/AgentDefaultsTab.tsx +274 -0
- package/src/interfaces/web/src/screens/base/ComingSoon.tsx +16 -0
- package/src/interfaces/web/src/screens/base/GlobalTasksTab.tsx +53 -0
- package/src/interfaces/web/src/screens/base/LogsTab.tsx +188 -0
- package/src/interfaces/web/src/screens/base/ModelsTab.tsx +13 -0
- package/src/interfaces/web/src/screens/base/SessionsTab.tsx +58 -0
- package/src/interfaces/web/src/screens/base/WorkspacesTab.tsx +49 -0
- package/src/interfaces/web/src/screens/modules/CodeScreen.tsx +295 -0
- package/src/interfaces/web/src/screens/modules/DeckScreen.tsx +173 -0
- package/src/interfaces/web/src/screens/modules/DesktopScreen.tsx +304 -0
- package/src/interfaces/web/src/screens/modules/VoiceScreen.tsx +174 -0
- package/src/interfaces/web/src/screens/project/AgentBrainGraph.tsx +152 -0
- package/src/interfaces/web/src/screens/project/AgentDetailScreen.tsx +455 -0
- package/src/interfaces/web/src/screens/project/AgentsTab.tsx +364 -0
- package/src/interfaces/web/src/screens/project/ChatTab.tsx +198 -0
- package/src/interfaces/web/src/screens/project/ConfigTab.tsx +94 -0
- package/src/interfaces/web/src/screens/project/McpsTab.tsx +149 -0
- package/src/interfaces/web/src/screens/project/MemoriesTab.tsx +134 -0
- package/src/interfaces/web/src/screens/project/Overview.tsx +37 -0
- package/src/interfaces/web/src/screens/project/RoutinesTab.tsx +386 -0
- package/src/interfaces/web/src/screens/project/TasksTab.tsx +116 -0
- package/src/interfaces/web/src/screens/project/TelegramTab.tsx +126 -0
- package/src/interfaces/web/src/screens/project/ThreadsTab.tsx +100 -0
- package/src/interfaces/web/src/styles.css +128 -0
- package/src/interfaces/web/src/types/daemon.ts +289 -0
- package/src/interfaces/web/tailwind.config.js +53 -0
- package/src/interfaces/web/tsconfig.json +24 -0
- package/src/interfaces/web/vite.config.ts +50 -0
- package/src/cli/commands/exec.js +0 -56
- package/src/cli/commands/overlay.js +0 -253
- package/src/cli/commands/session.js +0 -395
- package/src/cli/commands/sessions.js +0 -517
- package/src/cli/commands/telegram.js +0 -77
- package/src/cli/postinstall.js +0 -75
- package/src/cli-ts/commands/agent.ts +0 -173
- package/src/cli-ts/commands/chat.ts +0 -119
- package/src/cli-ts/commands/daemon.ts +0 -112
- package/src/cli-ts/commands/exec.ts +0 -109
- package/src/cli-ts/commands/mcp.ts +0 -235
- package/src/cli-ts/commands/session.ts +0 -224
- package/src/cli-ts/commands/status.ts +0 -61
- package/src/cli-ts/http.ts +0 -36
- package/src/cli-ts/index.ts +0 -73
- package/src/cli-ts/ui.ts +0 -107
- package/src/daemon/api.js +0 -1558
- package/src/daemon/engines/gemini.js +0 -56
- package/src/daemon/engines/openai.js +0 -79
- package/src/daemon/mcp-sources.js +0 -114
- package/src/daemon/super-agent-tools/index.js +0 -84
- package/src/daemon/super-agent-tools.js +0 -1
- package/src/daemon/super-agent.js +0 -541
- package/src/overlay/index.html +0 -44
- package/src/overlay/main.js +0 -480
- package/src/overlay/preload.js +0 -34
- package/src/overlay/renderer.js +0 -371
- package/src/overlay/style.css +0 -250
- package/src/tui/context/sync-apx.tsx +0 -284
- package/src/tui/routes/session/index.tsx +0 -274
- package/src/tui/routes/session/sidebar-apx.tsx +0 -90
- /package/src/{daemon → core}/tools/browser.js +0 -0
- /package/src/{daemon → core}/tools/fetch.js +0 -0
- /package/src/{daemon → core}/tools/glob.js +0 -0
- /package/src/{daemon → core}/tools/grep.js +0 -0
- /package/src/{daemon → core}/tools/registry.js +0 -0
- /package/src/{daemon → core}/tools/search.js +0 -0
- /package/src/{daemon → host/daemon}/conversations.js +0 -0
- /package/src/{daemon → host/daemon}/env-detect.js +0 -0
- /package/src/{daemon → host/daemon}/runtimes/_spawn.js +0 -0
- /package/src/{daemon → host/daemon}/runtimes/aider.js +0 -0
- /package/src/{daemon → host/daemon}/runtimes/claude-code.js +0 -0
- /package/src/{daemon → host/daemon}/runtimes/codex.js +0 -0
- /package/src/{daemon → host/daemon}/runtimes/cursor-agent.js +0 -0
- /package/src/{daemon → host/daemon}/runtimes/gemini-cli.js +0 -0
- /package/src/{daemon → host/daemon}/runtimes/index.js +0 -0
- /package/src/{daemon → host/daemon}/runtimes/opencode.js +0 -0
- /package/src/{daemon → host/daemon}/runtimes/qwen-code.js +0 -0
- /package/src/{daemon → host/daemon}/super-agent-tools/tools/call-mcp.js +0 -0
- /package/src/{daemon → host/daemon}/super-agent-tools/tools/edit-file.js +0 -0
- /package/src/{daemon → host/daemon}/super-agent-tools/tools/list-files.js +0 -0
- /package/src/{daemon → host/daemon}/super-agent-tools/tools/list-mcps.js +0 -0
- /package/src/{daemon → host/daemon}/super-agent-tools/tools/list-projects.js +0 -0
- /package/src/{daemon → host/daemon}/super-agent-tools/tools/list-skills.js +0 -0
- /package/src/{daemon → host/daemon}/super-agent-tools/tools/load-skill.js +0 -0
- /package/src/{daemon → host/daemon}/super-agent-tools/tools/read-agent-memory.js +0 -0
- /package/src/{daemon → host/daemon}/super-agent-tools/tools/read-file.js +0 -0
- /package/src/{daemon → host/daemon}/super-agent-tools/tools/run-shell.js +0 -0
- /package/src/{daemon → host/daemon}/super-agent-tools/tools/search-files.js +0 -0
- /package/src/{daemon → host/daemon}/super-agent-tools/tools/transcribe-audio.js +0 -0
- /package/src/{daemon → host/daemon}/super-agent-tools/tools/write-file.js +0 -0
- /package/src/{daemon → host/daemon}/thinking.js +0 -0
- /package/src/{daemon → host/daemon}/whisper-server.py +0 -0
- /package/src/{daemon → host/daemon}/whisper-transcribe.py +0 -0
- /package/src/{cli → interfaces/cli}/commands/a2a.js +0 -0
- /package/src/{cli → interfaces/cli}/commands/artifact.js +0 -0
- /package/src/{cli → interfaces/cli}/commands/chat.js +0 -0
- /package/src/{cli → interfaces/cli}/commands/log.js +0 -0
- /package/src/{cli → interfaces/cli}/commands/messages.js +0 -0
- /package/src/{cli → interfaces/cli}/commands/plugins.js +0 -0
- /package/src/{cli → interfaces/cli}/commands/routine.js +0 -0
- /package/src/{cli → interfaces/cli}/commands/runtime.js +0 -0
- /package/src/{cli → interfaces/cli}/terminal-chat/renderer.js +0 -0
- /package/src/{overlay → interfaces/desktop}/package.json +0 -0
- /package/src/{tui → interfaces/tui}/_shims/cli-error.ts +0 -0
- /package/src/{tui → interfaces/tui}/_shims/cli-logo.ts +0 -0
- /package/src/{tui → interfaces/tui}/_shims/cli-ui.ts +0 -0
- /package/src/{tui → interfaces/tui}/_shims/config-console-state.ts +0 -0
- /package/src/{tui → interfaces/tui}/_shims/core-any.ts +0 -0
- /package/src/{tui → interfaces/tui}/_shims/core-binary.ts +0 -0
- /package/src/{tui → interfaces/tui}/_shims/core-flag.ts +0 -0
- /package/src/{tui → interfaces/tui}/_shims/core-log.ts +0 -0
- /package/src/{tui → interfaces/tui}/_shims/lsp-language.ts +0 -0
- /package/src/{tui → interfaces/tui}/_shims/opencode-any.ts +0 -0
- /package/src/{tui → interfaces/tui}/_shims/opencode-sdk-v2.ts +0 -0
- /package/src/{tui → interfaces/tui}/_shims/plugin-tui.ts +0 -0
- /package/src/{tui → interfaces/tui}/_shims/prompt-display.ts +0 -0
- /package/src/{tui → interfaces/tui}/_shims/provider-provider.ts +0 -0
- /package/src/{tui → interfaces/tui}/_shims/session-retry.ts +0 -0
- /package/src/{tui → interfaces/tui}/_shims/session-schema.ts +0 -0
- /package/src/{tui → interfaces/tui}/_shims/session-session.ts +0 -0
- /package/src/{tui → interfaces/tui}/_shims/snapshot.ts +0 -0
- /package/src/{tui → interfaces/tui}/_shims/tool-any.ts +0 -0
- /package/src/{tui → interfaces/tui}/_shims/util-error.ts +0 -0
- /package/src/{tui → interfaces/tui}/_shims/util-filesystem.ts +0 -0
- /package/src/{tui → interfaces/tui}/_shims/util-format.ts +0 -0
- /package/src/{tui → interfaces/tui}/_shims/util-iife.ts +0 -0
- /package/src/{tui → interfaces/tui}/_shims/util-locale.ts +0 -0
- /package/src/{tui → interfaces/tui}/_shims/util-process.ts +0 -0
- /package/src/{tui → interfaces/tui}/asset/charge.wav +0 -0
- /package/src/{tui → interfaces/tui}/asset/pulse-a.wav +0 -0
- /package/src/{tui → interfaces/tui}/asset/pulse-b.wav +0 -0
- /package/src/{tui → interfaces/tui}/asset/pulse-c.wav +0 -0
- /package/src/{tui → interfaces/tui}/attach.ts +0 -0
- /package/src/{tui → interfaces/tui}/component/bg-pulse-render.ts +0 -0
- /package/src/{tui → interfaces/tui}/component/bg-pulse.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/border.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/dialog-agent.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/dialog-console-org.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/dialog-mcp.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/dialog-model.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/dialog-provider.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/dialog-retry-action.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/dialog-session-delete-failed.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/dialog-session-list.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/dialog-session-rename.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/dialog-skill.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/dialog-stash.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/dialog-status.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/dialog-tag.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/dialog-theme-list.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/dialog-variant.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/dialog-workspace-create.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/dialog-workspace-file-changes.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/dialog-workspace-unavailable.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/error-component.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/logo.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/plugin-route-missing.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/prompt/autocomplete.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/prompt/cwd.ts +0 -0
- /package/src/{tui → interfaces/tui}/component/prompt/frecency.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/prompt/history.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/prompt/part.ts +0 -0
- /package/src/{tui → interfaces/tui}/component/prompt/stash.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/prompt/traits.ts +0 -0
- /package/src/{tui → interfaces/tui}/component/spinner.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/startup-loading.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/todo-item.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/use-connected.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/workspace-label.tsx +0 -0
- /package/src/{tui → interfaces/tui}/config/cwd.ts +0 -0
- /package/src/{tui → interfaces/tui}/config/keybind.ts +0 -0
- /package/src/{tui → interfaces/tui}/config/tui-migrate.ts +0 -0
- /package/src/{tui → interfaces/tui}/config/tui-schema.ts +0 -0
- /package/src/{tui → interfaces/tui}/config/tui.ts +0 -0
- /package/src/{tui → interfaces/tui}/context/aggregate-failures.ts +0 -0
- /package/src/{tui → interfaces/tui}/context/args.tsx +0 -0
- /package/src/{tui → interfaces/tui}/context/command-palette.tsx +0 -0
- /package/src/{tui → interfaces/tui}/context/directory.ts +0 -0
- /package/src/{tui → interfaces/tui}/context/editor-zed.ts +0 -0
- /package/src/{tui → interfaces/tui}/context/editor.ts +0 -0
- /package/src/{tui → interfaces/tui}/context/event-apx.ts +0 -0
- /package/src/{tui → interfaces/tui}/context/event.ts +0 -0
- /package/src/{tui → interfaces/tui}/context/exit.tsx +0 -0
- /package/src/{tui → interfaces/tui}/context/helper.tsx +0 -0
- /package/src/{tui → interfaces/tui}/context/kv.tsx +0 -0
- /package/src/{tui → interfaces/tui}/context/local.tsx +0 -0
- /package/src/{tui → interfaces/tui}/context/path-format.tsx +0 -0
- /package/src/{tui → interfaces/tui}/context/project-apx.tsx +0 -0
- /package/src/{tui → interfaces/tui}/context/project.tsx +0 -0
- /package/src/{tui → interfaces/tui}/context/prompt.tsx +0 -0
- /package/src/{tui → interfaces/tui}/context/route.tsx +0 -0
- /package/src/{tui → interfaces/tui}/context/sdk.tsx +0 -0
- /package/src/{tui → interfaces/tui}/context/sync-v2.tsx +0 -0
- /package/src/{tui → interfaces/tui}/context/sync.tsx +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/aura.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/ayu.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/carbonfox.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/catppuccin-frappe.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/catppuccin-macchiato.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/catppuccin.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/cobalt2.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/cursor.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/dracula.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/everforest.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/flexoki.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/github.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/gruvbox.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/kanagawa.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/lucent-orng.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/material.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/matrix.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/mercury.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/monokai.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/nightowl.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/nord.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/one-dark.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/opencode.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/orng.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/osaka-jade.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/palenight.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/rosepine.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/solarized.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/synthwave84.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/tokyonight.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/vercel.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/vesper.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/zenburn.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme.tsx +0 -0
- /package/src/{tui → interfaces/tui}/context/tui-config.tsx +0 -0
- /package/src/{tui → interfaces/tui}/event.ts +0 -0
- /package/src/{tui → interfaces/tui}/feature-plugins/home/footer.tsx +0 -0
- /package/src/{tui → interfaces/tui}/feature-plugins/home/tips-view.tsx +0 -0
- /package/src/{tui → interfaces/tui}/feature-plugins/home/tips.tsx +0 -0
- /package/src/{tui → interfaces/tui}/feature-plugins/sidebar/context.tsx +0 -0
- /package/src/{tui → interfaces/tui}/feature-plugins/sidebar/files.tsx +0 -0
- /package/src/{tui → interfaces/tui}/feature-plugins/sidebar/footer.tsx +0 -0
- /package/src/{tui → interfaces/tui}/feature-plugins/sidebar/lsp.tsx +0 -0
- /package/src/{tui → interfaces/tui}/feature-plugins/sidebar/mcp.tsx +0 -0
- /package/src/{tui → interfaces/tui}/feature-plugins/sidebar/todo.tsx +0 -0
- /package/src/{tui → interfaces/tui}/feature-plugins/system/plugins.tsx +0 -0
- /package/src/{tui → interfaces/tui}/feature-plugins/system/session-v2.tsx +0 -0
- /package/src/{tui → interfaces/tui}/feature-plugins/system/which-key.tsx +0 -0
- /package/src/{tui → interfaces/tui}/keymap.tsx +0 -0
- /package/src/{tui → interfaces/tui}/layer.ts +0 -0
- /package/src/{tui → interfaces/tui}/plugin/api.tsx +0 -0
- /package/src/{tui → interfaces/tui}/plugin/command-shim.ts +0 -0
- /package/src/{tui → interfaces/tui}/plugin/internal.ts +0 -0
- /package/src/{tui → interfaces/tui}/plugin/runtime.ts +0 -0
- /package/src/{tui → interfaces/tui}/plugin/slots.tsx +0 -0
- /package/src/{tui → interfaces/tui}/routes/home.tsx +0 -0
- /package/src/{tui → interfaces/tui}/routes/session/dialog-fork-from-timeline.tsx +0 -0
- /package/src/{tui → interfaces/tui}/routes/session/dialog-message.tsx +0 -0
- /package/src/{tui → interfaces/tui}/routes/session/dialog-subagent.tsx +0 -0
- /package/src/{tui → interfaces/tui}/routes/session/dialog-timeline.tsx +0 -0
- /package/src/{tui → interfaces/tui}/routes/session/footer.tsx +0 -0
- /package/src/{tui → interfaces/tui}/routes/session/permission.tsx +0 -0
- /package/src/{tui → interfaces/tui}/routes/session/question.tsx +0 -0
- /package/src/{tui → interfaces/tui}/routes/session/sidebar.tsx +0 -0
- /package/src/{tui → interfaces/tui}/routes/session/subagent-footer.tsx +0 -0
- /package/src/{tui → interfaces/tui}/run.ts +0 -0
- /package/src/{tui → interfaces/tui}/thread.ts +0 -0
- /package/src/{tui → interfaces/tui}/ui/dialog-alert.tsx +0 -0
- /package/src/{tui → interfaces/tui}/ui/dialog-confirm.tsx +0 -0
- /package/src/{tui → interfaces/tui}/ui/dialog-export-options.tsx +0 -0
- /package/src/{tui → interfaces/tui}/ui/dialog-help.tsx +0 -0
- /package/src/{tui → interfaces/tui}/ui/dialog-prompt.tsx +0 -0
- /package/src/{tui → interfaces/tui}/ui/dialog-select.tsx +0 -0
- /package/src/{tui → interfaces/tui}/ui/dialog.tsx +0 -0
- /package/src/{tui → interfaces/tui}/ui/link.tsx +0 -0
- /package/src/{tui → interfaces/tui}/ui/spinner.ts +0 -0
- /package/src/{tui → interfaces/tui}/ui/toast.tsx +0 -0
- /package/src/{tui → interfaces/tui}/util/editor.ts +0 -0
- /package/src/{tui → interfaces/tui}/util/model.ts +0 -0
- /package/src/{tui → interfaces/tui}/util/provider-origin.ts +0 -0
- /package/src/{tui → interfaces/tui}/util/revert-diff.ts +0 -0
- /package/src/{tui → interfaces/tui}/util/scroll.ts +0 -0
- /package/src/{tui → interfaces/tui}/util/selection.ts +0 -0
- /package/src/{tui → interfaces/tui}/util/signal.ts +0 -0
- /package/src/{tui → interfaces/tui}/util/sound.ts +0 -0
- /package/src/{tui → interfaces/tui}/util/transcript.ts +0 -0
- /package/src/{tui → interfaces/tui}/validate-session.ts +0 -0
- /package/src/{tui → interfaces/tui}/win32.ts +0 -0
- /package/src/{tui → interfaces/tui}/worker.ts +0 -0
package/src/core/scaffold.js
CHANGED
|
@@ -3,7 +3,13 @@ import path from "node:path";
|
|
|
3
3
|
import os from "node:os";
|
|
4
4
|
import crypto from "node:crypto";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
VAULT_DIR,
|
|
8
|
+
BUNDLED_VAULT_DIR,
|
|
9
|
+
readVaultTombstones,
|
|
10
|
+
writeVaultTombstones,
|
|
11
|
+
} from "./parser.js";
|
|
12
|
+
import { readApcContextSkill } from "./apc-skill-sync.js";
|
|
7
13
|
|
|
8
14
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
9
15
|
const PACKAGE_ROOT = path.resolve(__dirname, "..", "..");
|
|
@@ -15,10 +21,16 @@ export const SPEC_VERSION = "0.1.0";
|
|
|
15
21
|
// ---------------------------------------------------------------------------
|
|
16
22
|
// Bundled skills — single source of truth lives at <packageRoot>/skills/<slug>/SKILL.md
|
|
17
23
|
// with proper frontmatter. The `apc-context` copy is refreshed on every
|
|
18
|
-
// install/update from the canonical APC repo (see src/cli/postinstall.js).
|
|
24
|
+
// install/update from the canonical APC repo (see src/interfaces/cli/postinstall.js).
|
|
19
25
|
// ---------------------------------------------------------------------------
|
|
20
26
|
|
|
27
|
+
// Bundled skills — apx lives in skills/apx/. apc-context is synced from
|
|
28
|
+
// the canonical APC repo (../apc or GitHub) — never edited in APX.
|
|
21
29
|
function readBundledSkill(slug) {
|
|
30
|
+
if (slug === "apc-context") {
|
|
31
|
+
const synced = readApcContextSkill();
|
|
32
|
+
return synced?.text || null;
|
|
33
|
+
}
|
|
22
34
|
const file = path.join(BUNDLED_SKILLS_DIR, slug, "SKILL.md");
|
|
23
35
|
if (!fs.existsSync(file)) return null;
|
|
24
36
|
return fs.readFileSync(file, "utf8");
|
|
@@ -176,51 +188,141 @@ export function installIdeSkills(root, targetIds = null) {
|
|
|
176
188
|
return results;
|
|
177
189
|
}
|
|
178
190
|
|
|
179
|
-
//
|
|
180
|
-
//
|
|
181
|
-
//
|
|
182
|
-
//
|
|
183
|
-
//
|
|
184
|
-
//
|
|
185
|
-
//
|
|
186
|
-
|
|
187
|
-
|
|
191
|
+
// Discover every bundled skill under skills/<slug>/SKILL.md. Used by
|
|
192
|
+
// installGlobalSkills() so a new skill added to the repo automatically lands
|
|
193
|
+
// on the user's machine after `npm install -g .` (or `npm update -g apx`)
|
|
194
|
+
// without anyone having to touch this file.
|
|
195
|
+
//
|
|
196
|
+
// Excluded: directory names starting with "." (e.g. .DS_Store), and any
|
|
197
|
+
// runtime-only CLI skill that lives under src/core/runtime-skills/ — those
|
|
198
|
+
// are loaded in-process at daemon startup and are NOT for IDE consumption.
|
|
199
|
+
// Public: bundled skill slugs grouped by scope.
|
|
200
|
+
// public → pushed to every global skill dir on install / sync (default).
|
|
201
|
+
// optional → not pushed by default; user opts in with --include-optional
|
|
202
|
+
// or `apx skills add <slug> --global` for one-off install.
|
|
203
|
+
// internal → APX-developer skills (mcp-builder, skill-builder, etc.); never
|
|
204
|
+
// pushed globally, only available to APX itself via the bundled
|
|
205
|
+
// copy. Avoids cluttering other IDEs with stuff their users won't
|
|
206
|
+
// run.
|
|
207
|
+
export function listBundledSkillSlugs() {
|
|
208
|
+
return discoverBundledSkills().map((s) => s.slug);
|
|
209
|
+
}
|
|
188
210
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
211
|
+
export function listBundledSkills() {
|
|
212
|
+
return discoverBundledSkills().map(({ slug, scope }) => ({ slug, scope }));
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// Tiny frontmatter peek — we only need the `scope:` field. Avoids pulling in
|
|
216
|
+
// a full YAML parser for one optional line.
|
|
217
|
+
function parseFrontmatterScope(md) {
|
|
218
|
+
if (!md.startsWith("---\n")) return "public";
|
|
219
|
+
const end = md.indexOf("\n---", 4);
|
|
220
|
+
if (end === -1) return "public";
|
|
221
|
+
const m = md.slice(4, end).match(/^scope:\s*(\w+)/m);
|
|
222
|
+
if (!m) return "public";
|
|
223
|
+
const s = m[1].toLowerCase();
|
|
224
|
+
if (s === "internal" || s === "optional" || s === "public") return s;
|
|
225
|
+
return "public";
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
function discoverBundledSkills() {
|
|
229
|
+
const root = BUNDLED_SKILLS_DIR;
|
|
230
|
+
if (!fs.existsSync(root)) return [];
|
|
231
|
+
const out = [];
|
|
232
|
+
for (const entry of fs.readdirSync(root, { withFileTypes: true })) {
|
|
233
|
+
if (!entry.isDirectory()) continue;
|
|
234
|
+
if (entry.name.startsWith(".")) continue;
|
|
235
|
+
const skillFile = path.join(root, entry.name, "SKILL.md");
|
|
236
|
+
if (!fs.existsSync(skillFile)) continue;
|
|
237
|
+
const md = fs.readFileSync(skillFile, "utf8");
|
|
238
|
+
out.push({ slug: entry.name, md, scope: parseFrontmatterScope(md) });
|
|
239
|
+
}
|
|
240
|
+
return out.sort((a, b) => a.slug.localeCompare(b.slug));
|
|
241
|
+
}
|
|
196
242
|
|
|
243
|
+
// Install bundled skills to every global ~/.../skills/ dir so Claude Code,
|
|
244
|
+
// Cursor, Codex, and other IDEs see them.
|
|
245
|
+
//
|
|
246
|
+
// By default only `scope: public` skills land globally. Pass
|
|
247
|
+
// includeOptional / includeInternal to push the other tiers (or call
|
|
248
|
+
// `apx skills add <slug> --global` for a single one).
|
|
249
|
+
//
|
|
250
|
+
// Pruning: if a slug that was previously installed has since been demoted to
|
|
251
|
+
// internal/optional (or marked as non-public for the current call), we remove
|
|
252
|
+
// the stale global copy unless prune=false. Keeps IDE skill lists clean.
|
|
253
|
+
//
|
|
254
|
+
// Returns an array of { dir, skill, file, status, scope }.
|
|
255
|
+
// status ∈ {created, updated, unchanged, pruned, skipped}
|
|
256
|
+
export function installGlobalSkills({
|
|
257
|
+
includeOptional = false,
|
|
258
|
+
includeInternal = false,
|
|
259
|
+
prune = true,
|
|
260
|
+
} = {}) {
|
|
261
|
+
const all = discoverBundledSkills();
|
|
262
|
+
const wanted = all.filter((s) => {
|
|
263
|
+
if (s.scope === "internal") return includeInternal;
|
|
264
|
+
if (s.scope === "optional") return includeOptional;
|
|
265
|
+
return true; // public
|
|
266
|
+
});
|
|
267
|
+
const wantedSlugs = new Set(wanted.map((s) => s.slug));
|
|
268
|
+
const knownSlugs = new Set(all.map((s) => s.slug));
|
|
269
|
+
|
|
270
|
+
const results = [];
|
|
197
271
|
for (const base of GLOBAL_SKILL_DIRS) {
|
|
198
|
-
|
|
272
|
+
// Push the wanted set.
|
|
273
|
+
for (const { slug, md, scope } of wanted) {
|
|
199
274
|
const dest = path.join(base, slug, "SKILL.md");
|
|
200
275
|
fs.mkdirSync(path.dirname(dest), { recursive: true });
|
|
201
276
|
const existed = fs.existsSync(dest);
|
|
277
|
+
const previous = existed ? fs.readFileSync(dest, "utf8") : null;
|
|
278
|
+
if (previous === md) {
|
|
279
|
+
results.push({ dir: base, skill: slug, file: dest, status: "unchanged", scope });
|
|
280
|
+
continue;
|
|
281
|
+
}
|
|
202
282
|
fs.writeFileSync(dest, md, "utf8");
|
|
203
|
-
results.push({ dir: base, skill: slug, file: dest, status: existed ? "updated" : "created" });
|
|
283
|
+
results.push({ dir: base, skill: slug, file: dest, status: existed ? "updated" : "created", scope });
|
|
284
|
+
}
|
|
285
|
+
// Prune anything WE shipped previously but should no longer be there
|
|
286
|
+
// (slug exists in the bundle but isn't `wanted` this run).
|
|
287
|
+
if (prune) {
|
|
288
|
+
for (const { slug, scope } of all) {
|
|
289
|
+
if (wantedSlugs.has(slug)) continue;
|
|
290
|
+
if (!knownSlugs.has(slug)) continue;
|
|
291
|
+
const dest = path.join(base, slug, "SKILL.md");
|
|
292
|
+
if (!fs.existsSync(dest)) continue;
|
|
293
|
+
fs.unlinkSync(dest);
|
|
294
|
+
// Best-effort: drop the now-empty <slug>/ dir too.
|
|
295
|
+
try { fs.rmdirSync(path.dirname(dest)); } catch {}
|
|
296
|
+
results.push({ dir: base, skill: slug, file: dest, status: "pruned", scope });
|
|
297
|
+
}
|
|
204
298
|
}
|
|
205
299
|
}
|
|
206
300
|
return results;
|
|
207
301
|
}
|
|
208
302
|
|
|
209
303
|
|
|
210
|
-
|
|
304
|
+
// Generic starter written ONCE at `apx init`. AGENTS.md is the project's
|
|
305
|
+
// startup-rules file — read by Claude, Codex, APX and other AGENTS.md-aware
|
|
306
|
+
// tools when they begin working here. It is NOT an agent registry (APX agents
|
|
307
|
+
// live in `.apc/agents/<slug>.md`). After init it belongs to the user; APX
|
|
308
|
+
// never rewrites it.
|
|
309
|
+
const AGENTS_MD_TEMPLATE = `# AGENTS.md
|
|
211
310
|
|
|
212
|
-
>
|
|
213
|
-
>
|
|
311
|
+
> Startup rules and conventions for AI agents working in this project.
|
|
312
|
+
> Read by Claude, Codex, APX and other AGENTS.md-aware tools. Edit freely —
|
|
313
|
+
> this file is yours; APX won't overwrite it.
|
|
214
314
|
|
|
215
|
-
|
|
315
|
+
## Overview
|
|
216
316
|
|
|
217
|
-
|
|
218
|
-
- **Role**: Support
|
|
219
|
-
- **Model**: claude-haiku-4-5
|
|
220
|
-
- **Skills**: customer-support
|
|
221
|
-
- **Language**: es-AR
|
|
317
|
+
<!-- What is this project? Tech stack, entry points, how to run it. -->
|
|
222
318
|
|
|
223
|
-
|
|
319
|
+
## Conventions
|
|
320
|
+
|
|
321
|
+
<!-- Code style, structure, naming, testing — how to write code that fits. -->
|
|
322
|
+
|
|
323
|
+
## Rules
|
|
324
|
+
|
|
325
|
+
<!-- Hard constraints: what agents must always / never do here. -->
|
|
224
326
|
`;
|
|
225
327
|
|
|
226
328
|
const APC_GITIGNORE = `# APC runtime data — never in the repository
|
|
@@ -409,6 +511,44 @@ export function writeVaultAgentFile(slug, fields, body = "") {
|
|
|
409
511
|
lines.push("---");
|
|
410
512
|
if (body) lines.push("", body);
|
|
411
513
|
fs.writeFileSync(dest, lines.join("\n") + "\n");
|
|
514
|
+
// Writing always clears a tombstone — the user is explicitly putting this
|
|
515
|
+
// slug back, even if it was previously removed.
|
|
516
|
+
const tombs = readVaultTombstones();
|
|
517
|
+
if (tombs.delete(slug)) writeVaultTombstones(tombs);
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
// Remove a vault agent. If the slug has a user-layer file we delete it; if
|
|
521
|
+
// the slug ALSO exists in the bundle (or the user file didn't exist but the
|
|
522
|
+
// bundled one does), we add a tombstone so it stays hidden. Returns one of:
|
|
523
|
+
// { removed: "user" } — user file deleted, bundled NOT present
|
|
524
|
+
// { removed: "user+tomb" } — user file deleted AND bundled hidden by tombstone
|
|
525
|
+
// { removed: "tomb" } — bundled-only slug, hidden by tombstone
|
|
526
|
+
// { removed: null } — slug not found anywhere
|
|
527
|
+
export function removeVaultAgent(slug) {
|
|
528
|
+
const userPath = path.join(VAULT_DIR, `${slug}.md`);
|
|
529
|
+
const bundledPath = path.join(BUNDLED_VAULT_DIR, `${slug}.md`);
|
|
530
|
+
const hadUser = fs.existsSync(userPath);
|
|
531
|
+
const hasBundled = fs.existsSync(bundledPath);
|
|
532
|
+
if (!hadUser && !hasBundled) return { removed: null };
|
|
533
|
+
if (hadUser) fs.rmSync(userPath);
|
|
534
|
+
if (hasBundled) {
|
|
535
|
+
const tombs = readVaultTombstones();
|
|
536
|
+
tombs.add(slug);
|
|
537
|
+
writeVaultTombstones(tombs);
|
|
538
|
+
}
|
|
539
|
+
return {
|
|
540
|
+
removed: hadUser && hasBundled ? "user+tomb" : hadUser ? "user" : "tomb",
|
|
541
|
+
};
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
// Un-tombstone a bundled slug so it becomes visible again. Returns whether a
|
|
545
|
+
// tombstone existed before. No-op if there was nothing to restore.
|
|
546
|
+
export function restoreVaultAgent(slug) {
|
|
547
|
+
const tombs = readVaultTombstones();
|
|
548
|
+
if (!tombs.has(slug)) return { restored: false };
|
|
549
|
+
tombs.delete(slug);
|
|
550
|
+
writeVaultTombstones(tombs);
|
|
551
|
+
return { restored: true };
|
|
412
552
|
}
|
|
413
553
|
|
|
414
554
|
// Add a slug to the project's agents.imported list in project.json
|
|
@@ -422,52 +562,8 @@ export function addImportedAgent(root, slug) {
|
|
|
422
562
|
fs.writeFileSync(p, JSON.stringify(cfg, null, 2) + "\n");
|
|
423
563
|
}
|
|
424
564
|
|
|
425
|
-
//
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
"",
|
|
431
|
-
"> Auto-generated from .apc/agents/*.md — edit individual agent files, not this file.",
|
|
432
|
-
"> Read by Codex, Antigravity, and other tools that follow the AGENTS.md convention.",
|
|
433
|
-
"",
|
|
434
|
-
].join("\n");
|
|
435
|
-
|
|
436
|
-
if (agents.length === 0) {
|
|
437
|
-
fs.writeFileSync(path.join(root, "AGENTS.md"), header);
|
|
438
|
-
return;
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
const blocks = agents.map((a) => {
|
|
442
|
-
const tag = a.source === "vault" ? " <!-- vault -->" : "";
|
|
443
|
-
return renderAgentBlock(a.slug, a.fields) + tag;
|
|
444
|
-
});
|
|
445
|
-
fs.writeFileSync(path.join(root, "AGENTS.md"), header + blocks.join("\n\n") + "\n");
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
export function appendAgentToAgentsMd(root, slug, fields) {
|
|
449
|
-
const agentsMdPath = path.join(root, "AGENTS.md");
|
|
450
|
-
let text = fs.existsSync(agentsMdPath)
|
|
451
|
-
? fs.readFileSync(agentsMdPath, "utf8")
|
|
452
|
-
: AGENTS_MD_TEMPLATE;
|
|
453
|
-
|
|
454
|
-
if (!/^#\s+Agents\s*$/im.test(text)) {
|
|
455
|
-
text = `# Agents\n\n${text}`;
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
const block = renderAgentBlock(slug, fields);
|
|
459
|
-
|
|
460
|
-
if (!text.endsWith("\n")) text += "\n";
|
|
461
|
-
text += `\n${block}\n`;
|
|
462
|
-
fs.writeFileSync(agentsMdPath, text);
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
export function renderAgentBlock(slug, fields) {
|
|
466
|
-
const lines = [`## ${slug}`];
|
|
467
|
-
for (const [k, v] of Object.entries(fields)) {
|
|
468
|
-
if (v === undefined || v === null || v === "") continue;
|
|
469
|
-
const value = Array.isArray(v) ? v.join(", ") : v;
|
|
470
|
-
lines.push(`- **${k}**: ${value}`);
|
|
471
|
-
}
|
|
472
|
-
return lines.join("\n");
|
|
473
|
-
}
|
|
565
|
+
// NOTE: AGENTS.md is created once at `apx init` (see AGENTS_MD_TEMPLATE) and is
|
|
566
|
+
// thereafter owned by the user — APX never regenerates it. Agents live in
|
|
567
|
+
// `.apc/agents/<slug>.md` (read by parser.js readAgents); they are NOT listed
|
|
568
|
+
// in AGENTS.md. The project's AGENTS.md is loaded INTO the super-agent prompt
|
|
569
|
+
// by buildSuperAgentSystem() in src/core/agent/prompt-builder.js.
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
// Tasks (TODOs) per project.
|
|
2
|
+
//
|
|
3
|
+
// Append-only JSONL event log, one file per month under
|
|
4
|
+
// ~/.apx/projects/<apxId>/tasks/YYYY-MM.jsonl
|
|
5
|
+
//
|
|
6
|
+
// Each line is a `{ id, ts, op, ... }` event. The current state of a task is
|
|
7
|
+
// the result of folding every event with that id in chronological order:
|
|
8
|
+
//
|
|
9
|
+
// create — sets initial fields (title, body, tags, due, agent, source, meta)
|
|
10
|
+
// update — shallow-merge patch (`patch` field)
|
|
11
|
+
// done — closes the task (`by` field optional)
|
|
12
|
+
// drop — archives without "completed" semantics (`by` field optional)
|
|
13
|
+
//
|
|
14
|
+
// State values: "open" (after create) → "done" or "dropped". Once dropped or
|
|
15
|
+
// done, further updates are recorded but the state is sticky unless the
|
|
16
|
+
// caller explicitly re-opens with op="reopen".
|
|
17
|
+
import fs from "node:fs";
|
|
18
|
+
import path from "node:path";
|
|
19
|
+
import { randomUUID } from "node:crypto";
|
|
20
|
+
|
|
21
|
+
function tasksDir(storagePath) {
|
|
22
|
+
return path.join(storagePath, "tasks");
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function monthlyFile(storagePath, date = new Date()) {
|
|
26
|
+
const ym = date.toISOString().slice(0, 7); // YYYY-MM
|
|
27
|
+
return path.join(tasksDir(storagePath), `${ym}.jsonl`);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function nowIso() {
|
|
31
|
+
return new Date().toISOString().replace(/\.\d{3}Z$/, "Z");
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function shortId() {
|
|
35
|
+
// 6 base36 chars from randomUUID's first 8 hex chars → 32 bits → ~4B keyspace.
|
|
36
|
+
const hex = randomUUID().replace(/-/g, "").slice(0, 8);
|
|
37
|
+
return "t_" + parseInt(hex, 16).toString(36).padStart(6, "0").slice(-6);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function appendEvent(storagePath, event) {
|
|
41
|
+
const file = monthlyFile(storagePath);
|
|
42
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
43
|
+
fs.appendFileSync(file, JSON.stringify(event) + "\n");
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function readAllEvents(storagePath) {
|
|
47
|
+
const dir = tasksDir(storagePath);
|
|
48
|
+
if (!fs.existsSync(dir)) return [];
|
|
49
|
+
const files = fs.readdirSync(dir).filter((f) => f.endsWith(".jsonl")).sort();
|
|
50
|
+
const events = [];
|
|
51
|
+
for (const f of files) {
|
|
52
|
+
const text = fs.readFileSync(path.join(dir, f), "utf8");
|
|
53
|
+
for (const line of text.split("\n")) {
|
|
54
|
+
if (!line.trim()) continue;
|
|
55
|
+
try {
|
|
56
|
+
const ev = JSON.parse(line);
|
|
57
|
+
if (ev && ev.id && ev.op) events.push(ev);
|
|
58
|
+
} catch {
|
|
59
|
+
// Skip corrupt lines; one bad write shouldn't break the projection.
|
|
60
|
+
// We could log here; for now we silently drop.
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
events.sort((a, b) => (a.ts || "").localeCompare(b.ts || ""));
|
|
65
|
+
return events;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function projectState(events) {
|
|
69
|
+
const tasks = new Map();
|
|
70
|
+
for (const ev of events) {
|
|
71
|
+
const existing = tasks.get(ev.id);
|
|
72
|
+
switch (ev.op) {
|
|
73
|
+
case "create": {
|
|
74
|
+
if (existing) break; // duplicate create — keep first
|
|
75
|
+
tasks.set(ev.id, {
|
|
76
|
+
id: ev.id,
|
|
77
|
+
created_at: ev.ts,
|
|
78
|
+
updated_at: ev.ts,
|
|
79
|
+
state: "open",
|
|
80
|
+
title: ev.title || "",
|
|
81
|
+
body: ev.body || null,
|
|
82
|
+
tags: Array.isArray(ev.tags) ? [...ev.tags] : [],
|
|
83
|
+
due: ev.due || null,
|
|
84
|
+
agent: ev.agent || null,
|
|
85
|
+
source: ev.source || null,
|
|
86
|
+
meta: ev.meta && typeof ev.meta === "object" ? { ...ev.meta } : {},
|
|
87
|
+
});
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
case "update": {
|
|
91
|
+
if (!existing) break;
|
|
92
|
+
const patch = ev.patch && typeof ev.patch === "object" ? ev.patch : {};
|
|
93
|
+
for (const k of Object.keys(patch)) {
|
|
94
|
+
if (k === "id" || k === "state" || k === "created_at") continue;
|
|
95
|
+
existing[k] = patch[k];
|
|
96
|
+
}
|
|
97
|
+
existing.updated_at = ev.ts;
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
case "done": {
|
|
101
|
+
if (!existing) break;
|
|
102
|
+
existing.state = "done";
|
|
103
|
+
existing.done_at = ev.ts;
|
|
104
|
+
existing.done_by = ev.by || null;
|
|
105
|
+
existing.updated_at = ev.ts;
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
case "drop": {
|
|
109
|
+
if (!existing) break;
|
|
110
|
+
existing.state = "dropped";
|
|
111
|
+
existing.dropped_at = ev.ts;
|
|
112
|
+
existing.dropped_by = ev.by || null;
|
|
113
|
+
existing.updated_at = ev.ts;
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
case "reopen": {
|
|
117
|
+
if (!existing) break;
|
|
118
|
+
existing.state = "open";
|
|
119
|
+
existing.reopened_at = ev.ts;
|
|
120
|
+
existing.updated_at = ev.ts;
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
default:
|
|
124
|
+
// unknown op — record nothing, but don't throw
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return tasks;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
132
|
+
// Public API
|
|
133
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Create a new task. Returns the freshly projected task object.
|
|
137
|
+
* fields: { title (required), body?, tags?, due?, agent?, source?, meta? }
|
|
138
|
+
*/
|
|
139
|
+
export function createTask(storagePath, fields) {
|
|
140
|
+
if (!fields || typeof fields !== "object") throw new Error("createTask: fields required");
|
|
141
|
+
if (!fields.title || typeof fields.title !== "string") throw new Error("createTask: title required");
|
|
142
|
+
const id = shortId();
|
|
143
|
+
const ev = {
|
|
144
|
+
id,
|
|
145
|
+
ts: nowIso(),
|
|
146
|
+
op: "create",
|
|
147
|
+
title: fields.title.trim(),
|
|
148
|
+
body: fields.body || null,
|
|
149
|
+
tags: Array.isArray(fields.tags) ? fields.tags.filter((t) => typeof t === "string") : [],
|
|
150
|
+
due: fields.due || null,
|
|
151
|
+
agent: fields.agent || null,
|
|
152
|
+
source: fields.source || null,
|
|
153
|
+
meta: fields.meta && typeof fields.meta === "object" ? fields.meta : {},
|
|
154
|
+
};
|
|
155
|
+
appendEvent(storagePath, ev);
|
|
156
|
+
return getTask(storagePath, id);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/** List tasks with optional filters. */
|
|
160
|
+
export function listTasks(storagePath, opts = {}) {
|
|
161
|
+
const events = readAllEvents(storagePath);
|
|
162
|
+
const tasks = [...projectState(events).values()];
|
|
163
|
+
|
|
164
|
+
let out = tasks;
|
|
165
|
+
if (opts.state && opts.state !== "all") {
|
|
166
|
+
out = out.filter((t) => t.state === opts.state);
|
|
167
|
+
} else if (!opts.state) {
|
|
168
|
+
out = out.filter((t) => t.state === "open");
|
|
169
|
+
}
|
|
170
|
+
if (opts.tag) {
|
|
171
|
+
out = out.filter((t) => Array.isArray(t.tags) && t.tags.includes(opts.tag));
|
|
172
|
+
}
|
|
173
|
+
if (opts.agent) {
|
|
174
|
+
out = out.filter((t) => t.agent === opts.agent);
|
|
175
|
+
}
|
|
176
|
+
if (opts.due_before) {
|
|
177
|
+
out = out.filter((t) => t.due && t.due <= opts.due_before);
|
|
178
|
+
}
|
|
179
|
+
if (opts.due_after) {
|
|
180
|
+
out = out.filter((t) => t.due && t.due >= opts.due_after);
|
|
181
|
+
}
|
|
182
|
+
out.sort((a, b) => (b.created_at || "").localeCompare(a.created_at || ""));
|
|
183
|
+
if (opts.limit && Number.isFinite(opts.limit)) {
|
|
184
|
+
out = out.slice(0, opts.limit);
|
|
185
|
+
}
|
|
186
|
+
return out;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/** Get a single task by id or by id prefix (≥ 3 chars, must be unique). */
|
|
190
|
+
export function getTask(storagePath, idOrPrefix) {
|
|
191
|
+
if (!idOrPrefix || typeof idOrPrefix !== "string") return null;
|
|
192
|
+
const events = readAllEvents(storagePath);
|
|
193
|
+
const tasks = projectState(events);
|
|
194
|
+
if (tasks.has(idOrPrefix)) return tasks.get(idOrPrefix);
|
|
195
|
+
if (idOrPrefix.length < 3) return null;
|
|
196
|
+
const matches = [...tasks.values()].filter((t) => t.id.startsWith(idOrPrefix));
|
|
197
|
+
if (matches.length === 1) return matches[0];
|
|
198
|
+
return null;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/** Patch a task. Returns the projected task; null if id not found. */
|
|
202
|
+
export function patchTask(storagePath, idOrPrefix, patch) {
|
|
203
|
+
const existing = getTask(storagePath, idOrPrefix);
|
|
204
|
+
if (!existing) return null;
|
|
205
|
+
if (!patch || typeof patch !== "object") return existing;
|
|
206
|
+
appendEvent(storagePath, {
|
|
207
|
+
id: existing.id,
|
|
208
|
+
ts: nowIso(),
|
|
209
|
+
op: "update",
|
|
210
|
+
patch,
|
|
211
|
+
});
|
|
212
|
+
return getTask(storagePath, existing.id);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/** Mark done. */
|
|
216
|
+
export function doneTask(storagePath, idOrPrefix, by = null) {
|
|
217
|
+
const existing = getTask(storagePath, idOrPrefix);
|
|
218
|
+
if (!existing) return null;
|
|
219
|
+
appendEvent(storagePath, {
|
|
220
|
+
id: existing.id,
|
|
221
|
+
ts: nowIso(),
|
|
222
|
+
op: "done",
|
|
223
|
+
by,
|
|
224
|
+
});
|
|
225
|
+
return getTask(storagePath, existing.id);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/** Drop (archive without completion). */
|
|
229
|
+
export function dropTask(storagePath, idOrPrefix, by = null) {
|
|
230
|
+
const existing = getTask(storagePath, idOrPrefix);
|
|
231
|
+
if (!existing) return null;
|
|
232
|
+
appendEvent(storagePath, {
|
|
233
|
+
id: existing.id,
|
|
234
|
+
ts: nowIso(),
|
|
235
|
+
op: "drop",
|
|
236
|
+
by,
|
|
237
|
+
});
|
|
238
|
+
return getTask(storagePath, existing.id);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/** Re-open a done/dropped task. */
|
|
242
|
+
export function reopenTask(storagePath, idOrPrefix) {
|
|
243
|
+
const existing = getTask(storagePath, idOrPrefix);
|
|
244
|
+
if (!existing) return null;
|
|
245
|
+
appendEvent(storagePath, {
|
|
246
|
+
id: existing.id,
|
|
247
|
+
ts: nowIso(),
|
|
248
|
+
op: "reopen",
|
|
249
|
+
});
|
|
250
|
+
return getTask(storagePath, existing.id);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/** Counts for status displays. */
|
|
254
|
+
export function countTasks(storagePath) {
|
|
255
|
+
const tasks = [...projectState(readAllEvents(storagePath)).values()];
|
|
256
|
+
const today = new Date().toISOString().slice(0, 10);
|
|
257
|
+
return {
|
|
258
|
+
open: tasks.filter((t) => t.state === "open").length,
|
|
259
|
+
done: tasks.filter((t) => t.state === "done").length,
|
|
260
|
+
dropped: tasks.filter((t) => t.state === "dropped").length,
|
|
261
|
+
overdue: tasks.filter((t) => t.state === "open" && t.due && t.due < today).length,
|
|
262
|
+
total: tasks.length,
|
|
263
|
+
};
|
|
264
|
+
}
|