@xpert-ai/plugin-sdk 3.19.0 → 3.21.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 (70) hide show
  1. package/CHANGELOG.md +124 -0
  2. package/README.md +55 -0
  3. package/RESOURCE-CARDS-VALIDATION.md +51 -0
  4. package/RESOURCE-CARDS.md +361 -0
  5. package/TOOL-IMAGES.md +85 -0
  6. package/agent-results.cjs.default.js +1 -0
  7. package/agent-results.cjs.js +20 -0
  8. package/agent-results.cjs.mjs +2 -0
  9. package/agent-results.d.ts +1 -0
  10. package/agent-results.esm.js +4 -0
  11. package/index.cjs.js +494 -115
  12. package/index.esm.js +444 -114
  13. package/model-provider.cjs.js +45 -68
  14. package/model-provider.esm.js +46 -64
  15. package/package.json +8 -2
  16. package/results.cjs.js +50 -0
  17. package/results.esm.js +46 -0
  18. package/src/agent-results.d.ts +2 -0
  19. package/src/index.d.ts +3 -0
  20. package/src/lib/agent/handoff/agent-chat.contract.d.ts +10 -1
  21. package/src/lib/agent/handoff/agent-runtime-message.contract.d.ts +319 -0
  22. package/src/lib/agent/handoff/index.d.ts +1 -0
  23. package/src/lib/agent/index.d.ts +1 -0
  24. package/src/lib/agent/middleware/index.d.ts +1 -0
  25. package/src/lib/agent/middleware/model-requirements.d.ts +9 -0
  26. package/src/lib/agent/middleware/strategy.interface.d.ts +4 -0
  27. package/src/lib/agent/middleware/types.d.ts +7 -0
  28. package/src/lib/agent/resource-card.d.ts +3 -0
  29. package/src/lib/agent/runtime/activity.d.ts +6 -0
  30. package/src/lib/agent/runtime/capability.d.ts +13 -5
  31. package/src/lib/agent/runtime/cli-model-profile.d.ts +62 -0
  32. package/src/lib/agent/runtime/dispatch.d.ts +517 -0
  33. package/src/lib/agent/runtime/execution-runner.d.ts +66 -0
  34. package/src/lib/agent/runtime/index.d.ts +7 -0
  35. package/src/lib/agent/runtime/model-execution.d.ts +15 -0
  36. package/src/lib/agent/runtime/results.d.ts +335 -0
  37. package/src/lib/agent/runtime/strategy.d.ts +3 -0
  38. package/src/lib/agent/runtime/task-wait.d.ts +35 -0
  39. package/src/lib/agent/runtime/types.d.ts +35 -11
  40. package/src/lib/agent-plugin/import-default-agent-plugins.command.d.ts +6 -0
  41. package/src/lib/ai-model/ai-model-provider.interface.d.ts +2 -0
  42. package/src/lib/ai-model/ai-model.d.ts +2 -0
  43. package/src/lib/ai-model/index.d.ts +3 -0
  44. package/src/lib/ai-model/llm.d.ts +4 -2
  45. package/src/lib/ai-model/native-model.d.ts +22 -0
  46. package/src/lib/ai-model/realtime.d.ts +36 -0
  47. package/src/lib/ai-model/token-usage.d.ts +13 -0
  48. package/src/lib/core/context/request-context.d.ts +1 -0
  49. package/src/lib/mcp/app.d.ts +4 -1
  50. package/src/lib/project-task/index.d.ts +8 -1
  51. package/src/lib/project-type/index.d.ts +8 -1
  52. package/src/lib/rag/capability/index.d.ts +5 -0
  53. package/src/lib/{runtime/capabilities → rag/capability}/knowledge-document-visual-assets.d.ts +2 -2
  54. package/src/lib/rag/capability/knowledge-upload-sessions.d.ts +71 -0
  55. package/src/lib/{runtime/capabilities → rag/capability}/knowledgebase-documents.d.ts +9 -1
  56. package/src/lib/{runtime/capabilities → rag/capability}/knowledgebase.d.ts +4 -0
  57. package/src/lib/rag/index.d.ts +1 -0
  58. package/src/lib/resource-card-provider/index.d.ts +3 -0
  59. package/src/lib/resource-card-provider/provider.decorator.d.ts +4 -0
  60. package/src/lib/resource-card-provider/provider.registry.d.ts +14 -0
  61. package/src/lib/resource-card-provider/types.d.ts +36 -0
  62. package/src/lib/resource-card.d.ts +6 -0
  63. package/src/lib/runtime/capabilities/index.d.ts +1 -4
  64. package/src/lib/runtime/capabilities/project-provisioning.d.ts +10 -0
  65. package/src/lib/runtime/capabilities/tool-images.d.ts +24 -0
  66. package/src/lib/runtime/capabilities/workspace-files.d.ts +8 -2
  67. package/src/lib/sandbox/execution-environment.d.ts +2 -0
  68. package/src/lib/sandbox/execution.d.ts +10 -0
  69. package/src/lib/sandbox/managed-service.d.ts +1 -0
  70. /package/src/lib/{runtime/capabilities → rag/capability}/knowledge-graph.d.ts +0 -0
