@xpert-ai/plugin-sdk 3.27.0 → 3.28.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/collaboration-client.cjs.js +31 -5
- package/collaboration-client.esm.js +31 -5
- package/index.cjs.js +310 -45
- package/index.esm.js +303 -47
- package/model-provider.cjs.js +2 -1
- package/model-provider.esm.js +2 -1
- package/package.json +2 -2
- package/src/index.d.ts +1 -0
- package/src/lib/agent/handoff/types.d.ts +5 -0
- package/src/lib/agent/middleware/capabilities/assistant-task.d.ts +6 -1
- package/src/lib/agent/runtime/capability.d.ts +4 -0
- package/src/lib/agent/runtime/cli-model-profile.d.ts +1 -1
- package/src/lib/agent/runtime/execution-runner.d.ts +11 -0
- package/src/lib/agent/runtime/index.d.ts +2 -0
- package/src/lib/agent/runtime/managed.d.ts +94 -0
- package/src/lib/agent/runtime/process-supervisor.d.ts +1 -0
- package/src/lib/agent/runtime/strategy.d.ts +14 -0
- package/src/lib/agent/runtime/types.d.ts +30 -1
- package/src/lib/ai-model/native-model.d.ts +5 -1
- package/src/lib/assistant-capability/index.d.ts +1 -0
- package/src/lib/assistant-capability/middleware.d.ts +10 -0
- package/src/lib/collaboration/types.d.ts +5 -0
- package/src/lib/content-resource/catalog.d.ts +88 -0
- package/src/lib/content-resource/editor-compatibility.d.ts +3 -0
- package/src/lib/content-resource/editor.d.ts +35 -3
- package/src/lib/content-resource/index.d.ts +3 -0
- package/src/lib/execution-control/context.d.ts +7 -0
- package/src/lib/execution-control/index.d.ts +2 -0
- package/src/lib/managed-queue/index.d.ts +12 -0
- package/src/lib/runtime/capabilities/artifact-drafts.d.ts +10 -1
- package/src/lib/runtime/capabilities/mcp-client-runtime.d.ts +2 -0
- package/src/lib/runtime/capabilities/sandbox-jobs.d.ts +12 -3
- package/src/lib/sandbox/file-edit-command.d.ts +2 -0
- package/src/lib/sandbox/file-edit-diff.d.ts +1 -0
- package/src/lib/sandbox/protocol.d.ts +13 -1
- package/src/lib/sandbox/runtime-provider.d.ts +12 -0
|
@@ -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
|
|
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;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { DiscoveryService, Reflector } from '@nestjs/core';
|
|
2
2
|
import type { I18nObject, LanguagesEnum, ModelFeature, TXpertTeamDraft, TXpertTemplate } from '@xpert-ai/contracts';
|
|
3
3
|
import { BaseStrategyRegistry } from '../strategy';
|
|
4
|
+
export { applyAssistantMiddleware, hasAssistantMiddleware } from './middleware';
|
|
4
5
|
export interface AssistantCapabilityContext {
|
|
5
6
|
template: TXpertTemplate;
|
|
6
7
|
draft: TXpertTeamDraft;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type TXpertTeamDraft } from '@xpert-ai/contracts';
|
|
2
|
+
export declare function hasAssistantMiddleware(draft: TXpertTeamDraft, provider: string): boolean;
|
|
3
|
+
/** Compose only the draft graph. The platform records the contribution for safe removal.
|
|
4
|
+
* No Project, permission, external resource or implicit replacement is created here. */
|
|
5
|
+
export declare function applyAssistantMiddleware(draft: TXpertTeamDraft, input: {
|
|
6
|
+
provider: string;
|
|
7
|
+
key: string;
|
|
8
|
+
title: string;
|
|
9
|
+
instructions: string;
|
|
10
|
+
}): void;
|
|
@@ -147,6 +147,11 @@ export interface CollaborationApi {
|
|
|
147
147
|
archiveDocument(input: GetCollaborationDocumentInput & {
|
|
148
148
|
expectedSequence?: number;
|
|
149
149
|
}): Promise<CollaborationDocumentRecord>;
|
|
150
|
+
/** Reopen an archived document after the provider's current manage authorization.
|
|
151
|
+
* State and sequence are retained; this cannot resurrect a deleted document. */
|
|
152
|
+
restoreDocument(input: GetCollaborationDocumentInput & {
|
|
153
|
+
expectedSequence?: number;
|
|
154
|
+
}): Promise<CollaborationDocumentRecord>;
|
|
150
155
|
/** Soft-delete the platform document and notify its provider. */
|
|
151
156
|
deleteDocument(input: GetCollaborationDocumentInput): Promise<CollaborationDocumentRecord>;
|
|
152
157
|
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { ContentCatalogItem, ContentResourceSnapshot, ContentTypeImplementation, ContentSearchProjection } from '@xpert-ai/contracts';
|
|
2
|
+
import type { ContentDocumentScope } from './document';
|
|
3
|
+
import type { ContentResourceReference, ContentSourceInput } from './index';
|
|
4
|
+
export type ContentResourceMutation = {
|
|
5
|
+
action: 'rename';
|
|
6
|
+
title: string;
|
|
7
|
+
} | {
|
|
8
|
+
action: 'move';
|
|
9
|
+
rootPath: string;
|
|
10
|
+
} | {
|
|
11
|
+
action: 'trash' | 'restore';
|
|
12
|
+
} | {
|
|
13
|
+
action: 'duplicate';
|
|
14
|
+
requestId: string;
|
|
15
|
+
title: string;
|
|
16
|
+
};
|
|
17
|
+
/** Plugins retain their native model and ACL. Discovery is scoped and paginated, never a grant. */
|
|
18
|
+
export interface ContentCatalogProvider {
|
|
19
|
+
readonly types: ContentTypeImplementation[];
|
|
20
|
+
discover(scope: ContentDocumentScope & {
|
|
21
|
+
cursor?: string;
|
|
22
|
+
}): Promise<{
|
|
23
|
+
resourceIds: string[];
|
|
24
|
+
nextCursor?: string;
|
|
25
|
+
}>;
|
|
26
|
+
describe(input: ContentSourceInput): Promise<ContentResourceSnapshot>;
|
|
27
|
+
/** Optional safe text extractor. Must read the requested revision or reject a concurrent change. */
|
|
28
|
+
extract?(input: ContentSourceInput & {
|
|
29
|
+
expectedRevision: string;
|
|
30
|
+
}): Promise<ContentSearchProjection>;
|
|
31
|
+
create(input: ContentDocumentScope & {
|
|
32
|
+
implementationKey: string;
|
|
33
|
+
requestId: string;
|
|
34
|
+
title: string;
|
|
35
|
+
templateId?: string;
|
|
36
|
+
}): Promise<ContentResourceReference>;
|
|
37
|
+
/** Idempotent repair of derived files only; must never overwrite newer native content. */
|
|
38
|
+
reconcile?(input: ContentSourceInput): Promise<void>;
|
|
39
|
+
/** Optional project-local derived index consumer. Called by durable reconciliation,
|
|
40
|
+
* including tombstones; must revalidate revision and never change the resource. */
|
|
41
|
+
onResourceReconciled?(input: ContentDocumentScope & {
|
|
42
|
+
item: ContentCatalogItem;
|
|
43
|
+
}): Promise<void>;
|
|
44
|
+
mutate?(input: ContentSourceInput & {
|
|
45
|
+
expectedRevision: string;
|
|
46
|
+
change: ContentResourceMutation;
|
|
47
|
+
}): Promise<ContentResourceReference>;
|
|
48
|
+
}
|
|
49
|
+
export interface ContentCatalogApi {
|
|
50
|
+
types(scope: ContentDocumentScope): Promise<Array<ContentTypeImplementation & {
|
|
51
|
+
providerKey: string;
|
|
52
|
+
}>>;
|
|
53
|
+
/** Reconciles registered providers before listing. The caller may continue with the returned cursor. */
|
|
54
|
+
list(scope: ContentDocumentScope & {
|
|
55
|
+
excludedProviderKeys?: string[];
|
|
56
|
+
contentIds?: string[];
|
|
57
|
+
typeId?: string;
|
|
58
|
+
search?: string;
|
|
59
|
+
deleted?: boolean;
|
|
60
|
+
offset?: number;
|
|
61
|
+
limit?: number;
|
|
62
|
+
}): Promise<{
|
|
63
|
+
items: ContentCatalogItem[];
|
|
64
|
+
hasMore: boolean;
|
|
65
|
+
}>;
|
|
66
|
+
register(input: ContentDocumentScope & {
|
|
67
|
+
source: ContentResourceReference;
|
|
68
|
+
}): Promise<ContentCatalogItem>;
|
|
69
|
+
get(input: ContentDocumentScope & {
|
|
70
|
+
contentId: string;
|
|
71
|
+
}): Promise<ContentCatalogItem>;
|
|
72
|
+
projectText(input: ContentDocumentScope & {
|
|
73
|
+
contentId: string;
|
|
74
|
+
expectedRevision: string;
|
|
75
|
+
}): Promise<ContentSearchProjection | null>;
|
|
76
|
+
create(input: ContentDocumentScope & {
|
|
77
|
+
providerKey: string;
|
|
78
|
+
implementationKey: string;
|
|
79
|
+
requestId: string;
|
|
80
|
+
title: string;
|
|
81
|
+
templateId?: string;
|
|
82
|
+
}): Promise<ContentCatalogItem>;
|
|
83
|
+
mutate(input: ContentDocumentScope & {
|
|
84
|
+
contentId: string;
|
|
85
|
+
expectedRevision: string;
|
|
86
|
+
change: ContentResourceMutation;
|
|
87
|
+
}): Promise<ContentCatalogItem>;
|
|
88
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ContentModelIdentity, ResourceContentEditorRegistration } from '@xpert-ai/contracts';
|
|
2
|
+
/** Matching semantic type alone never grants a writer access to an incompatible native model. */
|
|
3
|
+
export declare function supportsContentModel(editor: ResourceContentEditorRegistration, model: ContentModelIdentity, access: 'view' | 'edit'): boolean;
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
import { DiscoveryService, Reflector } from '@nestjs/core';
|
|
2
|
-
import type { ContentEditorRegistration, FileContentEditorRegistration } from '@xpert-ai/contracts';
|
|
2
|
+
import type { ContentEditorRegistration, FileContentEditorRegistration, ResourceContentEditorRegistration } from '@xpert-ai/contracts';
|
|
3
3
|
import { BaseStrategyRegistry } from '../strategy';
|
|
4
4
|
import type { ContentDocumentModel, ContentDocumentScope } from './document';
|
|
5
5
|
import type { ContentResourceReference, ContentSourceInput } from './index';
|
|
6
|
+
export { supportsContentModel } from './editor-compatibility';
|
|
6
7
|
/** File codecs expose no cells, blocks or plugin-specific edit operations to the platform. */
|
|
7
8
|
export interface ContentFileEditor {
|
|
8
9
|
readonly descriptor: FileContentEditorRegistration;
|
|
9
10
|
create(): Promise<Buffer>;
|
|
10
11
|
validateFile(buffer: Buffer): Promise<void>;
|
|
11
12
|
}
|
|
12
|
-
export
|
|
13
|
+
export interface ContentResourceEditorImplementation {
|
|
14
|
+
readonly descriptor: ResourceContentEditorRegistration;
|
|
15
|
+
}
|
|
16
|
+
export type IContentEditorProvider = ContentDocumentModel | ContentFileEditor | ContentResourceEditorImplementation;
|
|
13
17
|
export declare function isTextContentEditor(provider: IContentEditorProvider): provider is ContentDocumentModel;
|
|
18
|
+
export declare function isFileContentEditor(provider: IContentEditorProvider): provider is ContentFileEditor;
|
|
19
|
+
export declare function isResourceContentEditor(provider: IContentEditorProvider): provider is ContentResourceEditorImplementation;
|
|
14
20
|
export declare const ContentEditorProvider: (key: string) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
15
21
|
export declare class ContentEditorRegistry extends BaseStrategyRegistry<IContentEditorProvider> {
|
|
16
22
|
constructor(discovery: DiscoveryService, reflector: Reflector);
|
|
@@ -40,15 +46,41 @@ export interface ContentResourceEditor {
|
|
|
40
46
|
}
|
|
41
47
|
export type ContentEditorInput = ContentDocumentScope & {
|
|
42
48
|
source: ContentResourceReference;
|
|
49
|
+
editorKey?: string;
|
|
43
50
|
};
|
|
51
|
+
export type ContentEditorPreferenceScope = 'resource' | 'project' | 'organization';
|
|
52
|
+
export interface ContentEditorPreferenceState {
|
|
53
|
+
scope: ContentEditorPreferenceScope;
|
|
54
|
+
editorKey: string | null;
|
|
55
|
+
revision: number;
|
|
56
|
+
canSet: boolean;
|
|
57
|
+
}
|
|
44
58
|
export interface ContentEditorResolution {
|
|
45
59
|
registration: ContentEditorRegistration;
|
|
46
|
-
file
|
|
60
|
+
file?: ContentEditorFile;
|
|
61
|
+
resource?: import('@xpert-ai/contracts').ContentCatalogItem;
|
|
47
62
|
canWrite: boolean;
|
|
48
63
|
viewKey: string;
|
|
64
|
+
selectionId?: string;
|
|
65
|
+
parameters?: {
|
|
66
|
+
contentProvider: string;
|
|
67
|
+
contentId?: string;
|
|
68
|
+
contentTitle?: string;
|
|
69
|
+
contentEditor?: string;
|
|
70
|
+
};
|
|
71
|
+
editors?: ResourceContentEditorRegistration[];
|
|
49
72
|
}
|
|
50
73
|
/** Trusted scope only. Every operation checks Project, Assistant binding and resource permissions. */
|
|
51
74
|
export interface ContentEditorsApi {
|
|
75
|
+
preferences(input: ContentDocumentScope & {
|
|
76
|
+
contentId: string;
|
|
77
|
+
}): Promise<ContentEditorPreferenceState[]>;
|
|
78
|
+
setPreference(input: ContentDocumentScope & {
|
|
79
|
+
contentId: string;
|
|
80
|
+
scope: ContentEditorPreferenceScope;
|
|
81
|
+
editorKey: string | null;
|
|
82
|
+
expectedRevision: number;
|
|
83
|
+
}): Promise<ContentEditorPreferenceState>;
|
|
52
84
|
list(scope: ContentDocumentScope): Promise<ContentEditorRegistration[]>;
|
|
53
85
|
/** Prepare/validate bytes; does not create a resource or grant access to a destination. */
|
|
54
86
|
prepare(scope: ContentDocumentScope & {
|
|
@@ -66,6 +66,7 @@ export interface IContentResourceProvider {
|
|
|
66
66
|
readonly pages?: ContentPageProvider;
|
|
67
67
|
readonly publication?: ContentPublicationObserver;
|
|
68
68
|
readonly locations?: ContentLocationProvider;
|
|
69
|
+
readonly catalog?: import('./catalog').ContentCatalogProvider;
|
|
69
70
|
}
|
|
70
71
|
export declare const CONTENT_RESOURCE_PROVIDER = "XPERT_CONTENT_RESOURCE_PROVIDER";
|
|
71
72
|
export declare const ContentResourceProvider: (key: string) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
@@ -84,8 +85,10 @@ export interface ContentIdentitiesApi {
|
|
|
84
85
|
export interface ContentResourcesApi {
|
|
85
86
|
readonly identities: ContentIdentitiesApi;
|
|
86
87
|
authorize(input: ContentResourceRequest): Promise<ContentResourceDescriptor>;
|
|
88
|
+
readonly catalog: import('./catalog').ContentCatalogApi;
|
|
87
89
|
}
|
|
88
90
|
export declare const ContentResourcesRuntimeCapability: import("../core/runtime-capability").RuntimeCapabilityKey<ContentResourcesApi>;
|
|
89
91
|
export * from './document';
|
|
90
92
|
export * from './reference';
|
|
91
93
|
export * from './editor';
|
|
94
|
+
export * from './catalog';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { TaskControlRef, TaskControlIntent } from '@xpert-ai/contracts';
|
|
2
|
+
/** A handler may check control at a safe boundary; abort alone is not an exit receipt. */
|
|
3
|
+
export interface TaskControlContext {
|
|
4
|
+
reference: TaskControlRef;
|
|
5
|
+
signal: AbortSignal;
|
|
6
|
+
desired(): Promise<TaskControlIntent>;
|
|
7
|
+
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import type { TaskControlContext, TaskControlPolicy } from '../execution-control';
|
|
1
2
|
export declare const MANAGED_QUEUE_SERVICE_TOKEN = "XPERT_MANAGED_QUEUE_SERVICE";
|
|
2
3
|
export declare const MANAGED_QUEUE_HANDLER_REGISTRY_TOKEN = "XPERT_MANAGED_QUEUE_HANDLER_REGISTRY";
|
|
3
4
|
export declare const PLUGIN_JOB_PROCESSOR_METADATA = "XPERT_PLUGIN_JOB_PROCESSOR_METADATA";
|
|
4
5
|
export type PluginJobProcessorOptions = {
|
|
6
|
+
/** Explicit handler compatibility contract for controlled jobs; not a package version. */
|
|
7
|
+
controlContract?: string;
|
|
5
8
|
pluginName: string;
|
|
6
9
|
queueName?: string;
|
|
7
10
|
queue?: string;
|
|
@@ -10,6 +13,7 @@ export type PluginJobProcessorOptions = {
|
|
|
10
13
|
concurrency?: number;
|
|
11
14
|
};
|
|
12
15
|
export type PluginJobProcessorMetadata = {
|
|
16
|
+
controlContract?: string;
|
|
13
17
|
pluginName: string;
|
|
14
18
|
queueName: string;
|
|
15
19
|
jobName: string;
|
|
@@ -42,6 +46,12 @@ export type ManagedQueueRedis = {
|
|
|
42
46
|
eval(script: string, numKeys: number, ...args: Array<string | number>): Promise<unknown>;
|
|
43
47
|
};
|
|
44
48
|
export type ManagedQueueEnqueueInput<TPayload = unknown> = {
|
|
49
|
+
/** Trusted producer lifecycle policy; omission inherits an active host control scope. */
|
|
50
|
+
/** Explicitly enroll work in the current host task context; omitted retains the existing independent queue lifecycle. */
|
|
51
|
+
controlPolicy?: TaskControlPolicy;
|
|
52
|
+
/** Required when enrolling a new controlled job. Must match the registered handler. */
|
|
53
|
+
controlContract?: string;
|
|
54
|
+
drainOnPause?: boolean;
|
|
45
55
|
pluginName: string;
|
|
46
56
|
queueName: string;
|
|
47
57
|
jobName: string;
|
|
@@ -84,6 +94,7 @@ export type ManagedQueueJob<TPayload = unknown> = {
|
|
|
84
94
|
updateData(data: TPayload): Promise<void>;
|
|
85
95
|
};
|
|
86
96
|
export type ManagedQueueJobContext = {
|
|
97
|
+
control?: TaskControlContext;
|
|
87
98
|
pluginName: string;
|
|
88
99
|
queueName: string;
|
|
89
100
|
jobName: string;
|
|
@@ -107,6 +118,7 @@ export interface ManagedQueueJobProcessor<TPayload = unknown> {
|
|
|
107
118
|
handle(job: ManagedQueueJob<TPayload>, context: ManagedQueueJobContext): Promise<void> | void;
|
|
108
119
|
}
|
|
109
120
|
export type ManagedQueueHandlerRegistration<TPayload = unknown> = {
|
|
121
|
+
controlContract?: string;
|
|
110
122
|
pluginName: string;
|
|
111
123
|
queueName: string;
|
|
112
124
|
jobName: string;
|
|
@@ -21,7 +21,16 @@ export type PublishArtifactDraftInput = {
|
|
|
21
21
|
};
|
|
22
22
|
export interface ArtifactDraftsApi {
|
|
23
23
|
list(artifactIds: string[]): Promise<ArtifactDraftRecord[]>;
|
|
24
|
-
|
|
24
|
+
/** Catalog/recycle-bin reads only; ordinary editors must leave includeArchived unset. */
|
|
25
|
+
get(artifactId: string, options?: {
|
|
26
|
+
includeArchived?: boolean;
|
|
27
|
+
}): Promise<ArtifactDraftRecord | null>;
|
|
28
|
+
/** Manager-only CAS lifecycle; recycling revokes all links, restoring never reactivates them. */
|
|
29
|
+
setRecycled(input: {
|
|
30
|
+
artifactId: string;
|
|
31
|
+
expectedRevision: number;
|
|
32
|
+
recycled: boolean;
|
|
33
|
+
}): Promise<ArtifactDraftRecord>;
|
|
25
34
|
save(input: SaveArtifactDraftInput): Promise<ArtifactDraftRecord>;
|
|
26
35
|
/** Trusted application action only; never expose this operation as an Agent tool. */
|
|
27
36
|
publish(input: PublishArtifactDraftInput): Promise<ArtifactVersionRecord>;
|
|
@@ -23,6 +23,8 @@ export interface McpClientToolResult {
|
|
|
23
23
|
text: string[];
|
|
24
24
|
}
|
|
25
25
|
export interface McpClientToolCall {
|
|
26
|
+
/** Stable host call identity; required inside a controlled execution to prevent replay. */
|
|
27
|
+
operationKey?: string;
|
|
26
28
|
toolName: string;
|
|
27
29
|
contractHash: string;
|
|
28
30
|
arguments: Record<string, JSONValue>;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import type { SandboxJobRetryReference } from '@xpert-ai/contracts';
|
|
1
2
|
import type { JSONValue } from '@xpert-ai/contracts';
|
|
2
3
|
import type { WorkspaceFileScope, WorkspacePortableFileReference } from './workspace-files';
|
|
4
|
+
import type { TaskControlPolicy } from '../../execution-control';
|
|
3
5
|
/** Stable machine-readable failures emitted by the Sandbox Jobs capability. */
|
|
4
|
-
export declare const SANDBOX_JOB_ERROR_CODES: readonly ["SANDBOX_ACTION_UNAVAILABLE", "SANDBOX_ACTION_INVALID", "SANDBOX_PROFILE_UNAVAILABLE", "SANDBOX_RUNTIME_UNAVAILABLE", "SANDBOX_VERSION_MISMATCH", "SANDBOX_CAPACITY_UNAVAILABLE", "SANDBOX_START_FAILED", "SANDBOX_DEPENDENCY_MISSING", "EXPORT_CONVERSION_FAILED", "EXPORT_TEXT_EXTRACTION_FAILED", "SANDBOX_INVOCATION_FAILED", "BROWSER_LAUNCH_FAILED", "EXPORT_TIMEOUT", "EXPORT_OOM", "EXPORT_MEDIA_FAILED", "EXPORT_INPUT_INVALID", "EXPORT_OUTPUT_INVALID", "SANDBOX_CANCELLED"];
|
|
6
|
+
export declare const SANDBOX_JOB_ERROR_CODES: readonly ["SANDBOX_ACTION_UNAVAILABLE", "SANDBOX_ACTION_INVALID", "SANDBOX_PROFILE_UNAVAILABLE", "SANDBOX_RUNTIME_UNAVAILABLE", "SANDBOX_VERSION_MISMATCH", "SANDBOX_CAPACITY_UNAVAILABLE", "SANDBOX_START_FAILED", "SANDBOX_DEPENDENCY_MISSING", "EXPORT_CONVERSION_FAILED", "EXPORT_TEXT_EXTRACTION_FAILED", "SANDBOX_INVOCATION_FAILED", "BROWSER_LAUNCH_FAILED", "EXPORT_TIMEOUT", "EXPORT_OOM", "EXPORT_MEDIA_FAILED", "EXPORT_INPUT_INVALID", "EXPORT_OUTPUT_INVALID", "SANDBOX_CANCELLED", "SANDBOX_CONTROL_UNCONFIRMED"];
|
|
5
7
|
export type SandboxJobErrorCode = (typeof SANDBOX_JOB_ERROR_CODES)[number];
|
|
6
8
|
/** Persisted lifecycle states for a generic isolated background execution. */
|
|
7
|
-
export type SandboxJobStatus = 'waiting' | 'starting' | 'running' | 'succeeded' | 'failed' | 'cancelled' | 'lost';
|
|
9
|
+
export type SandboxJobStatus = 'waiting' | 'starting' | 'running' | 'settling' | 'cancelling' | 'unknown' | 'succeeded' | 'failed' | 'cancelled' | 'lost';
|
|
8
10
|
/** Line prefix used by trusted Actions to report structured, provider-neutral progress. */
|
|
9
11
|
export declare const SANDBOX_JOB_PROGRESS_PREFIX = "XPERT_SANDBOX_PROGRESS ";
|
|
10
12
|
/** Latest structured progress reported by a Sandbox Action or Core lifecycle stage. */
|
|
@@ -68,6 +70,8 @@ export type SandboxJobRunInput = {
|
|
|
68
70
|
actionVersion: string;
|
|
69
71
|
/** Stable tenant-scoped key combining business identity and immutable input checksum. */
|
|
70
72
|
idempotencyKey: string;
|
|
73
|
+
/** A new call identity that explicitly retries a settled original generation. */
|
|
74
|
+
retryOf?: SandboxJobRetryReference;
|
|
71
75
|
scope: SandboxJobScope;
|
|
72
76
|
/** Small structured request; file bytes must be supplied through `files`. */
|
|
73
77
|
payload: JSONValue;
|
|
@@ -89,6 +93,9 @@ export type SandboxJobOutput = {
|
|
|
89
93
|
};
|
|
90
94
|
/** Provider-neutral persisted view of a Sandbox Job and its runtime evidence. */
|
|
91
95
|
export type SandboxJobSnapshot = {
|
|
96
|
+
/** Business result and physical completion are independent facts. */
|
|
97
|
+
controlState?: 'pending' | 'settled' | 'unknown';
|
|
98
|
+
generation?: string;
|
|
92
99
|
id: string;
|
|
93
100
|
runtimeProfile: string;
|
|
94
101
|
sandboxRuntimeVersion: string;
|
|
@@ -137,6 +144,8 @@ export type SandboxJobInvocation = {
|
|
|
137
144
|
};
|
|
138
145
|
/** Live execution controls; kept separate from the persisted, JSON-only RunInput. */
|
|
139
146
|
export type SandboxJobRunOptions = {
|
|
147
|
+
/** Trusted host ownership; independent/shared work must not inherit caller termination. */
|
|
148
|
+
controlPolicy?: TaskControlPolicy;
|
|
140
149
|
/** Cancels an owned attempt; on reattachment, cancels only this caller's wait. */
|
|
141
150
|
signal?: AbortSignal;
|
|
142
151
|
invocation?: SandboxJobInvocation;
|
|
@@ -176,7 +185,7 @@ export type SandboxJobActionHealth = {
|
|
|
176
185
|
export interface SandboxJobsApi {
|
|
177
186
|
/** Starts, reattaches, or reuses a successful execution by tenant-scoped idempotency key. */
|
|
178
187
|
run(input: SandboxJobRunInput, options?: SandboxJobRunOptions): Promise<SandboxJobRunResult>;
|
|
179
|
-
/**
|
|
188
|
+
/** Persists stop intent; terminal status is returned only after actual execution and host settlement. */
|
|
180
189
|
cancel(input: {
|
|
181
190
|
jobId: string;
|
|
182
191
|
}): Promise<SandboxJobSnapshot>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const FILE_EDIT_DIFF_SCRIPT: string;
|
|
@@ -104,8 +104,20 @@ export interface EditResult {
|
|
|
104
104
|
* External backends set null (already persisted to disk/S3/database/etc).
|
|
105
105
|
*/
|
|
106
106
|
filesUpdate?: Record<string, FileData> | null;
|
|
107
|
-
/** Number of replacements
|
|
107
|
+
/** Number of matched replacements processed, including unchanged replacements. */
|
|
108
108
|
occurrences?: number;
|
|
109
|
+
/** Lines in the old/new arguments, before multiplying by occurrences. Empty text has zero lines. */
|
|
110
|
+
oldLines?: number;
|
|
111
|
+
newLines?: number;
|
|
112
|
+
/** Whether this edit changed the file's text. */
|
|
113
|
+
changed?: boolean;
|
|
114
|
+
/** Whole-file line additions/deletions computed in memory, independently of argument sizes. */
|
|
115
|
+
diff?: {
|
|
116
|
+
removed: number;
|
|
117
|
+
added: number;
|
|
118
|
+
};
|
|
119
|
+
/** Missing statistics do not turn a successful write into an error. */
|
|
120
|
+
diffUnavailable?: 'comparison_budget_exceeded' | 'diff_unavailable';
|
|
109
121
|
/** Metadata for the edit operation, attached to the ToolMessage */
|
|
110
122
|
metadata?: Record<string, unknown>;
|
|
111
123
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { SandboxRuntimeTarget, SandboxRuntimeEvidence } from '@xpert-ai/contracts';
|
|
2
|
+
export type { SandboxRuntimeTarget, SandboxRuntimeEvidence } from '@xpert-ai/contracts';
|
|
1
3
|
/** Per-execution limits applied to the Runtime Definition's fixed Runner command. */
|
|
2
4
|
export type SandboxRuntimeExecutionOptions = {
|
|
3
5
|
timeoutMs?: number;
|
|
@@ -81,6 +83,8 @@ export type SandboxRuntimeSecurity = {
|
|
|
81
83
|
};
|
|
82
84
|
/** Isolation guarantees a Provider advertises before it can be selected. */
|
|
83
85
|
export type SandboxRuntimeProviderCapabilities = {
|
|
86
|
+
/** Versioned original-target control and actual execution receipts. */
|
|
87
|
+
executionControl?: 1;
|
|
84
88
|
isolation: 'process' | 'hardened';
|
|
85
89
|
ephemeral: boolean;
|
|
86
90
|
resourceLimits: boolean;
|
|
@@ -156,6 +160,8 @@ export type SandboxRuntimeVolume = {
|
|
|
156
160
|
};
|
|
157
161
|
/** Fully resolved policy used to create or reattach one ephemeral Job Runtime. */
|
|
158
162
|
export type SandboxRuntimeCreateOptions = {
|
|
163
|
+
/** Host-persisted identity, prepared before create; never replace it with a new target. */
|
|
164
|
+
controlTarget?: SandboxRuntimeTarget;
|
|
159
165
|
tenantId: string;
|
|
160
166
|
workFor: {
|
|
161
167
|
type: 'job';
|
|
@@ -178,6 +184,7 @@ export type SandboxRuntimeCreateOptions = {
|
|
|
178
184
|
};
|
|
179
185
|
/** Persisted evidence required to destroy a Runtime even after Provider reload. */
|
|
180
186
|
export type SandboxRuntimeDestroyOptions = {
|
|
187
|
+
controlTarget?: SandboxRuntimeTarget;
|
|
181
188
|
tenantId: string;
|
|
182
189
|
workFor: {
|
|
183
190
|
type: 'job';
|
|
@@ -229,4 +236,9 @@ export interface ISandboxRuntimeProvider {
|
|
|
229
236
|
create(options: SandboxRuntimeCreateOptions): Promise<SandboxRuntimeInstance>;
|
|
230
237
|
/** Idempotently reclaims a Runtime by persisted scope, Binding, and runtimeRef evidence. */
|
|
231
238
|
destroy(options: SandboxRuntimeDestroyOptions): Promise<void>;
|
|
239
|
+
/** Resolve identity without starting business work; control never calls create/execute. */
|
|
240
|
+
prepareControl?(options: SandboxRuntimeDestroyOptions & {
|
|
241
|
+
generation: string;
|
|
242
|
+
}): Promise<SandboxRuntimeTarget>;
|
|
243
|
+
control?(target: SandboxRuntimeTarget, action: 'inspect' | 'stop'): Promise<SandboxRuntimeEvidence>;
|
|
232
244
|
}
|