Repository navigation
refactor: rename the Workspace concept to Project - #5206
Conversation
🦋 Changeset detectedLatest commit: 7317d09 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
commit: |
5bf654a to
603d3c5
Compare
603d3c5 to
7ae95ee
Compare
7ae95ee to
a8b526a
Compare
a8b526a to
e2b0a03
Compare
e2b0a03 to
6ce7e5d
Compare
6ce7e5d to
6d4b884
Compare
6d4b884 to
713319a
Compare
713319a to
8e856fc
Compare
8e856fc to
6aa20cb
Compare
c96903f to
1b433e0
Compare
0a6aa0a to
2c9804b
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
2c9804b to
b40e87b
Compare
The index mirror and the projector computed a workspace's session counts separately. The extra agent profile loader takes its config after the directories, so that its parameter list no longer repeats the explicit loader's. The rename that follows would otherwise make both fragments count as new duplicates.
agent-core-v2 now names the project the way the domain model does. The persisted project entity, the per-project layer under src/workspace (now src/project) and the session's view of its project carry the Project name. The change is mechanical. The type checker renames 104 top-level declarations and the 30 parameters typed with them; 106 files move (80 source, 26 test) and 443 import specifiers in 129 files follow them. The other packages change only their imports and type references, and klient re-exports the renamed types under their old public names. The state-manifest generator now names each scope's state service, so the regenerated state and config manifests differ only in source paths and type names inside comments. The wire manifest and the KAP contract are byte-identical. Kept as they are: - every string: DI ids, state keys, event types, error codes, the [workspace] config section and its fields, environment variables, storage names, telemetry event names, KAP paths and fields; - member names such as workspaceId, local variables and test-local declarations; - the session's workspace context and the tools' access roots, which hold the directories a session's tools may reach, not the project; - names tied to persisted or external values: the legacy workspaces.json shape and key, the trust config section and environment variable, the workspace_dirs_change reminder variant and the workspace skill source id; - workspaceRootKey, a path key shared by project roots, working directories and additional directories, and three names whose workspace means something else (the Tower checkout, the [environments] section, the workspaces.json migration record); - the scope wording of the state manifest.
b40e87b to
7317d09
Compare
MoonshotAI#5204 needs the layered project port, MoonshotAI#5206 is the Workspace -> Project rename, and MoonshotAI#5292 imports the projectSessions paths both create. Keep them in dependency order rather than applying 189/320-file patches wholesale.
…equivalent Register the deliberate naming deviation in PLAYBOOK and close the rename row as equivalent. MoonshotAI#5204/MoonshotAI#5292 are adapted to workspace semantics instead of importing upstream's project paths.
Reverse the earlier Workspace-as-fork-term verdict: files and symbols follow upstream's Project rename, while fork-only features stay. Record the preservation list and reopen the row for the mechanical port.
…oonshotAI#5206) Apply the file-move layer of the upstream Workspace -> Project rename: 95 modules and their tests move to the project paths (app/project, project/projectFs, project/projectInstance, project/sessionLifecycle and the rest), and every alias and relative import follows. The structural files that upstream deletes and recreates (project.ts, projectEvents.ts, projectContext, projectInstanceManager, projectTrust/configSection, projectState, the profile-loader barrel) move with them. Symbols still carry their Workspace names; the declaration rename is the next batch. Verified: agent-core-v2 typecheck clean, the moved project suites 107 pass / 3 skip, check:no-comments OK.
…onshotAI#5206) Apply the declaration half of the upstream rename: the 40 exported Workspace* symbols and their references become Project*, together with the engine imports. The upstream preservation list stays untouched: DI ids, state keys, event/error strings, workspaceId, workspaceRootKey, the persisted workspace formats and the fork's test-local helpers. Verified: agent-core-v2 typecheck clean, the project suites 440 pass / 5 skip, check:no-comments OK.
Rename the remaining engine type references in klient, node-sdk, kap-server, acp-server, migration-legacy, product and the apps. klient keeps its public Workspace/WorkspaceUpdate aliases; the preserved strings (DI ids, KAP fields, config sections, workspaceId/workspaceRootKey) stay. The bare Workspace/Kind/Create/Update/Instance types become Project*, the state and config manifests are regenerated, and the engine AGENTS/DEVELOP wording follows. Verified: the affected packages typecheck clean; project 440, kap sessions/workspaces 163, node-sdk list-sessions, acp lifecycle and CLI print tests pass; check:no-comments OK.
Engine and consumer packages now use the upstream Project names while keeping klient's public aliases and the preserved protocol strings.
Requirement or Bug
这组改动的领域模型是:项目(Project)是会话和信任的归属,有主目录和附加目录;会话属于一个项目,记录自己的工作目录。agent-core-v2 的代码里一直把项目叫作 Workspace,和产品、文档里的「项目」对不上。这个 PR 把代码里的 Workspace 概念改名为 Project。它基于已合入的 #5204,只做机械改名,不改任何行为。
Bug Reproduction Steps
N/A,机械改名。
Root Cause
N/A,不是缺陷修复。
Code Changes
改名由一份映射表驱动的 codemod 完成(映射表不在仓库里,下面的改名清单就是它的内容):按符号改名(TypeScript 编译器的引用改写)、移动文件并改写导入路径、少量文本替换,最后重新生成三份清单。codemod 在改名后的提交上再跑一次没有任何变化。
三个提交:
refactor(agent-core-v2): share the session count update:一个不改行为的小去重。会话索引的镜像和投影各自算一遍项目的会话计数,抽成sessionIndexModel.ts里的一个函数;extra agent 加载器的构造参数把 config 挪到目录之后。这两处是 main 上已有的重复片段,改名会改掉片段里的标识符,重复检查就会把它们算成新增,所以先消掉。refactor: rename the Workspace concept to Project:机械改名。chore: add a changeset for the Project rename。改名的规模:
app/workspace/*移到app/project/*,workspace/*移到project/*,features/skill/workspace/*移到features/skill/project/*,导入路径随之改写。scripts/checks/baselines/oxlint-ratchet.json的键跟着文件路径改名,计数不变。SCOPES每项带上自己的状态服务名,FEATURES_RECEIVER_SCOPE由它推导,不再另存一份名单;清单头部和分节注释里的接口名改成IProjectStateService。packages/agent-core-v2/AGENTS.md里的标识符和一句中文跟着改名。明确不改的:
[workspace]段、projects.json 的字段、KAP 的workspace_id等字段和路由,以及PersistedWorkspaceFile、LEGACY_WORKSPACES_KEY、WORKSPACE_TRUST_SECTION、TRUST_WORKSPACE_ENV、trustWorkspaceEnvTrusted、WORKSPACE_DIRS_CHANGE_VARIANT、WORKSPACE_ROOT_SKILL_SOURCE_ID这些名字。createDecorator('workspaceService'))、状态键、事件名、错误码、配置键。debug RPC 和 klient 按字符串调用服务,所以这些都不能动。workspaceId字段):很多会被序列化或按名字远程调用,类型检查证明不了改名安全,留到之后单独处理。ISessionWorkspaceContext等):它管的是会话的工具能访问哪些目录,也就是工作目录加项目的附加目录,和环境的访问根(environmentWorkspaceView等)是同一个概念,不是项目,所以和访问根一起保留原名。as保住公开的Workspace、WorkspaceUpdate类型名。workspaceRootKey,以及另外 3 个指别的东西的名字。改名清单(104 个名字)
src/_base/utils/paths.ts:canonicalWorkspaceRoot→canonicalProjectRootsrc/agent/changeNotifier/changeNotifierService.ts:diffWorkspaceDirs→diffProjectDirs,WorkspaceDirsChanges→ProjectDirsChanges,workspaceDirsChangeText→projectDirsChangeText,WorkspacePrimaryChange→ProjectPrimaryChangesrc/app/sessionIndex/sessionIndexModel.ts:SessionWorkspaceCounts→SessionProjectCountssrc/app/sessionIndex/sessionIndexService.ts:samePrimaryByWorkspace→samePrimaryByProjectsrc/app/sessionIndex/sessionIndexSource.ts:listWorkspaceIds→listProjectIdssrc/app/telemetry/events.ts:WorkspaceTrustChangedEvent→ProjectTrustChangedEvent,WorkspaceTrustReadFailedEvent→ProjectTrustReadFailedEventsrc/app/workspace/errors.ts:WorkspaceErrors→ProjectErrorssrc/app/workspace/fileWorkspacePersistence.ts:FileWorkspacePersistence→FileProjectPersistence,WORKSPACE_CATALOG_SCOPE→PROJECT_CATALOG_SCOPEsrc/app/workspace/workspace.ts:IWorkspaceService→IProjectService,Workspace→Project,WorkspaceCreate→ProjectCreate,WorkspaceKind→ProjectKind,WorkspaceUpdate→ProjectUpdatesrc/app/workspace/workspaceEvents.ts:WorkspaceCreated→ProjectCreated,WorkspaceCreatedPayload→ProjectCreatedPayload,WorkspaceDeleted→ProjectDeleted,WorkspaceDeletedPayload→ProjectDeletedPayload,WorkspaceUpdated→ProjectUpdated,WorkspaceUpdatedPayload→ProjectUpdatedPayloadsrc/app/workspace/workspacePersistence.ts:IWorkspacePersistence→IProjectPersistence,PersistedWorkspaceEntry→PersistedProjectEntry,WorkspaceCatalog→ProjectCatalog,WorkspaceCatalogMutator→ProjectCatalogMutatorsrc/app/workspace/workspaceProtocol.ts:Workspace→Project,WorkspaceCreatedEvent→ProjectCreatedEvent,WorkspaceDeletedEvent→ProjectDeletedEvent,WorkspaceUpdatedEvent→ProjectUpdatedEventsrc/app/workspace/workspaceService.ts:WorkspaceService→ProjectServicesrc/app/workspaceAliases/workspaceAliases.ts:IWorkspaceAliases→IProjectAliasessrc/app/workspaceAliases/workspaceAliasesService.ts:WorkspaceAliasesService→ProjectAliasesServicesrc/app/workspaceSessions/workspaceSessions.ts:IWorkspaceSessions→IProjectSessionssrc/app/workspaceSessions/workspaceSessionsService.ts:WorkspaceSessionsService→ProjectSessionsServicesrc/features/skill/workspace/rootFileSkillSource.ts:IWorkspaceRootSkillSource→IProjectRootSkillSource,WorkspaceRootSkillSource→ProjectRootSkillSourcesrc/features/skill/workspace/workspaceSkillCatalog.ts:IWorkspaceSkillCatalog→IProjectSkillCatalogsrc/features/skill/workspace/workspaceSkillCatalogService.ts:workspaceSkillCatalogContributionsKey→projectSkillCatalogContributionsKey,workspaceSkillCatalogMergedKey→projectSkillCatalogMergedKey,WorkspaceSkillCatalogService→ProjectSkillCatalogServicesrc/session/sessionContext/sessionContext.ts:SessionWorkspaceAssociationSnapshot→SessionProjectAssociationSnapshot,snapshotSessionWorkspaceAssociation→snapshotSessionProjectAssociationsrc/session/workspaceInfo/workspaceInfo.ts:ISessionWorkspaceInfo→ISessionProjectInfo,sessionWorkspaceInfoSeed→sessionProjectInfoSeedsrc/workspace/sessionLifecycle/internal/addressing.ts:workspacePersistenceScope→projectPersistenceScopesrc/workspace/state/workspaceState.ts:IWorkspaceStateService→IProjectStateServicesrc/workspace/state/workspaceStateService.ts:WorkspaceStateService→ProjectStateServicesrc/workspace/workspaceAgentProfileLoader/workspaceAgentProfileLoader.ts:IWorkspaceAgentProfileLoader→IProjectAgentProfileLoadersrc/workspace/workspaceAgentProfileLoader/workspaceAgentProfileLoaderService.ts:WorkspaceAgentProfileLoaderService→ProjectAgentProfileLoaderServicesrc/workspace/workspaceContext/workspaceContext.ts:IWorkspaceContext→IProjectContext,workspaceContextSeed→projectContextSeed,WorkspaceMeta→ProjectMeta,WorkspaceSource→ProjectSourcesrc/workspace/workspaceDirs/workspaceDirs.ts:IWorkspaceDirs→IProjectDirs,WorkspaceAddDirInput→ProjectAddDirInput,WorkspaceAdditionalDirsResult→ProjectAdditionalDirsResultsrc/workspace/workspaceDirs/workspaceDirsService.ts:samePrimaryByWorkspace→samePrimaryByProject,workspaceDirsEphemeralDirsKey→projectDirsEphemeralDirsKey,workspaceDirsFileDirsKey→projectDirsFileDirsKey,workspaceDirsPrimaryByWorkspaceKey→projectDirsPrimaryByProjectKey,workspaceDirsRegistryDirsKey→projectDirsRegistryDirsKey,WorkspaceDirsService→ProjectDirsServicesrc/workspace/workspaceFs/fs.ts:IWorkspaceFsService→IProjectFsServicesrc/workspace/workspaceFs/fsService.ts:WorkspaceFsService→ProjectFsServicesrc/workspace/workspaceGit/workspaceGit.ts:IWorkspaceGitService→IProjectGitServicesrc/workspace/workspaceGit/workspaceGitService.ts:WorkspaceGitService→ProjectGitServicesrc/workspace/workspaceInstance/workspaceInstance.ts:WorkspaceInstance→ProjectInstance,WorkspaceInstanceLifecycle→ProjectInstanceLifecycle,WorkspaceInstanceSnapshot→ProjectInstanceSnapshotsrc/workspace/workspaceInstance/workspaceInstanceManager.ts:IWorkspaceInstanceManager→IProjectInstanceManager,WorkspaceInstanceChange→ProjectInstanceChange,WorkspaceInstanceLease→ProjectInstanceLease,WorkspaceInstanceRef→ProjectInstanceRef,WorkspaceInstancesSnapshot→ProjectInstancesSnapshotsrc/workspace/workspaceInstance/workspaceInstanceManagerService.ts:WorkspaceInstanceManager→ProjectInstanceManagersrc/workspace/workspaceInstructions/workspaceInstructions.ts:IWorkspaceInstructionsService→IProjectInstructionsService,WorkspaceInstructionsSnapshot→ProjectInstructionsSnapshotsrc/workspace/workspaceInstructions/workspaceInstructionsService.ts:workspaceInstructionsCurrentKey→projectInstructionsCurrentKey,WorkspaceInstructionsService→ProjectInstructionsServicesrc/workspace/workspaceMcp/workspaceMcp.ts:IWorkspaceMcpService→IProjectMcpServicesrc/workspace/workspaceMcp/workspaceMcpService.ts:WorkspaceMcpService→ProjectMcpServicesrc/workspace/workspaceMcpConfig/workspaceMcpConfig.ts:IWorkspaceMcpConfigService→IProjectMcpConfigServicesrc/workspace/workspaceMcpConfig/workspaceMcpConfigService.ts:WorkspaceMcpConfigService→ProjectMcpConfigServicesrc/workspace/workspaceTrust/configSection.ts:DEFAULT_WORKSPACE_TRUST_CONFIG→DEFAULT_PROJECT_TRUST_CONFIG,WorkspaceTrustConfig→ProjectTrustConfig,WorkspaceTrustConfigSchema→ProjectTrustConfigSchema,workspaceTrustRequired→projectTrustRequiredsrc/workspace/workspaceTrust/trustDisclosure.ts:IWorkspaceTrustDisclosure→IProjectTrustDisclosuresrc/workspace/workspaceTrust/trustDisclosureService.ts:WorkspaceTrustDisclosureService→ProjectTrustDisclosureServicesrc/workspace/workspaceTrust/trustRecord.ts:deleteWorkspaceTrust→deleteProjectTrust,migrateWorkspaceTrust→migrateProjectTrust,readWorkspaceTrust→readProjectTrust,writeWorkspaceTrust→writeProjectTrustsrc/workspace/workspaceTrust/workspaceTrust.ts:IWorkspaceTrust→IProjectTrust,WorkspaceTrustChange→ProjectTrustChangesrc/workspace/workspaceTrust/workspaceTrustService.ts:WorkspaceTrustService→ProjectTrustService,workspaceTrustTrustedKey→projectTrustTrustedKeysrc/workspace/workspaceTrust/workspaceTrustStore.ts:IWorkspaceTrustEntry→IProjectTrustEntry,IWorkspaceTrustStore→IProjectTrustStore,WorkspaceTrustEntry→ProjectTrustEntry,WorkspaceTrustStore→ProjectTrustStoreBehavior Changes and Affected Users
没有行为变化。
packages/kap-server/schema/contract.txt和wire-manifest.d.ts逐字节不变;config-manifest.toml只有 4 行注释里的源码路径变了,state-manifest.d.ts只有 15 行里的注释变了(源码路径和IProjectStateService等类型名,其中一处是声明行末尾的行内注释),声明本身没有变化。packages/kap-server/docs/kap.md和packages/node-sdk/src/index.ts没有改动。依赖 agent-core-v2 深路径导入的代码(app/workspace/*、workspace/*等)需要换成新路径,仓库内的调用方都已改好。验证
e6b16c44d5,本机通过了完整的pnpm lint、pnpm run check:duplication origin/main(0 新增克隆)、11 个非app-*包与 CLI/测试套件的tsc --noEmit、桌面端typecheck,以及 kap-server、acp-server、klient、agent-core-v2(app/project、app/sessionIndex、project)和 node-sdk 共 30 个测试文件、873 条用例。packages/kap-server/schema/contract.txt、openapi.json和packages/node-sdk/src/index.ts无差异。2679368ca(在 feat: group implicit projects by git repository #5204 上)时,CI 全部通过,Codex 评审未提出问题;更早基底b5da9bcb1上在改名前后各跑过一遍全量测试并逐项比对,行为一致。这是机械改名,共 221 个文件,+1,924/−1,907 行。
Checklist
/approve).gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.