The panel stored notes, todos and plans inside one shared JSON file that six unrelated domains also wrote to, synchronised itself through window CustomEvents, and could only read plans. It is now Project knowledge: server-owned storage with explicit routes, a store with rollback, a section sidebar, plans that open and edit in place, and search across all of it. Notes and plans the user pins travel with every message sent in that project. Pinning is project state, not an attachment to one message, so it holds until unpinned and the work status panel names what is riding along and can detach it. Agent memory is added alongside, in two scopes: what is true about the user, and what is true about this codebase. The split is not cosmetic — a wrong project fact costs one project and is noticed, while a wrong global fact quietly shapes every session everywhere and the user has no code to check it against. It stays separate from notes so an agent mistake cannot land in what the user wrote. Sessions receive an index of titles only; bodies are read on demand, because an index carrying full text grows until it crowds out the conversation. Deciding what a session must be told, and whether it has been told, now lives on the server. The client owned it before, which meant sessions started without a UI — scheduled tasks, sessions the agent dispatches — received nothing at all, and a tab's record of what it had sent outlived the conversation: after compaction the agent no longer held the block while the tab went on believing it did. What was delivered is recorded in the session's own metadata, and compaction restores it through the runtime that already restores pinned messages, in the same turn. Agent memory ships dark behind OPENCHAMBER_MEMORY_ENABLE: unset, there is no tool, no routes, no session index, no settings row and no panel tab. Absent rather than switched off, so nothing invites turning on a feature that has not been announced. Pinned notes and plans are unaffected and ship as normal.
341 lines
11 KiB
JavaScript
341 lines
11 KiB
JavaScript
import { registerFsRoutes } from '../fs/routes.js';
|
|
import { registerQuotaRoutes } from '../quota/routes.js';
|
|
import { registerSmallModelRoutes } from '../small-model/routes.js';
|
|
import { registerWalkthroughRoutes } from '../walkthrough/routes.js';
|
|
import { registerSessionGoalRoutes } from '../session-goal/routes.js';
|
|
import { registerGitHubRoutes } from '../github/routes.js';
|
|
import { registerGitRoutes } from '../git/routes.js';
|
|
import { registerDevServerRoutes } from '../dev-servers/routes.js';
|
|
import { registerMagicPromptRoutes } from '../magic-prompts/routes.js';
|
|
import { registerSessionFoldersRoutes } from '../session-folders/routes.js';
|
|
import { registerProjectContextRoutes } from '../project-context/routes.js';
|
|
import { registerAgentMemoryRoutes } from '../agent-memory/routes.js';
|
|
import { registerSessionKnowledgeRoutes } from '../session-knowledge/routes.js';
|
|
import { registerPermissionAutoAcceptRoutes } from '../permission-auto-accept/runtime.js';
|
|
import { registerConfigEntityRoutes } from './config-entity-routes.js';
|
|
import { registerSettingsUtilityRoutes } from './core-routes.js';
|
|
import { registerProjectIconRoutes } from './project-icon-routes.js';
|
|
import { registerScheduledTaskRoutes } from '../scheduled-tasks/routes.js';
|
|
import { registerOpenChamberSessionRoutes } from '../openchamber-sessions/routes.js';
|
|
import { registerOpenChamberControlRoutes } from '../openchamber-control/routes.js';
|
|
import { registerMarkdownImageGrantRoutes } from '../markdown-image-grants/routes.js';
|
|
import { registerSkillRoutes } from './skill-routes.js';
|
|
import { registerPluginRoutes } from './plugin-routes.js';
|
|
import { getNpmInfo, clearCache as clearNpmCache } from './npm-registry.js';
|
|
import { parseNpmSpec, parsePathSpec, isExactSemver } from './plugin-spec.js';
|
|
import { registerOpenCodeRoutes } from './routes.js';
|
|
import { getProviderSources, removeProviderConfig, upsertProviderConfig } from './providers.js';
|
|
import { getAgentSources, getAgentConfig, createAgent, updateAgent, deleteAgent } from './agents.js';
|
|
import { getCommandSources, createCommand, updateCommand, deleteCommand } from './commands.js';
|
|
import { listMcpConfigs, getMcpConfig, createMcpConfig, updateMcpConfig, deleteMcpConfig } from './mcp.js';
|
|
import { listSnippets, getSnippet, createSnippet, updateSnippet, deleteSnippet, expandSnippets } from './snippets.js';
|
|
import {
|
|
listPluginEntries,
|
|
getPluginEntry,
|
|
createPluginEntry,
|
|
updatePluginEntry,
|
|
deletePluginEntry,
|
|
listPluginDirFiles,
|
|
readPluginDirFile,
|
|
writePluginDirFile,
|
|
deletePluginDirFile,
|
|
encodePluginId,
|
|
decodePluginId,
|
|
} from './plugins.js';
|
|
import { SKILL_DIR, SKILL_SCOPE, readSkillSupportingFile, writeSkillSupportingFile, deleteSkillSupportingFile } from './shared.js';
|
|
import { getSkillSources, discoverSkills, mergeDiscoveredSkills, createSkill, updateSkill, deleteSkill, renameSkill, isManagedSkillPath } from './skills.js';
|
|
import { getCuratedSkillsSources } from '../skills-catalog/curated-sources.js';
|
|
import { getCacheKey, getCachedScan, setCachedScan } from '../skills-catalog/cache.js';
|
|
import { isClawdHubSource, parseSkillRepoSource } from '../skills-catalog/source.js';
|
|
import { scanSkillsRepository } from '../skills-catalog/scan.js';
|
|
import { installSkillsFromRepository } from '../skills-catalog/install.js';
|
|
import { scanClawdHubPage } from '../skills-catalog/clawdhub/scan.js';
|
|
import { installSkillsFromClawdHub } from '../skills-catalog/clawdhub/install.js';
|
|
|
|
export const createFeatureRoutesRuntime = (dependencies) => {
|
|
const {
|
|
clientReloadDelayMs,
|
|
} = dependencies;
|
|
|
|
let quotaProviders = null;
|
|
const getQuotaProviders = async () => {
|
|
if (!quotaProviders) {
|
|
quotaProviders = await import('../quota/index.js');
|
|
}
|
|
return quotaProviders;
|
|
};
|
|
|
|
let smallModelService = null;
|
|
const getSmallModelService = async () => {
|
|
if (!smallModelService) {
|
|
smallModelService = await import('../small-model/index.js');
|
|
}
|
|
return smallModelService;
|
|
};
|
|
|
|
let walkthroughService = null;
|
|
const getWalkthroughService = async () => {
|
|
if (!walkthroughService) {
|
|
const [service, pullRequest] = await Promise.all([
|
|
import('../walkthrough/index.js'),
|
|
import('../walkthrough/pull-request.js'),
|
|
]);
|
|
walkthroughService = { ...service, getPullRequestDiff: pullRequest.getPullRequestDiff };
|
|
}
|
|
return walkthroughService;
|
|
};
|
|
|
|
const registerRoutes = async (app, routeDependencies) => {
|
|
const {
|
|
crypto,
|
|
fs,
|
|
os,
|
|
path,
|
|
fsPromises,
|
|
spawn,
|
|
resolveGitBinaryForSpawn,
|
|
createFsSearchRuntime,
|
|
openchamberDataDir,
|
|
openchamberUserConfigRoot,
|
|
normalizeDirectoryPath,
|
|
resolveProjectDirectory,
|
|
resolveOptionalProjectDirectory,
|
|
validateDirectoryPath,
|
|
readCustomThemesFromDisk,
|
|
refreshOpenCodeAfterConfigChange,
|
|
getOpenCodeResolutionSnapshot,
|
|
getOpenCodeUpgradeCapability,
|
|
formatSettingsResponse,
|
|
readSettingsFromDisk,
|
|
readSettingsFromDiskMigrated,
|
|
persistSettings,
|
|
sanitizeProjects,
|
|
sanitizeSkillCatalogs,
|
|
isUnsafeSkillRelativePath,
|
|
buildOpenCodeUrl,
|
|
getOpenCodeAuthHeaders,
|
|
getOpenCodePort,
|
|
getOwnPorts,
|
|
devServerScanner,
|
|
buildAugmentedPath,
|
|
projectConfigRuntime,
|
|
projectContextRuntime,
|
|
agentMemoryRuntime,
|
|
isAgentMemoryEnabled,
|
|
sessionKnowledgeRuntime,
|
|
scheduledTasksRuntime,
|
|
scheduledTaskService,
|
|
openChamberSessionService,
|
|
openChamberControlService,
|
|
waitForOpenCodeReady,
|
|
getOpenChamberEventClients,
|
|
writeSseEvent,
|
|
emitSessionCreatedEvent,
|
|
permissionAutoAcceptRuntime,
|
|
} = routeDependencies;
|
|
|
|
registerSettingsUtilityRoutes(app, {
|
|
readCustomThemesFromDisk,
|
|
refreshOpenCodeAfterConfigChange,
|
|
clientReloadDelayMs,
|
|
});
|
|
|
|
registerPermissionAutoAcceptRoutes(app, permissionAutoAcceptRuntime);
|
|
|
|
registerOpenCodeRoutes(app, {
|
|
crypto,
|
|
clientReloadDelayMs,
|
|
getOpenCodeResolutionSnapshot,
|
|
getOpenCodeUpgradeCapability,
|
|
formatSettingsResponse,
|
|
readSettingsFromDisk,
|
|
readSettingsFromDiskMigrated,
|
|
persistSettings,
|
|
sanitizeProjects,
|
|
validateDirectoryPath,
|
|
resolveProjectDirectory,
|
|
getProviderSources,
|
|
removeProviderConfig,
|
|
upsertProviderConfig,
|
|
refreshOpenCodeAfterConfigChange,
|
|
buildOpenCodeUrl,
|
|
getOpenCodeAuthHeaders,
|
|
});
|
|
|
|
registerProjectIconRoutes(app, {
|
|
fsPromises,
|
|
path,
|
|
crypto,
|
|
openchamberDataDir,
|
|
sanitizeProjects,
|
|
readSettingsFromDiskMigrated,
|
|
persistSettings,
|
|
createFsSearchRuntime,
|
|
spawn,
|
|
resolveGitBinaryForSpawn,
|
|
});
|
|
|
|
registerScheduledTaskRoutes(app, {
|
|
readSettingsFromDiskMigrated,
|
|
sanitizeProjects,
|
|
projectConfigRuntime,
|
|
scheduledTasksRuntime,
|
|
scheduledTaskService,
|
|
getOpenChamberEventClients,
|
|
writeSseEvent,
|
|
});
|
|
|
|
registerOpenChamberSessionRoutes(app, {
|
|
readSettingsFromDiskMigrated,
|
|
sanitizeProjects,
|
|
validateDirectoryPath,
|
|
buildOpenCodeUrl,
|
|
getOpenCodeAuthHeaders,
|
|
waitForOpenCodeReady,
|
|
emitSessionCreatedEvent,
|
|
sessionService: openChamberSessionService,
|
|
});
|
|
|
|
registerOpenChamberControlRoutes(app, { controlService: openChamberControlService });
|
|
|
|
registerMarkdownImageGrantRoutes(app, {
|
|
fsPromises,
|
|
path,
|
|
os,
|
|
crypto,
|
|
validateDirectoryPath,
|
|
buildOpenCodeUrl,
|
|
getOpenCodeAuthHeaders,
|
|
});
|
|
|
|
registerConfigEntityRoutes(app, {
|
|
resolveProjectDirectory,
|
|
resolveOptionalProjectDirectory,
|
|
refreshOpenCodeAfterConfigChange,
|
|
clientReloadDelayMs,
|
|
getAgentSources,
|
|
getAgentConfig,
|
|
createAgent,
|
|
updateAgent,
|
|
deleteAgent,
|
|
getCommandSources,
|
|
createCommand,
|
|
updateCommand,
|
|
deleteCommand,
|
|
listMcpConfigs,
|
|
getMcpConfig,
|
|
createMcpConfig,
|
|
updateMcpConfig,
|
|
deleteMcpConfig,
|
|
listSnippets,
|
|
getSnippet,
|
|
createSnippet,
|
|
updateSnippet,
|
|
deleteSnippet,
|
|
expandSnippets,
|
|
});
|
|
|
|
registerPluginRoutes(app, {
|
|
resolveOptionalProjectDirectory,
|
|
refreshOpenCodeAfterConfigChange,
|
|
clientReloadDelayMs,
|
|
listPluginEntries,
|
|
getPluginEntry,
|
|
createPluginEntry,
|
|
updatePluginEntry,
|
|
deletePluginEntry,
|
|
listPluginDirFiles,
|
|
readPluginDirFile,
|
|
writePluginDirFile,
|
|
deletePluginDirFile,
|
|
encodePluginId,
|
|
decodePluginId,
|
|
getNpmInfo,
|
|
parseNpmSpec,
|
|
parsePathSpec,
|
|
isExactSemver,
|
|
});
|
|
|
|
const { getProfiles, getProfile } = await import('../git/index.js');
|
|
|
|
registerSkillRoutes(app, {
|
|
fs,
|
|
path,
|
|
os,
|
|
resolveProjectDirectory,
|
|
resolveOptionalProjectDirectory,
|
|
readSettingsFromDisk,
|
|
sanitizeSkillCatalogs,
|
|
isUnsafeSkillRelativePath,
|
|
refreshOpenCodeAfterConfigChange,
|
|
clientReloadDelayMs,
|
|
buildOpenCodeUrl,
|
|
getOpenCodeAuthHeaders,
|
|
getOpenCodePort,
|
|
getSkillSources,
|
|
discoverSkills,
|
|
mergeDiscoveredSkills,
|
|
createSkill,
|
|
updateSkill,
|
|
deleteSkill,
|
|
renameSkill,
|
|
isManagedSkillPath,
|
|
readSkillSupportingFile,
|
|
writeSkillSupportingFile,
|
|
deleteSkillSupportingFile,
|
|
SKILL_SCOPE,
|
|
SKILL_DIR,
|
|
getCuratedSkillsSources,
|
|
getCacheKey,
|
|
getCachedScan,
|
|
setCachedScan,
|
|
parseSkillRepoSource,
|
|
scanSkillsRepository,
|
|
installSkillsFromRepository,
|
|
scanClawdHubPage,
|
|
installSkillsFromClawdHub,
|
|
isClawdHubSource,
|
|
getProfiles,
|
|
getProfile,
|
|
});
|
|
|
|
registerQuotaRoutes(app, { getQuotaProviders });
|
|
registerSmallModelRoutes(app, { getSmallModelService });
|
|
registerWalkthroughRoutes(app, { getWalkthroughService });
|
|
registerSessionGoalRoutes(app);
|
|
registerGitHubRoutes(app);
|
|
registerGitRoutes(app);
|
|
registerDevServerRoutes(app, { scanner: devServerScanner, getOwnPorts });
|
|
registerMagicPromptRoutes(app, {
|
|
fsPromises,
|
|
path,
|
|
openchamberDataDir,
|
|
});
|
|
registerProjectContextRoutes(app, { projectContextRuntime });
|
|
registerAgentMemoryRoutes(app, { agentMemoryRuntime, isAgentMemoryEnabled });
|
|
registerSessionKnowledgeRoutes(app, { sessionKnowledgeRuntime });
|
|
|
|
registerSessionFoldersRoutes(app, {
|
|
fsPromises,
|
|
path,
|
|
openchamberDataDir,
|
|
});
|
|
registerFsRoutes(app, {
|
|
os,
|
|
path,
|
|
fsPromises,
|
|
spawn,
|
|
crypto,
|
|
normalizeDirectoryPath,
|
|
resolveProjectDirectory,
|
|
buildAugmentedPath,
|
|
resolveGitBinaryForSpawn,
|
|
openchamberUserConfigRoot,
|
|
});
|
|
};
|
|
|
|
return {
|
|
registerRoutes,
|
|
};
|
|
};
|