@xpert-ai/plugin-sdk 3.27.0 → 3.29.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 (60) hide show
  1. package/collaboration-client.cjs.js +31 -5
  2. package/collaboration-client.esm.js +31 -5
  3. package/data-workbench.cjs.js +0 -679
  4. package/data-workbench.esm.js +1 -676
  5. package/docs/artifact-presentations.md +2 -0
  6. package/docs/artifact-types.md +97 -0
  7. package/docs/data-workbench.md +37 -0
  8. package/index.cjs.js +481 -49
  9. package/index.esm.js +469 -49
  10. package/model-provider.cjs.js +7 -1
  11. package/model-provider.esm.js +7 -2
  12. package/package.json +2 -2
  13. package/src/data-workbench.d.ts +0 -2
  14. package/src/index.d.ts +2 -0
  15. package/src/lib/agent/handoff/types.d.ts +5 -0
  16. package/src/lib/agent/middleware/capabilities/assistant-task.d.ts +6 -1
  17. package/src/lib/agent/middleware/capabilities/execution-observability.d.ts +26 -0
  18. package/src/lib/agent/middleware/capabilities/index.d.ts +1 -0
  19. package/src/lib/agent/runtime/capability.d.ts +4 -0
  20. package/src/lib/agent/runtime/cli-model-profile.d.ts +1 -1
  21. package/src/lib/agent/runtime/execution-runner.d.ts +11 -0
  22. package/src/lib/agent/runtime/index.d.ts +2 -0
  23. package/src/lib/agent/runtime/managed.d.ts +94 -0
  24. package/src/lib/agent/runtime/process-supervisor.d.ts +1 -0
  25. package/src/lib/agent/runtime/strategy.d.ts +14 -0
  26. package/src/lib/agent/runtime/types.d.ts +30 -1
  27. package/src/lib/ai-model/native-model.d.ts +5 -1
  28. package/src/lib/artifact-type/definition.schema.d.ts +119 -0
  29. package/src/lib/artifact-type/index.d.ts +91 -0
  30. package/src/lib/artifact-type/registry.d.ts +25 -0
  31. package/src/lib/assistant-capability/index.d.ts +1 -0
  32. package/src/lib/assistant-capability/middleware.d.ts +10 -0
  33. package/src/lib/collaboration/types.d.ts +5 -0
  34. package/src/lib/content-resource/catalog.d.ts +88 -0
  35. package/src/lib/content-resource/editor-compatibility.d.ts +3 -0
  36. package/src/lib/content-resource/editor.d.ts +35 -3
  37. package/src/lib/content-resource/index.d.ts +3 -0
  38. package/src/lib/data/datasource/adapter.strategy.d.ts +3 -0
  39. package/src/lib/data/datasource/index.d.ts +0 -2
  40. package/src/lib/data/datasource/strategy.interface.d.ts +5 -1
  41. package/src/lib/data/datasource/types.d.ts +2 -2
  42. package/src/lib/data/datasource/workbench.d.ts +4 -3
  43. package/src/lib/execution-control/context.d.ts +7 -0
  44. package/src/lib/execution-control/index.d.ts +2 -0
  45. package/src/lib/managed-queue/index.d.ts +12 -0
  46. package/src/lib/runtime/capabilities/artifact-drafts.d.ts +10 -1
  47. package/src/lib/runtime/capabilities/artifact-library.d.ts +52 -0
  48. package/src/lib/runtime/capabilities/artifacts.d.ts +15 -0
  49. package/src/lib/runtime/capabilities/index.d.ts +1 -0
  50. package/src/lib/runtime/capabilities/mcp-client-runtime.d.ts +2 -0
  51. package/src/lib/runtime/capabilities/sandbox-jobs.d.ts +12 -3
  52. package/src/lib/sandbox/file-edit-command.d.ts +2 -0
  53. package/src/lib/sandbox/file-edit-diff.d.ts +1 -0
  54. package/src/lib/sandbox/protocol.d.ts +13 -1
  55. package/src/lib/sandbox/runtime-provider.d.ts +12 -0
  56. package/src/lib/data/datasource/workbench-adapter.d.ts +0 -51
  57. package/src/lib/data/datasource/workbench-pagination.d.ts +0 -6
  58. package/src/lib/data/datasource/workbench-sql-lexer.d.ts +0 -11
  59. package/src/lib/data/datasource/workbench-sql-syntax.d.ts +0 -3
  60. package/src/lib/data/datasource/workbench-sql.d.ts +0 -20
@@ -198,6 +198,10 @@ const ArtifactsRuntimeCapability = createRuntimeCapability('platform.artifacts',
198
198
  description: 'Create, version, preview, download, share, archive, and delete platform-managed plugin and Agent artifacts.'
199
199
  });
200
200
 
