@xpert-ai/plugin-sdk 3.19.0 → 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.
Files changed (60) hide show
  1. package/CHANGELOG.md +104 -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 +455 -107
  12. package/index.esm.js +412 -112
  13. package/model-provider.cjs.js +5 -0
  14. package/model-provider.esm.js +5 -1
  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 +2 -0
  20. package/src/lib/agent/handoff/agent-chat.contract.d.ts +6 -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/ai-model/ai-model-provider.interface.d.ts +2 -0
  41. package/src/lib/ai-model/ai-model.d.ts +2 -0
  42. package/src/lib/ai-model/index.d.ts +3 -0
  43. package/src/lib/ai-model/llm.d.ts +4 -2
  44. package/src/lib/ai-model/native-model.d.ts +22 -0
  45. package/src/lib/ai-model/realtime.d.ts +36 -0
  46. package/src/lib/ai-model/token-usage.d.ts +13 -0
  47. package/src/lib/mcp/app.d.ts +4 -1
  48. package/src/lib/project-task/index.d.ts +8 -1
  49. package/src/lib/project-type/index.d.ts +8 -1
  50. package/src/lib/resource-card-provider/index.d.ts +3 -0
  51. package/src/lib/resource-card-provider/provider.decorator.d.ts +4 -0
  52. package/src/lib/resource-card-provider/provider.registry.d.ts +14 -0
  53. package/src/lib/resource-card-provider/types.d.ts +36 -0
  54. package/src/lib/resource-card.d.ts +6 -0
  55. package/src/lib/runtime/capabilities/index.d.ts +1 -0
  56. package/src/lib/runtime/capabilities/project-provisioning.d.ts +10 -0
  57. package/src/lib/runtime/capabilities/tool-images.d.ts +24 -0
  58. package/src/lib/sandbox/execution-environment.d.ts +2 -0
  59. package/src/lib/sandbox/execution.d.ts +10 -0
  60. package/src/lib/sandbox/managed-service.d.ts +1 -0
