@xpert-ai/plugin-sdk 3.33.1 → 3.35.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 (45) hide show
  1. package/agent-results.cjs.js +2 -0
  2. package/agent-results.esm.js +1 -1
  3. package/analytics.cjs.js +87 -2
  4. package/analytics.esm.js +86 -1
  5. package/docs/artifact-types.md +30 -0
  6. package/index.cjs.js +69 -25
  7. package/index.esm.js +67 -31
  8. package/model-provider.cjs.js +13 -0
  9. package/model-provider.esm.js +11 -1
  10. package/package.json +2 -2
  11. package/results.cjs.js +8 -0
  12. package/results.esm.js +7 -1
  13. package/src/analytics.d.ts +1 -0
  14. package/src/lib/agent/runtime/dispatch.d.ts +232 -9
  15. package/src/lib/agent/runtime/execution-runner.d.ts +11 -1
  16. package/src/lib/agent/runtime/results.d.ts +17 -0
  17. package/src/lib/agent/runtime/strategy.d.ts +3 -0
  18. package/src/lib/agent/runtime/types.d.ts +2 -0
  19. package/src/lib/artifact-document/dependencies.d.ts +10 -10
  20. package/src/lib/artifact-presentation/index.d.ts +29 -11
  21. package/src/lib/artifact-type/analytics.d.ts +30 -0
  22. package/src/lib/artifact-type/definition.schema.d.ts +181 -1
  23. package/src/lib/artifact-type/index.d.ts +37 -1
  24. package/src/lib/artifact-type/version-context.d.ts +21 -0
  25. package/src/lib/content-resource/discovery.d.ts +11 -0
  26. package/src/lib/content-resource/index.d.ts +3 -0
  27. package/src/lib/data/analytics/analytics-provider.d.ts +3 -0
  28. package/src/lib/data/analytics/resource-analysis.schema.d.ts +19 -0
  29. package/src/lib/evolution/artifact-hash.d.ts +8 -0
  30. package/src/lib/evolution/index.d.ts +1 -0
  31. package/src/lib/evolution/provider.decorator.d.ts +1 -0
  32. package/src/lib/evolution/provider.registry.d.ts +2 -0
  33. package/src/lib/evolution/runtime-capability.d.ts +3 -0
  34. package/src/lib/file/file-storage/provider.interface.d.ts +24 -1
  35. package/src/lib/project-task/acceptance.d.ts +17 -0
  36. package/src/lib/project-task/index.d.ts +4 -0
  37. package/src/lib/runtime/capabilities/artifact-use-grants.d.ts +80 -0
  38. package/src/lib/runtime/capabilities/index.d.ts +3 -0
  39. package/src/lib/runtime/capabilities/plugin-test-access.d.ts +14 -0
  40. package/src/lib/runtime/capabilities/project-configuration.d.ts +164 -0
  41. package/src/lib/runtime/capabilities/project-provisioning.d.ts +9 -1
  42. package/src/lib/tool-provider/claims.d.ts +8 -0
  43. package/src/lib/tool-provider/index.d.ts +1 -0
  44. package/src/lib/tool-provider/registry.d.ts +0 -1
  45. package/src/lib/types.d.ts +5 -0
@@ -163,15 +163,72 @@ export declare const agentInvocationDispatchContextSchema: z.ZodObject<{
163
163
  description?: string | undefined;
164
164
  };
165
165
  }>;
166
- purpose: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
166
+ purpose: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
167
167
  type: z.ZodLiteral<"implementation">;
