openxiangda-cli 2.0.0-alpha.150 → 2.0.0-alpha.151

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-cli",
3
- "version": "2.0.0-alpha.150",
3
+ "version": "2.0.0-alpha.151",
4
4
  "description": "Thin application-level CLI for OpenXiangda 2.0.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -21,10 +21,10 @@
21
21
  ],
22
22
  "dependencies": {
23
23
  "@oclif/core": "4.13.3",
24
- "openxiangda-contracts": "2.0.0-alpha.77",
25
- "openxiangda-devkit-core": "2.0.0-alpha.97",
26
- "openxiangda-mcp": "2.0.0-alpha.97",
27
- "openxiangda-skill-kit": "2.0.0-alpha.119"
24
+ "openxiangda-contracts": "2.0.0-alpha.78",
25
+ "openxiangda-devkit-core": "2.0.0-alpha.98",
26
+ "openxiangda-mcp": "2.0.0-alpha.98",
27
+ "openxiangda-skill-kit": "2.0.0-alpha.120"
28
28
  },
29
29
  "devDependencies": {
30
30
  "tsx": "4.23.12",
@@ -15,7 +15,7 @@
15
15
  "@nestjs/common": "11.1.29",
16
16
  "@nestjs/core": "11.1.29",
17
17
  "@nestjs/platform-fastify": "11.1.29",
18
- "openxiangda": "2.0.0-alpha.69",
18
+ "openxiangda": "2.0.0-alpha.70",
19
19
  "reflect-metadata": "0.2.2",
20
20
  "rxjs": "7.8.2"
21
21
  },