201
+ const ArtifactLibraryRuntimeCapability = createRuntimeCapability('platform.artifact-library', {
202
+ description: 'Add governed Artifact references to a Project content catalog and manage their published links.'
203
+ });
204
+
201
205
  const ArtifactDraftsRuntimeCapability = createRuntimeCapability('platform.artifact-drafts', {
202
206
  description: 'Persist working copies with optimistic concurrency; atomically publish a confirmed revision as an immutable Artifact version.'
203
207
  });
@@ -225,7 +229,8 @@ const WorkspaceFilesRuntimeCapability = createRuntimeCapability('platform.worksp
225
229
  'EXPORT_MEDIA_FAILED',
226
230
  'EXPORT_INPUT_INVALID',
227
231
  'EXPORT_OUTPUT_INVALID',
228
- 'SANDBOX_CANCELLED'
232
+ 'SANDBOX_CANCELLED',
233
+ 'SANDBOX_CONTROL_UNCONFIRMED'
229
234
  ];
230
235
  /** Line prefix used by trusted Actions to report structured, provider-neutral progress. */ const SANDBOX_JOB_PROGRESS_PREFIX = 'XPERT_SANDBOX_PROGRESS ';
231
236
  /**
@@ -425,6 +430,7 @@ function normalizeWorkspaceScope(scope) {
425
430
  exports.ActorTokenRuntimeCapability = ActorTokenRuntimeCapability;
426
431
  exports.ActorTokenRuntimeFactoryCapability = ActorTokenRuntimeFactoryCapability;
427
432
  exports.ArtifactDraftsRuntimeCapability = ArtifactDraftsRuntimeCapability;
433
+ exports.ArtifactLibraryRuntimeCapability = ArtifactLibraryRuntimeCapability;
428
434
  exports.ArtifactsRuntimeCapability = ArtifactsRuntimeCapability;
429
435
  exports.AssistantMiddlewareAccessRuntimeCapability = AssistantMiddlewareAccessRuntimeCapability;
430
436
  exports.BaseTool = BaseTool;
@@ -196,6 +196,10 @@ const ArtifactsRuntimeCapability = createRuntimeCapability('platform.artifacts',
196
196
  description: 'Create, version, preview, download, share, archive, and delete platform-managed plugin and Agent artifacts.'
197
197
  });
198
198
 
199
+ const ArtifactLibraryRuntimeCapability = createRuntimeCapability('platform.artifact-library', {
200
+ description: 'Add governed Artifact references to a Project content catalog and manage their published links.'
201
+ });
202
+
199
203
  const ArtifactDraftsRuntimeCapability = createRuntimeCapability('platform.artifact-drafts', {
200
204
  description: 'Persist working copies with optimistic concurrency; atomically publish a confirmed revision as an immutable Artifact version.'
201
205
  });
@@ -223,7 +227,8 @@ const WorkspaceFilesRuntimeCapability = createRuntimeCapability('platform.worksp
223
227
  'EXPORT_MEDIA_FAILED',
224
228
  'EXPORT_INPUT_INVALID',
225
229
  'EXPORT_OUTPUT_INVALID',
226
- 'SANDBOX_CANCELLED'
230
+ 'SANDBOX_CANCELLED',
231
+ 'SANDBOX_CONTROL_UNCONFIRMED'
227
232
  ];
228
233
  /** Line prefix used by trusted Actions to report structured, provider-neutral progress. */ const SANDBOX_JOB_PROGRESS_PREFIX = 'XPERT_SANDBOX_PROGRESS ';
