@xpert-ai/plugin-sdk 3.18.7 → 3.20.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.
- package/CHANGELOG.md +123 -0
- package/MIDDLEWARE_APPS.md +71 -0
- package/README.md +57 -0
- package/RESOURCE-CARDS-VALIDATION.md +51 -0
- package/RESOURCE-CARDS.md +361 -0
- package/TOOL-IMAGES.md +85 -0
- package/agent-results.cjs.default.js +1 -0
- package/agent-results.cjs.js +20 -0
- package/agent-results.cjs.mjs +2 -0
- package/agent-results.d.ts +1 -0
- package/agent-results.esm.js +4 -0
- package/index.cjs.js +586 -162
- package/index.esm.js +530 -167
- package/model-provider.cjs.js +5 -0
- package/model-provider.esm.js +5 -1
- package/package.json +8 -2
- package/results.cjs.js +50 -0
- package/results.esm.js +46 -0
- package/runtime-capabilities.md +35 -0
- package/src/agent-results.d.ts +2 -0
- package/src/index.d.ts +5 -0
- package/src/lib/agent/handoff/agent-chat.contract.d.ts +6 -1
- package/src/lib/agent/handoff/agent-runtime-message.contract.d.ts +319 -0
- package/src/lib/agent/handoff/index.d.ts +1 -0
- package/src/lib/agent/index.d.ts +2 -0
- package/src/lib/agent/middleware/capabilities/assistant-task.d.ts +55 -20
- package/src/lib/agent/middleware/index.d.ts +1 -0
- package/src/lib/agent/middleware/model-requirements.d.ts +9 -0
- package/src/lib/agent/middleware/strategy.interface.d.ts +4 -0
- package/src/lib/agent/middleware/types.d.ts +20 -3
- package/src/lib/agent/resource-card.d.ts +3 -0
- package/src/lib/agent/runtime/activity.d.ts +6 -0
- package/src/lib/agent/runtime/capability.d.ts +37 -0
- package/src/lib/agent/runtime/cli-model-profile.d.ts +62 -0
- package/src/lib/agent/runtime/dispatch.d.ts +517 -0
- package/src/lib/agent/runtime/execution-runner.d.ts +66 -0
- package/src/lib/agent/runtime/index.d.ts +10 -0
- package/src/lib/agent/runtime/model-execution.d.ts +15 -0
- package/src/lib/agent/runtime/results.d.ts +335 -0
- package/src/lib/agent/runtime/strategy.d.ts +53 -0
- package/src/lib/agent/runtime/task-wait.d.ts +35 -0
- package/src/lib/agent/runtime/types.d.ts +156 -0
- package/src/lib/ai-model/ai-model-provider.interface.d.ts +2 -0
- package/src/lib/ai-model/ai-model.d.ts +2 -0
- package/src/lib/ai-model/index.d.ts +3 -0
- package/src/lib/ai-model/llm.d.ts +4 -2
- package/src/lib/ai-model/native-model.d.ts +22 -0
- package/src/lib/ai-model/realtime.d.ts +36 -0
- package/src/lib/ai-model/token-usage.d.ts +13 -0
- package/src/lib/assistant-capability/index.d.ts +42 -0
- package/src/lib/connector/runtime-capability.d.ts +2 -0
- package/src/lib/connector/strategy.interface.d.ts +8 -0
- package/src/lib/core/context/request-context.d.ts +6 -0
- package/src/lib/core/strategy-bus.d.ts +0 -3
- package/src/lib/evolution/runtime-capability.d.ts +2 -1
- package/src/lib/integration/strategy.interface.d.ts +22 -0
- package/src/lib/mcp/app.d.ts +14 -1
- package/src/lib/project-task/index.d.ts +66 -0
- package/src/lib/project-type/index.d.ts +71 -0
- package/src/lib/resource-card-provider/index.d.ts +3 -0
- package/src/lib/resource-card-provider/provider.decorator.d.ts +4 -0
- package/src/lib/resource-card-provider/provider.registry.d.ts +14 -0
- package/src/lib/resource-card-provider/types.d.ts +36 -0
- package/src/lib/resource-card.d.ts +6 -0
- package/src/lib/runtime/capabilities/index.d.ts +1 -0
- package/src/lib/runtime/capabilities/knowledge-graph.d.ts +59 -0
- package/src/lib/runtime/capabilities/knowledgebase-documents.d.ts +21 -0
- package/src/lib/runtime/capabilities/knowledgebase.d.ts +8 -3
- package/src/lib/runtime/capabilities/project-access.d.ts +2 -1
- package/src/lib/runtime/capabilities/project-provisioning.d.ts +13 -0
- package/src/lib/runtime/capabilities/tool-images.d.ts +24 -0
- package/src/lib/runtime/runtime-scope.d.ts +7 -1
- package/src/lib/sandbox/execution-environment.d.ts +12 -0
- package/src/lib/sandbox/execution.d.ts +13 -0
- package/src/lib/sandbox/index.d.ts +1 -0
- package/src/lib/sandbox/managed-service.d.ts +1 -0
- package/src/lib/sandbox/protocol.d.ts +2 -0
- package/src/lib/tool-provider/types.d.ts +6 -0
- package/src/lib/types.d.ts +2 -1
- package/src/lib/workflow/trigger/strategy.interface.d.ts +2 -1
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { JSONValue, TAvatar } from '@xpert-ai/contracts';
|
|
2
|
+
/** Task lifecycle snapshot. interrupted means paused; unknown does not confirm failure. */
|
|
2
3
|
export type AgentMiddlewareAssistantTaskStatus = 'queued' | 'running' | 'succeeded' | 'failed' | 'interrupted' | 'unknown';
|
|
4
|
+
/** Existing platform file reference; access remains subject to host authorization. */
|
|
3
5
|
export type AgentMiddlewareAssistantTaskFile = {
|
|
4
6
|
id?: string;
|
|
5
7
|
fileId?: string;
|
|
@@ -13,33 +15,27 @@ export type AgentMiddlewareAssistantTaskFile = {
|
|
|
13
15
|
role?: string;
|
|
14
16
|
};
|
|
15
17
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* Plugin-owned callers must not persist workspace-local SkillPackage UUIDs.
|
|
19
|
-
* The host resolves this portable identity to the installed package and verifies
|
|
20
|
-
* that the target Agent is directly connected to the owning Skills Middleware.
|
|
18
|
+
* Portable plugin skill identity, resolved through the target Agent's connected Skills Middleware.
|
|
19
|
+
* Do not persist workspace-local SkillPackage UUIDs in plugin configuration.
|
|
21
20
|
*/
|
|
22
21
|
export type AgentMiddlewareAssistantTaskSkillRef = {
|
|
23
22
|
pluginName: string;
|
|
24
23
|
componentKey: string;
|
|
25
24
|
};
|
|
26
|
-
/**
|
|
27
|
-
* Portable role identity used to resolve an organization-owned Assistant.
|
|
28
|
-
* Instance UUIDs stay out of plugin contracts so the same workflow is deployable across organizations.
|
|
29
|
-
*/
|
|
25
|
+
/** Portable plugin/template/Agent identity used to resolve a deployed Assistant. */
|
|
30
26
|
export type AgentMiddlewareExternalAssistantExpectation = {
|
|
31
27
|
pluginName: string;
|
|
32
28
|
templateKey: string;
|
|
33
29
|
agentKey: string;
|
|
34
30
|
};
|
|
35
|
-
/** Resolve the executor from the requester's required, direct external-
|
|
31
|
+
/** Resolve the executor from the requester's required, direct published external-Assistant connections. */
|
|
36
32
|
export type AgentMiddlewareAssistantTaskTarget = {
|
|
37
33
|
kind: 'external_assistant';
|
|
38
34
|
requesterXpertId: string;
|
|
39
35
|
requesterAgentKey: string;
|
|
40
36
|
expectation: AgentMiddlewareExternalAssistantExpectation;
|
|
41
37
|
};
|
|
42
|
-
/**
|
|
38
|
+
/** Plugin-owned operation identity for reconciling executions with a domain subject. */
|
|
43
39
|
export type AgentMiddlewareExecutionCorrelation = {
|
|
44
40
|
namespace: string;
|
|
45
41
|
operationId: string;
|
|
@@ -48,7 +44,7 @@ export type AgentMiddlewareExecutionCorrelation = {
|
|
|
48
44
|
};
|
|
49
45
|
/** Availability of a resolved external Assistant binding. */
|
|
50
46
|
export type AgentMiddlewareExternalAssistantBindingStatus = 'available' | 'incompatible' | 'unpublished' | 'cross_organization';
|
|
51
|
-
/**
|
|
47
|
+
/** Binding display metadata; intentionally omits the deployed Assistant instance ID. */
|
|
52
48
|
export type AgentMiddlewareExternalAssistantBinding = {
|
|
53
49
|
title: string;
|
|
54
50
|
name: string;
|
|
@@ -63,12 +59,12 @@ export type AgentMiddlewareExternalAssistantBinding = {
|
|
|
63
59
|
publishedVersion?: string;
|
|
64
60
|
status: AgentMiddlewareExternalAssistantBindingStatus;
|
|
65
61
|
};
|
|
66
|
-
/**
|
|
62
|
+
/** Requester whose required direct external-Assistant bindings should be listed. */
|
|
67
63
|
export type AgentMiddlewareListExternalAssistantBindingsInput = {
|
|
68
64
|
requesterXpertId: string;
|
|
69
65
|
requesterAgentKey: string;
|
|
70
66
|
};
|
|
71
|
-
/**
|
|
67
|
+
/** Requester-scoped execution lookup for a plugin namespace and domain subject. */
|
|
72
68
|
export type AgentMiddlewareListCorrelatedExecutionsInput = {
|
|
73
69
|
requesterXpertId: string;
|
|
74
70
|
requesterAgentKey: string;
|
|
@@ -76,7 +72,7 @@ export type AgentMiddlewareListCorrelatedExecutionsInput = {
|
|
|
76
72
|
subjectId: string;
|
|
77
73
|
limit?: number;
|
|
78
74
|
};
|
|
79
|
-
/**
|
|
75
|
+
/** Execution receipt for domain reconciliation; executor fields identify the resolved published Assistant. */
|
|
80
76
|
export type AgentMiddlewareCorrelatedExecution = {
|
|
81
77
|
operationId: string;
|
|
82
78
|
subjectId: string;
|
|
@@ -93,27 +89,32 @@ export type AgentMiddlewareCorrelatedExecution = {
|
|
|
93
89
|
startedAt?: string;
|
|
94
90
|
updatedAt?: string;
|
|
95
91
|
};
|
|
92
|
+
/** Start an asynchronous task on the current Assistant or a resolved external Assistant. */
|
|
96
93
|
export type AgentMiddlewareAssistantTaskInput = {
|
|
94
|
+
/** Current/requesting Assistant ID; must match target.requesterXpertId when target is supplied. */
|
|
97
95
|
xpertId: string;
|
|
98
|
-
/** Selects the
|
|
96
|
+
/** Selects the base/Primary model; child Agents retain authored models. */
|
|
99
97
|
modelId?: string;
|
|
98
|
+
/** Entry Agent for the current Assistant; external targets use their resolved primary Agent. */
|
|
100
99
|
agentKey?: string;
|
|
101
|
-
/**
|
|
100
|
+
/** Optional external executor resolved from the requester's published graph. */
|
|
102
101
|
target?: AgentMiddlewareAssistantTaskTarget;
|
|
103
102
|
conversationId?: string | null;
|
|
104
103
|
executionId?: string | null;
|
|
105
104
|
projectId?: string | null;
|
|
106
105
|
taskId?: string;
|
|
106
|
+
/** Per-run idempotency key. Otherwise correlation.operationId or executionId is used; taskId alone is insufficient. */
|
|
107
107
|
clientMessageId?: string;
|
|
108
108
|
prompt: string;
|
|
109
109
|
files?: AgentMiddlewareAssistantTaskFile[];
|
|
110
|
-
/** Skills
|
|
110
|
+
/** Skills expected to load through the target Agent's connected Skills Middleware. */
|
|
111
111
|
selectedSkillRefs?: AgentMiddlewareAssistantTaskSkillRef[];
|
|
112
|
-
/** Additional bounded
|
|
112
|
+
/** Additional bounded runtime input; does not override the task prompt or files. */
|
|
113
113
|
humanInput?: Record<string, JSONValue>;
|
|
114
114
|
context?: Record<string, unknown>;
|
|
115
115
|
correlation?: AgentMiddlewareExecutionCorrelation;
|
|
116
116
|
};
|
|
117
|
+
/** Task receipt, not necessarily a completed result. Use status and execution identifiers to follow progress. */
|
|
117
118
|
export type AgentMiddlewareAssistantTaskResult = {
|
|
118
119
|
status: AgentMiddlewareAssistantTaskStatus;
|
|
119
120
|
taskId?: string;
|
|
@@ -127,6 +128,7 @@ export type AgentMiddlewareAssistantTaskResult = {
|
|
|
127
128
|
executorAssistantTitle?: string;
|
|
128
129
|
executorPublishedVersion?: string;
|
|
129
130
|
};
|
|
131
|
+
/** Host task/execution identifiers for lookup. Cancellation requires an execution, conversation or thread ID. */
|
|
130
132
|
export type AgentMiddlewareAssistantTaskStatusInput = {
|
|
131
133
|
taskId?: string;
|
|
132
134
|
executionId?: string;
|
|
@@ -135,17 +137,50 @@ export type AgentMiddlewareAssistantTaskStatusInput = {
|
|
|
135
137
|
clientMessageId?: string;
|
|
136
138
|
xpertId?: string;
|
|
137
139
|
};
|
|
140
|
+
/** Platform executions affected by the cancellation request. */
|
|
138
141
|
export type AgentMiddlewareAssistantTaskCancelResult = {
|
|
139
142
|
canceledExecutionIds: string[];
|
|
140
143
|
};
|
|
144
|
+
/** Host Assistant Task API. Feature-detect optional methods before calling them. */
|
|
141
145
|
export interface AgentMiddlewareAssistantTaskApi {
|
|
146
|
+
/**
|
|
147
|
+
* Verify that a running native delegate is the requester's bound external role.
|
|
148
|
+
*
|
|
149
|
+
* Re-resolves the requester's direct, required external-Assistant connections on
|
|
150
|
+
* every call. Exactly one candidate must match the plugin, template and primary
|
|
151
|
+
* Agent identity, be published and active in the same organization, and have
|
|
152
|
+
* the same instance ID as the actual executor. This only validates a binding;
|
|
153
|
+
* it does not create a task, invoke an Assistant or authorize domain artifacts.
|
|
154
|
+
*
|
|
155
|
+
* @param input - Requester identity, actual runtime executor and expected role.
|
|
156
|
+
* @param input.requesterXpertId - Assistant that owns the external connection.
|
|
157
|
+
* @param input.requesterAgentKey - The requesting Assistant's primary Agent key.
|
|
158
|
+
* @param input.executorXpertId - Actual executor ID from the trusted runtime context.
|
|
159
|
+
* @param input.expectation - Portable plugin, template and primary Agent identity.
|
|
160
|
+
* @returns Validated binding metadata with instance and workspace IDs omitted.
|
|
161
|
+
* @throws If the binding is missing, ambiguous, unpublished, incompatible, or
|
|
162
|
+
* the resolved instance differs from the runtime executor.
|
|
163
|
+
*/
|
|
164
|
+
assertExternalAssistantBinding?(input: {
|
|
165
|
+
requesterXpertId: string;
|
|
166
|
+
requesterAgentKey: string;
|
|
167
|
+
executorXpertId: string;
|
|
168
|
+
expectation: {
|
|
169
|
+
pluginName: string;
|
|
170
|
+
templateKey: string;
|
|
171
|
+
agentKey: string;
|
|
172
|
+
};
|
|
173
|
+
}): Promise<AgentMiddlewareExternalAssistantBinding>;
|
|
142
174
|
getModels?(xpertId: string): Promise<import('@xpert-ai/contracts').TAssistantModelsResponse>;
|
|
175
|
+
/** Submit once and retain the receipt; use getTaskStatus to follow asynchronous progress. */
|
|
143
176
|
startTask(input: AgentMiddlewareAssistantTaskInput): Promise<AgentMiddlewareAssistantTaskResult>;
|
|
144
|
-
/**
|
|
177
|
+
/** List safe binding descriptors without deployed Assistant instance IDs. */
|
|
145
178
|
listExternalAssistantBindings?(input: AgentMiddlewareListExternalAssistantBindingsInput): Promise<AgentMiddlewareExternalAssistantBinding[]>;
|
|
146
179
|
/** Read executions owned by the requester and its currently bound external Assistants. */
|
|
147
180
|
listCorrelatedExecutions?(input: AgentMiddlewareListCorrelatedExecutionsInput): Promise<AgentMiddlewareCorrelatedExecution[]>;
|
|
181
|
+
/** Return the current receipt, or null if no matching task is found. */
|
|
148
182
|
getTaskStatus?(input: AgentMiddlewareAssistantTaskStatusInput): Promise<AgentMiddlewareAssistantTaskResult | null>;
|
|
149
183
|
cancelTask?(input: AgentMiddlewareAssistantTaskStatusInput): Promise<AgentMiddlewareAssistantTaskCancelResult>;
|
|
150
184
|
}
|
|
185
|
+
/** Scoped runtime capability for platform Assistant tasks. */
|
|
151
186
|
export declare const AssistantTaskRuntimeCapability: import("../../../core/runtime-capability").RuntimeCapabilityKey<AgentMiddlewareAssistantTaskApi>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ModelFeature } from '@xpert-ai/contracts';
|
|
2
|
+
/** Expand only when the host can validate the feature at every model invocation. */
|
|
3
|
+
export type ModelRequirementFeature = ModelFeature.VISION;
|
|
4
|
+
/** Hard requirements for one model call, including retries and fallbacks. */
|
|
5
|
+
export interface ModelRequirements {
|
|
6
|
+
readonly features?: readonly ModelRequirementFeature[];
|
|
7
|
+
}
|
|
8
|
+
/** Combine middleware contributions without mutating or weakening existing requirements. */
|
|
9
|
+
export declare function mergeModelRequirements(...requirements: readonly (ModelRequirements | undefined)[]): ModelRequirements | undefined;
|
|
@@ -5,6 +5,7 @@ import { BaseStore } from '@langchain/langgraph';
|
|
|
5
5
|
import { AgentMiddleware } from './types';
|
|
6
6
|
import { PromiseOrValue } from '../../types';
|
|
7
7
|
import { AgentMiddlewareRuntimeApi } from './runtime';
|
|
8
|
+
import type { AgentInvocationScope } from '../runtime/types';
|
|
8
9
|
export interface IAgentMiddlewareContext {
|
|
9
10
|
tenantId: string;
|
|
10
11
|
organizationId?: string | null;
|
|
@@ -12,6 +13,9 @@ export interface IAgentMiddlewareContext {
|
|
|
12
13
|
workspaceId?: string;
|
|
13
14
|
projectId?: string;
|
|
14
15
|
conversationId?: string;
|
|
16
|
+
executionId?: string;
|
|
17
|
+
/** Omitted for legacy Assistant hosts. Project general agents must explicitly use project_agent. */
|
|
18
|
+
callerType?: AgentInvocationScope['callerType'];
|
|
15
19
|
threadId?: string;
|
|
16
20
|
xpertId?: string;
|
|
17
21
|
workspaceDataScope?: XpertWorkspaceDataScope | null;
|
|
@@ -8,6 +8,7 @@ import { Command } from '@langchain/langgraph';
|
|
|
8
8
|
import type { JsonSchemaObjectType } from '@xpert-ai/contracts';
|
|
9
9
|
import { AgentBuiltInState, Runtime } from './runtime';
|
|
10
10
|
import { PromiseOrValue } from '../../types';
|
|
11
|
+
import type { ModelRequirements } from './model-requirements';
|
|
11
12
|
export type ServerTool = Record<string, unknown>;
|
|
12
13
|
export type ClientTool = StructuredToolInterface | DynamicTool | RunnableToolLike;
|
|
13
14
|
export type NormalizedSchemaInput<TSchema extends InteropZodObject | undefined | never = any> = [TSchema] extends [
|
|
@@ -107,16 +108,26 @@ export type AfterAgentHook<TSchema extends InteropZodObject | undefined = undefi
|
|
|
107
108
|
*/
|
|
108
109
|
export interface ModelRequest<TState extends Record<string, unknown> = Record<string, unknown>, TContext = unknown> {
|
|
109
110
|
/**
|
|
110
|
-
* The model to use for this step.
|
|
111
|
+
* The unbound model to use for this step. Middleware may replace it before
|
|
112
|
+
* the host binds the final tool selection or structured output schema.
|
|
113
|
+
* Replacements must expose bindTools/withStructuredOutput when those features
|
|
114
|
+
* are used. A plain Runnable is supported for calls without either feature.
|
|
111
115
|
*/
|
|
112
116
|
model: LanguageModelLike;
|
|
113
117
|
/**
|
|
114
118
|
* The messages to send to the model.
|
|
115
119
|
*/
|
|
116
120
|
messages: BaseMessage[];
|
|
121
|
+
/**
|
|
122
|
+
* Hard capability requirements for this call. The host unions middleware
|
|
123
|
+
* contributions and checks every selected model, including fallbacks.
|
|
124
|
+
* Required capabilities cannot be silently dropped or replaced by a static response.
|
|
125
|
+
*/
|
|
126
|
+
requirements?: ModelRequirements;
|
|
117
127
|
systemMessage?: SystemMessage;
|
|
118
128
|
/**
|
|
119
|
-
*
|
|
129
|
+
* Portable tool choice configuration, applied by the host after selection.
|
|
130
|
+
* A named tool must remain selected; "required" needs a non-empty selection.
|
|
120
131
|
* Can be one of:
|
|
121
132
|
* - `"auto"`: means the model can pick between generating a message or calling one or more tools.
|
|
122
133
|
* - `"none"`: means the model will not call any tool and instead generates a message.
|
|
@@ -130,7 +141,11 @@ export interface ModelRequest<TState extends Record<string, unknown> = Record<st
|
|
|
130
141
|
};
|
|
131
142
|
};
|
|
132
143
|
/**
|
|
133
|
-
* The tools to make available for this step.
|
|
144
|
+
* The registered tools to make available for this step. Return a subset of
|
|
145
|
+
* these instances (or an empty array) to change the model's available tools.
|
|
146
|
+
* New definitions, cloned tools and schema replacements require separate
|
|
147
|
+
* runtime registration so that every advertised tool has an execution route.
|
|
148
|
+
* Selection does not replace authorization at the tool execution boundary.
|
|
134
149
|
*/
|
|
135
150
|
tools: (ServerTool | ClientTool)[];
|
|
136
151
|
/**
|
|
@@ -225,6 +240,8 @@ export interface AgentMiddleware<TSchema extends InteropZodObject | undefined =
|
|
|
225
240
|
*/
|
|
226
241
|
contextSchema?: TContextSchema;
|
|
227
242
|
tools?: DynamicStructuredTool[];
|
|
243
|
+
/** Resource-backed MCP Apps and explicit model/App tool visibility. */
|
|
244
|
+
apps?: import('../../mcp/app').MiddlewareMcpApps;
|
|
228
245
|
beforeAgent?: BeforeAgentHook<TSchema, TFullContext>;
|
|
229
246
|
beforeModel?: BeforeModelHook<TSchema, TFullContext>;
|
|
230
247
|
afterModel?: AfterModelHook<TSchema, TFullContext>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ExecutionActivityBatch, ExecutionActivityCheckpoint } from '@xpert-ai/contracts';
|
|
2
|
+
/** Optional, invocation-bound public activity sink. Does not alter execution or business status. */
|
|
3
|
+
export interface AgentActivityRecorder {
|
|
4
|
+
readCheckpoint(): Promise<ExecutionActivityCheckpoint>;
|
|
5
|
+
append(batch: ExecutionActivityBatch): Promise<ExecutionActivityCheckpoint>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { AgentInvocation, AgentInvocationRequest, AgentJson, AgentTarget } from './types';
|
|
2
|
+
import type { RuntimeIdentityScope } from '../../runtime/runtime-scope';
|
|
3
|
+
import type { TaskWaitRequest, TaskWaitResult } from './task-wait';
|
|
4
|
+
import type { ConversationResourceCard } from '@xpert-ai/contracts';
|
|
5
|
+
/** Invocation API bound to one authorized caller/execution. Each operation revalidates access. */
|
|
6
|
+
export interface AgentInvocationApi {
|
|
7
|
+
/** Create a host-owned presentation receipt after a successful dispatch, without inspecting the runtime. */
|
|
8
|
+
getResourceCard?(invocationId: string): Promise<ConversationResourceCard | null>;
|
|
9
|
+
/** Resolve a binding to a pinned target. Optional on hosts with pre-resolved native targets. */
|
|
10
|
+
resolve?(bindingId: string): Promise<AgentTarget>;
|
|
11
|
+
/** Start or recover an idempotent request. The returned snapshot may still be running. */
|
|
12
|
+
start(request: AgentInvocationRequest): Promise<AgentInvocation>;
|
|
13
|
+
/** Refresh an existing invocation, possibly persisting provider observations. Never relaunches work. */
|
|
14
|
+
inspect(invocationId: string): Promise<AgentInvocation>;
|
|
15
|
+
/** Request supported cancellation; cancelling does not confirm termination. */
|
|
16
|
+
cancel(invocationId: string): Promise<AgentInvocation>;
|
|
17
|
+
/** Answer the current interaction using its exact ID and provider-defined response schema. */
|
|
18
|
+
respond(invocationId: string, interactionId: string, response: AgentJson): Promise<AgentInvocation>;
|
|
19
|
+
/** Bounded observation; may return a running task. Only human interactions may suspend the graph. */
|
|
20
|
+
awaitResult?(invocationId: string, options?: {
|
|
21
|
+
signal?: AbortSignal;
|
|
22
|
+
timeoutMs?: number;
|
|
23
|
+
}): Promise<AgentInvocation>;
|
|
24
|
+
/** Wait for dependencies within a bounded window. The Agent may wait again when the result is pending. */
|
|
25
|
+
waitForTasks?(request: TaskWaitRequest, options?: {
|
|
26
|
+
signal?: AbortSignal;
|
|
27
|
+
}): Promise<TaskWaitResult<AgentInvocation>>;
|
|
28
|
+
}
|
|
29
|
+
/** Caller-scoped API obtained through runtime.capabilities.require(...). */
|
|
30
|
+
export declare const AgentInvocationRuntimeCapability: import("../../core/runtime-capability").RuntimeCapabilityKey<AgentInvocationApi>;
|
|
31
|
+
/** Trusted host factory; scope must come from authenticated context, not model arguments. */
|
|
32
|
+
export interface AgentRuntimeFactory {
|
|
33
|
+
/** Create an API per caller/execution. Do not cache it as a global singleton. */
|
|
34
|
+
createScopedApi(scope: RuntimeIdentityScope): AgentInvocationApi;
|
|
35
|
+
}
|
|
36
|
+
/** Platform factory capability. The wire key is stable across SDK naming changes. */
|
|
37
|
+
export declare const AgentRuntimeFactoryCapability: import("../../core/runtime-capability").RuntimeCapabilityKey<AgentRuntimeFactory>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { ModelExecutionModel, ModelExecutionLimits, ModelExecutionProtocol, ModelFeature, CliPermissionMode } from '@xpert-ai/contracts';
|
|
2
|
+
/** Configuration adapters describe secrets by reference; only the host materializes credentials. */
|
|
3
|
+
export declare const CLI_MODEL_TOKEN_REFERENCE = "${XPERT_EXECUTION_TOKEN}";
|
|
4
|
+
export interface CliModelConfiguration {
|
|
5
|
+
args: string[];
|
|
6
|
+
environment: Record<string, string>;
|
|
7
|
+
files: Array<{
|
|
8
|
+
name: string;
|
|
9
|
+
content: string;
|
|
10
|
+
}>;
|
|
11
|
+
}
|
|
12
|
+
export interface CliModelConfigurationInput {
|
|
13
|
+
directory: string;
|
|
14
|
+
gatewayBaseUrl: string;
|
|
15
|
+
defaultModelId?: string;
|
|
16
|
+
models: Array<Pick<ModelExecutionModel, 'id' | 'protocols' | 'contextWindow' | 'outputTokenLimit'>>;
|
|
17
|
+
/** @deprecated Legacy input only. Use the selected model's catalog metadata. */
|
|
18
|
+
limits?: Partial<ModelExecutionLimits> & {
|
|
19
|
+
maxOutputTokens?: number;
|
|
20
|
+
};
|
|
21
|
+
managed: boolean;
|
|
22
|
+
/** Host-resolved background approval policy; omitted preserves interactive/shell behavior. */
|
|
23
|
+
permissionMode?: CliPermissionMode;
|
|
24
|
+
}
|
|
25
|
+
/** Installed trusted code; neither an executable path nor a model permission comes from this adapter. */
|
|
26
|
+
export interface CliModelProfile {
|
|
27
|
+
id: string;
|
|
28
|
+
revision: string;
|
|
29
|
+
command: string;
|
|
30
|
+
protocol: Extract<ModelExecutionProtocol, 'openai_chat' | 'openai_responses' | 'anthropic_messages'>;
|
|
31
|
+
requiredCapabilities: ModelFeature[];
|
|
32
|
+
/** Modes this profile explicitly implements; unsupported modes must not be silently ignored. */
|
|
33
|
+
permissionModes?: readonly CliPermissionMode[];
|
|
34
|
+
chatBridge?: {
|
|
35
|
+
versions: readonly string[];
|
|
36
|
+
requiredCapabilities: ModelFeature[];
|
|
37
|
+
};
|
|
38
|
+
/** Optional host-managed background transport. Arguments are trusted profile code, never model input. */
|
|
39
|
+
background?: {
|
|
40
|
+
versions: readonly string[];
|
|
41
|
+
} & ({
|
|
42
|
+
transport: 'opencode';
|
|
43
|
+
} | {
|
|
44
|
+
transport: 'jsonl';
|
|
45
|
+
args: readonly string[];
|
|
46
|
+
/** For CLIs without stdin prompt support. Host appends one literal argv value, never shell text. */
|
|
47
|
+
promptArgument?: string;
|
|
48
|
+
});
|
|
49
|
+
/** Exact complete argv sequences that never need a model grant. */
|
|
50
|
+
offlineArguments: readonly (readonly string[])[];
|
|
51
|
+
/** Exact accepted stdout values for a policy-pinned version probe. */
|
|
52
|
+
versionOutputs(version: string): string[];
|
|
53
|
+
configure(input: CliModelConfigurationInput): CliModelConfiguration;
|
|
54
|
+
}
|
|
55
|
+
export interface CliModelProfiles {
|
|
56
|
+
get(id: string): CliModelProfile | undefined;
|
|
57
|
+
}
|
|
58
|
+
export declare const CliModelProfilesCapability: import("../../core/runtime-capability").RuntimeCapabilityKey<CliModelProfiles>;
|
|
59
|
+
/** Additional execution sources can validate lifecycle without making OS depend on Pro entities. */
|
|
60
|
+
export declare const ShellModelExecutionSourceCapability: import("../../core/runtime-capability").RuntimeCapabilityKey<{
|
|
61
|
+
assertCurrent(context: import("@xpert-ai/contracts").ModelExecutionContext, preparing?: boolean): Promise<void>;
|
|
62
|
+
}>;
|