Skip to content

feat(kernel): Dev Mode Plugin Protocol + full-service @objectstack/plugin-dev#610

Merged
hotlong merged 8 commits into
mainfrom
copilot/add-development-mode-plugin
Feb 11, 2026
Merged

feat(kernel): Dev Mode Plugin Protocol + full-service @objectstack/plugin-dev#610
hotlong merged 8 commits into
mainfrom
copilot/add-development-mode-plugin

Conversation

Copilot AI commented Feb 11, 2026

Copy link
Copy Markdown
Contributor
  • Protocol schema (dev-plugin.zod.ts) — 19 tests
  • Plugin implementation with 8 real service plugins
  • Code review feedback addressed
  • ALL 17+ kernel services with contract-compliant stubs:
    • Real plugins (8): ObjectQL, InMemoryDriver, AppPlugin, Auth, Security, Hono Server, REST API, Dispatcher
    • Contract-compliant dev stubs implementing interfaces from packages/spec/src/contracts/:
      • cache (Map-backed ICacheService), queue (in-memory IQueueService), job (IJobService), file-storage (IStorageService), search (ISearchService), automation (IAutomationService), graphql (IGraphQLService), analytics (IAnalyticsService), realtime (IRealtimeService), notification (INotificationService), ai (IAIService), i18n (II18nService), ui (IUIService), workflow (IWorkflowService), metadata (IMetadataService), data (IDataEngine), auth (IAuthService), security.* (permissions/RLS/masking)
  • Tests: 19 schema tests + 7 plugin tests with per-service contract assertions
  • Code review + CodeQL — no alerts

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@vercel

vercel Bot commented Feb 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
objectstack-play Ready Ready Preview, Comment Feb 11, 2026 8:29am
spec Error Error Feb 11, 2026 8:29am

Request Review

Add dev-plugin.zod.ts defining the protocol for a development-mode
plugin that automatically enables all platform services for local
simulation. Includes DevServiceOverrideSchema, DevFixtureConfigSchema,
DevToolsConfigSchema, DevPluginPreset, and DevPluginConfigSchema.

18 tests added covering all schemas and edge cases.

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot AI changed the title [WIP] Add plugin to enable all services in development mode feat(kernel): Dev Mode Plugin Protocol Feb 11, 2026
Copilot AI requested a review from hotlong February 11, 2026 06:06
@hotlong

hotlong commented Feb 11, 2026

Copy link
Copy Markdown
Collaborator

@copilot 这个需要定协议吗?还是直接帮我编写具体的插件和?

@hotlong
hotlong marked this pull request as ready for review February 11, 2026 06:32
Copilot AI review requested due to automatic review settings February 11, 2026 06:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Introduces a Kernel protocol (Zod schemas + inferred types) for configuring a development-mode plugin, enabling local “full-stack” simulation via in-memory/stubbed services and optional dev tooling.

Changes:

  • Added DevServiceOverrideSchema, DevFixtureConfigSchema, DevToolsConfigSchema, DevPluginPreset, and DevPluginConfigSchema under kernel/dev-plugin.zod.ts.
  • Added Vitest coverage for the new dev-plugin schemas and default behaviors.
  • Exported the new protocol from packages/spec/src/kernel/index.ts.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
packages/spec/src/kernel/index.ts Re-exports the new dev-plugin protocol from the Kernel barrel.
packages/spec/src/kernel/dev-plugin.zod.ts Defines the dev-mode plugin configuration protocol schemas and types.
packages/spec/src/kernel/dev-plugin.test.ts Adds validation/default tests for the new schemas.

