openxiangda-skill-kit 2.0.0-alpha.100 → 2.0.0-alpha.102

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openxiangda-skill-kit",
3
- "version": "2.0.0-alpha.100",
3
+ "version": "2.0.0-alpha.102",
4
4
  "description": "Validation and deterministic packaging for OpenXiangda 2.0 AI skills.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -17,7 +17,7 @@
17
17
  "README.md"
18
18
  ],
19
19
  "dependencies": {
20
- "openxiangda-devkit-core": "2.0.0-alpha.79"
20
+ "openxiangda-devkit-core": "2.0.0-alpha.81"
21
21
  },
22
22
  "devDependencies": {
23
23
  "tsx": "4.23.12",
@@ -4,4 +4,6 @@ Keep one React application, one optional NestJS service and one platform-owned d
4
4
 
5
5
  Declare resources, routes, capabilities, row policies and operation-aware field policies once in `openxiangda.config.ts`. The compiler owns derived contracts; the root package owns Field Kit, CRUD Renderer, Shell, clients and Nest integration; the platform owns identity, authorization, data, environment Heads and deployment state.
6
6
 
7
+ The compiler alone derives the AppPackage `requiredPlatformCapabilities` closure. Each entry binds a capability `code`, exact `contractVersion` and deterministic `usageDigest` of only that capability's normalized declarations. Never write `platform.requiredCapabilities`, append requirements through a build API, edit the AppPackage or accept a feature whose status is not `available` or whose contract version differs. The platform authoritatively recomputes the closure from the sealed config and contract artifacts.
8
+
7
9
  Ordinary list, detail, create, update and delete operations go directly through Data API. Add a NestJS endpoint only for a business action that cannot be represented as CRUD. Run `pnpm openxiangda check` after every contract change.
@@ -149,8 +149,11 @@ invariants when all must hold:
149
149
  }