@@ -6,6 +6,46 @@ var common = require('@nestjs/common');
6
6
  var tools = require('@langchain/core/tools');
7
7
  var v3 = require('zod/v3');
8
8
 
9
+ function createRuntimeCapability(id, options = {}) {
10
+ return Object.freeze({
11
+ id,
12
+ description: options.description
13
+ });
14
+ }
15
+ const XPERT_RUNTIME_CAPABILITIES_TOKEN = 'XPERT_RUNTIME_CAPABILITIES';
16
+ /** Metadata key under which RuntimeCapabilityProviderExplorer discovers capability providers. */ const RUNTIME_CAPABILITY_PROVIDER = 'XPERT_RUNTIME_CAPABILITY_PROVIDER';
17
+ /** Tags a Nest provider as the platform implementation of a runtime capability. */ const RuntimeCapabilityProvider = (capability)=>common.SetMetadata(RUNTIME_CAPABILITY_PROVIDER, capability);
18
+ class DefaultRuntimeCapabilityRegistry {
19
+ register(key, implementation) {
20
+ this.capabilities.set(runtimeCapabilityId(key), implementation);
21
+ return this;
22
+ }
23
+ has(key) {
24
+ var _this_parent;
25
+ return this.capabilities.has(runtimeCapabilityId(key)) || ((_this_parent = this.parent) == null ? void 0 : _this_parent.get(key)) !== undefined;
26
+ }
27
+ get(key) {
28
+ var _this_parent;
29
+ const id = runtimeCapabilityId(key);
30
+ return this.capabilities.has(id) ? this.capabilities.get(id) : (_this_parent = this.parent) == null ? void 0 : _this_parent.get(key);
31
+ }
32
+ require(key) {
33
+ const implementation = this.get(key);
34
+ if (!implementation) {
35
+ throw new Error(`Runtime capability '${runtimeCapabilityId(key)}' is not available`);
36
+ }
37
+ return implementation;
38
+ }
39
+ constructor(entries = [], parent){
40
+ this.capabilities = new Map();
41
+ this.parent = parent;
42
+ entries.forEach(([key, implementation])=>this.register(key, implementation));
43
+ }
44
+ }
45
+ function runtimeCapabilityId(key) {
46
+ return typeof key === 'string' ? key : key.id;
47
+ }
48
+
9
49
  /**
10
50
  * Base ability for all toolsets
11
51
  */ class BaseToolset extends tools.BaseToolkit {
@@ -147,68 +187,6 @@ class BuiltinToolset extends BaseToolset {
147
187
  }
148
188
  BuiltinToolset.provider = '';
149
189
 
150
- function createRuntimeCapability(id, options = {}) {
151
- return Object.freeze({
152
- id,
153
- description: options.description
154
- });
155
- }
156
- const XPERT_RUNTIME_CAPABILITIES_TOKEN = 'XPERT_RUNTIME_CAPABILITIES';
157
- /** Metadata key under which RuntimeCapabilityProviderExplorer discovers capability providers. */ const RUNTIME_CAPABILITY_PROVIDER = 'XPERT_RUNTIME_CAPABILITY_PROVIDER';
158
- /** Tags a Nest provider as the platform implementation of a runtime capability. */ const RuntimeCapabilityProvider = (capability)=>common.SetMetadata(RUNTIME_CAPABILITY_PROVIDER, capability);
159
- class DefaultRuntimeCapabilityRegistry {
160
- register(key, implementation) {
161
- this.capabilities.set(runtimeCapabilityId(key), implementation);
162
- return this;
163
- }
164
- has(key) {
165
- var _this_parent;
166
- return this.capabilities.has(runtimeCapabilityId(key)) || ((_this_parent = this.parent) == null ? void 0 : _this_parent.get(key)) !== undefined;
167
- }
168
- get(key) {
169
- var _this_parent;
170
- const id = runtimeCapabilityId(key);
171
- return this.capabilities.has(id) ? this.capabilities.get(id) : (_this_parent = this.parent) == null ? void 0 : _this_parent.get(key);
172
- }
173
- require(key) {
174
- const implementation = this.get(key);
175
- if (!implementation) {
176
- throw new Error(`Runtime capability '${runtimeCapabilityId(key)}' is not available`);
177
- }
178
- return implementation;
179
- }
180
- constructor(entries = [], parent){
181
- this.capabilities = new Map();
182
- this.parent = parent;
183
- entries.forEach(([key, implementation])=>this.register(key, implementation));
184
- }
185
- }
186
- function runtimeCapabilityId(key) {
187
- return typeof key === 'string' ? key : key.id;
188
- }
189
-
190
- const KnowledgebaseRuntimeCapability = createRuntimeCapability('platform.knowledgebase', {
191
- description: 'List, search, and write chunks in platform knowledgebases.'
192
- });
193
- const KnowledgebaseProvisioningRuntimeCapability = createRuntimeCapability('platform.knowledgebase.provisioning', {
194
- description: 'Idempotently provision managed platform knowledgebases and connect them to an Agent.'
195
- });
196
-
197
- const KnowledgeGraphRuntimeCapability = createRuntimeCapability('platform.knowledge-graph', {
198
- description: 'Publish, inspect, and retract source-owned structured knowledge graphs without model extraction.'
199
- });
200
-
201
- const KnowledgebaseDocumentsRuntimeCapability = createRuntimeCapability('platform.knowledgebase.documents', {
202
- description: 'Upload, import, create, process, reprocess, inspect, and delete persistent knowledgebase documents.'
203
- });
204
-
205
- const KnowledgeDocumentVisualAssetsRuntimeCapability = createRuntimeCapability('platform.knowledgebase.visual-assets', {
206
- description: 'Issue execution-scoped logical KnowledgeDocument image paths and inject validated images without exposing host storage paths.'
207
- });
208
- const KnowledgeDocumentVisualAssetsRuntimeFactoryCapability = createRuntimeCapability('platform.knowledge-document.visual-assets.factory', {
209
- description: 'Create a visual-assets API with an execution-local image allow-list and authorized workspace writer.'
210
- });
211
-
212
190
  const ActorTokenRuntimeCapability = createRuntimeCapability('platform.actor-token', {
213
191
  description: 'Mint a short-lived host-issued actor bearer token for outbound API calls.'
214
192
  });
@@ -272,6 +250,10 @@ const ProjectAccessRuntimeCapability = createRuntimeCapability('platform.project
272
250
  description: 'Resolve human Project membership for platform and plugin operations.'
273
251
  });
