@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
@@ -0,0 +1,319 @@
1
+ import { z } from 'zod/v3';
2
+ import { type AgentRuntimeReplyTarget } from '../runtime/dispatch';
3
+ export declare const AGENT_RUNTIME_EVENT_MESSAGE_TYPE: import("./message-type").StructuredHandoffMessageType;
4
+ /** Host-produced references. Consumers reload and authorize the invocation and its pinned observation. */
5
+ export declare const agentRuntimeEventSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
6
+ kind: z.ZodLiteral<"progress">;
7
+ progress: z.ZodObject<{
8
+ source: z.ZodEnum<["executor", "host"]>;
9
+ observedAt: z.ZodString;
10
+ startedAt: z.ZodOptional<z.ZodString>;
11
+ phase: z.ZodOptional<z.ZodString>;
12
+ summary: z.ZodOptional<z.ZodString>;
13
+ steps: z.ZodOptional<z.ZodEffects<z.ZodObject<{
14
+ completed: z.ZodNumber;
15
+ total: z.ZodNumber;
16
+ }, "strict", z.ZodTypeAny, {
17
+ total?: number;
18
+ completed?: number;
19
+ }, {
20
+ total?: number;
21
+ completed?: number;
22
+ }>, {
23
+ total?: number;
24
+ completed?: number;
25
+ }, {
26
+ total?: number;
27
+ completed?: number;
28
+ }>>;
29
+ }, "strict", z.ZodTypeAny, {
30
+ source?: "executor" | "host";
31
+ startedAt?: string;
32
+ summary?: string;
33
+ steps?: {
34
+ total?: number;
35
+ completed?: number;
36
+ };
37
+ observedAt?: string;
38
+ phase?: string;
39
+ }, {
40
+ source?: "executor" | "host";
41
+ startedAt?: string;
42
+ summary?: string;
43
+ steps?: {
44
+ total?: number;
45
+ completed?: number;
46
+ };
47
+ observedAt?: string;
48
+ phase?: string;
49
+ }>;
50
+ version: z.ZodLiteral<1>;
51
+ invocationId: z.ZodString;
52
+ /** Revision of the persisted observation, never a queue delivery attempt. */
53
+ revision: z.ZodNumber;
54
+ projectTask: z.ZodOptional<z.ZodObject<{
55
+ projectId: z.ZodString;
56
+ projectTaskId: z.ZodString;
57
+ taskExecutionId: z.ZodString;
58
+ }, "strict", z.ZodTypeAny, {
59
+ projectId?: string;
60
+ projectTaskId?: string;
61
+ taskExecutionId?: string;
62
+ }, {
63
+ projectId?: string;
64
+ projectTaskId?: string;
65
+ taskExecutionId?: string;
66
+ }>>;
67
+ }, "strict", z.ZodTypeAny, {
68
+ version?: 1;
69
+ kind?: "progress";
70
+ projectTask?: {
71
+ projectId?: string;
72
+ projectTaskId?: string;
73
+ taskExecutionId?: string;
74
+ };
75
+ progress?: {
76
+ source?: "executor" | "host";
77
+ startedAt?: string;
78
+ summary?: string;
79
+ steps?: {
80
+ total?: number;
81
+ completed?: number;
82
+ };
83
+ observedAt?: string;
84
+ phase?: string;
85
+ };
86
+ invocationId?: string;
87
+ revision?: number;
88
+ }, {
89
+ version?: 1;
90
+ kind?: "progress";
91
+ projectTask?: {
92
+ projectId?: string;
93
+ projectTaskId?: string;
94
+ taskExecutionId?: string;
95
+ };
96
+ progress?: {
97
+ source?: "executor" | "host";
98
+ startedAt?: string;
99
+ summary?: string;
100
+ steps?: {
101
+ total?: number;
102
+ completed?: number;
103
+ };
104
+ observedAt?: string;
105
+ phase?: string;
106
+ };
107
+ invocationId?: string;
108
+ revision?: number;
109
+ }>, z.ZodObject<{
110
+ kind: z.ZodLiteral<"result">;
111
+ status: z.ZodEnum<["succeeded", "failed", "cancelled"]>;
112
+ version: z.ZodLiteral<1>;
113
+ invocationId: z.ZodString;
114
+ /** Revision of the persisted observation, never a queue delivery attempt. */
115
+ revision: z.ZodNumber;
116
+ projectTask: z.ZodOptional<z.ZodObject<{
117
+ projectId: z.ZodString;
118
+ projectTaskId: z.ZodString;
119
+ taskExecutionId: z.ZodString;
120
+ }, "strict", z.ZodTypeAny, {
121
+ projectId?: string;
122
+ projectTaskId?: string;
123
+ taskExecutionId?: string;
124
+ }, {
125
+ projectId?: string;
126
+ projectTaskId?: string;
127
+ taskExecutionId?: string;
128
+ }>>;
129
+ }, "strict", z.ZodTypeAny, {
130
+ status?: "failed" | "succeeded" | "cancelled";
131
+ version?: 1;
132
+ kind?: "result";
133
+ projectTask?: {
134
+ projectId?: string;
135
+ projectTaskId?: string;
136
+ taskExecutionId?: string;
137
+ };
138
+ invocationId?: string;
139
+ revision?: number;
140
+ }, {
141
+ status?: "failed" | "succeeded" | "cancelled";
142
+ version?: 1;
143
+ kind?: "result";
144
+ projectTask?: {
145
+ projectId?: string;
146
+ projectTaskId?: string;
147
+ taskExecutionId?: string;
148
+ };
149
+ invocationId?: string;
150
+ revision?: number;
151
+ }>, z.ZodObject<{
152
+ kind: z.ZodLiteral<"input_request">;
153
+ interactionId: z.ZodString;
154
+ version: z.ZodLiteral<1>;
155
+ invocationId: z.ZodString;
156
+ /** Revision of the persisted observation, never a queue delivery attempt. */
157
+ revision: z.ZodNumber;
158
+ projectTask: z.ZodOptional<z.ZodObject<{
159
+ projectId: z.ZodString;
160
+ projectTaskId: z.ZodString;
161
+ taskExecutionId: z.ZodString;
162
+ }, "strict", z.ZodTypeAny, {
163
+ projectId?: string;
164
+ projectTaskId?: string;
165
+ taskExecutionId?: string;
166
+ }, {
167
+ projectId?: string;
168
+ projectTaskId?: string;
169
+ taskExecutionId?: string;
170
+ }>>;
171
+ }, "strict", z.ZodTypeAny, {
172
+ version?: 1;
173
+ kind?: "input_request";
174
+ projectTask?: {
175
+ projectId?: string;
176
+ projectTaskId?: string;
177
+ taskExecutionId?: string;
178
+ };
179
+ invocationId?: string;
180
+ revision?: number;
181
+ interactionId?: string;
182
+ }, {
183
+ version?: 1;
184
+ kind?: "input_request";
185
+ projectTask?: {
186
+ projectId?: string;
187
+ projectTaskId?: string;
188
+ taskExecutionId?: string;
189
+ };
190
+ invocationId?: string;
191
+ revision?: number;
192
+ interactionId?: string;
193
+ }>]>;
194
+ export type AgentRuntimeEvent = z.output<typeof agentRuntimeEventSchema>;
195
+ /** Same observation always has the same HandoffMessage.id across retries and process restarts. */
196
+ export declare function agentRuntimeEventMessageId(event: Pick<AgentRuntimeEvent, 'invocationId' | 'revision' | 'kind'>): string;
197
+ /** Transport states are deliberately separate from Task and Invocation status. */
198
+ export declare const agentRuntimeDeliveryStateSchema: z.ZodEnum<["pending", "received", "blocked", "failed"]>;
199
+ export declare const agentRuntimeConsumptionStateSchema: z.ZodEnum<["pending", "processing", "processed", "blocked", "failed"]>;
200
+ export type AgentRuntimeDeliveryState = z.output<typeof agentRuntimeDeliveryStateSchema>;
201
+ export type AgentRuntimeConsumptionState = z.output<typeof agentRuntimeConsumptionStateSchema>;
202
+ /** Store under a unique scoped key in the same transaction as the continuation reservation. */
203
+ export declare const agentRuntimeResultClaimSchema: z.ZodObject<{
204
+ invocationId: z.ZodString;
205
+ resultRevision: z.ZodNumber;
206
+ recipient: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
207
+ type: z.ZodOptional<z.ZodLiteral<"xpert">>;
208
+ xpertId: z.ZodString;
209
+ agentKey: z.ZodString;
210
+ conversationId: z.ZodString;
211
+ threadId: z.ZodString;
212
+ }, "strict", z.ZodTypeAny, {
213
+ type?: "xpert";
214
+ threadId?: string;
215
+ conversationId?: string;
216
+ xpertId?: string;
217
+ agentKey?: string;
218
+ }, {
219
+ type?: "xpert";
220
+ threadId?: string;
221
+ conversationId?: string;
222
+ xpertId?: string;
223
+ agentKey?: string;
224
+ }>, z.ZodObject<{
225
+ type: z.ZodLiteral<"project_agent">;
226
+ projectId: z.ZodString;
227
+ agentKey: z.ZodLiteral<"general_agent">;
228
+ conversationId: z.ZodString;
229
+ threadId: z.ZodString;
230
+ }, "strict", z.ZodTypeAny, {
231
+ type?: "project_agent";
232
+ threadId?: string;
233
+ conversationId?: string;
234
+ projectId?: string;
235
+ agentKey?: "general_agent";
236
+ }, {
237
+ type?: "project_agent";
238
+ threadId?: string;
239
+ conversationId?: string;
240
+ projectId?: string;
241
+ agentKey?: "general_agent";
242
+ }>]>;
243
+ consumer: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
244
+ type: z.ZodLiteral<"follow_up">;
245
+ executionId: z.ZodString;
246
+ }, "strict", z.ZodTypeAny, {
247
+ type?: "follow_up";
248
+ executionId?: string;
249
+ }, {
250
+ type?: "follow_up";
251
+ executionId?: string;
252
+ }>, z.ZodObject<{
253
+ type: z.ZodLiteral<"wait">;
254
+ executionId: z.ZodString;
255
+ callId: z.ZodString;
256
+ }, "strict", z.ZodTypeAny, {
257
+ type?: "wait";
258
+ executionId?: string;
259
+ callId?: string;
260
+ }, {
261
+ type?: "wait";
262
+ executionId?: string;
263
+ callId?: string;
264
+ }>]>;
265
+ }, "strict", z.ZodTypeAny, {
266
+ invocationId?: string;
267
+ resultRevision?: number;
268
+ recipient?: {
269
+ type?: "xpert";
270
+ threadId?: string;
271
+ conversationId?: string;
272
+ xpertId?: string;
273
+ agentKey?: string;
274
+ } | {
275
+ type?: "project_agent";
276
+ threadId?: string;
277
+ conversationId?: string;
278
+ projectId?: string;
279
+ agentKey?: "general_agent";
280
+ };
281
+ consumer?: {
282
+ type?: "follow_up";
283
+ executionId?: string;
284
+ } | {
285
+ type?: "wait";
286
+ executionId?: string;
287
+ callId?: string;
288
+ };
289
+ }, {
290
+ invocationId?: string;
291
+ resultRevision?: number;
292
+ recipient?: {
293
+ type?: "xpert";
294
+ threadId?: string;
295
+ conversationId?: string;
296
+ xpertId?: string;
297
+ agentKey?: string;
298
+ } | {
299
+ type?: "project_agent";
300
+ threadId?: string;
301
+ conversationId?: string;
302
+ projectId?: string;
303
+ agentKey?: "general_agent";
304
+ };
305
+ consumer?: {
306
+ type?: "follow_up";
307
+ executionId?: string;
308
+ } | {
309
+ type?: "wait";
310
+ executionId?: string;
311
+ callId?: string;
312
+ };
313
+ }>;
314
+ export type AgentRuntimeResultClaim = z.output<typeof agentRuntimeResultClaimSchema>;
315
+ /**
316
+ * Wait and asynchronous reply compete for this same key, regardless of delivery revision.
317
+ * The storage key must additionally include tenant, organization and owner from trusted scope.
318
+ */
319
+ export declare function agentRuntimeResultConsumptionKey(invocationId: string, recipient: AgentRuntimeReplyTarget): string;
@@ -1,5 +1,6 @@
1
1
  export * from './message-type';