@@ -62,7 +62,7 @@ function surface(completed = false, customDetail = false) {
62
62
  return {
63
63
  schemaVersion: 'openxiangda.workflow-surface/v2',
64
64
  protocolVersion: 'workflow_surface_v2',
65
- surfaceRevision: completed ? 'revision-2' : 'revision-1',
65
+ surfaceRevision: (completed ? 'b' : 'a').repeat(64),
66
66
  engineVersion: '2.0',
67
67
  commandToken: 'A'.repeat(43),
68
68
  commandTokenExpiresAt: '2099-08-29T09:05:00.000Z',
@@ -196,7 +196,7 @@ function surface(completed = false, customDetail = false) {
196
196
  },
197
197
  execute: {
198
198
  method: 'POST',
199
- href: '/workflow/approve',
199
+ href: `/openxiangda-api/v2/applications/${appCode}/workflow/tasks/${taskId}/commands/approve`,
200
200
  idempotencyRequired: true,
201
201
  },
202
202
  refresh: ['surface', 'timeline', 'work_center'],
@@ -226,7 +226,7 @@ function surface(completed = false, customDetail = false) {
226
226
  uiSchema: { confirmText: `确认${key}` },
227
227
  execute: {
228
228
  method: 'POST',
229
- href: `/workflow/${key}`,
229
+ href: `/openxiangda-api/v2/applications/${appCode}/workflow/tasks/${taskId}/commands/${key}`,
230
230
  idempotencyRequired: true,
231
231
  },
232
232
  refresh: ['surface', 'timeline', 'work_center'],
@@ -237,67 +237,173 @@ function surface(completed = false, customDetail = false) {
237
237
  }
238
238
 
239
239
  function timeline(completed = false) {
240
- return {
241
- engineVersion: '2.0',
242
- instanceId,
243
- flow: [
240
+ const flow = [
241
+ {
242
+ key: 'start',
243
+ nodeId: null,
244
+ kind: 'start',
245
+ title: '张三',
246
+ status: 'completed',
247
+ startedAt: '2026-08-25T01:00:00.000Z',
248
+ completedAt: '2026-08-25T01:00:00.000Z',
249
+ assignees: [],
250
+ operations: [],
251
+ },
252
+ {
253
+ key: 'manager',
254
+ nodeId: 'manager-review',
255
+ kind: 'approval',
256
+ title: '部门负责人',
257
+ status: completed ? 'completed' : 'active',
258
+ startedAt: '2026-08-25T01:01:00.000Z',
259
+ completedAt: completed ? '2026-08-25T01:12:00.000Z' : null,
260
+ assignees: [{ userId: 'acceptance-user', displayName: '李明' }],
261
+ operations: [{
262
+ id: 'operation-transfer',
263
+ operation: 'transfer',
264
+ operationLabel: '转交',
265
+ actorUserId: 'acceptance-user',
266
+ actorDisplayName: '李明',
267
+ actingForUserId: null,
268
+ reason: '由值班负责人继续处理',
269
+ detail: {},
270
+ severity: 'normal',
271
+ createdAt: '2026-08-25T01:08:00.000Z',
272
+ }],
273
+ },
274
+ {
275
+ key: 'finance',
276
+ nodeId: 'finance-review',
277
+ kind: 'approval',
278
+ title: '财务负责人',
279
+ status: completed ? 'completed' : 'waiting',
280
+ startedAt: null,
281
+ completedAt: null,
282
+ assignees: [{ userId: 'finance-user', displayName: '财务负责人' }],
283
+ operations: [],
284
+ },
285
+ ];
286
+ const items = [{
287
+ id: 'operation-transfer',
288
+ operation: 'transfer',
289
+ operationLabel: '转交',
290
+ actorUserId: 'acceptance-user',
291
+ actorDisplayName: '李明',
292
+ actingForUserId: null,
293
+ reason: '由值班负责人继续处理',
294
+ detail: {},
295
+ severity: 'normal',
296
+ createdAt: '2026-08-25T01:08:00.000Z',
297
+ }];
298
+ const display = {
299
+ entries: [
244
300
  {
245
301
  key: 'start',
302
+ kind: 'submission',
246
303
  nodeId: null,
247
- kind: 'start',
248
- title: '张三',
304
+ nodeKind: 'start',
305
+ title: '提交申请',
249
306
  status: 'completed',
250
- startedAt: '2026-08-25T01:00:00.000Z',
251
- completedAt: '2026-08-25T01:00:00.000Z',
252
- assignees: [],
307
+ enteredAt: '2026-08-25T01:00:00.000Z',
308
+ leftAt: '2026-08-25T01:00:00.000Z',
309
+ primaryDisplayTime: '2026-08-25T01:00:00.000Z',
310
+ people: [{
311
+ userId: 'applicant-user',
312
+ displayName: '张三',
313
+ avatarUrl: null,
314
+ departmentDisplayName: '理学院',
315
+ }],
253
316
  operations: [],
317
+ result: {},
318
+ terminalReason: null,
254
319
  },
255
320
  {
256
321
  key: 'manager',
322
+ kind: 'node',
257
323
  nodeId: 'manager-review',
258
- kind: 'approval',
324
+ nodeKind: 'approval',
259
325
  title: '部门负责人',
260
326
  status: completed ? 'completed' : 'active',
261
- startedAt: '2026-08-25T01:01:00.000Z',
262
- completedAt: completed ? '2026-08-25T01:12:00.000Z' : null,
263
- assignees: [{ userId: 'acceptance-user', displayName: '李明' }],
327
+ enteredAt: '2026-08-25T01:01:00.000Z',
328
+ leftAt: completed ? '2026-08-25T01:12:00.000Z' : null,
329
+ primaryDisplayTime: '2026-08-25T01:08:00.000Z',
330
+ people: [],
264
331
  operations: [{
265
332
  id: 'operation-transfer',
266
333
  operation: 'transfer',
267
334
  operationLabel: '转交',
268
- actorUserId: 'acceptance-user',
269
- actorDisplayName: '李明',
335
+ actor: {
336
+ userId: 'acceptance-user',
337
+ displayName: '李明',
338
+ avatarUrl: null,
339
+ departmentDisplayName: null,
340
+ },
270
341
  actingForUserId: null,
271
342
  reason: '由值班负责人继续处理',
272
- detail: {},
273
343
  severity: 'normal',
274
- createdAt: '2026-08-25T01:08:00.000Z',
344
+ occurredAt: '2026-08-25T01:08:00.000Z',
275
345
  }],
346
+ result: {},
347
+ terminalReason: null,
276
348
  },
277
349
  {
278
350
  key: 'finance',
351
+ kind: completed ? 'node' : 'planned_node',
279
352
  nodeId: 'finance-review',
280
- kind: 'approval',
353
+ nodeKind: 'approval',
281
354
  title: '财务负责人',
282
355
  status: completed ? 'completed' : 'waiting',
283
- startedAt: null,
284
- completedAt: null,
285
- assignees: [{ userId: 'finance-user', displayName: '财务负责人' }],
356
+ enteredAt: null,
357
+ leftAt: null,
358
+ primaryDisplayTime: null,
359
+ people: [{
360
+ userId: 'finance-user',
361
+ displayName: '财务负责人',
362
+ avatarUrl: null,
363
+ departmentDisplayName: null,
364
+ }],
286
365
  operations: [],
366
+ result: {},
367
+ terminalReason: null,
287
368
  },
288
369
  ],
289
- items: [{
290
- id: 'operation-transfer',
291
- operation: 'transfer',
292
- operationLabel: '转交',
293
- actorUserId: 'acceptance-user',
294
- actorDisplayName: '李明',
295
- actingForUserId: null,
296
- reason: '由值班负责人继续处理',
297
- detail: {},
298
- severity: 'normal',
299
- createdAt: '2026-08-25T01:08:00.000Z',
300
- }],
370
+ };
371
+ return {
372
+ engineVersion: '2.0',
373
+ instanceId,
374
+ instanceSequence: completed ? 4 : 3,
375
+ timelineRevision: (completed ? 'f' : 'e').repeat(64),
376
+ flow,
377
+ items,
378
+ display,
379
+ };
380
+ }
381
+
382
+ function detail(completed = false, customDetail = false) {
383
+ const currentSurface = surface(completed, customDetail);
384
+ const currentTimeline = timeline(completed);
385
+ return {
386
+ schemaVersion: 'openxiangda.workflow-detail-surface/v2',
387
+ protocolVersion: 'workflow_detail_surface_v2',
388
+ detailRevision: (completed ? '2' : '1').repeat(64),
389
+ instanceSequence: currentSurface.instanceSequence,
390
+ timelineRevision: currentTimeline.timelineRevision,
391
+ surface: currentSurface,
392
+ timeline: currentTimeline,
393
+ currentStatus: {
394
+ code: completed ? 'approved' : 'assigned',
395
+ label: completed ? '已同意' : '待审批',
396
+ tone: completed ? 'success' : 'warning',
397
+ },
398
+ nodes: currentTimeline.display.entries,
399
+ handlingRecords: currentTimeline.display.entries.flatMap(
400
+ entry => entry.operations
401
+ ),
402
+ operations: currentSurface.operations,
403
+ navigationContext: {
404
+ desktopReturnPath: '/admin/work-center',
405
+ mobileReturnPath: '/m/work-center',
406
+ },
301
407
  };
302
408
  }
303
409
 
@@ -610,6 +716,20 @@ async function mockWorkflow(
610
716
  ),
611
717
  });
612
718
  }
719
+ if (
720
+ path.endsWith(`/workflow/tasks/${taskId}/detail`) ||
721
+ path.endsWith(`/workflow/instances/${instanceId}/detail`)
722
+ ) {
723
+ expect(route.request().headers()['x-openxiangda-csrf-token']).toBe(
724
+ 'workflow-csrf-1'
725
+ );
726
+ return route.fulfill({
727
+ contentType: 'application/json',
728
+ body: JSON.stringify(
729
+ envelope(detail(completed, options.customDetail))
730
+ ),
731
+ });
732
+ }
613
733
  if (path.endsWith(`/workflow/instances/${instanceId}/surface`)) {
614
734
  return route.fulfill({
615
735
  contentType: 'application/json',
@@ -14,7 +14,7 @@
14
14
  "@ant-design/icons": "6.2.3",
15
15
  "@refinedev/core": "5.0.12",
16
16
  "antd": "6.4.3",
17
- "openxiangda": "2.0.0-alpha.69",
17
+ "openxiangda": "2.0.0-alpha.70",
18
18
  "react": "19.2.8",
19
19
  "react-dom": "19.2.8",
20
20
  "react-router-dom": "7.8.2"
@@ -23,7 +23,7 @@
23
23
  "build": "pnpm --recursive build"
24
24
  },
25
25
  "devDependencies": {
26
- "openxiangda": "2.0.0-alpha.69",
26
+ "openxiangda": "2.0.0-alpha.70",
27
27
  "typescript": "5.9.3"
28
28
  }
29
29
  }