@@ -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
+ }>;
@@ -0,0 +1,517 @@
1
+ import { z } from 'zod/v3';
2
+ export declare const agentRuntimeReplyTargetSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
3
+ type: z.ZodOptional<z.ZodLiteral<"xpert">>;
4
+ xpertId: z.ZodString;
5
+ agentKey: z.ZodString;
6
+ conversationId: z.ZodString;
7
+ threadId: z.ZodString;
8
+ }, "strict", z.ZodTypeAny, {
9
+ type?: "xpert";
10
+ threadId?: string;
11
+ conversationId?: string;
12
+ xpertId?: string;
13
+ agentKey?: string;
14
+ }, {
15
+ type?: "xpert";
16
+ threadId?: string;
17
+ conversationId?: string;
18
+ xpertId?: string;
19
+ agentKey?: string;
20
+ }>, z.ZodObject<{
21
+ type: z.ZodLiteral<"project_agent">;
22
+ projectId: z.ZodString;
23
+ agentKey: z.ZodLiteral<"general_agent">;
24
+ conversationId: z.ZodString;
25
+ threadId: z.ZodString;
26
+ }, "strict", z.ZodTypeAny, {
27
+ type?: "project_agent";
28
+ threadId?: string;
29
+ conversationId?: string;
30
+ projectId?: string;
31
+ agentKey?: "general_agent";
32
+ }, {
33
+ type?: "project_agent";
34
+ threadId?: string;
35
+ conversationId?: string;
36
+ projectId?: string;
37
+ agentKey?: "general_agent";
38
+ }>]>;
39
+ export type AgentRuntimeReplyTarget = z.output<typeof agentRuntimeReplyTargetSchema>;
40
+ /** Persist with the immutable invocation request before launch. No credentials or arbitrary routing headers. */
41
+ export declare const agentInvocationDispatchContextSchema: z.ZodObject<{
42
+ version: z.ZodLiteral<1>;
43
+ requestId: z.ZodString;
44
+ sourceMessageId: z.ZodString;
45
+ replyTo: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
46
+ type: z.ZodOptional<z.ZodLiteral<"xpert">>;
47
+ xpertId: z.ZodString;
48
+ agentKey: z.ZodString;
49
+ conversationId: z.ZodString;
50
+ threadId: z.ZodString;
51
+ }, "strict", z.ZodTypeAny, {
52
+ type?: "xpert";
53
+ threadId?: string;
54
+ conversationId?: string;
55
+ xpertId?: string;
56
+ agentKey?: string;
57
+ }, {
58
+ type?: "xpert";
59
+ threadId?: string;
60
+ conversationId?: string;
61
+ xpertId?: string;
62
+ agentKey?: string;
63
+ }>, z.ZodObject<{
64
+ type: z.ZodLiteral<"project_agent">;
65
+ projectId: z.ZodString;
66
+ agentKey: z.ZodLiteral<"general_agent">;
67
+ conversationId: z.ZodString;
68
+ threadId: z.ZodString;
69
+ }, "strict", z.ZodTypeAny, {
70
+ type?: "project_agent";
71
+ threadId?: string;
72
+ conversationId?: string;
73
+ projectId?: string;
74
+ agentKey?: "general_agent";
75
+ }, {
76
+ type?: "project_agent";
77
+ threadId?: string;
78
+ conversationId?: string;
79
+ projectId?: string;
80
+ agentKey?: "general_agent";
81
+ }>]>;
82
+ projectTask: z.ZodOptional<z.ZodEffects<z.ZodObject<{
83
+ projectId: z.ZodString;
84
+ projectTaskId: z.ZodString;
85
+ taskExecutionId: z.ZodString;
86
+ } & {
87
+ specification: z.ZodObject<{
88
+ digest: z.ZodString;
89
+ specification: z.ZodEffects<z.ZodObject<{
90
+ version: z.ZodLiteral<1>;
91
+ title: z.ZodString;
92
+ description: z.ZodOptional<z.ZodString>;
93
+ requirements: z.ZodArray<z.ZodString, "many">;
94
+ steps: z.ZodArray<z.ZodObject<{
95
+ stepIndex: z.ZodNumber;
96
+ description: z.ZodString;
97
+ }, "strict", z.ZodTypeAny, {
98
+ description?: string;
99
+ stepIndex?: number;
100
+ }, {
101
+ description?: string;
102
+ stepIndex?: number;
103
+ }>, "many">;
104
+ }, "strict", z.ZodTypeAny, {
105
+ description?: string;
106
+ version?: 1;
107
+ title?: string;
108
+ steps?: {
109
+ description?: string;
110
+ stepIndex?: number;
111
+ }[];
112
+ requirements?: string[];
113
+ }, {
114
+ description?: string;
115
+ version?: 1;
116
+ title?: string;
117
+ steps?: {
118
+ description?: string;
119
+ stepIndex?: number;
120
+ }[];
121
+ requirements?: string[];
122
+ }>, {
123
+ description?: string;
124
+ version?: 1;
125
+ title?: string;
126
+ steps?: {
127
+ description?: string;
128
+ stepIndex?: number;
129
+ }[];
130
+ requirements?: string[];
131
+ }, {
132
+ description?: string;
133
+ version?: 1;
134
+ title?: string;
135
+ steps?: {
136
+ description?: string;
137
+ stepIndex?: number;
138
+ }[];
139
+ requirements?: string[];
140
+ }>;
141
+ }, "strict", z.ZodTypeAny, {
142
+ digest?: string;
143
+ specification?: {
144
+ description?: string;
145
+ version?: 1;
146
+ title?: string;
147
+ steps?: {
148
+ description?: string;
149
+ stepIndex?: number;
150
+ }[];
151
+ requirements?: string[];
152
+ };
153
+ }, {
154
+ digest?: string;
155
+ specification?: {
156
+ description?: string;
157
+ version?: 1;
158
+ title?: string;
159
+ steps?: {
160
+ description?: string;
161
+ stepIndex?: number;
162
+ }[];
163
+ requirements?: string[];
164
+ };
165
+ }>;
166
+ purpose: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
167
+ type: z.ZodLiteral<"implementation">;
168
+ }, "strict", z.ZodTypeAny, {
169
+ type?: "implementation";
170
+ }, {
171
+ type?: "implementation";
172
+ }>, z.ZodObject<{
173
+ type: z.ZodLiteral<"review">;
174
+ implementationExecutionId: z.ZodString;
175
+ implementationInvocationId: z.ZodString;
176
+ specificationDigest: z.ZodString;
177
+ evidence: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
178
+ type: z.ZodLiteral<"artifact">;
179
+ artifactId: z.ZodString;
180
+ versionId: z.ZodString;
181
+ }, "strict", z.ZodTypeAny, {
182
+ type?: "artifact";
183
+ versionId?: string;
184
+ artifactId?: string;
185
+ }, {
186
+ type?: "artifact";
187
+ versionId?: string;
188
+ artifactId?: string;
189
+ }>, z.ZodObject<{
190
+ type: z.ZodLiteral<"invocation_result">;
191
+ invocationId: z.ZodString;
192
+ revision: z.ZodNumber;
193
+ }, "strict", z.ZodTypeAny, {
194
+ type?: "invocation_result";
195
+ revision?: number;
196
+ invocationId?: string;
197
+ }, {
198
+ type?: "invocation_result";
199
+ revision?: number;
200
+ invocationId?: string;
201
+ }>, z.ZodObject<{
202
+ type: z.ZodLiteral<"workspace_snapshot">;
203
+ snapshotId: z.ZodString;
204
+ digest: z.ZodString;
205
+ }, "strict", z.ZodTypeAny, {
206
+ type?: "workspace_snapshot";
207
+ digest?: string;
208
+ snapshotId?: string;
209
+ }, {
210
+ type?: "workspace_snapshot";
211
+ digest?: string;
212
+ snapshotId?: string;
213
+ }>]>, "many">;
214
+ }, "strict", z.ZodTypeAny, {
215
+ type?: "review";
216
+ implementationExecutionId?: string;
217
+ implementationInvocationId?: string;
218
+ specificationDigest?: string;
219
+ evidence?: ({
220
+ type?: "artifact";
221
+ versionId?: string;
222
+ artifactId?: string;
223
+ } | {
224
+ type?: "invocation_result";
225
+ revision?: number;
226
+ invocationId?: string;
227
+ } | {
228
+ type?: "workspace_snapshot";
229
+ digest?: string;
230
+ snapshotId?: string;
231
+ })[];
232
+ }, {
233
+ type?: "review";
234
+ implementationExecutionId?: string;
235
+ implementationInvocationId?: string;
236
+ specificationDigest?: string;
237
+ evidence?: ({
238
+ type?: "artifact";
239
+ versionId?: string;
240
+ artifactId?: string;
241
+ } | {
242
+ type?: "invocation_result";
243
+ revision?: number;
244
+ invocationId?: string;
245
+ } | {
246
+ type?: "workspace_snapshot";
247
+ digest?: string;
248
+ snapshotId?: string;
249
+ })[];
250
+ }>]>;
251
+ }, "strict", z.ZodTypeAny, {
252
+ projectId?: string;
253
+ specification?: {
254
+ digest?: string;
255
+ specification?: {
256
+ description?: string;
257
+ version?: 1;
258
+ title?: string;
259
+ steps?: {
260
+ description?: string;
261
+ stepIndex?: number;
262
+ }[];
263
+ requirements?: string[];
264
+ };
265
+ };
266
+ projectTaskId?: string;
267
+ taskExecutionId?: string;
268
+ purpose?: {
269
+ type?: "implementation";
270
+ } | {
271
+ type?: "review";
272
+ implementationExecutionId?: string;
273
+ implementationInvocationId?: string;
274
+ specificationDigest?: string;
275
+ evidence?: ({
276
+ type?: "artifact";
277
+ versionId?: string;
278
+ artifactId?: string;
279
+ } | {
280
+ type?: "invocation_result";
281
+ revision?: number;
282
+ invocationId?: string;
283
+ } | {
284
+ type?: "workspace_snapshot";
285
+ digest?: string;
286
+ snapshotId?: string;
287
+ })[];
288
+ };
289
+ }, {
290
+ projectId?: string;
291
+ specification?: {
292
+ digest?: string;
293
+ specification?: {
294
+ description?: string;
295
+ version?: 1;
296
+ title?: string;
297
+ steps?: {
298
+ description?: string;
299
+ stepIndex?: number;
300
+ }[];
301
+ requirements?: string[];
302
+ };
303
+ };
304
+ projectTaskId?: string;
305
+ taskExecutionId?: string;
306
+ purpose?: {
307
+ type?: "implementation";
308
+ } | {
309
+ type?: "review";
310
+ implementationExecutionId?: string;
311
+ implementationInvocationId?: string;
312
+ specificationDigest?: string;
313
+ evidence?: ({
314
+ type?: "artifact";
315
+ versionId?: string;
316
+ artifactId?: string;
317
+ } | {
318
+ type?: "invocation_result";
319
+ revision?: number;
320
+ invocationId?: string;
321
+ } | {
322
+ type?: "workspace_snapshot";
323
+ digest?: string;
324
+ snapshotId?: string;
325
+ })[];
326
+ };
327
+ }>, {
328
+ projectId?: string;
329
+ specification?: {
330
+ digest?: string;
331
+ specification?: {
332
+ description?: string;
333
+ version?: 1;
334
+ title?: string;
335
+ steps?: {
336
+ description?: string;
337
+ stepIndex?: number;
338
+ }[];
339
+ requirements?: string[];
340
+ };
341
+ };
342
+ projectTaskId?: string;
343
+ taskExecutionId?: string;
344
+ purpose?: {
345
+ type?: "implementation";
346
+ } | {
347
+ type?: "review";
348
+ implementationExecutionId?: string;
349
+ implementationInvocationId?: string;
350
+ specificationDigest?: string;
351
+ evidence?: ({
352
+ type?: "artifact";
353
+ versionId?: string;
354
+ artifactId?: string;
355
+ } | {
356
+ type?: "invocation_result";
357
+ revision?: number;
358
+ invocationId?: string;
359
+ } | {
360
+ type?: "workspace_snapshot";
361
+ digest?: string;
362
+ snapshotId?: string;
363
+ })[];
364
+ };
365
+ }, {
366
+ projectId?: string;
367
+ specification?: {
368
+ digest?: string;
369
+ specification?: {
370
+ description?: string;
371
+ version?: 1;
372
+ title?: string;
373
+ steps?: {
374
+ description?: string;
375
+ stepIndex?: number;
376
+ }[];
377
+ requirements?: string[];
378
+ };
379
+ };
380
+ projectTaskId?: string;
381
+ taskExecutionId?: string;
382
+ purpose?: {
383
+ type?: "implementation";
384
+ } | {
385
+ type?: "review";
386
+ implementationExecutionId?: string;
387
+ implementationInvocationId?: string;
388
+ specificationDigest?: string;
389
+ evidence?: ({
390
+ type?: "artifact";
391
+ versionId?: string;
392
+ artifactId?: string;
393
+ } | {
394
+ type?: "invocation_result";
395
+ revision?: number;
396
+ invocationId?: string;
397
+ } | {
398
+ type?: "workspace_snapshot";
399
+ digest?: string;
400
+ snapshotId?: string;
401
+ })[];
402
+ };
403
+ }>>;
404
+ }, "strict", z.ZodTypeAny, {
405
+ version?: 1;
406
+ requestId?: string;
407
+ sourceMessageId?: string;
408
+ replyTo?: {
409
+ type?: "xpert";
410
+ threadId?: string;
411
+ conversationId?: string;
412
+ xpertId?: string;
413
+ agentKey?: string;
414
+ } | {
415
+ type?: "project_agent";
416
+ threadId?: string;
417
+ conversationId?: string;
418
+ projectId?: string;
419
+ agentKey?: "general_agent";
420
+ };
421
+ projectTask?: {
422
+ projectId?: string;
423
+ specification?: {
424
+ digest?: string;
425
+ specification?: {
426
+ description?: string;
427
+ version?: 1;
428
+ title?: string;
429
+ steps?: {
430
+ description?: string;
431
+ stepIndex?: number;
432
+ }[];
433
+ requirements?: string[];
434
+ };
435
+ };
436
+ projectTaskId?: string;
437
+ taskExecutionId?: string;
438
+ purpose?: {
439
+ type?: "implementation";
440
+ } | {
441
+ type?: "review";
442
+ implementationExecutionId?: string;
443
+ implementationInvocationId?: string;
444
+ specificationDigest?: string;
445
+ evidence?: ({
446
+ type?: "artifact";
447
+ versionId?: string;
448
+ artifactId?: string;
449
+ } | {
450
+ type?: "invocation_result";
451
+ revision?: number;
452
+ invocationId?: string;
453
+ } | {
454
+ type?: "workspace_snapshot";
455
+ digest?: string;
456
+ snapshotId?: string;
457
+ })[];
458
+ };
459
+ };
460
+ }, {
461
+ version?: 1;
462
+ requestId?: string;
463
+ sourceMessageId?: string;
464
+ replyTo?: {
465
+ type?: "xpert";
466
+ threadId?: string;
467
+ conversationId?: string;
468
+ xpertId?: string;
469
+ agentKey?: string;
470
+ } | {
471
+ type?: "project_agent";
472
+ threadId?: string;
473
+ conversationId?: string;
474
+ projectId?: string;
475
+ agentKey?: "general_agent";
476
+ };
477
+ projectTask?: {
478
+ projectId?: string;
479
+ specification?: {
480
+ digest?: string;
481
+ specification?: {
482
+ description?: string;
483
+ version?: 1;
484
+ title?: string;
485
+ steps?: {
486
+ description?: string;
487
+ stepIndex?: number;
488
+ }[];
489
+ requirements?: string[];
490
+ };
491
+ };
492
+ projectTaskId?: string;
493
+ taskExecutionId?: string;
494
+ purpose?: {
495
+ type?: "implementation";
496
+ } | {
497
+ type?: "review";
498
+ implementationExecutionId?: string;
499
+ implementationInvocationId?: string;
500
+ specificationDigest?: string;
501
+ evidence?: ({
502
+ type?: "artifact";
503
+ versionId?: string;
504
+ artifactId?: string;
505
+ } | {
506
+ type?: "invocation_result";
507
+ revision?: number;
508
+ invocationId?: string;
509
+ } | {
510
+ type?: "workspace_snapshot";
511
+ digest?: string;
512
+ snapshotId?: string;
513
+ })[];
514
+ };
515
+ };
516
+ }>;
517
+ export type AgentInvocationDispatchContext = z.output<typeof agentInvocationDispatchContextSchema>;
@@ -0,0 +1,66 @@
1
+ import type { CliPermissionMode, ModelExecutionEnvironment } from '@xpert-ai/contracts';
2
+ import type { AgentInvocationScope, AgentInvocationResult, AgentJson } from './types';
3
+ import type { AgentArtifactSelection } from './results';
4
+ /** A host-managed process location. Remote service runtimes can use their own session/run handles. */
5
+ export type AgentRunnerEnvironment = Extract<ModelExecutionEnvironment, {
6
+ type: 'computer' | 'sandbox';
7
+ }>;
8
+ /** A durable process receipt, not a second Agent task or a credential. Host methods must revalidate ownership. */
9
+ interface AgentRunnerReceiptBase {
10
+ /** Owning platform invocation; never a caller-selected process launch key. */
11
+ invocationId: string;
12
+ /** Bound environment instance; replacing the instance invalidates this receipt. */
13
+ environment: AgentRunnerEnvironment;
14
+ /** Opaque host process reference, not necessarily an operating-system PID. */
15
+ processId: string;
16
+ /** Model execution grant ID only; never store its bearer secret in the receipt. */
17
+ grantId: string;
18
+ /** Actual business cwd selected by the host; retained verbatim for historical receipts. */
19
+ workingDirectory: string;
20
+ /** Tool selected from the approved binding and host policy, independent of the model provider. */
21
+ tool: {
22
+ id: string;
23
+ version: string;
24
+ };
25
+ /** Effective policy pinned when this process started; absent on historical receipts. */
26
+ permissionMode?: CliPermissionMode;
27
+ }
28
+ /** V1 retains its original cwd; V2 separates per-invocation records from the business cwd. */
29
+ export type AgentRunnerReceipt = AgentRunnerReceiptBase & ({
30
+ version: 1;
31
+ } | {
32
+ version: 2;
33
+ executionDirectory: string;
34
+ });
35
+ /** Per-scope host capability. Methods recheck the persisted invocation and receipt before side effects. */
36
+ export interface AgentExecutionRunner {
37
+ /** Resolve the already persisted Invocation/Binding. Checkpoint before sending launch input. */
38
+ start(invocationId: string, checkpoint: (receipt: AgentRunnerReceipt) => Promise<void>): Promise<AgentRunnerReceipt>;
39
+ /** Observe the existing process. Unknown is not permission to relaunch or proof of completion. */
40
+ inspect(receipt: AgentRunnerReceipt): Promise<{
41
+ state: 'running' | 'exited' | 'unknown';
42
+ exitCode?: number;
43
+ }>;
44
+ /** Relative HTTP request over the approved local service transport; no caller-supplied URL or headers. */
45
+ request(receipt: AgentRunnerReceipt, request: {
46
+ method: 'GET' | 'POST';
47
+ path: string;
48
+ body?: AgentJson;
49
+ query?: {
50
+ limit: number;
51
+ };
52
+ }): Promise<unknown>;
53
+ /** Export only selected files after revalidating the persisted delivery request. No selection means no export. */
54
+ collectArtifacts(receipt: AgentRunnerReceipt, selection?: AgentArtifactSelection): Promise<NonNullable<AgentInvocationResult['artifacts']>>;
55
+ /** Revoke model access and request process termination. Only exited confirms termination. */
56
+ stop(receipt: AgentRunnerReceipt): Promise<{
57
+ state: 'exited' | 'stopping' | 'unknown';
58
+ }>;
59
+ }
60
+ export declare const AgentExecutionRunnerCapability: import("../../core/runtime-capability").RuntimeCapabilityKey<AgentExecutionRunner>;
61
+ export interface AgentExecutionRunnerFactory {
62
+ /** Capture trusted scope only; defer authorization and I/O to runner methods. Never launch during construction. */
63
+ createScopedRunner(scope: Readonly<AgentInvocationScope>): AgentExecutionRunner;
64
+ }
65
+ export declare const AgentExecutionRunnerFactoryCapability: import("../../core/runtime-capability").RuntimeCapabilityKey<AgentExecutionRunnerFactory>;
66
+ export {};
@@ -1,3 +1,10 @@
1
1
  export * from './types';