274
252
 
253
+ const ToolImagesRuntimeCapability = createRuntimeCapability('platform.tool-images', {
254
+ description: 'Save scoped immutable tool images and materialize verified pixels for one model request.'
255
+ });
256
+
275
257
  /**
276
258
  * Shared host-runtime plumbing for built-in tools backed by a configured model provider.
277
259
  * Provider request/response semantics remain owned by each plugin.
@@ -393,12 +375,6 @@ exports.BaseTool = BaseTool;
393
375
  exports.BaseToolset = BaseToolset;
394
376
  exports.BuiltinToolset = BuiltinToolset;
395
377
  exports.DefaultRuntimeCapabilityRegistry = DefaultRuntimeCapabilityRegistry;
396
- exports.KnowledgeDocumentVisualAssetsRuntimeCapability = KnowledgeDocumentVisualAssetsRuntimeCapability;
397
- exports.KnowledgeDocumentVisualAssetsRuntimeFactoryCapability = KnowledgeDocumentVisualAssetsRuntimeFactoryCapability;
398
- exports.KnowledgeGraphRuntimeCapability = KnowledgeGraphRuntimeCapability;
399
- exports.KnowledgebaseDocumentsRuntimeCapability = KnowledgebaseDocumentsRuntimeCapability;
400
- exports.KnowledgebaseProvisioningRuntimeCapability = KnowledgebaseProvisioningRuntimeCapability;
401
- exports.KnowledgebaseRuntimeCapability = KnowledgebaseRuntimeCapability;
402
378
  exports.ModelProviderBuiltinToolset = ModelProviderBuiltinToolset;
403
379
  exports.ProjectAccessRuntimeCapability = ProjectAccessRuntimeCapability;
404
380
  exports.ProjectProvisioningRuntimeCapability = ProjectProvisioningRuntimeCapability;
@@ -408,6 +384,7 @@ exports.SANDBOX_JOB_ERROR_CODES = SANDBOX_JOB_ERROR_CODES;
408
384
  exports.SANDBOX_JOB_PROGRESS_PREFIX = SANDBOX_JOB_PROGRESS_PREFIX;
409
385
  exports.SandboxJobRuntimeError = SandboxJobRuntimeError;
410
386
  exports.SandboxJobsRuntimeCapability = SandboxJobsRuntimeCapability;
387
+ exports.ToolImagesRuntimeCapability = ToolImagesRuntimeCapability;
411
388
  exports.WORKSPACE_FILES_SOURCE = WORKSPACE_FILES_SOURCE;
412
389
  exports.WorkspaceFilesRuntimeCapability = WorkspaceFilesRuntimeCapability;
413
390
  exports.XPERT_RUNTIME_CAPABILITIES_TOKEN = XPERT_RUNTIME_CAPABILITIES_TOKEN;
@@ -1,9 +1,49 @@
1
1
  import { _ as _extends } from './_extends.esm.js';
2
2
  import { AiModelTypeEnum } from '@xpert-ai/contracts';
3
- import { Logger, SetMetadata } from '@nestjs/common';
3
+ import { SetMetadata, Logger } from '@nestjs/common';
4
4
  import { BaseToolkit, StructuredTool } from '@langchain/core/tools';
5
5
  import { z } from 'zod/v3';
6
6
 
7
+ function createRuntimeCapability(id, options = {}) {
8
+ return Object.freeze({
9
+ id,
10
+ description: options.description
11
+ });
12
+ }
13
+ const XPERT_RUNTIME_CAPABILITIES_TOKEN = 'XPERT_RUNTIME_CAPABILITIES';
14
+ /** Metadata key under which RuntimeCapabilityProviderExplorer discovers capability providers. */ const RUNTIME_CAPABILITY_PROVIDER = 'XPERT_RUNTIME_CAPABILITY_PROVIDER';
15
+ /** Tags a Nest provider as the platform implementation of a runtime capability. */ const RuntimeCapabilityProvider = (capability)=>SetMetadata(RUNTIME_CAPABILITY_PROVIDER, capability);
16
+ class DefaultRuntimeCapabilityRegistry {
17
+ register(key, implementation) {
18
+ this.capabilities.set(runtimeCapabilityId(key), implementation);
19
+ return this;
20
+ }
21
+ has(key) {
22
+ var _this_parent;
23
+ return this.capabilities.has(runtimeCapabilityId(key)) || ((_this_parent = this.parent) == null ? void 0 : _this_parent.get(key)) !== undefined;
24
+ }
25
+ get(key) {
26
+ var _this_parent;
27
+ const id = runtimeCapabilityId(key);
28
+ return this.capabilities.has(id) ? this.capabilities.get(id) : (_this_parent = this.parent) == null ? void 0 : _this_parent.get(key);
29
+ }
30
+ require(key) {
31
+ const implementation = this.get(key);
32
+ if (!implementation) {
33
+ throw new Error(`Runtime capability '${runtimeCapabilityId(key)}' is not available`);
34
+ }
35
+ return implementation;
36
+ }
37
+ constructor(entries = [], parent){
38
+ this.capabilities = new Map();
39
+ this.parent = parent;
40
+ entries.forEach(([key, implementation])=>this.register(key, implementation));
41
+ }
42
+ }
43
+ function runtimeCapabilityId(key) {
44
+ return typeof key === 'string' ? key : key.id;
45
+ }
46
+
7
47
  /**
8
48
  * Base ability for all toolsets
9
49
  */ class BaseToolset extends BaseToolkit {
@@ -145,68 +185,6 @@ class BuiltinToolset extends BaseToolset {
145
185
  }
146
186
  BuiltinToolset.provider = '';
147
187
 
148
- function createRuntimeCapability(id, options = {}) {
149
- return Object.freeze({
150
- id,
151
- description: options.description
152
- });
153
- }
154
- const XPERT_RUNTIME_CAPABILITIES_TOKEN = 'XPERT_RUNTIME_CAPABILITIES';
155
- /** Metadata key under which RuntimeCapabilityProviderExplorer discovers capability providers. */ const RUNTIME_CAPABILITY_PROVIDER = 'XPERT_RUNTIME_CAPABILITY_PROVIDER';
156
- /** Tags a Nest provider as the platform implementation of a runtime capability. */ const RuntimeCapabilityProvider = (capability)=>SetMetadata(RUNTIME_CAPABILITY_PROVIDER, capability);
157
- class DefaultRuntimeCapabilityRegistry {
158
- register(key, implementation) {
159
- this.capabilities.set(runtimeCapabilityId(key), implementation);
160
- return this;
161
- }
162
- has(key) {
163
- var _this_parent;
164
- return this.capabilities.has(runtimeCapabilityId(key)) || ((_this_parent = this.parent) == null ? void 0 : _this_parent.get(key)) !== undefined;
165
- }
166
- get(key) {
167
- var _this_parent;
168
- const id = runtimeCapabilityId(key);
169
- return this.capabilities.has(id) ? this.capabilities.get(id) : (_this_parent = this.parent) == null ? void 0 : _this_parent.get(key);
170
- }
171
- require(key) {
172
- const implementation = this.get(key);
173
- if (!implementation) {
174
- throw new Error(`Runtime capability '${runtimeCapabilityId(key)}' is not available`);
175
- }
176
- return implementation;
177
- }
178
- constructor(entries = [], parent){
179
- this.capabilities = new Map();
180
- this.parent = parent;
181
- entries.forEach(([key, implementation])=>this.register(key, implementation));
182
- }
183
- }
184
- function runtimeCapabilityId(key) {
185
- return typeof key === 'string' ? key : key.id;
186
- }
187
-
188
- const KnowledgebaseRuntimeCapability = createRuntimeCapability('platform.knowledgebase', {
189
- description: 'List, search, and write chunks in platform knowledgebases.'
190
- });
191
- const KnowledgebaseProvisioningRuntimeCapability = createRuntimeCapability('platform.knowledgebase.provisioning', {
192
- description: 'Idempotently provision managed platform knowledgebases and connect them to an Agent.'
193
- });
194
-
195
- const KnowledgeGraphRuntimeCapability = createRuntimeCapability('platform.knowledge-graph', {
196
- description: 'Publish, inspect, and retract source-owned structured knowledge graphs without model extraction.'
197
- });
198
-
199
- const KnowledgebaseDocumentsRuntimeCapability = createRuntimeCapability('platform.knowledgebase.documents', {
200
- description: 'Upload, import, create, process, reprocess, inspect, and delete persistent knowledgebase documents.'
201
- });
202
-
203
- const KnowledgeDocumentVisualAssetsRuntimeCapability = createRuntimeCapability('platform.knowledgebase.visual-assets', {
204
- description: 'Issue execution-scoped logical KnowledgeDocument image paths and inject validated images without exposing host storage paths.'
205
- });
206
- const KnowledgeDocumentVisualAssetsRuntimeFactoryCapability = createRuntimeCapability('platform.knowledge-document.visual-assets.factory', {
207
- description: 'Create a visual-assets API with an execution-local image allow-list and authorized workspace writer.'
208
- });
209
-
210
188
  const ActorTokenRuntimeCapability = createRuntimeCapability('platform.actor-token', {
211
189
  description: 'Mint a short-lived host-issued actor bearer token for outbound API calls.'
212
190
  });
@@ -270,6 +248,10 @@ const ProjectAccessRuntimeCapability = createRuntimeCapability('platform.project
270
248
  description: 'Resolve human Project membership for platform and plugin operations.'
271
249
  });
