@xpert-ai/plugin-live-dashboard 0.5.0 → 0.6.0

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.
Files changed (58) hide show
  1. package/.xpertai-plugin/plugin.json +1 -1
  2. package/README.md +4 -2
  3. package/dist/index.js +3 -1
  4. package/dist/lib/agent.schema.d.ts +9 -9
  5. package/dist/lib/agent.schema.js +2 -1
  6. package/dist/lib/archive.service.d.ts +26 -2
  7. package/dist/lib/archive.service.js +17 -3
  8. package/dist/lib/bounded-map.d.ts +2 -0
  9. package/dist/lib/bounded-map.js +25 -0
  10. package/dist/lib/capacity.d.ts +14 -0
  11. package/dist/lib/capacity.js +16 -0
  12. package/dist/lib/dashboard-archive.d.ts +1 -1
  13. package/dist/lib/dashboard-queries.d.ts +1 -1
  14. package/dist/lib/dashboard-queries.js +11 -6
  15. package/dist/lib/dashboard-receipt.js +1 -1
  16. package/dist/lib/dashboard-sources.js +3 -2
  17. package/dist/lib/dashboard-view.schema.d.ts +20 -20
  18. package/dist/lib/dashboard.schema.d.ts +18 -18
  19. package/dist/lib/dashboard.schema.js +2 -1
  20. package/dist/lib/dashboard.service.d.ts +24 -5
  21. package/dist/lib/dashboard.service.js +58 -8
  22. package/dist/lib/definition-tools.d.ts +4 -4
  23. package/dist/lib/document-host.js +1 -1
  24. package/dist/lib/document-package.d.ts +1 -1
  25. package/dist/lib/editing-patch.js +2 -1
  26. package/dist/lib/editing.d.ts +11 -10
  27. package/dist/lib/editing.js +5 -1
  28. package/dist/lib/filter-evidence.d.ts +28 -0
  29. package/dist/lib/filter-evidence.js +3 -2
  30. package/dist/lib/html-guidance.d.ts +1 -0
  31. package/dist/lib/html-guidance.js +2 -1
  32. package/dist/lib/html-validation.js +1 -1
  33. package/dist/lib/middleware.d.ts +3 -1
  34. package/dist/lib/middleware.js +89 -11
  35. package/dist/lib/plugin.js +2 -1
  36. package/dist/lib/presentation.provider.d.ts +1 -1
  37. package/dist/lib/preview-retry.d.ts +4 -3
  38. package/dist/lib/preview-retry.js +13 -7
  39. package/dist/lib/prompt-workflows.js +1 -1
  40. package/dist/lib/query-session.d.ts +9 -0
  41. package/dist/lib/query-session.js +64 -0
  42. package/dist/lib/save-requests.d.ts +118 -0
  43. package/dist/lib/save-requests.js +199 -0
  44. package/dist/lib/source-executions.d.ts +243 -2
  45. package/dist/lib/source-executions.js +29 -5
  46. package/dist/lib/view.provider.d.ts +38 -3
  47. package/dist/lib/view.provider.js +20 -4
  48. package/dist/remote/app.js +114 -65
  49. package/dist/remote/build-manifest.json +37 -32
  50. package/dist/sandbox-actions/action.json +1 -1
  51. package/dist/sandbox-actions/bundle/host.js +63 -14
  52. package/dist/sandbox-actions/bundle/validate.mjs +2 -2
  53. package/dist/validation/host-entry.d.ts +5 -1
  54. package/dist/validation/host-entry.js +21 -4
  55. package/docs/docs.json +2 -0
  56. package/docs/large-dashboards-acceptance.mdx +74 -0
  57. package/docs/large-dashboards.mdx +80 -0
  58. package/package.json +5 -5
@@ -8,8 +8,13 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
8
8
  var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
11
14
  Object.defineProperty(exports, "__esModule", { value: true });
12
15
  exports.DashboardViewProvider = exports.FEATURE = exports.VIEW_PROVIDER = exports.VIEW_KEY = void 0;
16
+ const node_crypto_1 = require("node:crypto");
17
+ const save_requests_1 = require("./save-requests");
13
18
  const projects_service_1 = require("./projects.service");
14
19
  const projects_schema_1 = require("./projects.schema");
15
20
  const common_1 = require("@nestjs/common");
@@ -31,11 +36,12 @@ exports.VIEW_PROVIDER = 'live-dashboard';
31
36
  exports.FEATURE = 'live_dashboard';