2
2
  export * from './strategy';
3
3
  export * from './capability';
4
+ export * from './model-execution';
5
+ export * from './cli-model-profile';
6
+ export * from './task-wait';
7
+ export * from './results';
8
+ export * from './execution-runner';
9
+ export * from './dispatch';
10
+ export * from './activity';
@@ -0,0 +1,15 @@
1
+ import type { ModelExecutionContext } from '@xpert-ai/contracts';
2
+ /** Trusted host adapter; bearer callers cannot validate their own execution environment. */
3
+ export interface ModelExecutionEnvironmentGuard {
4
+ /** Check trusted runtime state and throw when the grant's bound environment is no longer valid. */
5
+ assertCurrent(context: Readonly<ModelExecutionContext>): Promise<void>;
6
+ }
7
+ /**
8
+ * Keeps shared OS model authorization independent of Pro Computer/Docker lifecycle details.
9
+ * Grant issuance, authentication, revalidation and renewal delegate environment checks to this host adapter.
10
+ * Implementations validate ownership and instance identity so a replaced runtime cannot keep its old grant.
11
+ * Execution validity is independent of desktop viewing sessions; managed runners may also require an operation lease.
12
+ * Other environments can supply their own checks without changing the grant service.
13
+ * This capability validates the bound environment; model selection and usage accounting remain separate concerns.
14
+ */
15
+ export declare const ModelExecutionEnvironmentCapability: import("../../core/runtime-capability").RuntimeCapabilityKey<ModelExecutionEnvironmentGuard>;