168
+ reviewer: z.ZodOptional<z.ZodObject<{
169
+ bindingId: z.ZodString;
170
+ mode: z.ZodEnum<["evidence_only", "execution"]>;
171
+ }, "strict", z.ZodTypeAny, {
172
+ mode: "execution" | "evidence_only";
173
+ bindingId: string;
174
+ }, {
175
+ mode: "execution" | "evidence_only";
176
+ bindingId: string;
177
+ }>>;
178
+ coordination: z.ZodOptional<z.ZodObject<{
179
+ taskId: z.ZodString;
180
+ specificationDigest: z.ZodString;
181
+ }, "strict", z.ZodTypeAny, {
182
+ taskId: string;
183
+ specificationDigest: string;
184
+ }, {
185
+ taskId: string;
186
+ specificationDigest: string;
187
+ }>>;
188
+ rework: z.ZodOptional<z.ZodObject<{
189
+ reviewExecutionId: z.ZodString;
190
+ findingIds: z.ZodArray<z.ZodString, "many">;
191
+ }, "strict", z.ZodTypeAny, {
192
+ reviewExecutionId: string;
193
+ findingIds: string[];
194
+ }, {
195
+ reviewExecutionId: string;
196
+ findingIds: string[];
197
+ }>>;
168
198
  }, "strict", z.ZodTypeAny, {
169
199
  type: "implementation";
200
+ reviewer?: {
201
+ mode: "execution" | "evidence_only";
202
+ bindingId: string;
203
+ } | undefined;
204
+ coordination?: {
205
+ taskId: string;
206
+ specificationDigest: string;
207
+ } | undefined;
208
+ rework?: {
209
+ reviewExecutionId: string;
210
+ findingIds: string[];
211
+ } | undefined;
170
212
  }, {
171
213
  type: "implementation";
214
+ reviewer?: {
215
+ mode: "execution" | "evidence_only";
216
+ bindingId: string;
217
+ } | undefined;
218
+ coordination?: {
219
+ taskId: string;
220
+ specificationDigest: string;
221
+ } | undefined;
222
+ rework?: {
223
+ reviewExecutionId: string;
224
+ findingIds: string[];
225
+ } | undefined;
172
226
  }>, z.ZodObject<{
173
227
  type: z.ZodLiteral<"review">;
228
+ mode: z.ZodOptional<z.ZodEnum<["evidence_only", "execution"]>>;
229
+ candidatePaths: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
174
230
  implementationExecutionId: z.ZodString;
231
+ implementationTaskId: z.ZodOptional<z.ZodString>;
175
232
  implementationInvocationId: z.ZodString;
176
233
  specificationDigest: z.ZodString;
177
234
  evidence: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
@@ -227,8 +284,11 @@ export declare const agentInvocationDispatchContextSchema: z.ZodObject<{
227
284
  snapshotId: string;
228
285
  })[];
229
286
  implementationExecutionId: string;
230
- implementationInvocationId: string;
231
287
  specificationDigest: string;