150
150
  ```
151
151
 
152
- `datetime-range` is always a non-empty half-open interval `[start, end)`.
153
- Adjacent values such as `[10:00, 11:00)` and `[11:00, 12:00)` do not overlap.
152
+ Every `date-range` and `datetime-range` field explicitly declares
153
+ `rangeBoundary: 'closed' | 'half-open'`. Values remain `{ start, end }`; callers
154
+ never send or override the boundary. Closed ranges allow `start <= end` and use
155
+ PostgreSQL `[]`; half-open ranges require `start < end` and use `[)`. Adjacent
156
+ half-open values such as `[10:00, 11:00)` and `[11:00, 12:00)` do not overlap.
154
157
  Use the ordinary `overlaps` query operator or a `query-empty` transaction guard;
155
158
  never add or subtract milliseconds at the boundary.
156
159
 
@@ -34,9 +34,16 @@ promote or satisfy any release gate. Use it only when the requested acceptance
34
34
  needs real role membership and browser login.
35
35
 
36
36
  Use `pnpm openxiangda status` and `pnpm openxiangda logs` without an ID for the most recent run, or pass an explicit run ID.
37
+ Treat DeploymentRun recovery as platform-authoritative. Inspect `rootFailure`,
38
+ `latestFailure`, `candidate`, `recovery` and the append-only `attempts` ledger.
39
+ Run only the published `recovery.nextCommand`; offer cancellation only when
40
+ `recovery.cancelAllowed` is true. Never infer retryability or cancellation from
41
+ status, the latest failure, or locally interpreted checkpoints.
37
42
 
38
43
  For the AI-native MCP entrypoint, `build_app` and `deployment_plan` are explicitly unsealed previews. After the user authorizes deployment, call `deploy_app` without any image coordinate; it owns the same automatic Buildx, push, digest and sealing path as the CLI.
39
44
 
40
45
  Applications with Native Data Resources automatically require `data.native-golden-crud`. If deployment returns `OPENXIANGDA_REQUIRED_CAPABILITY_UNAVAILABLE`, preserve the remediation to upgrade the platform and retry the same deploy command. Never remove the requirement, edit the AppPackage, construct a second identity path, or create Function-based CRUD.
41
46
 
47
+ All AppPackage platform requirements are compiler-derived structured entries with `code`, exact `contractVersion` and a deterministic declaration-only `usageDigest`. The target platform feature must be `available` at exactly that contract version. Applications cannot declare `platform.requiredCapabilities`, pass additional requirements to the package compiler or use the deleted string `requiredCapabilities` shape.
48
+
42
49
  After a successful test run, deploy the exact same version with `pnpm openxiangda deploy --environment production --from <test-deployment-id>`. Roll back with `pnpm openxiangda rollback --environment production --to <app-version-id>`. The platform owns durable deployment state.
@@ -69,6 +69,17 @@ operation pages under `/admin/operations`; parameterized routes remain
69
69
  reachable but cannot be menu references. `defineAdminContributions` remains an
70
70
  admin-only helper and intentionally rejects `user` routes.
71
71
 
72
+ The platform also owns admin appearance. Wrap bespoke admin content in
73
+ `OpenXiangdaAdminPage`. Ant Design components inherit the existing
74
+ `ConfigProvider`; do not create another theme provider. Use
75
+ `useOpenXiangdaTheme()` for TypeScript-rendered values such as chart colors and
76
+ the public `--oxa-color-*`, `--oxa-shadow-surface`, and
77
+ `--oxa-radius-surface` variables for custom CSS. Never hard-code white, black,
78
+ or neutral greys as admin canvas, card, border, or text colors. Application
79
+ brand and categorical colors may remain explicit only when they are not used as
80
+ structural theme colors. Verify every custom admin page in light, dark, and
81
+ follow-system modes.
82
+
72
83
  Declare application-owned login visuals with optional
73
84
  `frontend.authentication`. The only supported account contract is
74
85
  `existing-platform-users-only` with `registration.mode: 'reject'`; use exact
@@ -17,21 +17,27 @@ Use these optional modules only when the application has a real standard approva
17
17
 
18
18
  ## Workflow declaration
19
19
 
20
- Declare workflow topology and bindings once in `openxiangda.config.ts`. Use only approval, condition and end nodes for the standard module. Keep business data in Data API/App API and pass an immutable `dataRef`, business revision and bounded facts into prepare/start.
20
+ Declare workflow topology and bindings once in `openxiangda.config.ts`. Use only approval, condition and end nodes for the standard module. Every definition `inputSchema` is a closed root object (`type: 'object'`, `additionalProperties: false`). Keep business data in Data API/App API and pass the exact `{ resourceCode, id }` `dataRef`, a separate positive `dataRevision`, and bounded schema-valid facts into prepare/start. Undeclared facts and answers fail closed.
21
+
22
+ `workflows.activations` is the complete desired set for the deployed version,
23
+ not a patch list. Removing a declaration deactivates that workflow for new
24
+ starts. Every assignee provider binding uses candidate `min`/`max` defaults of
25
+ 1/200 and may not exceed 200. Application Provider callbacks accept only the
26
+ signed `openxiangda.workflow-assignee-request/v2.1` envelope, including the
27
+ business/data/version tuple and `factDigest`.
21
28
 
22
29
  Every definition declares a launch mode: `standalone` for a self-contained
23
- generated save-and-start page, `custom-page` for an application operation page,
30
+ generated durable-process page, `custom-page` for an application operation page,
24
31
  `hidden-handoff` for a non-menu handoff route, or `work-center-only` when users
25
32
  only act on existing tasks. Only `standalone` may be referenced by
26
33
  `adminWorkflowLaunchPage`; the generated browser runtime uses the workflow's
27
34
  localized definition title, so applications do not maintain code-to-title
28
- maps. A standalone page receives all durable business context through its
29
- typed save handler and URL/search contract; it must never depend on transient
30
- router location state. Work center, task and instance pages remain reachable
31
- without becoming launch menu entries. Bind the generated metadata with
32
- `defineWorkflowLaunchContributions(workflowDefinitions, handlers)`; handlers
33
- only persist the durable business revision, while generated code keeps title
34
- and launch mode authoritative.
35
+ maps. `standalone` and `hidden-handoff` receive a compiler-owned
36
+ `processOperationCode` and subject declaration. The browser submits the
37
+ platform standard process commit and persists only `commandId` in the URL; it
38
+ never owns a save callback, facts/dataRef, preparation token, or direct start.
39
+ Custom pages launch only inside a verified Named Action through
40
+ `OpenXiangdaBusinessProcessService`.
35
41
 
36
42
  Use an assignee Provider only when resolution depends on application data. The Provider returns stable Native user/role subjects and never makes the final task authorization decision.
37
43
 
@@ -39,10 +45,10 @@ The standard operations are approve, reject, return, resubmit, transfer, delegat
39
45
 
40
46
  ## Submission and concurrency
41
47
 
42
- 1. Persist the business draft through Data API/App API.
43
- 2. Bind prepare to the saved revision and all submission answers.
44
- 3. Resolve required organization/approver choices.
45
- 4. Start with a stable idempotency key distinct from the draft-save key.
48
+ 1. Commit the bounded Native mutation and Workflow intent as one durable command.
49
+ 2. Persist `commandId` in the route and reload `ProcessCommandSurface` after refresh.
50
+ 3. Answer only requirements emitted for that command revision.
51
+ 4. Let the platform worker start the pinned Workflow exactly once.
46
52
  5. Use the Surface revision/concurrency token for every command.
47
53
 
48
54
  Duplicate commands return the stored command receipt. Stale revisions fail with a structured conflict. A task/participant state transition, operation log, Workflow fact and event outbox commit atomically.
@@ -135,8 +141,8 @@ back silently.
135
141
  Standard launch entry is also a platform Surface. Desktop uses
136
142
  `/admin/workflows/:workflowCode/new` and mobile uses
137
143
  `/m/workflows/:workflowCode/start`; both first load
138
- `loadWorkflowLaunchSurface(workflowCode)`, then use the same durable
139
- `saveBusinessRevision -> prepareWorkflowStart -> startWorkflow` protocol.
144
+ `loadWorkflowLaunchSurface(workflowCode)`, verify its compiler-owned subject and
145
+ process operation, then use the standard durable process commit.
140
146
  `custom-page` and `work-center-only` declarations do not expose the standard
141
147
  launch Surface. After start, navigate through the device's standard instance
142
148
  entry so the current `detailRouteCode` contract can redirect consistently.
@@ -158,7 +164,12 @@ Use direct card actions first for approve/reject. Return, transfer, delegate and
158
164
 
159
165
  ## Event handling
160
166
 
161
- Consume typed participant/task/instance facts with durable idempotency. Order Workflow message projection by `instanceId + instanceSequence`; never assume global event order. Terminal instance facts dominate stale participant facts and update every historical message for that instance.
167
+ Consume typed participant/task/instance facts with durable idempotency. Declare
168
+ event delivery `ordering: 'workflow-instance'` when the handler requires the
169
+ platform to serialize by instance; `workflow_instance` is not an alias. Still
170
+ verify `instanceSequence` in the consumer and never assume global event order.
171
+ Terminal instance facts dominate stale participant facts and update every
172
+ historical message for that instance.
162
173
 
163
174
  For Native Data facts, the platform owns the capture plan under the exact Event
164
175
  revision, Data revision, AuthZ revision and resource tuple selected by the
@@ -14,6 +14,7 @@
14
14
  - Use the current logged-in user and the union of that user's application roles. An optional declared Perspective projects only read visibility (pages, rows and fields); create/update/delete, workflows and custom actions continue to authorize against the complete union. Standard Data API calls inherit `X-OpenXiangda-Perspective` automatically. Use `@CurrentPerspective()` only when custom Nest code reads outside the standard Data API, and apply an equivalent read projection explicitly. Business code must not persist a platform Token or authorization result and must not implement a second identity path.
15
15
  - Fields inherit the resource read/create/update capabilities. Use field `access` only to tighten them; arrays are all-of and `false` is explicit deny. There is no `write` fallback.
16
16
  - Field `type` is semantic, never a hand-authored database type. The supported catalog is exactly `text.short`, `text.long`, `text.rich`, `number.integer`, `number.decimal`, `boolean`, `date`, `time`, `datetime`, `date-range`, `datetime-range`, `option.single`, `option.multiple`, `cascade.single`, `cascade.multiple`, `user.single`, `user.multiple`, `department.single`, `department.multiple`, `resource-ref.single`, `resource-ref.multiple`, `file`, `image`, `signature`, `address`, `location`, `json`, `serial-number`, `uuid` and `subtable`. The compiler alone derives PostgreSQL columns, constraints and indexes.
17
+ - Every `date-range` and `datetime-range` field explicitly declares `rangeBoundary: 'closed' | 'half-open'`. Values remain `{ start, end }`; callers never send or override the boundary. Closed ranges allow `start <= end` and use PostgreSQL `[]`; half-open ranges require `start < end` and use `[)`.
17
18
  - Declare every custom operation capability in `authz.capabilities` with `kind: 'backend'`, then reference that same code from the operation and its allowed roles. Generated resource CRUD capabilities do not go in this catalog.
18
19
  - Build App Operation request/response schemas with `resourceRecordSchema`, `schemaRef`, `composeJsonSchema` and `composeAppOperationSchemas` from `openxiangda/config`. They project the same Resource declaration and canonical field value protocols; never import a physical toolchain package or repeat user, department, resource-reference or managed-file schemas by hand.
19
20
  - Visitor duplicate protection uses `createVisitorReservation({ duplicateMatch: { fieldCode: submittedValue }, ... })`. `duplicateMatch` is a non-empty value map, never a field-name array, and no mutable pre-read is allowed.
@@ -21,6 +22,6 @@
21
22
  - `option.*`, `user.*`, `department.*` and `resource-ref.*` values never collapse to scalar IDs. Single values store one labeled object and multiple values store object arrays. `resource-ref.*` JSON is not a foreign key, trusted target snapshot or automatically refreshed copy; current target state is read by `resourceCode` plus `value`. A resource source `labelField` must be `text.short` or `text.long`; `serial-number` is allowed in source search, description and snapshot fields, but not as the label. `location` accepts only exact WGS84 coordinates captured by DingTalk or browser geolocation; it has no manual input or `manual` source. Roles that consume directory-backed fields explicitly include `app:<app-code>:directory:read`.
22
23
  - Derive role grants with `resourceCapabilityCodes(appCode, resourceCode)`. Declare current-user rows only with `currentUserDataPolicy(...)`; do not invent operators, values or alternate current-user spellings.
23
24
  - Do not add compatibility aliases, migration branches or silent fallbacks for an earlier 2.0 alpha contract. Replace an incorrect contract and regenerate the application.
24
- - Standard Workflow and Notification Hub are optional 2.0 modules. Enable them only through the canonical `openxiangda.config.ts` declarations and generated clients; declare each Workflow launch as `standalone`, `custom-page`, `hidden-handoff` or `work-center-only`, put only self-contained standalone launch pages in navigation, and bind durable save handlers with `defineWorkflowLaunchContributions` without repeating generated titles. Desktop and mobile standard launch pages load the same canonical Workflow launch Surface. To replace Workflow detail, declare both desktop and mobile `detailRouteCode` values whose routes contain exactly `:instanceId`; Work Center, the application todo center and notification channels consume the platform-resolved paths, while every Surface and command remains server-authorized. Add the standard current-user todo page only with `adminApplicationTodoCenterPage()`; never query Notification Hub management APIs from a user page. Never depend on temporary router location state or copy 1.x workflow/message code, tables, APIs, templates or callbacks into this workspace. Keep ordinary CRUD and application-specific state machines independent of them.
25
+ - Standard Workflow and Notification Hub are optional 2.0 modules. Enable them only through canonical `openxiangda.config.ts` declarations and generated clients. `standalone`/`hidden-handoff` use the compiler-owned process operation and Durable Business Process Command; never add a browser save callback or call Workflow prepare/start directly. Custom pages launch only through a verified Named Action using `OpenXiangdaBusinessProcessService`. PC and mobile render the same `ProcessCommandSurface` independently and recover only by `commandId`. To replace Workflow detail, declare both desktop and mobile `detailRouteCode` values whose routes contain exactly `:instanceId`. Add the current-user todo page only with `adminApplicationTodoCenterPage()`; never query Notification Hub management APIs from a user page.
25
26
  - Run `pnpm openxiangda check --json` after contract changes and read `data.sealedArtifact`; check never seals, and an older `.openxiangda/build/app-package.json` is not the current check result. Use `pnpm openxiangda accept --plan <file>` only for optional real preproduction identity acceptance; it never blocks delivery. Deploy with `pnpm openxiangda deploy`, inspect with `pnpm openxiangda status` and `pnpm openxiangda logs`, and use the platform rollback command rather than mutating K3s directly.
26
27
  - AI-native clients start the workspace protocol through the same pinned binary: `pnpm exec openxiangda --mcp-stdio --cwd <workspace>`. Read `openxiangda://workspace/contracts` or call `contract_describe`; for first-time menu authoring, copy `data.adminNavigationAuthoring.suggestion.expression` once into `frontend.admin.navigation` with its listed `openxiangda/config` imports, then edit that application-owned declaration. Never treat the proposal as runtime discovery. When AppSpec is enabled, also read `openxiangda://workspace/appspec` or call `appspec_context`. Require `aiCatalog` and `aiCatalogDigest` to match the normal compiler output. This is a stdio transport mode, not another application-owned server. Never write an application MCP server, Catalog file, preview store or second authorization path.