229
234
  /**
@@ -420,4 +425,4 @@ function normalizeWorkspaceScope(scope) {
420
425
  } : {});
421
426
  }
422
427
 
423
- 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, ArtifactDraftsRuntimeCapability as b, createRuntimeCapability as c, ArtifactsRuntimeCapability as d, AssistantMiddlewareAccessRuntimeCapability as e, BaseTool as f, BaseToolset as g, McpClientRuntimeCapability as h, ProjectFilesRuntimeCapability as i, ProjectKnowledgeRuntimeCapability as j, ProjectProvisioningRuntimeCapability as k, RestClientRuntimeCapability as l, RuntimeCapabilityProvider as m, SANDBOX_JOB_INVOCATION_PREFIX as n, SANDBOX_JOB_PROGRESS_PREFIX as o, SandboxJobRuntimeError as p, SandboxJobsRuntimeCapability as q, WORKSPACE_FILES_SOURCE as r, isSandboxJobRuntimeError as s, workspaceFileMutationPath as t, workspaceRelativeFilePathSchema as u, workspaceFileMutationMetadata as w };
428
+ 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, ArtifactDraftsRuntimeCapability as b, createRuntimeCapability as c, ArtifactLibraryRuntimeCapability as d, ArtifactsRuntimeCapability as e, AssistantMiddlewareAccessRuntimeCapability as f, BaseTool as g, BaseToolset as h, McpClientRuntimeCapability as i, ProjectFilesRuntimeCapability as j, ProjectKnowledgeRuntimeCapability as k, ProjectProvisioningRuntimeCapability as l, RestClientRuntimeCapability as m, RuntimeCapabilityProvider as n, SANDBOX_JOB_INVOCATION_PREFIX as o, SANDBOX_JOB_PROGRESS_PREFIX as p, SandboxJobRuntimeError as q, SandboxJobsRuntimeCapability as r, WORKSPACE_FILES_SOURCE as s, isSandboxJobRuntimeError as t, workspaceFileMutationPath as u, workspaceRelativeFilePathSchema as v, workspaceFileMutationMetadata as w };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xpert-ai/plugin-sdk",
3
- "version": "3.27.0",
3
+ "version": "3.29.0",
4
4
  "license": "AGPL-3.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -74,7 +74,7 @@
74
74
  },
75
75
  "dependencies": {
76
76
  "@langchain/openai": "0.6.9",
77
- "@xpert-ai/contracts": "3.27.0",
77
+ "@xpert-ai/contracts": "3.29.0",
78
78
  "express": "^4.22.1",
79
79
  "js-tiktoken": "^1.0.21"
80
80
  },
@@ -1,3 +1 @@
1
1
  export * from './lib/data/datasource/workbench';
2
- export * from './lib/data/datasource/workbench-sql';
3
- export * from './lib/data/datasource/workbench-adapter';
package/src/index.d.ts CHANGED
@@ -27,6 +27,7 @@ export * from './lib/managed-connection/index';
27
27
  export * from './lib/managed-queue/index';
28
28
  export * from './lib/view-extension/index';
29
29
  export * from './lib/artifact-presentation/index';
30
+ export * from './lib/artifact-type/index';
30
31
  export * from './lib/collaboration/index';
31
32
  export * from './lib/content-resource/index';
32
33
  export * from './lib/evolution/index';
@@ -36,3 +37,4 @@ export * from './lib/project-type/index';
36
37
  export * from './lib/project-task/index';
37
38
  export * from './lib/project-pipeline';
38
39
  export * from './lib/agent-plugin/import-default-agent-plugins.command';
40
+ export * from './lib/execution-control';
@@ -5,6 +5,7 @@
5
5
  * - Two-gate lane/session permit logic has been removed.
6
6
  * - Lane is now an execution tag for observability and soft policy only.
7
7
  */
8
+ import type { TaskControlRef, TaskControlContext, TaskControlPolicy } from '../../execution-control';
8
9
  export type LaneName = 'main' | 'subagent' | 'cron' | 'nested';
9
10
  export type RunSource = 'chat' | 'xpert' | 'lark' | 'analytics' | 'api';