32
37
  const text = (en_US, zh_Hans) => ({ en_US, zh_Hans });
33
38
  let DashboardViewProvider = class DashboardViewProvider {
34
- constructor(service, sharing, projects, archives) {
39
+ constructor(service, sharing, projects, archives, saves) {
35
40
  this.service = service;
36
41
  this.sharing = sharing;
37
42
  this.projects = projects;
38
43
  this.archives = archives;
44
+ this.saves = saves;
39
45
  }
40
46
  supports(context) { return context.hostType === 'agent'; }
41
47
  getViewManifests(context, slot) {
@@ -56,7 +62,7 @@ let DashboardViewProvider = class DashboardViewProvider {
56
62
  filter: { toolNames: dashboard_receipt_1.DASHBOARD_MUTATION_TOOLS }, action: { type: 'forward', debounceMs: 0 } }] },
57
63
  actions: [
58
64
  { key: 'import-preview', label: text('Import dashboard file', '导入看板文件'), actionType: 'invoke', transport: 'file' },
59
- ...['import-commit', 'import-discard', 'import-browse'].map(key => ({ key, label: text('Import dashboard', '导入看板'), actionType: 'invoke' })),
65
+ ...['import-commit', 'import-discard', 'import-browse', 'save-wait', 'save-status'].map(key => ({ key, label: text('Import dashboard', '导入看板'), actionType: 'invoke' })),
60
66
  ...[
61
67
  { key: 'dashboards', label: text('Select dashboard', '选择看板') },
62
68
  { key: 'projects', label: text('Select project', '选择项目') },
@@ -96,6 +102,12 @@ let DashboardViewProvider = class DashboardViewProvider {
96
102
  }
97
103
  async executeViewAction(context, viewKey, action, request) {
98
104
  assertView(viewKey);
105
+ if (action === 'save-wait' && this.saves) {
106
+ const input = save_requests_1.waitSaveRequestSchema.parse(request.input);
107
+ return { success: true, data: await this.saves.wait(context, input.requestId, input.cursor), refresh: false };
108
+ }
109
+ if (action === 'save-status' && this.saves)
110
+ return { success: true, data: await this.saves.get(context, save_requests_1.saveRequestSchema.parse(request.input).requestId), refresh: false };
99
111
  if (action === 'import-commit')
100
112
  return { success: true, data: await this.archives.commit(context, archive_service_1.importInputSchema.parse(request.input)), refresh: false };
101
113
  if (action === 'import-browse')
@@ -137,7 +149,10 @@ let DashboardViewProvider = class DashboardViewProvider {
137
149
  }
138
150
  if (action === 'save') {
139
151
  const input = dashboard_schema_1.saveSchema.parse(request.input);
140
- return { success: true, data: await this.service.save(context, input.manifest, input.expectedVersionId, input.expectedRevision), refresh: false };
152
+ const data = this.saves && input.manifest.bindings.length > 8
153
+ ? await this.saves.submit(context, input.manifest, input.expectedVersionId, input.expectedRevision, (0, node_crypto_1.createHash)('sha256').update(JSON.stringify(input)).digest('hex'))
154
+ : await this.service.save(context, input.manifest, input.expectedVersionId, input.expectedRevision);
155
+ return { success: true, data, refresh: false };
141
156
  }
142
157
  if (action === 'query') {
143
158
  const input = dashboard_schema_1.querySchema.parse(request.input);
@@ -169,7 +184,8 @@ let DashboardViewProvider = class DashboardViewProvider {
169
184
  exports.DashboardViewProvider = DashboardViewProvider;
170
185
  exports.DashboardViewProvider = DashboardViewProvider = __decorate([
171
186
  (0, plugin_sdk_1.ViewExtensionProvider)(exports.VIEW_PROVIDER),
172
- __metadata("design:paramtypes", [dashboard_service_1.DashboardService, sharing_service_1.DashboardSharingService, projects_service_1.DashboardProjectsService, archive_service_1.DashboardArchiveService])
187
+ __param(4, (0, common_1.Optional)()),
188
+ __metadata("design:paramtypes", [dashboard_service_1.DashboardService, sharing_service_1.DashboardSharingService, projects_service_1.DashboardProjectsService, archive_service_1.DashboardArchiveService, save_requests_1.DashboardSaveRequests])
173
189
  ], DashboardViewProvider);
174
190
  function assertView(key) { if (key !== exports.VIEW_KEY)
175
191
  throw new common_1.BadRequestException('DASHBOARD_VIEW_UNSUPPORTED'); }