GeezerVison is showing github.com — feat(sdk): consolidate project services into SDK (#111) · modelstudioai/OpenAgentPack@0084ddc
File treeExpand file treeCollapse file tree Open diff view settings Some content is hiddenLarge Commits have some content hidden by default. Use the searchbox below for content that may be hidden. Dismiss bannerExpand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: .changeset/config.json +1-9Lines changed: 1 addition & 9 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 2 | 2 | | 3 | 3 | "changelog": "@changesets/cli/changelog", | 4 | 4 | "commit": false, | 5 | | - "fixed": [ | 6 | | - [ | 7 | | - "@openagentpack/sdk", | 8 | | - "@openagentpack/project-versions", | 9 | | - "@openagentpack/project-workspace", | 10 | | - "@openagentpack/playground", | 11 | | - "@openagentpack/cli" | 12 | | - ] | 13 | | - ], | | 5 | + "fixed": [["@openagentpack/sdk", "@openagentpack/playground", "@openagentpack/cli"]], | 14 | 6 | "linked": [], | 15 | 7 | "access": "public", | 16 | 8 | "baseBranch": "main", | |
Collapse file Copy file name to clipboardExpand all lines: .dependency-cruiser.cjs +12-23Lines changed: 12 additions & 23 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -20,22 +20,25 @@ module.exports = { | 20 | 20 | severity: "error", | 21 | 21 | comment: "@openagentpack/sdk is the shared engine and must not depend on host packages or applications.", | 22 | 22 | from: { path: "^packages/sdk/" }, | 23 | | - to: { path: "^(packages/cli|apps/server|apps/webui)/" }, | | 23 | + to: { path: "^(packages/cli|packages/playground|apps/server|apps/webui)/" }, | 24 | 24 | }, | 25 | 25 | { | 26 | | - name: "no-project-versions-to-hosts-or-apps", | | 26 | + name: "no-sdk-core-to-project-services", | 27 | 27 | severity: "error", | 28 | 28 | comment: | 29 | | - "@openagentpack/project-versions is a shared Node engine and must not depend on host packages or applications.", | 30 | | - from: { path: "^packages/project-versions/" }, | 31 | | - to: { path: "^(packages/cli|packages/playground|apps/server|apps/webui)/" }, | | 29 | + "Core SDK modules must not pull Node project services into the default entry or create dependency cycles.", | | 30 | + from: { | | 31 | + path: "^packages/sdk/src/", | | 32 | + pathNot: "^packages/sdk/src/(internal/project-(versions|workspace)/|project-(versions|workspace)\\.ts$)", | | 33 | + }, | | 34 | + to: { path: "^packages/sdk/src/(internal/project-(versions|workspace)/|project-(versions|workspace)\\.ts$)" }, | 32 | 35 | }, | 33 | 36 | { | 34 | | - name: "no-project-workspace-to-hosts-or-apps", | | 37 | + name: "no-project-versions-to-workspace", | 35 | 38 | severity: "error", | 36 | | - comment: "@openagentpack/project-workspace is a shared Node engine and must not depend on hosts or applications.", | 37 | | - from: { path: "^packages/project-workspace/" }, | 38 | | - to: { path: "^(packages/cli|packages/playground|apps/server|apps/webui)/" }, | | 39 | + comment: "Snapshot storage must remain independent of the directory workspace adapter.", | | 40 | + from: { path: "^packages/sdk/src/(internal/project-versions/|project-versions\\.ts$)" }, | | 41 | + to: { path: "^packages/sdk/src/(internal/project-workspace/|project-workspace\\.ts$)" }, | 39 | 42 | }, | 40 | 43 | { | 41 | 44 | name: "no-sdk-deep-imports", | @@ -57,20 +60,6 @@ module.exports = { | 57 | 60 | from: { path: "^apps/webui/src/" }, | 58 | 61 | to: { path: "^packages/sdk/" }, | 59 | 62 | }, | 60 | | - { | 61 | | - name: "no-webui-project-versions-runtime-import", | 62 | | - severity: "error", | 63 | | - comment: "Browser-facing code must use Workbench APIs instead of importing the Node-only version engine.", | 64 | | - from: { path: "^apps/webui/src/" }, | 65 | | - to: { path: "^packages/project-versions/" }, | 66 | | - }, | 67 | | - { | 68 | | - name: "no-webui-project-workspace-runtime-import", | 69 | | - severity: "error", | 70 | | - comment: "Browser-facing code must use Workbench APIs instead of importing the Node-only workspace engine.", | 71 | | - from: { path: "^apps/webui/src/" }, | 72 | | - to: { path: "^packages/project-workspace/" }, | 73 | | - }, | 74 | 63 | ], | 75 | 64 | options: { | 76 | 65 | doNotFollow: { | |
Collapse file Copy file name to clipboardExpand all lines: .github/workflows/ci.yml +1-3Lines changed: 1 addition & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 64 | 64 | - node: 24 | 65 | 65 | scope: all | 66 | 66 | # Library smoke on the SDK engines floor (>=18.17.0): build and install | 67 | | - # sdk, project-versions, and project-workspace; cli/playground require Node >=22. | | 67 | + # SDK and its project subpaths; cli/playground require Node >=22. | 68 | 68 | - node: 18.17.0 | 69 | 69 | scope: sdk | 70 | 70 | - node: 20 | | 86 | 86 | - if: matrix.scope == 'sdk' | 87 | 87 | run: | | 88 | 88 | bun run build:sdk | 89 | | - bun run build:project-versions | 90 | | - bun run build:project-workspace | 91 | 89 | bun scripts/release/smoke-packed.ts --sdk-only | 92 | 90 |
| 93 | 91 | gate: | |
Collapse file Copy file name to clipboardExpand all lines: README.md +2-2Lines changed: 2 additions & 2 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -179,10 +179,10 @@ The [`examples/`](./examples) directory has runnable configs for every provider, | 179 | 179 |
| 180 | 180 | ## Using the SDK | 181 | 181 |
| 182 | | -Cloud runtime capabilities are available from `@openagentpack/sdk`. Directory compilation, Build/Publish, and full-tree versions are exposed by `@openagentpack/project-workspace`, backed by the storage primitives in `@openagentpack/project-versions`: | | 182 | +Cloud runtime capabilities are available from `@openagentpack/sdk`. The same npm package includes Node-only subpaths: `@openagentpack/sdk/project-workspace` provides directory compilation, Build/Publish, and full-tree versions, backed by the storage primitives in `@openagentpack/sdk/project-versions`: | 183 | 183 |
| 184 | 184 | ```ts | 185 | | -import { previewProjectBuild, commitProjectBuild } from "@openagentpack/project-workspace"; | | 185 | +import { previewProjectBuild, commitProjectBuild } from "@openagentpack/sdk/project-workspace"; | 186 | 186 |
| 187 | 187 | const preview = await previewProjectBuild("./my-agent"); | 188 | 188 | const build = await commitProjectBuild({ | |
Collapse file Copy file name to clipboardExpand all lines: README.zh-CN.md +2-2Lines changed: 2 additions & 2 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -175,11 +175,11 @@ Beta 用户可以安装 `@openagentpack/cli@beta`;固定版本及切回稳定 | 175 | 175 |
| 176 | 176 | ## 使用 SDK | 177 | 177 |
| 178 | | -云端项目运行能力可通过 `@openagentpack/sdk` 以编程方式调用;仅限 Node.js 的本地项目版本能力由独立包 `@openagentpack/project-versions` 提供: | | 178 | +云端项目运行能力可通过 `@openagentpack/sdk` 以编程方式调用;本地版本和目录项目能力随同一个 SDK 包发布,分别通过仅限 Node.js 的 `@openagentpack/sdk/project-versions`、`@openagentpack/sdk/project-workspace` 子路径调用: | 179 | 179 |
| 180 | 180 | ```ts | 181 | 181 | import { resolveProjectConfig, planProjectContext } from "@openagentpack/sdk"; | 182 | | -import { createProjectVersionService } from "@openagentpack/project-versions"; | | 182 | +import { createProjectVersionService } from "@openagentpack/sdk/project-versions"; | 183 | 183 |
| 184 | 184 | const config = await resolveProjectConfig({ configPath: "agents.yaml" }); | 185 | 185 | const plan = await planProjectContext(config); | |
Collapse file Copy file name to clipboardExpand all lines: apps/server/package.json -2Lines changed: 0 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 16 | 16 | }, | 17 | 17 | "dependencies": { | 18 | 18 | "@hono/zod-openapi": "^1.4.0", | 19 | | - "@openagentpack/project-versions": "workspace:*", | 20 | | - "@openagentpack/project-workspace": "workspace:*", | 21 | 19 | "@openagentpack/sdk": "workspace:*", | 22 | 20 | "chokidar": "^4.0.3", | 23 | 21 | "hono": "^4.12.28", | |
Collapse file Copy file name to clipboardExpand all lines: apps/server/src/routes/project.ts +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | import { createRoute, OpenAPIHono, z } from "@hono/zod-openapi"; | | 2 | +import { planAgentResourcesWithStateBackend, syncAgentResourcesWithStateBackend } from "@openagentpack/sdk"; | 2 | 3 | import { | 3 | 4 | acquireDirectoryProjectMutation, | 4 | 5 | commitProjectBuild, | 5 | 6 | previewProjectBuild, | 6 | 7 | readValidProjectBuild, | 7 | | -} from "@openagentpack/project-workspace"; | 8 | | -import { planAgentResourcesWithStateBackend, syncAgentResourcesWithStateBackend } from "@openagentpack/sdk"; | | 8 | +} from "@openagentpack/sdk/project-workspace"; | 9 | 9 | import { errorResponses } from "@/schemas/common"; | 10 | 10 | import { | 11 | 11 | AgentApplyBodySchema, | |
Collapse file Copy file name to clipboardExpand all lines: apps/server/src/services/project-declarations.ts +7-7Lines changed: 7 additions & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | import { randomUUID } from "node:crypto"; | 2 | 2 | import { mkdir, readFile, rename, stat, unlink, writeFile } from "node:fs/promises"; | 3 | 3 | import { basename, dirname, relative, resolve } from "node:path"; | 4 | | -import { | 5 | | - acquireDirectoryProjectMutation, | 6 | | - type DirectoryResourceType, | 7 | | - FILE_AUTO_ASSOCIATION_IGNORE_FILE, | 8 | | - inspectDirectoryProject, | 9 | | - locateDirectoryProjectResource, | 10 | | -} from "@openagentpack/project-workspace"; | 11 | 4 | import { | 12 | 5 | type Diagnostic, | 13 | 6 | type ResolvedProjectConfig, | 14 | 7 | resolveProjectConfigFromObject, | 15 | 8 | validateProjectConfig, | 16 | 9 | } from "@openagentpack/sdk"; | | 10 | +import { | | 11 | + acquireDirectoryProjectMutation, | | 12 | + type DirectoryResourceType, | | 13 | + FILE_AUTO_ASSOCIATION_IGNORE_FILE, | | 14 | + inspectDirectoryProject, | | 15 | + locateDirectoryProjectResource, | | 16 | +} from "@openagentpack/sdk/project-workspace"; | 17 | 17 | import { parse, stringify } from "yaml"; | 18 | 18 | import { type ProjectRuntimeManager, projectRuntimeManager } from "@/services/project-manager"; | 19 | 19 | import { projectMutationCoordinator } from "@/services/project-mutations"; | |
Collapse file Copy file name to clipboardExpand all lines: apps/server/src/services/project-manager.ts +8-8Lines changed: 8 additions & 8 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | import { createHash } from "node:crypto"; | 2 | 2 | import { existsSync } from "node:fs"; | 3 | 3 | import { basename, resolve } from "node:path"; | 4 | | -import { | 5 | | - getProjectBuildStatus, | 6 | | - inspectDirectoryProject, | 7 | | - PROJECT_BUILD_FILE, | 8 | | - PROJECT_METADATA_FILE, | 9 | | - PROJECT_STATE_FILE, | 10 | | - resolveDirectoryProjectRuntime, | 11 | | -} from "@openagentpack/project-workspace"; | 12 | 4 | import { | 13 | 5 | type AgentWithReadiness, | 14 | 6 | type BackendRuntimeInput, | @@ -18,6 +10,14 @@ import { | 18 | 10 | type ResolvedProjectConfig, | 19 | 11 | readProjectRuntime, | 20 | 12 | } from "@openagentpack/sdk"; | | 13 | +import { | | 14 | + getProjectBuildStatus, | | 15 | + inspectDirectoryProject, | | 16 | + PROJECT_BUILD_FILE, | | 17 | + PROJECT_METADATA_FILE, | | 18 | + PROJECT_STATE_FILE, | | 19 | + resolveDirectoryProjectRuntime, | | 20 | +} from "@openagentpack/sdk/project-workspace"; | 21 | 21 | import { type FSWatcher, watch } from "chokidar"; | 22 | 22 | import { type ProjectMutationSnapshot, projectMutationCoordinator } from "@/services/project-mutations"; | 23 | 23 |
| |
Collapse file Copy file name to clipboardExpand all lines: apps/server/src/services/project-versions.ts +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -4,8 +4,8 @@ import type { | 4 | 4 | DirectoryProjectVersionStatus, | 5 | 5 | DirectoryVersionFileChange, | 6 | 6 | PreparedDirectoryProjectVersion, | 7 | | -} from "@openagentpack/project-versions"; | 8 | | -import { createDirectoryWorkspaceVersionService, inspectDirectoryProject } from "@openagentpack/project-workspace"; | | 7 | +} from "@openagentpack/sdk/project-versions"; | | 8 | +import { createDirectoryWorkspaceVersionService, inspectDirectoryProject } from "@openagentpack/sdk/project-workspace"; | 9 | 9 | import { type ProjectRuntimeManager, projectRuntimeManager } from "@/services/project-manager"; | 10 | 10 | import { projectMutationCoordinator } from "@/services/project-mutations"; | 11 | 11 |
| |
|