2
2
  export * from './agent-chat.contract';
3
+ export * from './agent-runtime-message.contract';
3
4
  export * from './handoff.interface';
4
5
  export * from './handoff-processor.decorator';
5
6
  export * from './handoff-processor.registry';
@@ -2,3 +2,4 @@ export * from './skill/index';
2
2
  export * from './middleware';
3
3
  export * from './handoff';
4
4
  export * from './runtime';
5
+ export * from './resource-card';
@@ -4,3 +4,4 @@ export * from './strategy.registry';
4
4
  export * from './types';
5
5
  export * from './runtime';
6
6
  export * from './model-output-validation-error';
7
+ export * from './model-requirements';
@@ -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 [
@@ -117,6 +118,12 @@ export interface ModelRequest<TState extends Record<string, unknown> = Record<st
117
118
  * The messages to send to the model.
118
119
  */
119
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;
120
127
  systemMessage?: SystemMessage;
121
128
  /**
122
129
  * Portable tool choice configuration, applied by the host after selection.
@@ -0,0 +1,3 @@
1
+ /** Older runtime plugins can still send this event; new emissions use ON_CHAT_EVENT. */
2
+ export declare const RESOURCE_CARD_EVENT = "xpert.resource_card";
3
+ export { emitResourceCard } from '../resource-card';
@@ -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
+ }
@@ -1,7 +1,11 @@
1
1
  import type { AgentInvocation, AgentInvocationRequest, AgentJson, AgentTarget } from './types';
