@xpert-ai/plugin-sdk 3.22.2 → 3.23.1
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/_object_without_properties_loose.cjs.js +16 -0
- package/_object_without_properties_loose.esm.js +14 -0
- package/analytics-result.cjs.js +212 -0
- package/analytics-result.esm.js +201 -0
- package/analytics.cjs.default.js +1 -0
- package/analytics.cjs.js +17 -0
- package/analytics.cjs.mjs +2 -0
- package/analytics.d.ts +1 -0
- package/analytics.esm.js +2 -0
- package/artifact-document.cjs.default.js +1 -0
- package/artifact-document.cjs.js +581 -0
- package/artifact-document.cjs.mjs +2 -0
- package/artifact-document.d.ts +1 -0
- package/artifact-document.esm.js +563 -0
- package/data-workbench.cjs.js +23 -6
- package/data-workbench.esm.js +23 -6
- package/docs/analytics.md +66 -0
- package/docs/artifact-documents.md +74 -0
- package/docs/artifact-drafts.md +24 -0
- package/docs/json-encoded-schema.md +19 -0
- package/docs/workspace-dataset-pipelines.md +120 -0
- package/docs/workspace-file-tools.md +60 -0
- package/index.cjs.js +84 -19
- package/index.esm.js +127 -82
- package/model-provider-toolset.cjs.js +1 -1
- package/model-provider-toolset.esm.js +1 -1
- package/model-provider.cjs.js +37 -1
- package/model-provider.esm.js +33 -2
- package/package.json +14 -2
- package/src/analytics.d.ts +3 -0
- package/src/artifact-document.d.ts +5 -0
- package/src/lib/agent/handoff/agent-runtime-message.contract.d.ts +18 -18
- package/src/lib/artifact-document/dependencies.d.ts +101 -0
- package/src/lib/artifact-document/host.d.ts +30 -0
- package/src/lib/artifact-document/protocol.d.ts +60 -0
- package/src/lib/artifact-document/runtime.d.ts +4 -0
- package/src/lib/artifact-document/sha256.d.ts +2 -0
- package/src/lib/core/index.d.ts +1 -0
- package/src/lib/core/json-encoded-schema.d.ts +15 -0
- package/src/lib/data/analytics/analytics-provider.d.ts +74 -0
- package/src/lib/data/analytics/analytics-result.d.ts +4 -0
- package/src/lib/data/analytics/analytics.registry.d.ts +10 -0
- package/src/lib/data/analytics/analytics.schema.d.ts +206 -0
- package/src/lib/data/analytics/index.d.ts +4 -0
- package/src/lib/data/datasource/index.d.ts +1 -0
- package/src/lib/data/datasource/workbench-adapter.d.ts +11 -1
- package/src/lib/data/datasource/workbench-sql.d.ts +12 -0
- package/src/lib/runtime/capabilities/artifact-drafts.d.ts +29 -0
- package/src/lib/runtime/capabilities/artifacts.d.ts +10 -0
- package/src/lib/runtime/capabilities/index.d.ts +1 -0
- package/src/lib/runtime/capabilities/sandbox-jobs.d.ts +36 -2
- package/src/lib/runtime/index.d.ts +2 -0
- package/src/lib/runtime/mutation-evidence.d.ts +7 -0
- package/src/lib/runtime/workspace-file-tools.d.ts +11 -0
- package/src/lib/sandbox/runtime-provider.d.ts +4 -0
- package/src/lib/sandbox/sandbox.interface.d.ts +8 -0
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { z } from 'zod/v3';
|
|
2
|
+
import type { AnalyticsBinding, AnalyticsQueryRequest, AnalyticsDiscoveryRequest, AnalyticsDiscoveryResult, JSONValue } from '@xpert-ai/contracts';
|
|
3
|
+
export declare const analyticsOptionsSchema: z.ZodRecord<z.ZodString, z.ZodType<JSONValue, z.ZodTypeDef, JSONValue>>;
|
|
4
|
+
export declare const analyticsFieldSchema: z.ZodObject<{
|
|
5
|
+
id: z.ZodString;
|
|
6
|
+
sourceField: z.ZodString;
|
|
7
|
+
label: z.ZodString;
|
|
8
|
+
logicalType: z.ZodEnum<["string", "boolean", "int64", "float64", "decimal", "date", "timestamp"]>;
|
|
9
|
+
nullable: z.ZodBoolean;
|
|
10
|
+
role: z.ZodEnum<["dimension", "measure", "time", "identifier"]>;
|
|
11
|
+
semanticRef: z.ZodOptional<z.ZodString>;
|
|
12
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
13
|
+
}, "strict", z.ZodTypeAny, {
|
|
14
|
+
id?: string;
|
|
15
|
+
sourceField?: string;
|
|
16
|
+
label?: string;
|
|
17
|
+
logicalType?: "string" | "boolean" | "date" | "int64" | "float64" | "decimal" | "timestamp";
|
|
18
|
+
nullable?: boolean;
|
|
19
|
+
role?: "dimension" | "measure" | "time" | "identifier";
|
|
20
|
+
semanticRef?: string;
|
|
21
|
+
unit?: string;
|
|
22
|
+
}, {
|
|
23
|
+
id?: string;
|
|
24
|
+
sourceField?: string;
|
|
25
|
+
label?: string;
|
|
26
|
+
logicalType?: "string" | "boolean" | "date" | "int64" | "float64" | "decimal" | "timestamp";
|
|
27
|
+
nullable?: boolean;
|
|
28
|
+
role?: "dimension" | "measure" | "time" | "identifier";
|
|
29
|
+
semanticRef?: string;
|
|
30
|
+
unit?: string;
|
|
31
|
+
}>;
|
|
32
|
+
export declare const analyticsParameterSchema: z.ZodObject<{
|
|
33
|
+
name: z.ZodString;
|
|
34
|
+
controlId: z.ZodString;
|
|
35
|
+
type: z.ZodEnum<["string", "number", "boolean", "date"]>;
|
|
36
|
+
required: z.ZodBoolean;
|
|
37
|
+
defaultValue: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
|
|
38
|
+
allowedValues: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, "many">>;
|
|
39
|
+
}, "strict", z.ZodTypeAny, {
|
|
40
|
+
type?: "string" | "number" | "boolean" | "date";
|
|
41
|
+
name?: string;
|
|
42
|
+
controlId?: string;
|
|
43
|
+
required?: boolean;
|
|
44
|
+
defaultValue?: string | number | boolean;
|
|
45
|
+
allowedValues?: (string | number | boolean)[];
|
|
46
|
+
}, {
|
|
47
|
+
type?: "string" | "number" | "boolean" | "date";
|
|
48
|
+
name?: string;
|
|
49
|
+
controlId?: string;
|
|
50
|
+
required?: boolean;
|
|
51
|
+
defaultValue?: string | number | boolean;
|
|
52
|
+
allowedValues?: (string | number | boolean)[];
|
|
53
|
+
}>;
|
|
54
|
+
export declare const analyticsBindingObjectSchema: z.ZodObject<{
|
|
55
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
56
|
+
id: z.ZodString;
|
|
57
|
+
dataSourceId: z.ZodString;
|
|
58
|
+
providerId: z.ZodString;
|
|
59
|
+
operation: z.ZodString;
|
|
60
|
+
contractVersion: z.ZodNumber;
|
|
61
|
+
payload: z.ZodType<JSONValue, z.ZodTypeDef, JSONValue>;
|
|
62
|
+
parameters: z.ZodArray<z.ZodObject<{
|
|
63
|
+
name: z.ZodString;
|
|
64
|
+
controlId: z.ZodString;
|
|
65
|
+
type: z.ZodEnum<["string", "number", "boolean", "date"]>;
|
|
66
|
+
required: z.ZodBoolean;
|
|
67
|
+
defaultValue: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
|
|
68
|
+
allowedValues: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, "many">>;
|
|
69
|
+
}, "strict", z.ZodTypeAny, {
|
|
70
|
+
type?: "string" | "number" | "boolean" | "date";
|
|
71
|
+
name?: string;
|
|
72
|
+
controlId?: string;
|
|
73
|
+
required?: boolean;
|
|
74
|
+
defaultValue?: string | number | boolean;
|
|
75
|
+
allowedValues?: (string | number | boolean)[];
|
|
76
|
+
}, {
|
|
77
|
+
type?: "string" | "number" | "boolean" | "date";
|
|
78
|
+
name?: string;
|
|
79
|
+
controlId?: string;
|
|
80
|
+
required?: boolean;
|
|
81
|
+
defaultValue?: string | number | boolean;
|
|
82
|
+
allowedValues?: (string | number | boolean)[];
|
|
83
|
+
}>, "many">;
|
|
84
|
+
output: z.ZodObject<{
|
|
85
|
+
datasetId: z.ZodString;
|
|
86
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
87
|
+
id: z.ZodString;
|
|
88
|
+
sourceField: z.ZodString;
|
|
89
|
+
label: z.ZodString;
|
|
90
|
+
logicalType: z.ZodEnum<["string", "boolean", "int64", "float64", "decimal", "date", "timestamp"]>;
|
|
91
|
+
nullable: z.ZodBoolean;
|
|
92
|
+
role: z.ZodEnum<["dimension", "measure", "time", "identifier"]>;
|
|
93
|
+
semanticRef: z.ZodOptional<z.ZodString>;
|
|
94
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
95
|
+
}, "strict", z.ZodTypeAny, {
|
|
96
|
+
id?: string;
|
|
97
|
+
sourceField?: string;
|
|
98
|
+
label?: string;
|
|
99
|
+
logicalType?: "string" | "boolean" | "date" | "int64" | "float64" | "decimal" | "timestamp";
|
|
100
|
+
nullable?: boolean;
|
|
101
|
+
role?: "dimension" | "measure" | "time" | "identifier";
|
|
102
|
+
semanticRef?: string;
|
|
103
|
+
unit?: string;
|
|
104
|
+
}, {
|
|
105
|
+
id?: string;
|
|
106
|
+
sourceField?: string;
|
|
107
|
+
label?: string;
|
|
108
|
+
logicalType?: "string" | "boolean" | "date" | "int64" | "float64" | "decimal" | "timestamp";
|
|
109
|
+
nullable?: boolean;
|
|
110
|
+
role?: "dimension" | "measure" | "time" | "identifier";
|
|
111
|
+
semanticRef?: string;
|
|
112
|
+
unit?: string;
|
|
113
|
+
}>, "many">;
|
|
114
|
+
grain: z.ZodArray<z.ZodString, "many">;
|
|
115
|
+
}, "strict", z.ZodTypeAny, {
|
|
116
|
+
datasetId?: string;
|
|
117
|
+
fields?: {
|
|
118
|
+
id?: string;
|
|
119
|
+
sourceField?: string;
|
|
120
|
+
label?: string;
|
|
121
|
+
logicalType?: "string" | "boolean" | "date" | "int64" | "float64" | "decimal" | "timestamp";
|
|
122
|
+
nullable?: boolean;
|
|
123
|
+
role?: "dimension" | "measure" | "time" | "identifier";
|
|
124
|
+
semanticRef?: string;
|
|
125
|
+
unit?: string;
|
|
126
|
+
}[];
|
|
127
|
+
grain?: string[];
|
|
128
|
+
}, {
|
|
129
|
+
datasetId?: string;
|
|
130
|
+
fields?: {
|
|
131
|
+
id?: string;
|
|
132
|
+
sourceField?: string;
|
|
133
|
+
label?: string;
|
|
134
|
+
logicalType?: "string" | "boolean" | "date" | "int64" | "float64" | "decimal" | "timestamp";
|
|
135
|
+
nullable?: boolean;
|
|
136
|
+
role?: "dimension" | "measure" | "time" | "identifier";
|
|
137
|
+
semanticRef?: string;
|
|
138
|
+
unit?: string;
|
|
139
|
+
}[];
|
|
140
|
+
grain?: string[];
|
|
141
|
+
}>;
|
|
142
|
+
}, "strict", z.ZodTypeAny, {
|
|
143
|
+
id?: string;
|
|
144
|
+
schemaVersion?: 1;
|
|
145
|
+
dataSourceId?: string;
|
|
146
|
+
providerId?: string;
|
|
147
|
+
operation?: string;
|
|
148
|
+
contractVersion?: number;
|
|
149
|
+
payload?: JSONValue;
|
|
150
|
+
parameters?: {
|
|
151
|
+
type?: "string" | "number" | "boolean" | "date";
|
|
152
|
+
name?: string;
|
|
153
|
+
controlId?: string;
|
|
154
|
+
required?: boolean;
|
|
155
|
+
defaultValue?: string | number | boolean;
|
|
156
|
+
allowedValues?: (string | number | boolean)[];
|
|
157
|
+
}[];
|
|
158
|
+
output?: {
|
|
159
|
+
datasetId?: string;
|
|
160
|
+
fields?: {
|
|
161
|
+
id?: string;
|
|
162
|
+
sourceField?: string;
|
|
163
|
+
label?: string;
|
|
164
|
+
logicalType?: "string" | "boolean" | "date" | "int64" | "float64" | "decimal" | "timestamp";
|
|
165
|
+
nullable?: boolean;
|
|
166
|
+
role?: "dimension" | "measure" | "time" | "identifier";
|
|
167
|
+
semanticRef?: string;
|
|
168
|
+
unit?: string;
|
|
169
|
+
}[];
|
|
170
|
+
grain?: string[];
|
|
171
|
+
};
|
|
172
|
+
}, {
|
|
173
|
+
id?: string;
|
|
174
|
+
schemaVersion?: 1;
|
|
175
|
+
dataSourceId?: string;
|
|
176
|
+
providerId?: string;
|
|
177
|
+
operation?: string;
|
|
178
|
+
contractVersion?: number;
|
|
179
|
+
payload?: JSONValue;
|
|
180
|
+
parameters?: {
|
|
181
|
+
type?: "string" | "number" | "boolean" | "date";
|
|
182
|
+
name?: string;
|
|
183
|
+
controlId?: string;
|
|
184
|
+
required?: boolean;
|
|
185
|
+
defaultValue?: string | number | boolean;
|
|
186
|
+
allowedValues?: (string | number | boolean)[];
|
|
187
|
+
}[];
|
|
188
|
+
output?: {
|
|
189
|
+
datasetId?: string;
|
|
190
|
+
fields?: {
|
|
191
|
+
id?: string;
|
|
192
|
+
sourceField?: string;
|
|
193
|
+
label?: string;
|
|
194
|
+
logicalType?: "string" | "boolean" | "date" | "int64" | "float64" | "decimal" | "timestamp";
|
|
195
|
+
nullable?: boolean;
|
|
196
|
+
role?: "dimension" | "measure" | "time" | "identifier";
|
|
197
|
+
semanticRef?: string;
|
|
198
|
+
unit?: string;
|
|
199
|
+
}[];
|
|
200
|
+
grain?: string[];
|
|
201
|
+
};
|
|
202
|
+
}>;
|
|
203
|
+
export declare const analyticsBindingSchema: z.ZodType<AnalyticsBinding>;
|
|
204
|
+
export declare const analyticsQueryRequestSchema: z.ZodType<AnalyticsQueryRequest, z.ZodTypeDef, unknown>;
|
|
205
|
+
export declare const analyticsDiscoveryRequestSchema: z.ZodType<AnalyticsDiscoveryRequest, z.ZodTypeDef, unknown>;
|
|
206
|
+
export declare const analyticsDiscoveryResultSchema: z.ZodType<AnalyticsDiscoveryResult>;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Why this exists: existing SQL Workbench plugins share this SDK implementation.
|
|
3
|
+
* Metadata and transaction SQL still couple it to PostgreSQL/MySQL/Doris.
|
|
4
|
+
* TODO: delegate dialect behavior to plugin-owned strategies behind DatabaseWorkbenchAdapter.
|
|
5
|
+
* Keep host authorization/execution limits and generic Dataset/Binding independent of dialects.
|
|
6
|
+
*/
|
|
1
7
|
import type { DatabaseCapabilities, DatabaseEngine, DatabaseImportInput, DatabaseImportReceipt, DatabaseLocation, DatabaseObjectDetail, DatabaseObjectPage, DatabaseObjectRef, DatabaseQueryInput, DatabaseResult, DatabaseValue, DatabaseWorkbenchAdapter } from './workbench';
|
|
2
8
|
export interface WorkbenchTransport {
|
|
3
9
|
execute(sql: string, parameters: DatabaseValue[], options: {
|
|
@@ -8,7 +14,11 @@ export interface WorkbenchTransport {
|
|
|
8
14
|
close(): Promise<void>;
|
|
9
15
|
importRows?(input: DatabaseImportInput, signal?: AbortSignal): Promise<DatabaseImportReceipt>;
|
|
10
16
|
}
|
|
11
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* One adapter per physical connection. A host session must not share it across users.
|
|
19
|
+
* @deprecated Legacy SDK-owned SQL dialects. New plugins should implement DatabaseWorkbenchAdapter
|
|
20
|
+
* with plugin-owned dialect behavior. Retained for compatibility with existing plugins.
|
|
21
|
+
*/
|
|
12
22
|
export declare class SqlDatabaseWorkbenchAdapter implements DatabaseWorkbenchAdapter {
|
|
13
23
|
readonly engine: DatabaseEngine;
|
|
14
24
|
private readonly transport;
|
|
@@ -7,6 +7,18 @@ export interface SqlStatement {
|
|
|
7
7
|
words: string[];
|
|
8
8
|
effect: 'read' | 'write' | 'unsupported';
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated Mixed-dialect Workbench policy. New adapters should own dialect-aware statement
|
|
12
|
+
* validation. Existing callers must retain this guard until an equivalent replacement is in place.
|
|
13
|
+
*/
|
|
10
14
|
export declare function splitWorkbenchSql(source: string): SqlStatement[];
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated Uses the legacy mixed-dialect policy. New adapters should enforce read-only execution
|
|
17
|
+
* with dialect-aware validation and database permissions. Keep this guard until safely migrated.
|
|
18
|
+
*/
|
|
11
19
|
export declare function requireReadStatement(sql: string): string;
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated Built-in engine switch. New adapters should own dialect-specific identifier quoting
|
|
22
|
+
* while preserving identifier validation and escaping.
|
|
23
|
+
*/
|
|
12
24
|
export declare function quoteDatabaseIdentifier(name: string, engine: 'doris' | 'mysql' | 'postgres'): string;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ArtifactVersionInput, ArtifactVersionRecord } from './artifacts';
|
|
2
|
+
/** Mutable working copy. Revision numbers are never published version numbers. */
|
|
3
|
+
export type ArtifactDraftRecord = ArtifactVersionInput & {
|
|
4
|
+
id: string;
|
|
5
|
+
artifactId: string;
|
|
6
|
+
revision: number;
|
|
7
|
+
baseVersionId: string | null;
|
|
8
|
+
publishedRevision: number | null;
|
|
9
|
+
publishedVersionId: string | null;
|
|
10
|
+
updatedAt?: string | Date;
|
|
11
|
+
};
|
|
12
|
+
export type SaveArtifactDraftInput = ArtifactVersionInput & {
|
|
13
|
+
artifactId: string;
|
|
14
|
+
expectedRevision: number;
|
|
15
|
+
expectedCurrentVersionId: string | null;
|
|
16
|
+
};
|
|
17
|
+
export type PublishArtifactDraftInput = {
|
|
18
|
+
artifactId: string;
|
|
19
|
+
expectedRevision: number;
|
|
20
|
+
expectedCurrentVersionId: string | null;
|
|
21
|
+
};
|
|
22
|
+
export interface ArtifactDraftsApi {
|
|
23
|
+
list(artifactIds: string[]): Promise<ArtifactDraftRecord[]>;
|
|
24
|
+
get(artifactId: string): Promise<ArtifactDraftRecord | null>;
|
|
25
|
+
save(input: SaveArtifactDraftInput): Promise<ArtifactDraftRecord>;
|
|
26
|
+
/** Trusted application action only; never expose this operation as an Agent tool. */
|
|
27
|
+
publish(input: PublishArtifactDraftInput): Promise<ArtifactVersionRecord>;
|
|
28
|
+
}
|
|
29
|
+
export declare const ArtifactDraftsRuntimeCapability: import("../../core/runtime-capability").RuntimeCapabilityKey<ArtifactDraftsApi>;
|
|
@@ -46,6 +46,12 @@ export type CreateArtifactVersionInput = ArtifactVersionInput & {
|
|
|
46
46
|
/** Idempotently creates or reuses one immutable Artifact content version. */
|
|
47
47
|
export type EnsureArtifactVersionInput = CreateArtifactVersionInput & {
|
|
48
48
|
idempotencyKey: string;
|
|
49
|
+
/**
|
|
50
|
+
* Compare-and-set guard when promoting a version to current; ignored when setCurrent is false.
|
|
51
|
+
* null requires no current version; omission preserves legacy behavior. Retrying the current
|
|
52
|
+
* immutable version is allowed, while a stale save targeting a different version returns a conflict.
|
|
53
|
+
*/
|
|
54
|
+
expectedCurrentVersionId?: string | null;
|
|
49
55
|
};
|
|
50
56
|
/** Access policy requested for an Artifact link. */
|
|
51
57
|
export type ArtifactLinkAccessInput = {
|
|
@@ -143,9 +149,13 @@ export type ArtifactLinkRecord = ArtifactScopeInput & {
|
|
|
143
149
|
};
|
|
144
150
|
/** Filter used when listing Artifacts visible to the current plugin/runtime scope. */
|
|
145
151
|
export type ListArtifactsInput = {
|
|
152
|
+
/** Include current-version metadata in one batch, without reading Workspace file bytes. */
|
|
153
|
+
includeCurrentVersion?: boolean;
|
|
146
154
|
pluginName?: string | null;
|
|
147
155
|
resourceType?: string | null;
|
|
148
156
|
resourceId?: string | null;
|
|
157
|
+
/** Literal resource ID prefix, never a pattern; narrows results without granting access. */
|
|
158
|
+
resourceIdPrefix?: string | null;
|
|
149
159
|
status?: ArtifactStatus | 'all' | null;
|
|
150
160
|
page?: number | null;
|
|
151
161
|
pageSize?: number | null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { JSONValue } from '@xpert-ai/contracts';
|
|
2
2
|
import type { WorkspaceFileScope, WorkspacePortableFileReference } from './workspace-files';
|
|
3
3
|
/** 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", "BROWSER_LAUNCH_FAILED", "EXPORT_TIMEOUT", "EXPORT_OOM", "EXPORT_MEDIA_FAILED", "EXPORT_INPUT_INVALID", "EXPORT_OUTPUT_INVALID", "SANDBOX_CANCELLED"];
|
|
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_INVOCATION_FAILED", "BROWSER_LAUNCH_FAILED", "EXPORT_TIMEOUT", "EXPORT_OOM", "EXPORT_MEDIA_FAILED", "EXPORT_INPUT_INVALID", "EXPORT_OUTPUT_INVALID", "SANDBOX_CANCELLED"];
|
|
5
5
|
export type SandboxJobErrorCode = (typeof SANDBOX_JOB_ERROR_CODES)[number];
|
|
6
6
|
/** Persisted lifecycle states for a generic isolated background execution. */
|
|
7
7
|
export type SandboxJobStatus = 'waiting' | 'starting' | 'running' | 'succeeded' | 'failed' | 'cancelled' | 'lost';
|
|
@@ -114,6 +114,40 @@ export type SandboxJobSnapshot = {
|
|
|
114
114
|
startedAt?: Date | string | null;
|
|
115
115
|
finishedAt?: Date | string | null;
|
|
116
116
|
};
|
|
117
|
+
/**
|
|
118
|
+
* Host callbacks available only for one execution attempt. This configuration is never
|
|
119
|
+
* serialized into a Job or exposed to the script. An attached caller cannot replace it.
|
|
120
|
+
*/
|
|
121
|
+
export type SandboxJobInvocation = {
|
|
122
|
+
/** Exact operation names the script may request; names carry no built-in business meaning. */
|
|
123
|
+
operations: readonly string[];
|
|
124
|
+
/** Positive integer request limit, including queued requests; Core caps it at 32. */
|
|
125
|
+
maxCalls: number;
|
|
126
|
+
/** Positive integer budget for UTF-8 request lines and response JSON combined; capped at 8 MB. */
|
|
127
|
+
maxBytes: number;
|
|
128
|
+
/**
|
|
129
|
+
* Runs in the initiating host context. The plugin validates the operation payload and
|
|
130
|
+
* rechecks resource access; the operation allowlist is not business authorization.
|
|
131
|
+
* Honor signal to stop child work. Return only data permitted to enter the script workspace.
|
|
132
|
+
*/
|
|
133
|
+
handle(operation: string, payload: JSONValue, context: {
|
|
134
|
+
jobId: string;
|
|
135
|
+
signal: AbortSignal;
|
|
136
|
+
}): Promise<JSONValue>;
|
|
137
|
+
};
|
|
138
|
+
/** Live execution controls; kept separate from the persisted, JSON-only RunInput. */
|
|
139
|
+
export type SandboxJobRunOptions = {
|
|
140
|
+
/** Cancels an owned attempt; on reattachment, cancels only this caller's wait. */
|
|
141
|
+
signal?: AbortSignal;
|
|
142
|
+
invocation?: SandboxJobInvocation;
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* Stdout frame: prefix + JSON { id, operation, payload } + newline.
|
|
146
|
+
* Core writes { id, value } to <workspaceRoot>/invocations/<id>.json after validation.
|
|
147
|
+
* IDs are unique per attempt and restricted to 1–64 ASCII letters, digits, '_' or '-'.
|
|
148
|
+
* The bridge has no network endpoint and gives the script no host credentials.
|
|
149
|
+
*/
|
|
150
|
+
export declare const SANDBOX_JOB_INVOCATION_PREFIX = "XPERT_SANDBOX_INVOKE ";
|
|
117
151
|
/** Successful `run()` result; failed executions reject with SandboxJobRuntimeError. */
|
|
118
152
|
export type SandboxJobRunResult = SandboxJobSnapshot & {
|
|
119
153
|
status: 'succeeded';
|
|
@@ -141,7 +175,7 @@ export type SandboxJobActionHealth = {
|
|
|
141
175
|
*/
|
|
142
176
|
export interface SandboxJobsApi {
|
|
143
177
|
/** Starts, reattaches, or reuses a successful execution by tenant-scoped idempotency key. */
|
|
144
|
-
run(input: SandboxJobRunInput): Promise<SandboxJobRunResult>;
|
|
178
|
+
run(input: SandboxJobRunInput, options?: SandboxJobRunOptions): Promise<SandboxJobRunResult>;
|
|
145
179
|
/** Cancels the logical Job and terminates its active Runtime when one exists. */
|
|
146
180
|
cancel(input: {
|
|
147
181
|
jobId: string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod/v3';
|
|
2
|
+
/** Portable Agent input; filesystem containment and authorization remain with the host. */
|
|
3
|
+
export declare const workspaceRelativeFilePathSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
4
|
+
/** Host-owned metadata lets plugins observe file intent without guessing tool names. */
|
|
5
|
+
export declare const workspaceFileMutationMetadata: {
|
|
6
|
+
readonly workspaceFileOperation: {
|
|
7
|
+
readonly type: "mutation";
|
|
8
|
+
readonly pathArgument: "file_path";
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export declare function workspaceFileMutationPath(metadata: unknown, args: Record<string, unknown>): string | undefined;
|
|
@@ -76,6 +76,8 @@ export type SandboxRuntimeSecurity = {
|
|
|
76
76
|
readOnlyRootFilesystem: boolean;
|
|
77
77
|
noNewPrivileges: boolean;
|
|
78
78
|
dropCapabilities: 'all';
|
|
79
|
+
/** Mount job inputs/actions read-only; outputs must live on a bounded ephemeral filesystem. */
|
|
80
|
+
readOnlyWorkspace?: boolean;
|
|
79
81
|
};
|
|
80
82
|
/** Isolation guarantees a Provider advertises before it can be selected. */
|
|
81
83
|
export type SandboxRuntimeProviderCapabilities = {
|
|
@@ -86,6 +88,8 @@ export type SandboxRuntimeProviderCapabilities = {
|
|
|
86
88
|
readOnlyRootFilesystem: boolean;
|
|
87
89
|
/** Supports Job-scoped, read-only, seekable Workspace file mappings. */
|
|
88
90
|
readOnlyFileMounts?: boolean;
|
|
91
|
+
/** Enforces read-only job inputs and bounded ephemeral outputs. */
|
|
92
|
+
readOnlyWorkspace?: boolean;
|
|
89
93
|
};
|
|
90
94
|
/** Minimum Provider guarantees required by a Runtime Definition. */
|
|
91
95
|
export type SandboxRuntimeRequirements = SandboxRuntimeProviderCapabilities;
|
|
@@ -22,6 +22,12 @@ export type SandboxWorkspaceBinding = {
|
|
|
22
22
|
*/
|
|
23
23
|
workspaceRoot: string;
|
|
24
24
|
};
|
|
25
|
+
/** A mount resolved by the application after resource authorization. Never accept it from HTTP input. */
|
|
26
|
+
export type SandboxWorkspaceMount = {
|
|
27
|
+
source: string;
|
|
28
|
+
destination: string;
|
|
29
|
+
readOnly: boolean;
|
|
30
|
+
};
|
|
25
31
|
export type SandboxProviderCreateOptions = {
|
|
26
32
|
/**
|
|
27
33
|
* Working space directory for the sandbox instance
|
|
@@ -37,6 +43,8 @@ export type SandboxProviderCreateOptions = {
|
|
|
37
43
|
* Canonical sandbox environment identifier that owns the container lifecycle.
|
|
38
44
|
*/
|
|
39
45
|
environmentId?: string;
|
|
46
|
+
/** Authorized mount configuration; providers enforce physical mount identity, not business access. */
|
|
47
|
+
workspaceMounts?: SandboxWorkspaceMount[];
|
|
40
48
|
/**
|
|
41
49
|
* Tenant identifier
|
|
42
50
|
*/
|