openxiangda-skill-kit 2.0.0-alpha.123 → 2.0.0-alpha.125
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.
|
|
3
|
+
"version": "2.0.0-alpha.125",
|
|
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.
|
|
20
|
+
"openxiangda-devkit-core": "2.0.0-alpha.103"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"tsx": "4.23.12",
|
package/skills/manifest.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
{
|
|
5
5
|
"name": "openxiangda-v2",
|
|
6
6
|
"description": "Use when researching, designing, building, testing, or delivering an OpenXiangda 2.0 application, including anonymous public forms and other no-account external-user pages.",
|
|
7
|
-
"sha256": "
|
|
7
|
+
"sha256": "99c39264c2159b1236db8b61a58825433b3083fd996ed63e29be4298f8b8f45f"
|
|
8
8
|
}
|
|
9
9
|
]
|
|
10
10
|
}
|
|
@@ -27,6 +27,7 @@ Use this order:
|
|
|
27
27
|
3. If the workspace contains `appspec/`, the user asks to maintain requirements, or the task changes observable behavior, read [AppSpec](references/appspec.md), load the bounded index with `pnpm openxiangda spec context --json`, then select only the relevant stable ID. AppSpec is optional and never a release gate; L0 changes create no record.
|
|
28
28
|
4. Read [Architecture](references/architecture.md), assign one owner to each capability and keep ordinary CRUD on platform Data API.
|
|
29
29
|
5. For every resource or permission change, read [Data and authorization](references/data-authz.md) before editing `openxiangda.config.ts`.
|
|
30
|
+
When a custom authenticated page lets business users maintain application-role memberships or delegate that maintenance authority, also read [Frontend](references/frontend.md). Use the current-user role-management browser SDK documented there; never add actor selection, an application-owned grant table, or a proxy authorization service.
|
|
30
31
|
6. If the request mentions external users without platform accounts, anonymous or guest access, a public form/page, resumable submission, duplicate checks, public uploads, or letting a visitor read their own submissions, read [Anonymous public access](references/public-access.md). Use the declared platform contract; do not invent a guest role, public Native Data API, fingerprint identity or application-owned token.
|
|
31
32
|
7. Read [Frontend](references/frontend.md) for pages or fields and [Backend actions](references/backend.md) only for a real business action.
|
|
32
33
|
8. When the application explicitly enables standard approval, application events or notifications, read [Workflow, Events and Notification Hub](references/workflow-events.md). Keep them optional and out of ordinary CRUD.
|
|
@@ -301,4 +301,100 @@ rows or recover a dead-letter job. Rebuild/recovery are idempotent and accept an
|
|
|
301
301
|
input. Do not write `sourceCode`, canonical membership rows or relationship
|
|
302
302
|
grant rows yourself.
|
|
303
303
|
|
|
304
|
+
## Custom role-management pages
|
|
305
|
+
|
|
306
|
+
Use the current-user browser SDK when a custom desktop or mobile page must
|
|
307
|
+
maintain this application's role members. Do not create an application role
|
|
308
|
+
table, call the platform `role` controller, forward a developer token, or add a
|
|
309
|
+
NestJS endpoint that accepts a user/tenant/role from the browser.
|
|
310
|
+
|
|
311
|
+
An application or platform super administrator initializes delegation by
|
|
312
|
+
attaching one role-management grant to a business role. `manageAllRoles: true`
|
|
313
|
+
means every current application role and therefore requires
|
|
314
|
+
`managedRoleCodes: []`; otherwise list the exact role codes. Every grant must
|
|
315
|
+
include `membership.read` and may add `membership.assign`,
|
|
316
|
+
`membership.update`, `membership.revoke`, and `management.delegate`:
|
|
317
|
+
|
|
318
|
+
```ts
|
|
319
|
+
import {
|
|
320
|
+
createRoleManagementGrant,
|
|
321
|
+
loadRoleManagementCatalog,
|
|
322
|
+
} from 'openxiangda/core';
|
|
323
|
+
|
|
324
|
+
const catalog = await loadRoleManagementCatalog();
|
|
325
|
+
const managerAuthority = catalog.roleManagement.roles.find(
|
|
326
|
+
item => item.roleCode === 'business_manager',
|
|
327
|
+
);
|
|
328
|
+
|
|
329
|
+
await createRoleManagementGrant({
|
|
330
|
+
operationId: crypto.randomUUID(),
|
|
331
|
+
reason: '允许业务管理员维护场馆操作员',
|
|
332
|
+
subjectRoleCode: 'business_manager',
|
|
333
|
+
manageAllRoles: false,
|
|
334
|
+
managedRoleCodes: ['venue_operator'],
|
|
335
|
+
actions: [
|
|
336
|
+
'membership.read',
|
|
337
|
+
'membership.assign',
|
|
338
|
+
'membership.update',
|
|
339
|
+
'membership.revoke',
|
|
340
|
+
'management.delegate',
|
|
341
|
+
],
|
|
342
|
+
});
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
The platform always evaluates the current logged-in user's complete
|
|
346
|
+
application-role union. A delegated manager can pass on only role/action pairs
|
|
347
|
+
already present in that union and needs `management.delegate` for both the
|
|
348
|
+
recipient role and every managed role. It cannot manufacture an all-role grant
|
|
349
|
+
from several selected-role grants.
|
|
350
|
+
|
|
351
|
+
Build the member page only from these SDK calls:
|
|
352
|
+
|
|
353
|
+
```ts
|
|
354
|
+
import {
|
|
355
|
+
createRoleMembership,
|
|
356
|
+
listRoleMemberships,
|
|
357
|
+
searchRoleManagementUsers,
|
|
358
|
+
updateRoleMembership,
|
|
359
|
+
revokeRoleMembership,
|
|
360
|
+
} from 'openxiangda/core';
|
|
361
|
+
|
|
362
|
+
const users = await searchRoleManagementUsers({ keyword: '张' });
|
|
363
|
+
const page = await listRoleMemberships({
|
|
364
|
+
roleCode: 'venue_operator',
|
|
365
|
+
status: 'active',
|
|
366
|
+
limit: 20,
|
|
367
|
+
offset: 0,
|
|
368
|
+
});
|
|
369
|
+
|
|
370
|
+
await createRoleMembership({
|
|
371
|
+
operationId: crypto.randomUUID(),
|
|
372
|
+
reason: '张老师负责场馆日常运营',
|
|
373
|
+
userId: users.items[0]!.id,
|
|
374
|
+
roleCode: 'venue_operator',
|
|
375
|
+
scopeGrants: [],
|
|
376
|
+
});
|
|
377
|
+
|
|
378
|
+
const membership = page.items[0]!;
|
|
379
|
+
if (membership.maintainable) {
|
|
380
|
+
await updateRoleMembership(membership.id, {
|
|
381
|
+
operationId: crypto.randomUUID(),
|
|
382
|
+
reason: '调整角色有效期',
|
|
383
|
+
expectedRevision: membership.revision,
|
|
384
|
+
scopeGrants: membership.scopeGrants,
|
|
385
|
+
validFrom: null,
|
|
386
|
+
validTo: '2027-01-01T00:00:00.000Z',
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
Use `listRoleManagementGrants`, `updateRoleManagementGrant` and
|
|
392
|
+
`revokeRoleManagementGrant` for the delegation page. All updates/revocations
|
|
393
|
+
require the row's latest `revision`. On HTTP 409, reload catalog and rows; never
|
|
394
|
+
retry with a guessed revision. Every successful mutation returns an immutable
|
|
395
|
+
`receipt`; `loadAuthorizationMutationReceipt(operationId)` reads it again for
|
|
396
|
+
the same actor. Show `immutableReason` for an authenticated-user or projection
|
|
397
|
+
membership and never try to mutate it. A hidden button is only UX—the server
|
|
398
|
+
returns 403 for every undelegated role/action.
|
|
399
|
+
|
|
304
400
|
Run `pnpm openxiangda check` after every declaration or permission change.
|
|
@@ -28,6 +28,15 @@ union. Never fetch identity for the header, display role codes, add a second
|
|
|
28
28
|
identity selector, or copy Shell and
|
|
29
29
|
directory-client implementations into application source.
|
|
30
30
|
|
|
31
|
+
For a custom application role-management page, use only the typed functions in
|
|
32
|
+
`openxiangda/core`: `loadRoleManagementCatalog`, `listRoleMemberships`,
|
|
33
|
+
`searchRoleManagementUsers`, the membership mutations, and the
|
|
34
|
+
role-management-grant mutations. The catalog's `roleManagement` projection
|
|
35
|
+
drives button visibility, while the platform repeats the check for every
|
|
36
|
+
request. The “Custom role-management pages” section in
|
|
37
|
+
[Data and authorization](data-authz.md) defines the delegation and CAS
|
|
38
|
+
contract. Do not use the developer control-plane client in browser code.
|
|
39
|
+
|
|
31
40
|
The application owns the editable admin information architecture through the
|
|
32
41
|
typed `defineAdminNavigation`, `adminNavigationGroup`, `adminResourcePage`,
|
|
33
42
|
and `adminOperationPage` helpers in `openxiangda/config`. The compiler emits
|