openxiangda-skill-kit 2.0.0-alpha.92 → 2.0.0-alpha.94

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.92",
3
+ "version": "2.0.0-alpha.94",
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.73"
20
+ "openxiangda-devkit-core": "2.0.0-alpha.75"
21
21
  },
22
22
  "devDependencies": {
23
23
  "tsx": "4.23.12",
@@ -43,22 +43,39 @@ discovery, and permission logic cannot create entries. Read
43
43
  proposal is deterministic and editable; the compiler/runtime never invokes it
44
44
  or appends newly added resources later.
45
45
 
46
- For a custom admin operation page, declare the route in
47
- `openxiangda.config.ts`, import the generated `appRoutes`, and bind every route
48
- key to exactly one local React page with `defineAdminContributions` from
49
- `openxiangda/react`. Pass the result to `OpenXiangdaApplication`. Do not wrap the
50
- page in another `Shell`: the runtime registers it in the unified router and the
51
- same Shell owns its menu entry, title, history and direct-URL capability gate.
52
- Only static admin routes explicitly referenced by `frontend.admin.navigation`
53
- enter the menu. Hidden routes retain the same `capability` or
54
- `access.allOf/anyOf`, including ancestor constraints. Never add an
55
- application-owned layout, router, identity provider, permission store or a
56
- second menu store. Keep operation pages under `/admin/operations`;
57
- parameterized routes remain reachable but cannot be menu references.
46
+ Declare custom routes in `openxiangda.config.ts`, import the generated
47
+ `appRoutes`, and bind every route key to exactly one local React page with
48
+ `defineApplicationContributions` from `openxiangda/react`. Pass the result to
49
+ `OpenXiangdaApplication`. The runtime registers `surface: 'admin'` routes inside
50
+ the one platform Shell; do not wrap them in another Shell. It renders
51
+ `surface: 'user'` routes without the admin Shell so mobile/user experiences can
52
+ own their page layout without creating another router, identity provider or
53
+ permission store. Only static admin routes explicitly referenced by
54
+ `frontend.admin.navigation` enter the menu. Hidden routes retain the same
55
+ `capability` or `access.allOf/anyOf`, including ancestor constraints. Keep admin
56
+ operation pages under `/admin/operations`; parameterized routes remain
57
+ reachable but cannot be menu references. `defineAdminContributions` remains an
58
+ admin-only helper and intentionally rejects `user` routes.
59
+
60
+ This is also the whole-application composition contract: pass the resulting
61
+ `contributions` to `OpenXiangdaApplication` and let that component remain the
62
+ only owner of `BrowserRouter`, `RuntimeBoundary`, Refine, generated resource and
63
+ Workflow routes, and the admin Shell. A user page may render an independent PC
64
+ or mobile layout, but it must not add a nested router/Shell or copy generated
65
+ routes. Route parameters continue to come from React Router, and generated
66
+ capability plus ancestor access guards run before the component renders.
67
+
68
+ To expose the standard application-level todo center, add
69
+ `adminApplicationTodoCenterPage()` to an explicit admin navigation group. The
70
+ compiler generates `/admin/todos`; the same runtime exposes the independent
71
+ mobile `/m/todos` page. The page reads only the authenticated user's
72
+ Notification Hub recipient projection and deep-links to the platform-resolved
73
+ target. Do not query Notification Hub management endpoints or recreate a local
74
+ message state store.
58
75
 
59
76
  For a small business action on a generated resource page, use the typed
60
77
  `resources[resourceCode].toolbar`, `.row` or `.detail` slots accepted by
61
- `defineAdminContributions`. Declare a stable action code, label and
78
+ `defineApplicationContributions`. Declare a stable action code, label and
62
79
  capability/access expression. The render context contains only the current
63
80
  resource, already-authorized record or selection, and a bounded `refresh()`;
64
81
  it does not own CRUD, revisions, fields or authorization. Invoke a guarded Nest
@@ -84,6 +84,70 @@ Use a canonical navigation target with `PLATFORM_ROUTE`, `APP_ROUTE` or allowlis
84
84
 
85
85
  The Notification Hub resolves desktop, mobile and channel deep links. The landing page always re-runs platform authentication and Data/AuthZ/Workflow authorization.
86
86
 
87
+ To replace the standard Workflow detail page everywhere, declare both route
88
+ codes on the Workflow definition declaration. The desktop route must be an
89
+ `admin` route, the mobile route must be a `user` route, and both paths contain
90
+ exactly `:instanceId`:
91
+
92
+ ```ts
93
+ frontend: {
94
+ root: 'apps/web',
95
+ routes: [
96
+ {
97
+ code: 'purchase-detail',
98
+ path: '/admin/operations/purchases/:instanceId',
99
+ label: '采购审批详情',
100
+ surface: 'admin',
101
+ },
102
+ {
103
+ code: 'purchase-detail-mobile',
104
+ path: '/m/purchases/:instanceId',
105
+ label: '移动采购审批详情',
106
+ surface: 'user',
107
+ },
108
+ ],
109
+ },
110
+ workflows: {
111
+ definitions: [{
112
+ version: 1,
113
+ definition: purchaseApproval,
114
+ launch: { mode: 'work-center-only' },
115
+ detailRouteCode: {
116
+ desktop: 'purchase-detail',
117
+ mobile: 'purchase-detail-mobile',
118
+ },
119
+ }],
120
+ bindings: [],
121
+ activations: [],
122
+ },
123
+ ```
124
+
125
+ Bind the generated routes with `defineApplicationContributions`. Inside the
126
+ page, read `instanceId` from React Router and optional `taskId` from the query.
127
+ Use `loadWorkflowInstanceSurface`, `loadWorkflowTaskSurface` and
128
+ `loadWorkflowTimeline` from `openxiangda/core`; render only operations returned
129
+ by the Surface. The platform resolves the same declaration for desktop/mobile
130
+ work centers, Notification Hub logical messages, DingTalk cards and other
131
+ channel snapshots. Omitting `detailRouteCode` keeps the standard pages. A
132
+ declared but missing or incompatible route fails closed rather than falling
133
+ back silently.
134
+
135
+ Standard launch entry is also a platform Surface. Desktop uses
136
+ `/admin/workflows/:workflowCode/new` and mobile uses
137
+ `/m/workflows/:workflowCode/start`; both first load
138
+ `loadWorkflowLaunchSurface(workflowCode)`, then use the same durable
139
+ `saveBusinessRevision -> prepareWorkflowStart -> startWorkflow` protocol.
140
+ `custom-page` and `work-center-only` declarations do not expose the standard
141
+ launch Surface. After start, navigate through the device's standard instance
142
+ entry so the current `detailRouteCode` contract can redirect consistently.
143
+
144
+ An application-level inbox is enabled in explicit admin navigation with
145
+ `adminApplicationTodoCenterPage()`. It projects Notification Hub messages and
146
+ per-recipient interaction for the current logged-in user only; it is not the
147
+ Notification Hub management console. Use its `去处理` navigation to enter the
148
+ authorized Workflow or application page, and keep approve/reject/transfer
149
+ commands on the destination Surface.
150
+
87
151
  ## Interactive channel actions
88
152
 
89
153
  Channel callbacks enter the Notification Action Gateway. The gateway verifies tenant, environment, recipient identity, task/participant, Surface revision, operation, nonce, signature and expiry before calling Workflow.
@@ -3,7 +3,7 @@
3
3
  - Use only the workspace-pinned CLI: `pnpm openxiangda <command>`. Never invoke a bare global `openxiangda` inside a 2.0 task.
4
4
  - `appspec/` is the optional OpenXiangda 2.0 business-intent layer. Before changing observable behavior, read the bounded index with `pnpm openxiangda spec context --json`, then select only the relevant stable ID; use no ChangeSpec for L0 work, one short ChangeSpec for L1, and add permission/rollback/concurrency detail only for L2/L3. Before close, the user—not AI—confirms `currentSpec=merged` or `not-applicable`. AppSpec is advisory and never a release gate. Never read, import or migrate 1.x `openspec/` or SDD.
5
5
  - Use Vite, React Router, Refine Core and Ant Design. Do not add Umi, ProComponents or another admin shell.
6
- - Keep generated admin routes and custom actions inside the platform Shell. Bind generated `appRoutes` to local operation pages with `defineAdminContributions`, and use only its typed `toolbar`, `row` and `detail` resource slots. Declare the complete editable menu with `defineAdminNavigation` and its page/group helpers; the Shell renders only generated `adminNavigation` references and permissions only filter them. Do not create another router, menu store, layout, identity provider, permission store or copied CRUD page; route/action access uses capability or `allOf`/`anyOf`, while Data/App API authorization remains server-owned.
6
+ - Bind every generated `appRoutes` entry to its local page with `defineApplicationContributions`; desktop `admin` routes stay inside the platform Shell, while `user` routes render without an admin Shell for independent mobile/user experiences. Use only its typed `toolbar`, `row` and `detail` resource slots for generated resource actions. Declare the complete editable admin menu with `defineAdminNavigation` and its page/group helpers; the Shell renders only generated `adminNavigation` references and permissions only filter them. Do not create another router, menu store, layout, identity provider, permission store or copied CRUD page; route/action access uses capability or `allOf`/`anyOf`, while Data/App API and Workflow authorization remain server-owned.
7
7
  - Declare each resource once in `openxiangda.config.ts` with only `code`, `name`, `fields` and optional `mutationOwner`, generated/list/layout/data-policy settings. Each field owns type, label, required state, Surface flags, reference/file metadata and access. Resource codes are lower kebab-case. Use `native` for direct Data API mutations, `action`, `readonly` or `workflow` for non-Native ownership; never grant or generate Native mutation for a non-Native owner.
8
8
  - Never write resource-level `schemaVersion`, `appCode`, `schema`, `surface`, `capabilities`, `fieldPolicies` or `platform/data` modules. The compiler derives the strict DataResource, CRUD capabilities, Surface and AI Schema. The application manifest still starts with its one top-level `schemaVersion: 3`.
9
9
  - Ordinary list/get/create/update/delete, filters, export and batch operations use the platform Native Data API. Do not create Function CRUD or NestJS wrappers.
@@ -20,6 +20,6 @@
20
20
  - `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`.
21
21
  - Derive role grants with `resourceCapabilityCodes(appCode, resourceCode)`. Declare current-user rows only with `currentUserDataPolicy(...)`; do not invent operators, values or alternate current-user spellings.
22
22
  - 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.
23
- - 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. 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.
23
+ - 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.
24
24
  - 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.
25
25
  - 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.