288
+ implementationInvocationId: string;
289
+ mode?: "execution" | "evidence_only" | undefined;
290
+ implementationTaskId?: string | undefined;
291
+ candidatePaths?: string[] | undefined;
232
292
  }, {
233
293
  type: "review";
234
294
  evidence: ({
@@ -245,9 +305,82 @@ export declare const agentInvocationDispatchContextSchema: z.ZodObject<{
245
305
  snapshotId: string;
246
306
  })[];
247
307
  implementationExecutionId: string;
308
+ specificationDigest: string;
309
+ implementationInvocationId: string;
310
+ mode?: "execution" | "evidence_only" | undefined;
311
+ implementationTaskId?: string | undefined;
312
+ candidatePaths?: string[] | undefined;
313
+ }>]>, {
314
+ type: "implementation";
315
+ reviewer?: {
316
+ mode: "execution" | "evidence_only";
317
+ bindingId: string;
318
+ } | undefined;
319
+ coordination?: {
320
+ taskId: string;
321
+ specificationDigest: string;
322
+ } | undefined;
323
+ rework?: {
324
+ reviewExecutionId: string;
325
+ findingIds: string[];
326
+ } | undefined;
327
+ } | {
328
+ type: "review";
329
+ evidence: ({
330
+ type: "artifact";
331
+ artifactId: string;
332
+ versionId: string;
333
+ } | {
334
+ type: "invocation_result";
335
+ revision: number;
336
+ invocationId: string;
337
+ } | {
338
+ type: "workspace_snapshot";
339
+ digest: string;
340
+ snapshotId: string;
341
+ })[];
342
+ implementationExecutionId: string;
343
+ specificationDigest: string;
248
344
  implementationInvocationId: string;
345
+ mode?: "execution" | "evidence_only" | undefined;
346
+ implementationTaskId?: string | undefined;
347
+ candidatePaths?: string[] | undefined;
348
+ }, {
349
+ type: "implementation";
350
+ reviewer?: {
351
+ mode: "execution" | "evidence_only";
352
+ bindingId: string;
353
+ } | undefined;
354
+ coordination?: {
355
+ taskId: string;
356
+ specificationDigest: string;
357
+ } | undefined;
358
+ rework?: {
359
+ reviewExecutionId: string;
360
+ findingIds: string[];
361
+ } | undefined;
362
+ } | {
363
+ type: "review";
364
+ evidence: ({
365
+ type: "artifact";
366
+ artifactId: string;
367
+ versionId: string;
368
+ } | {
369
+ type: "invocation_result";
370
+ revision: number;
371
+ invocationId: string;
372
+ } | {
373
+ type: "workspace_snapshot";
374
+ digest: string;
375
+ snapshotId: string;
376
+ })[];
377
+ implementationExecutionId: string;
249
378
  specificationDigest: string;
250
- }>]>;
379
+ implementationInvocationId: string;
380
+ mode?: "execution" | "evidence_only" | undefined;
381
+ implementationTaskId?: string | undefined;
382
+ candidatePaths?: string[] | undefined;
383
+ }>;
251
384
  }, "strict", z.ZodTypeAny, {
252
385
  projectId: string;
253
386
  specification: {
@@ -267,6 +400,18 @@ export declare const agentInvocationDispatchContextSchema: z.ZodObject<{
267
400
  taskExecutionId: string;
268
401
  purpose: {
269
402
  type: "implementation";
403
+ reviewer?: {
404
+ mode: "execution" | "evidence_only";
405
+ bindingId: string;
406
+ } | undefined;
407
+ coordination?: {
408
+ taskId: string;
409
+ specificationDigest: string;
410
+ } | undefined;
411
+ rework?: {
412
+ reviewExecutionId: string;
413
+ findingIds: string[];
414
+ } | undefined;
270
415
  } | {
271
416
  type: "review";
272
417
  evidence: ({
@@ -283,8 +428,11 @@ export declare const agentInvocationDispatchContextSchema: z.ZodObject<{
283
428
  snapshotId: string;
284
429
  })[];
285
430
  implementationExecutionId: string;
286
- implementationInvocationId: string;
287
431
  specificationDigest: string;
432
+ implementationInvocationId: string;
433
+ mode?: "execution" | "evidence_only" | undefined;
434
+ implementationTaskId?: string | undefined;
435
+ candidatePaths?: string[] | undefined;
288
436
  };
289
437
  }, {
290
438
  projectId: string;
@@ -305,6 +453,18 @@ export declare const agentInvocationDispatchContextSchema: z.ZodObject<{
305
453
  taskExecutionId: string;
306
454
  purpose: {
307
455
  type: "implementation";
456
+ reviewer?: {
457
+ mode: "execution" | "evidence_only";
458
+ bindingId: string;
459
+ } | undefined;
460
+ coordination?: {
461
+ taskId: string;
462
+ specificationDigest: string;
463
+ } | undefined;
464
+ rework?: {
465
+ reviewExecutionId: string;
466
+ findingIds: string[];
467
+ } | undefined;
308
468
  } | {
309
469
  type: "review";
310
470
  evidence: ({
@@ -321,8 +481,11 @@ export declare const agentInvocationDispatchContextSchema: z.ZodObject<{
321
481
  snapshotId: string;
322
482
  })[];
323
483
  implementationExecutionId: string;
324
- implementationInvocationId: string;
325
484
  specificationDigest: string;
485
+ implementationInvocationId: string;
486
+ mode?: "execution" | "evidence_only" | undefined;
487
+ implementationTaskId?: string | undefined;
488
+ candidatePaths?: string[] | undefined;
326
489
  };
327
490
  }>, {
328
491
  projectId: string;
@@ -343,6 +506,18 @@ export declare const agentInvocationDispatchContextSchema: z.ZodObject<{
343
506
  taskExecutionId: string;
344
507
  purpose: {
345
508
  type: "implementation";
509
+ reviewer?: {
510
+ mode: "execution" | "evidence_only";
511
+ bindingId: string;
512
+ } | undefined;
513
+ coordination?: {
514
+ taskId: string;
515
+ specificationDigest: string;
516
+ } | undefined;
517
+ rework?: {
518
+ reviewExecutionId: string;
519
+ findingIds: string[];
520
+ } | undefined;
346
521
  } | {
347
522
  type: "review";
348
523
  evidence: ({
@@ -359,8 +534,11 @@ export declare const agentInvocationDispatchContextSchema: z.ZodObject<{
359
534
  snapshotId: string;
360
535
  })[];
361
536
  implementationExecutionId: string;
362
- implementationInvocationId: string;
363
537
  specificationDigest: string;
538
+ implementationInvocationId: string;
539
+ mode?: "execution" | "evidence_only" | undefined;
540
+ implementationTaskId?: string | undefined;
541
+ candidatePaths?: string[] | undefined;
364
542
  };
365
543
  }, {
366
544
  projectId: string;
@@ -381,6 +559,18 @@ export declare const agentInvocationDispatchContextSchema: z.ZodObject<{
381
559
  taskExecutionId: string;
382
560
  purpose: {
383
561
  type: "implementation";
562
+ reviewer?: {
563
+ mode: "execution" | "evidence_only";
564
+ bindingId: string;
565
+ } | undefined;
566
+ coordination?: {
567
+ taskId: string;
568
+ specificationDigest: string;
569
+ } | undefined;
570
+ rework?: {
571
+ reviewExecutionId: string;
572
+ findingIds: string[];
573
+ } | undefined;
384
574
  } | {
385
575
  type: "review";
386
576
  evidence: ({
@@ -397,8 +587,11 @@ export declare const agentInvocationDispatchContextSchema: z.ZodObject<{
397
587
  snapshotId: string;
398
588
  })[];
399
589
  implementationExecutionId: string;
400
- implementationInvocationId: string;
401
590
  specificationDigest: string;
591
+ implementationInvocationId: string;
592
+ mode?: "execution" | "evidence_only" | undefined;
593
+ implementationTaskId?: string | undefined;
594
+ candidatePaths?: string[] | undefined;
402
595
  };
403
596
  }>>;
404
597
  }, "strict", z.ZodTypeAny, {
@@ -437,6 +630,18 @@ export declare const agentInvocationDispatchContextSchema: z.ZodObject<{
437
630
  taskExecutionId: string;
438
631
  purpose: {
439
632
  type: "implementation";
633
+ reviewer?: {
634
+ mode: "execution" | "evidence_only";
635
+ bindingId: string;
636
+ } | undefined;
637
+ coordination?: {
638
+ taskId: string;
639
+ specificationDigest: string;
640
+ } | undefined;
641
+ rework?: {
642
+ reviewExecutionId: string;
643
+ findingIds: string[];
644
+ } | undefined;
440
645
  } | {
441
646
  type: "review";
442
647
  evidence: ({
@@ -453,8 +658,11 @@ export declare const agentInvocationDispatchContextSchema: z.ZodObject<{
453
658
  snapshotId: string;
454
659
  })[];
455
660
  implementationExecutionId: string;
456
- implementationInvocationId: string;
457
661
  specificationDigest: string;
662
+ implementationInvocationId: string;
663
+ mode?: "execution" | "evidence_only" | undefined;
664
+ implementationTaskId?: string | undefined;
665
+ candidatePaths?: string[] | undefined;
458
666
  };
459
667
  };
460
668
  }, {
@@ -493,6 +701,18 @@ export declare const agentInvocationDispatchContextSchema: z.ZodObject<{
493
701
  taskExecutionId: string;
494
702
  purpose: {
495
703
  type: "implementation";
704
+ reviewer?: {
705
+ mode: "execution" | "evidence_only";
706
+ bindingId: string;
707
+ } | undefined;
708
+ coordination?: {
709
+ taskId: string;
710
+ specificationDigest: string;
711
+ } | undefined;
712
+ rework?: {
713
+ reviewExecutionId: string;
714
+ findingIds: string[];
715
+ } | undefined;
496
716
  } | {
497
717
  type: "review";
498
718
  evidence: ({
@@ -509,8 +729,11 @@ export declare const agentInvocationDispatchContextSchema: z.ZodObject<{
509
729
  snapshotId: string;
510
730
  })[];
511
731
  implementationExecutionId: string;
512
- implementationInvocationId: string;
513
732
  specificationDigest: string;
733
+ implementationInvocationId: string;
734
+ mode?: "execution" | "evidence_only" | undefined;
735
+ implementationTaskId?: string | undefined;
736
+ candidatePaths?: string[] | undefined;
514
737
  };
515
738
  };
516
739
  }>;
@@ -1,6 +1,6 @@
1
1
  import type { CliPermissionMode, ModelExecutionEnvironment } from '@xpert-ai/contracts';
2
2
  import type { AgentInvocationScope, AgentInvocationResult, AgentJson } from './types';
3
- import type { AgentArtifactSelection } from './results';
3
+ import type { AgentArtifactSelection, AgentTaskResult, AgentTaskResultFile } from './results';
4
4
  /** A host-managed process location. Remote service runtimes can use their own session/run handles. */
5
5
  export type AgentRunnerEnvironment = Extract<ModelExecutionEnvironment, {
6
6
  type: 'computer' | 'sandbox';
@@ -26,6 +26,11 @@ interface AgentRunnerReceiptBase {
26
26
  };
27
27
  /** Effective policy pinned when this process started; absent on historical receipts. */
28
28
  permissionMode?: CliPermissionMode;
29
+ executionBudget?: {
30
+ maxDurationSeconds: number;
31
+ deadline: string;
32
+ project?: import('@xpert-ai/contracts').ProjectTaskDurationConfiguration;
33
+ };
29
34
  }
30
35
  /** V1 retains its original cwd; V2 separates per-invocation records from the business cwd. */
31
36
  export type AgentRunnerReceipt = AgentRunnerReceiptBase & ({
@@ -62,6 +67,11 @@ export interface AgentExecutionRunner {
62
67
  }): Promise<unknown>;
63
68
  /** Export only selected files after revalidating the persisted delivery request. No selection means no export. */
64
69
  collectArtifacts(receipt: AgentRunnerReceipt, selection?: AgentArtifactSelection): Promise<NonNullable<AgentInvocationResult['artifacts']>>;
70
+ /** Read a submitted result envelope after checking receipt ownership, instance, byte limit, digest and schema.
71
+ * Adapters call after verified CLI completion and checkpoint the result before cleanup.
72
+ * Absence means file submission is unsupported; reading does not export files or accept the task.
73
+ */
74
+ readTaskResultFile?(receipt: AgentRunnerReceipt, reference: AgentTaskResultFile): Promise<AgentTaskResult>;
65
75
  /** Revoke model access and request process termination. Only exited confirms termination. */
66
76
  stop(receipt: AgentRunnerReceipt): Promise<{
67
77
  state: 'exited' | 'stopping' | 'unknown';
@@ -311,6 +311,23 @@ export declare const agentTaskResultSchema: z.ZodEffects<z.ZodObject<{
311
311
  })[];
312
312
  }>;
313
313
  export type AgentTaskResult = z.output<typeof agentTaskResultSchema>;
314
+ /** Bound structured report transfer independently of the host's artifact-export quota. */
315
+ export declare const AGENT_TASK_RESULT_FILE_MAX_BYTES: number;
316
+ /** Explicit final submission of an envelope file. Its digest pins bytes, not a business verdict. */
317
+ export declare const agentTaskResultFileSchema: z.ZodObject<{
318
+ version: z.ZodLiteral<1>;
319
+ path: z.ZodEffects<z.ZodString, string, string>;
320
+ sha256: z.ZodString;
321
+ }, "strict", z.ZodTypeAny, {
322
+ path?: string;
323
+ version?: 1;
324
+ sha256?: string;
325
+ }, {
326
+ path?: string;
327
+ version?: 1;
328
+ sha256?: string;
329
+ }>;
330
+ export type AgentTaskResultFile = z.output<typeof agentTaskResultFileSchema>;
314
331
  /** Persist only after the platform has committed the artifact; never accept an ID invented by a model. */
315
332
  export interface AgentResultArtifact {
316
333
  id: string;
@@ -1,4 +1,5 @@
1
1
  import { DiscoveryService, Reflector } from '@nestjs/core';
2
+ import type { ProjectTaskExecutionContext } from '@xpert-ai/contracts';
2
3
  import type { RuntimeCapabilityRegistry } from '../../core/runtime-capability';
3
4
  import { BaseStrategyRegistry, type StrategySource } from '../../strategy';
4
5
  import type { AgentActivityRecorder } from './activity';
@@ -15,6 +16,8 @@ export interface AgentRuntimeContext {
15
16
  /** Durable host invocation ID used to correlate provider receipts. */
16
17
  invocationId: string;
17
18
  scope: Readonly<AgentInvocationScope>;
19
+ /** Validated host task snapshot, separate from reply routing; does not grant workspace access. */
20
+ projectTask?: Readonly<ProjectTaskExecutionContext>;
18
21
  /** Cooperative cancellation; abort alone does not confirm remote termination. */
19
22
  signal?: AbortSignal;
20
23
  capabilities: RuntimeCapabilityRegistry;
@@ -173,6 +173,8 @@ export interface AgentInvocation extends AgentRuntimeObservation {
173
173
  activity?: ExecutionActivityCapabilities;
174
174
  /** Host startup fence; intermediate receipts are not inspected until start returns or this deadline expires. */
175
175
  startPendingUntil?: string;
176
+ /** Host-only startup owner; a stale heartbeat cannot renew another launch. */
177
+ startPendingId?: string;
176
178
  /** Host invocation ID used by inspect, cancel and respond. */
177
179
  id: string;
178
180
  /** Host-managed concurrency revision, distinct from the target version. */
@@ -18,21 +18,21 @@ export declare const artifactDocumentDependencyLock: z.ZodEffects<z.ZodObject<{
18
18
  }, "strict", z.ZodTypeAny, {
19
19
  id?: string;
20
20
  version?: string;
21
+ sha256?: string;
21
22
  format?: "classic-script";
22
23
  global?: string;
23
- sha256?: string;
24
24
  }, {
25
25
  id?: string;
26
26
  version?: string;
27
+ sha256?: string;
27
28
  format?: "classic-script";
28
29
  global?: string;
29
- sha256?: string;
30
30
  }>, ArtifactDocumentDependencyLock, {
31
31
  id?: string;
32
32
  version?: string;
33
+ sha256?: string;
33
34
  format?: "classic-script";
34
35
  global?: string;
35
- sha256?: string;
36
36
  }>;
37
37
  export declare const artifactDocumentDependencyLocks: z.ZodEffects<z.ZodArray<z.ZodEffects<z.ZodObject<{
38
38
  id: z.ZodString;
@@ -43,27 +43,27 @@ export declare const artifactDocumentDependencyLocks: z.ZodEffects<z.ZodArray<z.
43
43
  }, "strict", z.ZodTypeAny, {
44
44
  id?: string;
45
45
  version?: string;
46
+ sha256?: string;
46
47
  format?: "classic-script";
47
48
  global?: string;
48
- sha256?: string;
49
49
  }, {
50
50
  id?: string;
51
51
  version?: string;
52
+ sha256?: string;
52
53
  format?: "classic-script";
53
54
  global?: string;
54
- sha256?: string;
55
55
  }>, ArtifactDocumentDependencyLock, {
56
56
  id?: string;
57
57
  version?: string;
58
+ sha256?: string;
58
59
  format?: "classic-script";
59
60
  global?: string;
60
- sha256?: string;
61
61
  }>, "many">, ArtifactDocumentDependencyLock[], {
62
62
  id?: string;
63
63
  version?: string;
64
+ sha256?: string;
64
65
  format?: "classic-script";
65
66
  global?: string;
66
- sha256?: string;
67
67
  }[]>;
68
68
  export declare const artifactDocumentDependencyAssets: z.ZodArray<z.ZodEffects<z.ZodObject<{
69
69
  id: z.ZodString;
@@ -76,24 +76,24 @@ export declare const artifactDocumentDependencyAssets: z.ZodArray<z.ZodEffects<z
76
76
  }, "strict", z.ZodTypeAny, {
77
77
  id?: string;
78
78
  version?: string;
79
+ sha256?: string;
79
80
  source?: string;
80
81
  format?: "classic-script";
81
82
  global?: string;
82
- sha256?: string;
83
83
  }, {
84
84
  id?: string;
85
85
  version?: string;
86
+ sha256?: string;
86
87
  source?: string;
87
88
  format?: "classic-script";
88
89
  global?: string;
89
- sha256?: string;
90
90
  }>, ArtifactDocumentDependencyAsset, {
91
91
  id?: string;
92
92
  version?: string;
93
+ sha256?: string;
93
94
  source?: string;
94
95
  format?: "classic-script";
95
96
  global?: string;
96
- sha256?: string;
97
97
  }>, "many">;
98
98
  /** Browser/server identical verification. Integrity is not authorization: the caller owns library admission. */
99
99
  export declare function verifyArtifactDocumentDependencies(input: unknown, expected?: ArtifactDocumentDependencyLock[]): ArtifactDocumentDependencyAsset[];
@@ -1,33 +1,51 @@
1
1
  import { DiscoveryService, Reflector } from '@nestjs/core';
2
2
  import type { ArtifactPresentationQuery } from '@xpert-ai/contracts';
3
- import type { ArtifactRecord, ArtifactVersionRecord } from '../runtime/capabilities/artifacts';
3
+ import type { ArtifactVersionContext } from '../artifact-type/version-context';
4
4
  import { BaseStrategyRegistry } from '../strategy';
5
5
  export declare const ARTIFACT_PRESENTATION_PROVIDER = "ARTIFACT_PRESENTATION_PROVIDER";
6
+ /** Exact plugin/type registration key; use declared identifiers, never titles, MIME types or storage kinds. */
6
7
  export interface ArtifactPresentationSource {
8
+ /** Owning plugin's registered package name. */
7
9
  pluginName: string;
10
+ /** Artifact type key declared within that plugin's namespace. */
8
11
  resourceType: string;
9
12
  }
10
13
  export declare const artifactPresentationKey: (source: ArtifactPresentationSource) => string;
11
14
  /** Registers a read-only renderer for an explicit Artifact source, independently of Workbench actions. */
12
15
  export declare const ArtifactPresentationProvider: (source: ArtifactPresentationSource) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
13
- export interface ArtifactPresentationContext {
14
- /** Current authenticated viewer. Never substitute the Artifact creator. */
15
- actor: {
16
- tenantId: string;
17
- organizationId: string;
18
- userId: string;
16
+ /** Authorized version plus optional host-derived usage metadata for read-only presentation. */
17
+ export interface ArtifactPresentationContext extends ArtifactVersionContext {
18
+ /** Optional host-derived cross-project usage; absent for ordinary source presentation. Never accept it from tool input. */
19
+ usage?: {
20
+ /** Explicit usage discriminator; future kinds need their own host authorization and provider support. */
21
+ kind: 'group-reference';
22
+ /** Accepted placement being accessed, distinct from the backing grant and source Artifact. */
23
+ referenceId: string;
24
+ /** Live grant whose scope and lifecycle the host rechecks. */
25
+ grantId: string;
26
+ /** Receiving group audience; sharing its runtime Project does not share its grant. */
27
+ groupId: string;
28
+ /** Usage Project bound to the group; do not use it to locate source version bytes. */
29
+ runtimeProjectId: string;
30
+ /** Source Project, consistent with artifact.projectId; does not confer source membership or Assistant binding. */
31
+ ownerProjectId: string;
19
32
  };
20
- artifact: ArtifactRecord;
21
- version: ArtifactVersionRecord;
22
- /** Platform-authorized, integrity-checked version bytes. This grants no Workspace file access. */
23
- content: Buffer;
24
33
  }
34
+ /**
35
+ * Plugin implementation for read-only presentation of its registered Artifact type.
36
+ * Return only client-safe payloads and preserve the current viewer's upstream data ACLs.
37
+ * Declared operations express viewer support; they do not replace platform authorization.
38
+ */
25
39
  export interface IArtifactPresentationProvider {
40
+ /** Read-only interactive operation names. Group use intersects these with ArtifactTypeDefinition.useGrants.queryOperations. */
26
41
  readonly operations: readonly string[];
42
+ /** Viewer entry HTML without actor credentials; resource data and queries arrive through the host presentation bridge. */
27
43
  getEntry(): Promise<{
28
44
  html: string;
29
45
  }>;
46
+ /** Client-safe state derived from context.content; omit credentials, private file handles and native query declarations. */
30
47
  read(context: ArtifactPresentationContext): Promise<object>;
48
+ /** Validate the operation-specific input and pinned target, then execute a read under context.actor's data permissions. */
31
49
  query(context: ArtifactPresentationContext, request: ArtifactPresentationQuery): Promise<object>;
32
50
  }
33
51
  export declare class ArtifactPresentationRegistry extends BaseStrategyRegistry<IArtifactPresentationProvider> {
@@ -0,0 +1,30 @@
1
+ import type { AnalyticsBinding, AnalyticsValue } from '@xpert-ai/contracts';
2
+ import type { ArtifactVersionContext } from './version-context';
3
+ /** A published dataset declaration, available only to trusted server-side orchestration. */
4
+ export interface ArtifactAnalyticsBinding {
5
+ /**
6
+ * Binding resolved exclusively from the fixed version. Its id is the stable dataset key used by grants.
7
+ * Preserve its source, provider, operation and native payload; never substitute a mutable query.
8
+ * Do not expose this object to Agent/UI clients: it can contain private native query declarations.
9
+ */
10
+ binding: AnalyticsBinding;
11
+ /** Optional domain label; the host uses binding.output.datasetId when omitted. Not an identity or permission. */
12
+ title?: string;
13
+ }
14
+ /**
15
+ * Optional analytics extension of an existing Artifact Type registration, not a separately registered provider.
16
+ * Parses published declarations without querying data, discovering sources or requiring a Workbench renderer.
17
+ * The host owns grants, safe descriptions, source-sharing checks and Analytics execution under the current actor.
18
+ * Omission means this type does not support Agent analysis; it never falls back to presentation query hooks.
19
+ */
20
+ export interface ArtifactTypeAnalytics {
21
+ /** Return unique binding ids from context.content only; [] means this version has no analyzable datasets. */
22
+ resolveBindings(context: ArtifactVersionContext): Promise<readonly ArtifactAnalyticsBinding[]> | readonly ArtifactAnalyticsBinding[];
23
+ /**
24
+ * Optional domain control validation/mapping for the selected dataset (e.g. published dashboard control defaults).
25
+ * Reject unknown or disallowed inputs before applying defaults and selecting the binding's controls.
26
+ * Return scalar values keyed by controlId; never execute data or change the binding/source/actor.
27
+ * When omitted, input is passed unchanged. Analytics still validates declared parameters, types and allowlists.
28
+ */
29
+ normalizeControls?(context: ArtifactVersionContext, datasetKey: string, controls: Record<string, AnalyticsValue>): Promise<Record<string, AnalyticsValue>> | Record<string, AnalyticsValue>;
30
+ }