10
11
  export interface RunMetadata {
@@ -51,6 +52,9 @@ export declare const DEFAULT_EXECUTION_CONFIG: ExecutionConfig;
51
52
  * Using `type` with a string allows plugins to dynamically expand at runtime without needing to modify the core type definition.
52
53
  */
53
54
  export interface HandoffMessage<TPayload extends Record<string, unknown> = Record<string, unknown>> {
55
+ /** Host-issued control identity; serialized separately from business payload. */
56
+ control?: TaskControlRef;
57
+ controlPolicy?: TaskControlPolicy;
54
58
  id: string;
55
59
  /**
56
60
  * Message type, used for processor resolution.
@@ -91,6 +95,7 @@ export interface ProcessorPolicy {
91
95
  idleTimeoutMs?: number;
92
96
  }
93
97
  export interface ProcessContext {
98
+ control?: TaskControlContext;
94
99
  runId: string;
95
100
  traceId: string;
96
101
  abortSignal: AbortSignal;
@@ -1,4 +1,5 @@
1
- import type { JSONValue, TAvatar, ProjectPipelineNativeSource } from '@xpert-ai/contracts';
1
+ import type { TaskControlPolicy } from '../../../execution-control';
2
+ import type { JSONValue, TAvatar, ProjectPipelineNativeSource, ExecutionControlEvidence } from '@xpert-ai/contracts';
2
3
  /** Task lifecycle snapshot. interrupted means paused; unknown does not confirm failure. */
3
4
  export type AgentMiddlewareAssistantTaskStatus = 'queued' | 'running' | 'succeeded' | 'failed' | 'interrupted' | 'unknown';
4
5
  /** Existing platform file reference; access remains subject to host authorization. */
@@ -115,6 +116,8 @@ export type AgentMiddlewareCorrelatedExecution = {
115
116
  };
116
117
  /** Start an asynchronous task on the current Assistant or a resolved external Assistant. */
117
118
  export type AgentMiddlewareAssistantTaskInput = {
119
+ /** Trusted host lifecycle selection; background mode alone never selects independence. */
120
+ controlPolicy?: TaskControlPolicy;
118
121
  /** Current/requesting Assistant ID; must match target.requesterXpertId when target is supplied. */
119
122
  xpertId: string;
120
123
  /** Fail before dispatch if the accessible published executor changed after the caller prepared its intent. */
@@ -145,6 +148,8 @@ export type AgentMiddlewareAssistantTaskInput = {
145
148
  /** Task receipt, not necessarily a completed result. Use status and execution identifiers to follow progress. */
146
149
  export type AgentMiddlewareAssistantTaskResult = {
147
150
  status: AgentMiddlewareAssistantTaskStatus;
151
+ /** Actual execution evidence, independent of legacy business status and cancellation acknowledgements. */
152
+ control?: ExecutionControlEvidence;
148
153
  taskId?: string;
149
154
  executionId?: string;
150
155
  conversationId?: string;
@@ -0,0 +1,26 @@
1
+ import type { z } from 'zod/v3';
2
+ import type { ExecutionObservationQueryInput, ExecutionObservationOverview, ExecutionObservationList, ExecutionObservationConversations, ExecutionObservationSummary, ExecutionObservationDetail, ExecutionObservationComparison, ExecutionObservationAnomalies, executionObservationDetailQuerySchema, executionObservationCompareSchema, executionObservationAnomalySchema } from '@xpert-ai/contracts';
3
+ import { type IApiPrincipal } from '@xpert-ai/contracts';
4
+ /** Credential audience check only; the host must still revalidate the human's live admin role and grant. */
5
+ export declare function isExecutionObservationSession(principal: IApiPrincipal | null, xpertId?: string | null): boolean;
6
+ /** Read-only execution analytics. The host binds identity; arguments cannot change its authorization scope. */
7
+ export interface ExecutionObservabilityApi {
8
+ workspaces(input: {
9
+ page: number;
10
+ search?: string;
11
+ }): Promise<{
12
+ items: Array<{
13
+ id: string;
14
+ name: string;
15
+ }>;
16
+ hasMore: boolean;
17
+ }>;
18
+ overview(input: ExecutionObservationQueryInput): Promise<ExecutionObservationOverview>;
19
+ conversations(input: ExecutionObservationQueryInput): Promise<ExecutionObservationConversations>;
20
+ query(input: ExecutionObservationQueryInput): Promise<ExecutionObservationList>;
21
+ summary(input: ExecutionObservationQueryInput): Promise<ExecutionObservationSummary>;
22
+ get(input: z.input<typeof executionObservationDetailQuerySchema>): Promise<ExecutionObservationDetail>;
23
+ compare(input: z.input<typeof executionObservationCompareSchema>): Promise<ExecutionObservationComparison>;
24
+ findAnomalies(input: z.input<typeof executionObservationAnomalySchema>): Promise<ExecutionObservationAnomalies>;
25
+ }
26
+ export declare const ExecutionObservabilityRuntimeCapability: import("../../../core/runtime-capability").RuntimeCapabilityKey<ExecutionObservabilityApi>;
@@ -1,2 +1,3 @@
1
1
  export * from './assistant-task';
2
2
  export * from './file';
3
+ export * from './execution-observability';
@@ -4,6 +4,10 @@ import type { TaskWaitRequest, TaskWaitResult } from './task-wait';
4
4
  import type { ConversationResourceCard } from '@xpert-ai/contracts';
5
5
  /** Invocation API bound to one authorized caller/execution. Each operation revalidates access. */
6
6
  export interface AgentInvocationApi {
7
+ /** Discover inherited runtime presets without creating bindings or starting processes. */
8
+ listManaged?(): Promise<import('./managed').ManagedAgentRuntimeOption[]>;
9
+ /** Resolve an installed preset using the captured caller's current permissions. */
10
+ resolveManaged?(selection: import('./managed').ManagedAgentRuntimeSelection): Promise<AgentTarget>;
7
11
  /** Create a host-owned presentation receipt after a successful dispatch, without inspecting the runtime. */
8
12
  getResourceCard?(invocationId: string): Promise<ConversationResourceCard | null>;
9
13
  /** Resolve a binding to a pinned target. Optional on hosts with pre-resolved native targets. */
@@ -13,7 +13,7 @@ export interface CliModelConfigurationInput {
13
13
  directory: string;
14
14
  gatewayBaseUrl: string;
15
15
  defaultModelId?: string;
16
- models: Array<Pick<ModelExecutionModel, 'id' | 'protocols' | 'contextWindow' | 'outputTokenLimit'>>;
16
+ models: Array<Pick<ModelExecutionModel, 'id' | 'protocols' | 'contextWindow' | 'outputTokenLimit' | 'parameters'>>;
17
17
  /** @deprecated Legacy input only. Use the selected model's catalog metadata. */
18
18
  limits?: Partial<ModelExecutionLimits> & {
19
19
  maxOutputTokens?: number;
@@ -9,6 +9,8 @@ export type AgentRunnerEnvironment = Extract<ModelExecutionEnvironment, {
9
9
  interface AgentRunnerReceiptBase {
10
10
  /** Owning platform invocation; never a caller-selected process launch key. */
11
11
  invocationId: string;
12
+ /** Set only by hosts using the owned-descendant supervisor. Historical receipts remain unconfirmed. */
13
+ supervision?: 1;
12
14
  /** Bound environment instance; replacing the instance invalidates this receipt. */
13
15
  environment: AgentRunnerEnvironment;
14
16
  /** Opaque host process reference, not necessarily an operating-system PID. */
@@ -32,6 +34,13 @@ export type AgentRunnerReceipt = AgentRunnerReceiptBase & ({
32
34
  version: 2;
33
35
  executionDirectory: string;
34
36
  });
37
+ export interface AgentRunnerExitEvidence {
38
+ version: 1;
39
+ coverage: 'descendants';
40
+ invocationId: string;
41
+ environment: AgentRunnerEnvironment;
42
+ processId: string;
43
+ }
35
44
  /** Per-scope host capability. Methods recheck the persisted invocation and receipt before side effects. */
36
45
  export interface AgentExecutionRunner {
37
46
  /** Resolve the already persisted Invocation/Binding. Checkpoint before sending launch input. */
@@ -40,6 +49,7 @@ export interface AgentExecutionRunner {
40
49
  inspect(receipt: AgentRunnerReceipt): Promise<{
41
50
  state: 'running' | 'exited' | 'unknown';
42
51
  exitCode?: number;
52
+ completion?: AgentRunnerExitEvidence;
43
53
  }>;
44
54
  /** Relative HTTP request over the approved local service transport; no caller-supplied URL or headers. */
45
55
  request(receipt: AgentRunnerReceipt, request: {
@@ -55,6 +65,7 @@ export interface AgentExecutionRunner {
55
65
  /** Revoke model access and request process termination. Only exited confirms termination. */
56
66
  stop(receipt: AgentRunnerReceipt): Promise<{
57
67
  state: 'exited' | 'stopping' | 'unknown';
68
+ completion?: AgentRunnerExitEvidence;
58
69
  }>;
59
70
  }
60
71
  export declare const AgentExecutionRunnerCapability: import("../../core/runtime-capability").RuntimeCapabilityKey<AgentExecutionRunner>;
@@ -6,6 +6,8 @@ export * from './cli-model-profile';
6
6
  export * from './task-wait';
7
7
  export * from './results';
8
8
  export * from './execution-runner';
9
+ export * from './process-supervisor';
9
10
  export * from './dispatch';
10
11
  export * from './activity';
12
+ export * from './managed';
11
13
  export * from './pipeline-scope';
@@ -0,0 +1,94 @@
1
+ import { z } from 'zod/v3';
2
+ /** Adapter declarations are discoverability metadata, never an execution grant. */
3
+ export interface ManagedAgentRuntimeProfile {
4
+ reference: string;
5
+ version: string;
6
+ title: string;
7
+ toolName: string;
8
+ description: string;
9
+ environment: 'computer' | 'process' | 'sdk' | 'service';
10
+ }
11
+ export interface ManagedAgentRuntimeSelection {
12
+ provider: string;
13
+ reference: string;
14
+ }
15
+ export interface ManagedAgentRuntimeOption extends ManagedAgentRuntimeSelection {
16
+ title: string;
17
+ toolName: string;
18
+ description: string;
19
+ }
20
+ /** Persisted host ownership marker. Only built-in presets are supported. */
21
+ export declare const managedAgentRuntimeSchema: z.ZodObject<{
22
+ type: z.ZodLiteral<"builtin">;
23
+ version: z.ZodString;
24
+ }, "strict", z.ZodTypeAny, {
25
+ type?: "builtin";
26
+ version?: string;
27
+ }, {
28
+ type?: "builtin";
29
+ version?: string;
30
+ }>;
31
+ /** Launch settings supplied by the installed strategy, never by tool input or host provider lists. */
32
+ export declare const agentRuntimeDeploymentSpecSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
33
+ type: z.ZodLiteral<"process">;
34
+ command: z.ZodEffects<z.ZodString, string, string>;
35
+ args: z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">;
36
+ environment: z.ZodRecord<z.ZodString, z.ZodString>;
37
+ model: z.ZodOptional<z.ZodString>;
38
+ timeoutMs: z.ZodNumber;
39
+ }, "strict", z.ZodTypeAny, {
40
+ type?: "process";
41
+ command?: string;
42
+ timeoutMs?: number;
43
+ model?: string;
44
+ args?: string[];
45
+ environment?: Record<string, string>;
46
+ }, {
47
+ type?: "process";
48
+ command?: string;
49
+ timeoutMs?: number;
50
+ model?: string;
51
+ args?: string[];
52
+ environment?: Record<string, string>;
53
+ }>, z.ZodObject<{
54
+ type: z.ZodLiteral<"sdk">;
55
+ environment: z.ZodRecord<z.ZodString, z.ZodString>;
56
+ model: z.ZodOptional<z.ZodString>;
57
+ timeoutMs: z.ZodNumber;
58
+ }, "strict", z.ZodTypeAny, {
59
+ type?: "sdk";
60
+ timeoutMs?: number;
61
+ model?: string;
62
+ environment?: Record<string, string>;
63
+ }, {
64
+ type?: "sdk";
65
+ timeoutMs?: number;
66
+ model?: string;
67
+ environment?: Record<string, string>;
68
+ }>, z.ZodObject<{
69
+ type: z.ZodLiteral<"service">;
70
+ serverUrl: z.ZodEffects<z.ZodString, string, string>;
71
+ authorization: z.ZodOptional<z.ZodString>;
72
+ timeoutMs: z.ZodNumber;
73
+ }, "strict", z.ZodTypeAny, {
74
+ type?: "service";
75
+ timeoutMs?: number;
76
+ authorization?: string;
77
+ serverUrl?: string;
78
+ }, {
79
+ type?: "service";
80
+ timeoutMs?: number;
81
+ authorization?: string;
82
+ serverUrl?: string;
83
+ }>]>;
84
+ export type AgentRuntimeDeploymentSpec = z.infer<typeof agentRuntimeDeploymentSpecSchema>;
85
+ /** Ephemeral launch settings scoped by the host. Only the fingerprint enters persisted targets. */
86
+ export type AgentRuntimeDeployment = AgentRuntimeDeploymentSpec & {
87
+ provider: string;
88
+ revision: string;
89
+ workspaceRoot: string;
90
+ };
91
+ /** Used by SDK/process/service adapters. The host pins the target and rechecks access; no caller-selected scope. */
92
+ export declare const AgentRuntimeDeploymentCapability: import("../../core/runtime-capability").RuntimeCapabilityKey<{
93
+ resolve(): Promise<AgentRuntimeDeployment>;
94
+ }>;
@@ -0,0 +1 @@
1
+ export declare const AGENT_PROCESS_SUPERVISOR: string;
@@ -5,6 +5,13 @@ import type { AgentActivityRecorder } from './activity';
5
5
  import type { AgentInvocationInput, AgentInvocationScope, AgentJson, AgentRuntimeCapabilities, AgentRuntimeHandle, AgentRuntimeObservation, AgentTarget } from './types';
6
6
  /** Trusted per-operation host context, independent of graph and provider transport details. */
7
7
  export interface AgentRuntimeContext {
8
+ /** Original host-assigned attempt; include it in version 2 completion evidence. */
9
+ settlement?: {
10
+ status: 'succeeded' | 'failed' | 'cancelled';
11
+ result?: AgentRuntimeObservation['result'];
12
+ error?: string;
13
+ };
14
+ executionTarget?: import('@xpert-ai/contracts').ExecutionRuntimeTarget;
8
15
  /** Durable host invocation ID used to correlate provider receipts. */
9
16
  invocationId: string;
10
17
  scope: Readonly<AgentInvocationScope>;
@@ -30,6 +37,13 @@ export interface AgentRuntimeStart {
30
37
  * keep per-invocation state isolated. The host owns authorization and persistence.
31
38
  */
32
39
  export interface IAgentRuntimeStrategy {
40
+ /** Built-in transport presets. Declared by installed code; the host still enforces caller access. */
41
+ readonly managedProfiles?: readonly import('./managed').ManagedAgentRuntimeProfile[];
42
+ /** Read-only resolution from this strategy's dependencies/connections; never launch or grant access here.
43
+ * Return undefined when unavailable. The host supplies an already authorized, immutable caller scope.
44
+ * Keep settings stable for a given deployment; changing them invalidates existing bindings.
45
+ */
46
+ resolveManagedDeployment?(reference: string, scope: Readonly<AgentInvocationScope>): Promise<import('./managed').AgentRuntimeDeploymentSpec | undefined>;
33
47
  /** Support flags must agree with the optional methods implemented below. */
34
48
  readonly capabilities: AgentRuntimeCapabilities;
35
49
  /** Launch or recover approved work; checkpoint the handle as soon as it is known. */
@@ -1,4 +1,4 @@
1
- import type { AgentInvocationStatus, AgentRuntimeProgress, ModelExecutionEnvironment, ExecutionActivityCapabilities, ProjectPipelineWorkContext } from '@xpert-ai/contracts';
1
+ import type { ExecutionControlEvidence, AgentInvocationStatus, AgentRuntimeProgress, ModelExecutionEnvironment, ExecutionActivityCapabilities, ProjectPipelineWorkContext } from '@xpert-ai/contracts';
2
2
  export type { AgentInvocationStatus, AgentRuntimeProgress } from '@xpert-ai/contracts';
3
3
  import type { AgentInvocationDispatchContext } from './dispatch';
4
4
  import type { AgentRunnerReceipt } from './execution-runner';
@@ -43,6 +43,12 @@ export interface AgentTarget {
43
43
  }
44
44
  /** Provider support flags; they do not grant caller permissions. */
45
45
  export interface AgentRuntimeCapabilities {
46
+ /** Explicitly allow repeat delivery of the same cancellation after an ambiguous response. */
47
+ idempotentCancellation?: boolean;
48
+ /** Versioned proof of original operation completion, including its owned work. Omitted is unsupported. */
49
+ completionEvidence?: 1 | 2;
50
+ /** Process-local adapters must be controlled on the host boot that admitted the execution. */
51
+ hostAffinity?: 1;
46
52
  activity?: ExecutionActivityCapabilities;
47
53
  /** Explicit adapter compatibility; does not install tools or grant model/environment access. */
48
54
  executionTools?: Array<{
@@ -116,6 +122,8 @@ export interface AgentInteraction {
116
122
  * The host manages identity, revisions and persistence.
117
123
  */
118
124
  export interface AgentRuntimeObservation {
125
+ /** Distinct from request acceptance. The host validates source, capability and exact operation identity. */
126
+ controlEvidence?: ExecutionControlEvidence;
119
127
  /** succeeded requires a result, even for structured-only output. */
120
128
  status: AgentInvocationStatus;
121
129
  handle?: AgentRuntimeHandle;
@@ -140,6 +148,27 @@ export interface AgentInvocationRequest {
140
148
  }
141
149
  /** Host-owned invocation snapshot; not an update DTO. */
142
150
  export interface AgentInvocation extends AgentRuntimeObservation {
151
+ /** Persisted business outcome awaiting independent process completion evidence. */
152
+ reportedOutcome?: 'succeeded' | 'failed' | 'cancelled';
153
+ /** Pinned at admission; plugins cannot replace the original host or execution generation. */
154
+ executionTarget?: import('@xpert-ai/contracts').ExecutionRuntimeTarget;
155
+ completionEvidence?: 1 | 2;
156
+ /** Host-only durable response delivery. An ambiguous claimed response is never resent. */
157
+ hostResponse?: {
158
+ interactionId: string;
159
+ response: AgentJson;
160
+ claimed: boolean;
161
+ };
162
+ /** Host-assigned control adapter, independent of provider names or task labels. */
163
+ controlAdapter?: 'native-assistant-task' | 'native-graph';
164
+ /** Host control survives a missing handle and cannot be cleared by provider progress. */
165
+ control?: {
166
+ intent: 'terminated';
167
+ requestedAt: string;
168
+ deliveryToken?: string;
169
+ deliveryUntil?: string;
170
+ attempted?: boolean;
171
+ };
143
172
  /** Pinned presentation contract remains readable after the runtime plugin is removed. */
144
173
  activity?: ExecutionActivityCapabilities;
145
174
  /** Host startup fence; intermediate receipts are not inspected until start returns or this deadline expires. */
@@ -12,7 +12,11 @@ export interface NativeModelClient {
12
12
  generate(body: NativeModelBody, headers: Readonly<Record<string, string>>, signal: AbortSignal): Promise<Response>;
13
13
  priceUsage(usage: TTokenUsage, context?: LLMPriceContext): ILLMUsage;
14
14
  }
15
- export type NativeModelClientFactory = (protocol: NativeModelProtocol, model: ICopilotModel) => Promise<NativeModelClient>;
15
+ export type NativeModelClientFactory = (protocol: NativeModelProtocol, model: ICopilotModel,
16
+ /** Host-resolved custom model settings, including credentials; never serialized into a grant. */
17
+ options?: {
18
+ modelProperties?: Record<string, unknown>;
19
+ }) => Promise<NativeModelClient>;
16
20
  /** A single fetch is one billable attempt. No SDK retries or redirects to another credential origin. */
17
21
  export declare function nativeModelTransport(input: {
18
22
  protocol: NativeModelProtocol;
@@ -0,0 +1,119 @@
1
+ import { z } from 'zod/v3';
2
+ /** Package exports are a runtime boundary; reject malformed declarations before registration. */
3
+ export declare const artifactTypeDefinitionSchema: z.ZodObject<{
4
+ title: z.ZodOptional<z.ZodObject<{
5
+ en_US: z.ZodString;
6
+ zh_Hans: z.ZodOptional<z.ZodString>;
7
+ zh_Hant: z.ZodOptional<z.ZodString>;
8
+ }, "strict", z.ZodTypeAny, {
9
+ en_US?: string;
10
+ zh_Hans?: string;
11
+ zh_Hant?: string;
12
+ }, {
13
+ en_US?: string;
14
+ zh_Hans?: string;
15
+ zh_Hant?: string;
16
+ }>>;
17
+ kinds: z.ZodArray<z.ZodEnum<["html", "markdown", "pdf", "pptx", "image", "file", "site", "presentation"]>, "many">;
18
+ collection: z.ZodOptional<z.ZodObject<{
19
+ allowCopy: z.ZodBoolean;
20
+ }, "strict", z.ZodTypeAny, {
21
+ allowCopy?: boolean;
22
+ }, {
23
+ allowCopy?: boolean;
24
+ }>>;
25
+ content: z.ZodOptional<z.ZodObject<{
26
+ mimeTypes: z.ZodArray<z.ZodString, "many">;
27
+ maxBytes: z.ZodNumber;
28
+ }, "strict", z.ZodTypeAny, {
29
+ mimeTypes?: string[];
30
+ maxBytes?: number;
31
+ }, {
32
+ mimeTypes?: string[];
33
+ maxBytes?: number;
34
+ }>>;
35
+ sharing: z.ZodOptional<z.ZodObject<{
36
+ accessModes: z.ZodArray<z.ZodEnum<["owner_only", "workspace_all", "organization_all", "custom_principals", "public_link", "signed_preview"]>, "many">;
37
+ versionModes: z.ZodArray<z.ZodEnum<["latest", "version"]>, "many">;
38
+ maxTtlSeconds: z.ZodOptional<z.ZodNumber>;
39
+ allowDownload: z.ZodBoolean;
40
+ mutableLinks: z.ZodBoolean;
41
+ descriptor: z.ZodBoolean;
42
+ shareKey: z.ZodOptional<z.ZodString>;
43
+ }, "strict", z.ZodTypeAny, {
44
+ accessModes?: ("owner_only" | "workspace_all" | "organization_all" | "custom_principals" | "public_link" | "signed_preview")[];
45
+ versionModes?: ("version" | "latest")[];
46
+ maxTtlSeconds?: number;
47
+ allowDownload?: boolean;
48
+ mutableLinks?: boolean;
49
+ descriptor?: boolean;
50
+ shareKey?: string;
51
+ }, {
52
+ accessModes?: ("owner_only" | "workspace_all" | "organization_all" | "custom_principals" | "public_link" | "signed_preview")[];
53
+ versionModes?: ("version" | "latest")[];
54
+ maxTtlSeconds?: number;
55
+ allowDownload?: boolean;
56
+ mutableLinks?: boolean;
57
+ descriptor?: boolean;
58
+ shareKey?: string;
59
+ }>>;
60
+ presentation: z.ZodObject<{
61
+ mode: z.ZodEnum<["file", "snapshot", "authenticated"]>;
62
+ }, "strict", z.ZodTypeAny, {
63
+ mode?: "file" | "authenticated" | "snapshot";
64
+ }, {
65
+ mode?: "file" | "authenticated" | "snapshot";
66
+ }>;
67
+ }, "strict", z.ZodTypeAny, {
68
+ title?: {
69
+ en_US?: string;
70
+ zh_Hans?: string;
71
+ zh_Hant?: string;
72
+ };
73
+ collection?: {
74
+ allowCopy?: boolean;
75
+ };
76
+ content?: {
77
+ mimeTypes?: string[];
78
+ maxBytes?: number;
79
+ };
80
+ presentation?: {
81
+ mode?: "file" | "authenticated" | "snapshot";
82
+ };
83
+ kinds?: ("file" | "image" | "html" | "markdown" | "pdf" | "pptx" | "site" | "presentation")[];
84
+ sharing?: {
85
+ accessModes?: ("owner_only" | "workspace_all" | "organization_all" | "custom_principals" | "public_link" | "signed_preview")[];
86
+ versionModes?: ("version" | "latest")[];
87
+ maxTtlSeconds?: number;
88
+ allowDownload?: boolean;
89
+ mutableLinks?: boolean;
90
+ descriptor?: boolean;
91
+ shareKey?: string;
92
+ };
93
+ }, {
94
+ title?: {
95
+ en_US?: string;
96
+ zh_Hans?: string;
97
+ zh_Hant?: string;
98
+ };
99
+ collection?: {
100
+ allowCopy?: boolean;
101
+ };
102
+ content?: {
103
+ mimeTypes?: string[];
104
+ maxBytes?: number;
105
+ };
106
+ presentation?: {
107
+ mode?: "file" | "authenticated" | "snapshot";
108
+ };
109
+ kinds?: ("file" | "image" | "html" | "markdown" | "pdf" | "pptx" | "site" | "presentation")[];
110
+ sharing?: {
111
+ accessModes?: ("owner_only" | "workspace_all" | "organization_all" | "custom_principals" | "public_link" | "signed_preview")[];
112
+ versionModes?: ("version" | "latest")[];
113
+ maxTtlSeconds?: number;
114
+ allowDownload?: boolean;
115
+ mutableLinks?: boolean;
116
+ descriptor?: boolean;
117
+ shareKey?: string;
118
+ };
119
+ }>;