272
250
 
251
+ const ToolImagesRuntimeCapability = createRuntimeCapability('platform.tool-images', {
252
+ description: 'Save scoped immutable tool images and materialize verified pixels for one model request.'
253
+ });
254
+
273
255
  /**
274
256
  * Shared host-runtime plumbing for built-in tools backed by a configured model provider.
275
257
  * Provider request/response semantics remain owned by each plugin.
@@ -384,4 +366,4 @@ function normalizeWorkspaceScope(scope) {
384
366
  } : {});
385
367
  }
386
368
 
387
- export { ActorTokenRuntimeCapability as A, BuiltinToolset as B, DefaultRuntimeCapabilityRegistry as D, KnowledgeDocumentVisualAssetsRuntimeCapability as K, ModelProviderBuiltinToolset as M, ProjectAccessRuntimeCapability as P, RUNTIME_CAPABILITY_PROVIDER as R, SANDBOX_JOB_ERROR_CODES as S, WorkspaceFilesRuntimeCapability as W, XPERT_RUNTIME_CAPABILITIES_TOKEN as X, ActorTokenRuntimeFactoryCapability as a, ArtifactsRuntimeCapability as b, createRuntimeCapability as c, BaseTool as d, BaseToolset as e, KnowledgeDocumentVisualAssetsRuntimeFactoryCapability as f, KnowledgeGraphRuntimeCapability as g, KnowledgebaseDocumentsRuntimeCapability as h, KnowledgebaseProvisioningRuntimeCapability as i, KnowledgebaseRuntimeCapability as j, ProjectProvisioningRuntimeCapability as k, RuntimeCapabilityProvider as l, SANDBOX_JOB_PROGRESS_PREFIX as m, SandboxJobRuntimeError as n, SandboxJobsRuntimeCapability as o, WORKSPACE_FILES_SOURCE as p, isSandboxJobRuntimeError as q };
369
+ export { ActorTokenRuntimeCapability as A, BuiltinToolset as B, DefaultRuntimeCapabilityRegistry as D, ModelProviderBuiltinToolset as M, ProjectAccessRuntimeCapability as P, RUNTIME_CAPABILITY_PROVIDER as R, SANDBOX_JOB_ERROR_CODES as S, ToolImagesRuntimeCapability as T, WorkspaceFilesRuntimeCapability as W, XPERT_RUNTIME_CAPABILITIES_TOKEN as X, ActorTokenRuntimeFactoryCapability as a, ArtifactsRuntimeCapability as b, createRuntimeCapability as c, BaseTool as d, BaseToolset as e, ProjectProvisioningRuntimeCapability as f, RuntimeCapabilityProvider as g, SANDBOX_JOB_PROGRESS_PREFIX as h, SandboxJobRuntimeError as i, SandboxJobsRuntimeCapability as j, WORKSPACE_FILES_SOURCE as k, isSandboxJobRuntimeError as l };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xpert-ai/plugin-sdk",
3
- "version": "3.19.0",
3
+ "version": "3.21.0",
4
4
  "license": "AGPL-3.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -19,6 +19,12 @@
19
19
  "import": "./index.cjs.mjs",
20
20
  "default": "./index.cjs.js"
21
21
  },
22
+ "./agent-results": {
23
+ "module": "./agent-results.esm.js",
24
+ "types": "./agent-results.d.ts",
25
+ "import": "./agent-results.cjs.mjs",
26
+ "default": "./agent-results.cjs.js"
27
+ },
22
28
  "./data-workbench": {
23
29
  "module": "./data-workbench.esm.js",
24
30
  "types": "./data-workbench.d.ts",
@@ -56,7 +62,7 @@
56
62
  },
57
63
  "dependencies": {
58
64
  "@langchain/openai": "0.6.9",
59
- "@xpert-ai/contracts": "3.19.0",
65
+ "@xpert-ai/contracts": "3.21.0",
60
66
  "express": "^4.22.1",
61
67
  "js-tiktoken": "^1.0.21"
62
68
  },
package/results.cjs.js ADDED
@@ -0,0 +1,50 @@
1
+ 'use strict';
2
+
3
+ var _extends = require('./_extends.cjs.js');
4
+ var v3 = require('zod/v3');
5
+ var contracts = require('@xpert-ai/contracts');
6
+
7
+ /** Opt in to the host's authorized, on-demand result View from middleware metadata. */ const AGENT_TASK_RESULTS_FEATURE = 'agent_task_results';
8
+ const common = {
9
+ id: v3.z.string().regex(/^[a-zA-Z0-9_-]{1,80}$/),
10
+ title: v3.z.string().min(1).max(200),
11
+ summary: v3.z.string().max(16000)
12
+ };
13
+ /** Machine-readable result kind; file declarations are not committed artifacts or download grants. */ const agentResultItemSchema = v3.z.discriminatedUnion('type', [
14
+ v3.z.object(_extends._extends({}, common, {
15
+ type: v3.z.literal('analysis')
16
+ })).strict(),
17
+ v3.z.object(_extends._extends({}, common, {
18
+ type: v3.z.literal('changes'),
19
+ files: v3.z.array(v3.z.object({
20
+ path: contracts.agentResultPathSchema,
21
+ change: v3.z.enum([
22
+ 'created',
23
+ 'modified',
24
+ 'deleted'
25
+ ])
26
+ }).strict()).max(128)
27
+ })).strict(),
28
+ v3.z.object(_extends._extends({}, common, {
29
+ type: v3.z.literal('tests'),
30
+ status: v3.z.enum([
31
+ 'passed',
32
+ 'failed',
33
+ 'skipped'
34
+ ]),
35
+ command: v3.z.string().max(2000).optional()
36
+ })).strict(),
37
+ v3.z.object(_extends._extends({}, common, {
38
+ type: v3.z.literal('file'),
39
+ path: contracts.agentResultPathSchema
40
+ })).strict()
41
+ ]);
42
+ /** Explicit final response envelope shared by adapters; ordinary prose is never classified heuristically. */ const agentTaskResultSchema = v3.z.object({
43
+ version: v3.z.literal(1),
44
+ summary: v3.z.string().max(64000),
45
+ items: v3.z.array(agentResultItemSchema).max(32)
46
+ }).strict().refine((value)=>new Set(value.items.map((item)=>item.id)).size === value.items.length, 'Result item IDs must be unique');
47
+
48
+ exports.AGENT_TASK_RESULTS_FEATURE = AGENT_TASK_RESULTS_FEATURE;
49
+ exports.agentResultItemSchema = agentResultItemSchema;
50
+ exports.agentTaskResultSchema = agentTaskResultSchema;
package/results.esm.js ADDED
@@ -0,0 +1,46 @@
1
+ import { _ as _extends } from './_extends.esm.js';
2
+ import { z } from 'zod/v3';
3
+ import { agentResultPathSchema } from '@xpert-ai/contracts';
4
+
5
+ /** Opt in to the host's authorized, on-demand result View from middleware metadata. */ const AGENT_TASK_RESULTS_FEATURE = 'agent_task_results';
6
+ const common = {
7
+ id: z.string().regex(/^[a-zA-Z0-9_-]{1,80}$/),
8
+ title: z.string().min(1).max(200),
9
+ summary: z.string().max(16000)
10
+ };
11
+ /** Machine-readable result kind; file declarations are not committed artifacts or download grants. */ const agentResultItemSchema = z.discriminatedUnion('type', [
12
+ z.object(_extends({}, common, {
13
+ type: z.literal('analysis')
14
+ })).strict(),
15
+ z.object(_extends({}, common, {
16
+ type: z.literal('changes'),
17
+ files: z.array(z.object({
18
+ path: agentResultPathSchema,
19
+ change: z.enum([
20
+ 'created',
21
+ 'modified',
22
+ 'deleted'
23
+ ])
24
+ }).strict()).max(128)
25
+ })).strict(),
26
+ z.object(_extends({}, common, {
27
+ type: z.literal('tests'),
28
+ status: z.enum([
29
+ 'passed',
30
+ 'failed',
31
+ 'skipped'
32
+ ]),
33
+ command: z.string().max(2000).optional()
34
+ })).strict(),
35
+ z.object(_extends({}, common, {
36
+ type: z.literal('file'),
37
+ path: agentResultPathSchema
38
+ })).strict()
39
+ ]);
40
+ /** Explicit final response envelope shared by adapters; ordinary prose is never classified heuristically. */ const agentTaskResultSchema = z.object({
41
+ version: z.literal(1),
42
+ summary: z.string().max(64000),
43
+ items: z.array(agentResultItemSchema).max(32)
44
+ }).strict().refine((value)=>new Set(value.items.map((item)=>item.id)).size === value.items.length, 'Result item IDs must be unique');
45
+
46
+ export { AGENT_TASK_RESULTS_FEATURE as A, agentResultItemSchema as a, agentTaskResultSchema as b };
@@ -0,0 +1,2 @@
1
+ /** Browser-safe result contracts. Keep this entry independent of the server SDK barrel. */
2
+ export * from './lib/agent/runtime/results';
package/src/index.d.ts CHANGED
@@ -2,6 +2,8 @@ export * from './lib/plugin';
2
2
  export * from './lib/plugin.interface';