Comment on lines +154 to +184
* This is the shape of the config object a developer passes to
* `@objectstack/plugin-dev` (or equivalent) in their stack definition.
*
* @example Minimal usage (zero-config)
* ```ts
* devPlugins: ['@objectstack/plugin-dev']
* ```
*
* @example With preset
* ```ts
* devPlugins: [
* { id: '@objectstack/plugin-dev', config: { preset: 'full' } }
* ]
* ```
*
* @example Fine-grained overrides
* ```ts
* devPlugins: [
* {
* id: '@objectstack/plugin-dev',
* config: {
* preset: 'standard',
* services: {
* auth: { enabled: true, strategy: 'mock' },
* fileStorage: { enabled: false },
* },
* fixtures: { paths: ['./fixtures/*.json'] },
* tools: { dbExplorer: true },
* }
* }
* ]

Copilot AI Feb 11, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The usage examples here show devPlugins entries like { id, config }, but ObjectStackDefinitionSchema.devPlugins currently only validates string | ManifestSchema (no {id, config} shape). Either update the stack schema to accept a typed plugin reference that can carry DevPluginConfigSchema, or adjust these examples/docs to match what the stack schema actually accepts.

Suggested change
* This is the shape of the config object a developer passes to
* `@objectstack/plugin-dev` (or equivalent) in their stack definition.
*
* @example Minimal usage (zero-config)
* ```ts
* devPlugins: ['@objectstack/plugin-dev']
* ```
*
* @example With preset
* ```ts
* devPlugins: [
* { id: '@objectstack/plugin-dev', config: { preset: 'full' } }
* ]
* ```
*
* @example Fine-grained overrides
* ```ts
* devPlugins: [
* {
* id: '@objectstack/plugin-dev',
* config: {
* preset: 'standard',
* services: {
* auth: { enabled: true, strategy: 'mock' },
* fileStorage: { enabled: false },
* },
* fixtures: { paths: ['./fixtures/*.json'] },
* tools: { dbExplorer: true },
* }
* }
* ]
* This is the shape of the configuration payload that
* `@objectstack/plugin-dev` (or equivalent) understands.
*
* The outer wiring (e.g. how a stack declares `devPlugins`) is defined
* by the stack/manifest schemas; this type only describes the plugin's
* own config object.
*
* @example Minimal usage (zero-config)
* ```ts
* const devConfig: DevPluginConfig = {};
* ```
*
* @example With preset
* ```ts
* const devConfig: DevPluginConfig = {
* preset: 'full',
* };
* ```
*
* @example Fine-grained overrides
* ```ts
* const devConfig: DevPluginConfig = {
* preset: 'standard',
* services: {
* auth: { enabled: true, strategy: 'mock' },
* fileStorage: { enabled: false },
* },
* fixtures: { paths: ['./fixtures/*.json'] },
* tools: { dbExplorer: true },
* };

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in d3635d3. Updated the doc examples to only show the plugin's own config object shape, without referencing the devPlugins: [{ id, config }] pattern that the stack schema doesn't support.

* Only services explicitly listed here override the preset defaults.
*/
services: z.record(
z.string(),

Copilot AI Feb 11, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

services is documented as "keyed by service name", but the record key schema is z.string() which allows an empty string key. Consider using a constrained key schema (e.g. .min(1) and/or a regex aligned with service identifiers) so this record form enforces the same non-empty constraint as DevServiceOverrideSchema.service.

Suggested change
z.string(),
z.string().min(1),

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in d3635d3. Changed to z.string().min(1) and added a test that verifies empty-string service keys are rejected.

Copilot AI and others added 2 commits February 11, 2026 06:39
Create the actual DevPlugin implementation that auto-configures
all platform services (ObjectQL, InMemoryDriver, Auth, Hono HTTP
server, REST API) for development mode. One-line setup replaces
manual multi-plugin wiring.

Usage: plugins: [new DevPlugin()]

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Address code review feedback: ensure all dynamically imported
optional peer dependencies are available during development.

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>

Copilot AI commented Feb 11, 2026

Copy link
Copy Markdown
Contributor Author

@copilot 这个需要定协议吗?还是直接帮我编写具体的插件和?

Both done! I've added both the protocol schema (packages/spec/src/kernel/dev-plugin.zod.ts) and the actual working plugin implementation (packages/plugins/plugin-dev/).

The @objectstack/plugin-dev package provides DevPlugin — a one-line replacement for manual multi-plugin wiring:

// Before
plugins: [
  new ObjectQLPlugin(),
  new DriverPlugin(new InMemoryDriver()),
  new AuthPlugin({ secret: '...', baseUrl: '...' }),
  new HonoServerPlugin({ port: 3000 }),
]

// After
import { DevPlugin } from '@objectstack/plugin-dev';
plugins: [new DevPlugin()]

It auto-configures ObjectQL, InMemoryDriver, Auth, Hono HTTP server, and REST API. All peer dependencies are optional — missing packages are silently skipped. Services can be individually disabled via services: { auth: false }.

See commits b3304ad and 4f5f0da.

@hotlong

hotlong commented Feb 11, 2026

Copy link
Copy Markdown
Collaborator

@copilot 我的意思是这个开发模式,可以模拟所有的内核服务。进入一个全功能的API开发环境,比如我可以修改和保存视图。

…onment

- Add AppPlugin integration to register project metadata (objects, views, dashboards)
- Add REST API plugin via createRestApiPlugin (metadata read/write endpoints)
- Add Dispatcher plugin (auth, GraphQL, analytics, packages, storage, automation)
- Add `stack` option to DevPluginOptions for loading project metadata
- Fix DevPluginConfigSchema doc examples per reviewer feedback
- Add z.string().min(1) constraint on service record keys
- Add test for empty service key rejection
- Update README with full API endpoint documentation

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>

Copilot AI commented Feb 11, 2026

Copy link
Copy Markdown
Contributor Author

@copilot 我的意思是这个开发模式,可以模拟所有的内核服务。进入一个全功能的API开发环境,比如我可以修改和保存视图。

Done in d3635d3. DevPlugin now simulates all kernel services for a full API development environment:

  1. ObjectQL + MetadataFacade — data engine + metadata registry
  2. InMemoryDriver — no database needed
  3. AppPlugin — loads project metadata (objects, views, apps, dashboards) via new stack option
  4. REST API — CRUD + metadata read/write (PUT /api/v1/meta/:type/:name for saving views)
  5. Dispatcher — auth, GraphQL, analytics, packages, storage, automation endpoints

Usage for full-stack dev with metadata:

import config from './objectstack.config';
plugins: [new DevPlugin({ stack: config })]

This gives you a complete API where you can read, modify, and save views through the metadata endpoints.

Copilot AI changed the title feat(kernel): Dev Mode Plugin Protocol feat(kernel): Dev Mode Plugin Protocol + full-service @objectstack/plugin-dev Feb 11, 2026
@hotlong

hotlong commented Feb 11, 2026

Copy link
Copy Markdown
Collaborator

@copilot 我们有十几个内部服务,比如说UI权限,自动化等等等等

- Add dev stub registration for all CoreServiceName services not covered
  by real plugins (cache, queue, job, file-storage, search, automation,
  graphql, analytics, realtime, notification, ai, i18n, ui, workflow)
- Add SecurityPlugin integration (RBAC, RLS, field masking)
- Register security sub-services as dev stubs when plugin unavailable
- Add Proxy-based createDevStub() that accepts any method call
- Add test for stub service registration and callable stubs
- Update tests: 7 tests covering full service coverage
- Add @objectstack/plugin-security as optional peer dependency
- Update README with full service coverage documentation

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>

Copilot AI commented Feb 11, 2026

Copy link
Copy Markdown
Contributor Author

@copilot 我们有十几个内部服务,比如说UI权限,自动化等等等等

Done in 4bdc0e6. DevPlugin now covers all 17 core kernel services + 3 security sub-services:

Real plugins (8): ObjectQL, InMemoryDriver, AppPlugin, Auth, SecurityPlugin (RBAC/RLS/field masking), Hono Server, REST API, Dispatcher

Auto-registered dev stubs for remaining services: cache, queue, job, file-storage, search, automation, graphql, analytics, realtime, notification, ai, i18n, ui, workflow, security.permissions, security.rls, security.fieldMasker

Every service in the kernel service map (CoreServiceName enum) is now populated. Features like UI permissions, automation, workflow, etc. won't crash — they'll get a dev stub that accepts any call and returns sensible defaults. Individual services can be disabled via services: { workflow: false }.

@hotlong

hotlong commented Feb 11, 2026

Copy link
Copy Markdown
Collaborator

@copilot 你注册的这些服务都符合协议中约定的API合约吗?API都能正常模拟调用吗?

Copilot AI and others added 2 commits February 11, 2026 07:32
… implementations

Each dev stub now implements the corresponding service contract interface
from packages/spec/src/contracts/. Services return correct types:

- cache: Map-backed get/set/delete/has/clear/stats
- queue: in-memory pub/sub with message IDs
- job: schedule/cancel/trigger/listJobs with in-memory store
- file-storage: Map-backed upload/download/delete/exists/getInfo/list
- search: in-memory full-text search returning SearchResult with hits
- automation: execute returns AutomationResult {success, durationMs}
- graphql: execute returns GraphQLResponse with data/errors
- analytics: query returns AnalyticsResult with rows/fields
- realtime: in-memory pub/sub with subscription IDs
- notification: send returns NotificationResult {success, messageId}
- ai: chat/complete return AIResult {content, model}
- i18n: Map-backed t/getTranslations/loadTranslations with interpolation
- ui: Map-backed getView/listViews/registerView/registerDashboard
- workflow: Map-backed transition/getStatus returning correct types
- metadata: Map-backed register/get/list/getObject/listObjects
- auth: handleRequest/verify returning success + dev admin user
- security.*: permissions/rls/fieldMasker with contract-correct returns

Tests verify all 17 core service stubs with contract-specific assertions.

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
…ents

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>

Copilot AI commented Feb 11, 2026

Copy link
Copy Markdown
Contributor Author

@copilot 你注册的这些服务都符合协议中约定的API合约吗?API都能正常模拟调用吗?

Fixed in cb869d9. All dev stubs now implement the corresponding service contract interface from packages/spec/src/contracts/:

Service Contract Key Behaviors
cache ICacheService get()→T|undefined, has()→boolean, stats()→CacheStats
queue IQueueService publish()→string (msgId), getQueueSize()→number
job IJobService schedule/cancel/trigger, listJobs()→string[]
file-storage IStorageService upload/download/exists→boolean, getInfo()→StorageFileInfo
search ISearchService index/search()→SearchResult {hits, totalHits}
automation IAutomationService execute()→AutomationResult {success, durationMs}
graphql IGraphQLService execute()→GraphQLResponse {data, errors}
analytics IAnalyticsService query()→AnalyticsResult {rows, fields}
notification INotificationService send()→NotificationResult {success, messageId}
i18n II18nService t() with interpolation, loadTranslations/getLocales
ui IUIService getView/listViews/registerView/registerDashboard
workflow IWorkflowService transition()→{success, currentState}, getStatus()

Tests verify each stub with contract-specific assertions (e.g. cache.has()→boolean, search.search()→{hits:[], totalHits:number}).

@hotlong
hotlong merged commit c9a1ac9 into main Feb 11, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants