Skip to content

Commit 55f47e6

Browse files
committed
feat(artifact-api): update Artifact API endpoints and enhance project version handling
1 parent d4cb481 commit 55f47e6

1 file changed

Lines changed: 13 additions & 19 deletions

File tree

content/docs/concepts/north-star.mdx

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,11 @@ GET /api/v1/cloud/projects/:projectId/artifact
143143
-> { schemaVersion, projectId, versionId, commitId, checksum, metadata, functions, manifest }
144144
```
145145

146-
**Today:** the Artifact API endpoint is not yet built. Local artifacts can already
147-
be bound to projects through `sys_project.metadata.artifact_path` and resolved
148-
when a project kernel boots.
146+
**Today (M3 built):** `GET /api/v1/cloud/projects/:projectId/artifact` is live — assembles the artifact from `sys_project.metadata.artifact_path` / `artifact_paths[]`, merges metadata bundles, and returns the `ProjectArtifact` envelope with `commitId` and `checksum`. `GET /api/v1/cloud/resolve-hostname` resolves a hostname to a project id. See [packages/services/service-cloud/src/cloud-artifact-api-plugin.ts](packages/services/service-cloud/src/cloud-artifact-api-plugin.ts).
147+
**Phase 1 next step:** wire proper Project Versions so the endpoint returns `versionId` / `versionNumber` and ObjectOS can use them for ETag cache invalidation.
148+
**Future:** the same endpoint can return a redirect or signed URL pointing at an
149+
S3 object. The interface is stable; the backend swaps.
150+
149151
**Phase 1 target:** the control plane returns the Project's current Version
150152
artifact. A pinned endpoint can later return a specific immutable version:
151153
`GET /api/v1/cloud/projects/:projectId/versions/:versionId/artifact`.
@@ -158,7 +160,7 @@ S3 object. The interface is stable; the backend swaps.
158160
- Leave room in the response shape for future `{ url, expiresAt, checksum }` indirection
159161
- Be cacheable at the CDN edge (future; read-heavy by design)
160162

161-
**Status:** Not yet built. This is the biggest Missing item under §7.
163+
**Status:** M3 + D2 built. Core endpoint live; Project Versions (immutable `versionId` / `versionNumber`) are the next step (M5).
162164

163165
### <Cpu className="inline" /> ObjectOS Runtime
164166

@@ -339,7 +341,7 @@ a request to either vertex must resolve the same user/org/role. Splitting
339341
identity would require federated auth, which is out of scope.
340342

341343
**Key code anchors:**
342-
- Control-plane app (target): `apps/cloud/objectstack.config.ts` (not yet created - see ROADMAP D8)
344+
- Control-plane app (target): [apps/cloud/objectstack.config.ts](apps/cloud/objectstack.config.ts) (D8 complete)
343345
- ObjectOS app (target): [apps/server/objectstack.config.ts](apps/server/objectstack.config.ts) (currently hybrid; will be reduced to ObjectOS manifest)
344346
- Hostname -> project resolver: [packages/runtime/src/environment-registry.ts](packages/runtime/src/environment-registry.ts)
345347
- Per-project kernel factory: [packages/runtime/src/project-kernel-factory.ts](packages/runtime/src/project-kernel-factory.ts)
@@ -467,7 +469,7 @@ Subsequent requests reuse the cached artifact. Cache invalidation strategy
467469

468470
## 7. Alignment Check
469471

470-
Honest state of the platform as of 2026-04-30, **re-classified under the Phase
472+
Honest state of the platform as of 2026-05-01, **re-classified under the Phase
471473
1 code-first, version-first model**. Every future architectural decision should
472474
preserve Built, reduce Drift, and advance Missing.
473475

@@ -491,22 +493,17 @@ preserve Built, reduce Drift, and advance Missing.
491493
- **Manifest scope enum trimmed.** `ManifestSchema.scope` accepts only `cloud`, `system`, and `project` - [packages/spec/src/kernel/manifest.zod.ts](packages/spec/src/kernel/manifest.zod.ts).
492494
- **Canonical package manifest files.** Plugin/service packages now share a single `src/manifest.ts` between compile-time config and runtime registration, reducing object-list drift.
493495
- **CLI `publish` link.** The end-to-end "local JSON -> remote server" wire is alive, even though the endpoint shape is wrong - [packages/cli/src/commands/publish.ts](packages/cli/src/commands/publish.ts).
496+
- **`env_id``project_id` migration (M2).** All metadata tables (`sys_metadata`, `sys_metadata_history`, `sys_object`, `sys_view`, `sys_flow`, `sys_agent`, `sys_tool`) have been updated to use `project_id` as the partition key. Idempotent migration helper shipped at `@objectstack/metadata/migrations` - [packages/metadata/src/migrations/migrate-env-id-to-project-id.ts](packages/metadata/src/migrations/migrate-env-id-to-project-id.ts). `DatabaseLoader` filters by `project_id` - [packages/metadata/src/loaders/database-loader.ts](packages/metadata/src/loaders/database-loader.ts).
497+
- **Artifact API endpoints (M3 + D2).** `GET /api/v1/cloud/projects/:id/artifact` returns the current artifact assembled from `sys_project.metadata.artifact_path`. `POST /api/v1/cloud/projects/:id/metadata` receives compiled JSON, persists it under `<artifactRoot>/<projectId>/artifact.json`, and updates the project metadata pointer — [packages/services/service-cloud/src/cloud-artifact-api-plugin.ts](packages/services/service-cloud/src/cloud-artifact-api-plugin.ts). `GET /api/v1/cloud/resolve-hostname` resolves a hostname to a project id.
498+
- **CLI `publish` routes to project publish endpoint (D2).** `objectstack publish` now POSTs to `/api/v1/cloud/projects/:id/metadata`, accepts `--project` and `--server` flags, and returns `versionId`, `commitId`, and `checksum`[packages/cli/src/commands/publish.ts](packages/cli/src/commands/publish.ts).
499+
- **`apps/server` uses ObjectOS runtime mode (M4).** `apps/server/objectstack.config.ts` boots via `createBootStack({ runtime: { cloudUrl: ... } })`, separating the ObjectOS runtime from the control plane — [apps/server/objectstack.config.ts](apps/server/objectstack.config.ts).
500+
- **`apps/cloud` is an independent control plane (D8).** `apps/cloud/objectstack.config.ts` boots via `createBootStack({ mode: 'cloud', ... })`, running the control plane independently without the ObjectOS runtime manifest — [apps/cloud/objectstack.config.ts](apps/cloud/objectstack.config.ts).
494501

495502
### <AlertTriangle className="inline" /> Drift (Needs Cleanup)
496503

497-
- **`env_id` should not become the version or branch partition key.** In Phase 1
498-
the primary user artifact state is a Project Version owned by `project_id`;
499-
deployment target differences are runtime/deployment configuration, not
500-
metadata row partitioning. Future branches need their own first-class model
501-
rather than reusing `env_id`.
502504
- **Half-wired abstractions**: `ScopedServiceManager` and `SharedProjectPlugin`
503505
were added but their integration into the request path is incomplete. Either
504506
finish them or remove.
505-
- **`objectstack publish` uses the legacy `/api/v1/packages` endpoint.** Today
506-
it POSTs a "package" payload ([packages/cli/src/commands/publish.ts](packages/cli/src/commands/publish.ts))
507-
which is not the Phase 1 project publish endpoint. It needs to create an
508-
immutable Project Version and return `versionId`, `versionNumber`, `commitId`,
509-
and checksum.
510507
- **`ProjectKernelFactory` 直连控制面 DB 读 `sys_project` / `sys_project_credential`,绕过 Artifact API。**
511508
[packages/runtime/src/project-kernel-factory.ts](packages/runtime/src/project-kernel-factory.ts)
512509
在 boot 时直接查控制面表拿业务 DB 坐标和凭据,破坏了 §8「ObjectOS 只通过
@@ -517,9 +514,6 @@ preserve Built, reduce Drift, and advance Missing.
517514

518515
- **Project Version storage** - persist every publish as an immutable Project Version with artifact JSON or `payloadRef`, `versionId`, `versionNumber`, `commitId`, checksum, publish metadata, and summary indexes.
519516
- **Current Version pointer** - add a project-level pointer that decides which Version ObjectOS serves; rollback/promote should update this pointer without mutating Version rows.
520-
- **Project Artifact API** - `GET /api/v1/cloud/projects/:projectId/artifact` returns the current Version artifact as a single consumable blob, with content hash/ETag for cache validation; a pinned version endpoint can return a specific immutable Version.
521-
- **ObjectOS Artifact API loader** - add the production HTTP fetch source for `MetadataPlugin` and local artifact cache durability across control-plane outages.
522-
- **Project publish endpoint** - receives compiled JSON, validates with Zod, creates a Project Version, advances `current_version_id` in the simple auto-promote path, and returns `versionId`, `versionNumber`, `commitId`, and checksum.
523517
- **Studio version/artifact viewer** - browse current version, publish history, artifact envelope, version id, commit id, checksum, logs, and runtime health. No metadata editing.
524518
- **UI auto-generation** - artifact schemas -> Amis/React components without hand-wiring.
525519

0 commit comments

Comments
 (0)