3
3
  export * from './lib/plugin-metadata';
4
4
  export * from './lib/artifact-namespace';
5
+ export * from './lib/resource-card';
6
+ export * from './lib/resource-card-provider';
5
7
  export * from './lib/types';
6
8
  export * from './lib/logger';
7
9
  export * from './lib/integration/index';
@@ -30,3 +32,4 @@ export * from './lib/mcp/index';
30
32
  export * from './lib/tool-provider/index';
31
33
  export * from './lib/project-type/index';
32
34
  export * from './lib/project-task/index';
35
+ export * from './lib/agent-plugin/import-default-agent-plugins.command';
@@ -1,8 +1,10 @@
1
- import { TChatOptions, TChatRequest, TChatRuntimePrincipal, TChatSourceAuditOptions } from '@xpert-ai/contracts';
1
+ import { TChatMessageEnvelope, TChatOptions, TChatRequest, TChatRuntimePrincipal, TChatSourceAuditOptions } from '@xpert-ai/contracts';
2
2
  export declare const AGENT_CHAT_DISPATCH_MESSAGE_TYPE: import("./message-type").StructuredHandoffMessageType;
3
3
  export declare const AGENT_CHAT_DISPATCH_ERROR_STEER_TARGET_NOT_RUNNING = "steer_target_not_running";