2
2
  import type { RuntimeIdentityScope } from '../../runtime/runtime-scope';
3
+ import type { TaskWaitRequest, TaskWaitResult } from './task-wait';
4
+ import type { ConversationResourceCard } from '@xpert-ai/contracts';
3
5
  /** Invocation API bound to one authorized caller/execution. Each operation revalidates access. */
4
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>;
5
9
  /** Resolve a binding to a pinned target. Optional on hosts with pre-resolved native targets. */
6
10
  resolve?(bindingId: string): Promise<AgentTarget>;
7
11
  /** Start or recover an idempotent request. The returned snapshot may still be running. */
@@ -12,11 +16,15 @@ export interface AgentInvocationApi {
12
16
  cancel(invocationId: string): Promise<AgentInvocation>;
13
17
  /** Answer the current interaction using its exact ID and provider-defined response schema. */
14
18
  respond(invocationId: string, interactionId: string, response: AgentJson): Promise<AgentInvocation>;
15
- /**
16
- * Optional checkpoint-aware wait; returns a terminal or unknown observation.
17
- * Allow host suspension to propagate instead of treating it as a tool failure.
18
- */
19
- awaitResult?(invocationId: string): 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>>;
20
28
  }
21
29
  /** Caller-scoped API obtained through runtime.capabilities.require(...). */
22
30
  export declare const AgentInvocationRuntimeCapability: import("../../core/runtime-capability").RuntimeCapabilityKey<AgentInvocationApi>;
@@ -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
+ }>;