4
4
  export interface AgentChatHandoffMessageCallbackTarget {
5
5
  transport?: 'handoff-message';
6
+ /** Defaults to all events; lifecycle emits only terminal callbacks, leaving tokens in the run stream. */
7
+ events?: 'all' | 'lifecycle';
6
8
  messageType: string;
7
9
  headers?: Record<string, string>;
8
10
  context?: Record<string, unknown>;
@@ -16,11 +18,18 @@ export type AgentChatRuntimePrincipal = TChatRuntimePrincipal;
16
18
  export interface AgentChatDispatchPayload extends Record<string, unknown> {
17
19
  request: TChatRequest;
18
20
  options: TChatOptions & TChatSourceAuditOptions & {
21
+ /** Host-created group recipient receipt; the runtime must reauthorize it before execution. */
22
+ groupDeliveryId?: string;
23
+ /** Host-resolved runtime branch, independent of the conversation root. */
24
+ threadId?: string;
25
+ isDerivedThread?: boolean;
19
26
  xpertId?: string;
20
27
  isDraft?: boolean;
21
28
  from?: string;
22
29
  fromEndUserId?: string;
23
30
  runtimePrincipal?: AgentChatRuntimePrincipal;
31
+ /** Host-resolved provenance and presentation; never grants routing or execution privileges. */
32
+ messageEnvelope?: TChatMessageEnvelope;
24
33
  execution?: {
25
34
  id: string;
26
35
  };