@xpert-ai/plugin-sdk 3.38.0 → 3.38.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/index.cjs.js
CHANGED
|
@@ -5745,7 +5745,6 @@ if (endIndex < allEntries.length) {
|
|
|
5745
5745
|
return value.split(node_path.sep).join('/') || '.';
|
|
5746
5746
|
}
|
|
5747
5747
|
|
|
5748
|
-
const MAX_LINE_LENGTH = 500;
|
|
5749
5748
|
const MAX_GREP_LINE_LENGTH = 2000;
|
|
5750
5749
|
const GREP_RESULT_LIMIT = 100;
|
|
5751
5750
|
const GLOB_RESULT_LIMIT = 100;
|
|
@@ -5900,7 +5899,6 @@ const COMMENT_PREFIXES = [
|
|
|
5900
5899
|
const safeLimit = Number.isFinite(limit) && limit > 0 && limit < Number.MAX_SAFE_INTEGER ? Math.floor(limit) : 2000;
|
|
5901
5900
|
return `node -e "
|
|
5902
5901
|
const fs = require('fs');
|
|
5903
|
-
const MAX_LINE_LENGTH = ${MAX_LINE_LENGTH};
|
|
5904
5902
|
|
|
5905
5903
|
const filePath = Buffer.from('${pathB64}', 'base64').toString('utf-8');
|
|
5906
5904
|
const offset = ${safeOffset};
|
|
@@ -5929,10 +5927,7 @@ const selected = lines.slice(offset, offset + limit);
|
|
|
5929
5927
|
|
|
5930
5928
|
for (let i = 0; i < selected.length; i++) {
|
|
5931
5929
|
const lineNum = offset + i + 1;
|
|
5932
|
-
|
|
5933
|
-
if (line.length > MAX_LINE_LENGTH) {
|
|
5934
|
-
line = line.substring(0, MAX_LINE_LENGTH);
|
|
5935
|
-
}
|
|
5930
|
+
const line = selected[i];
|
|
5936
5931
|
console.log('L' + lineNum + ': ' + line);
|
|
5937
5932
|
}
|
|
5938
5933
|
"`;
|
|
@@ -5955,9 +5950,8 @@ for (let i = 0; i < selected.length; i++) {
|
|
|
5955
5950
|
const maxLines = (_options_max_lines = options.max_lines) != null ? _options_max_lines : safeLimit;
|
|
5956
5951
|
return `node -e "
|
|
5957
5952
|
const fs = require('fs');
|
|
5958
|
-
const MAX_LINE_LENGTH = ${MAX_LINE_LENGTH};
|
|
5959
5953
|
const TAB_WIDTH = ${TAB_WIDTH};
|
|
5960
|
-
const COMMENT_PREFIXES = ${JSON.stringify(COMMENT_PREFIXES)};
|
|
5954
|
+
const COMMENT_PREFIXES = JSON.parse(Buffer.from('${utf8ToBase64(JSON.stringify(COMMENT_PREFIXES))}', 'base64').toString('utf8'));
|
|
5961
5955
|
|
|
5962
5956
|
const filePath = Buffer.from('${pathB64}', 'base64').toString('utf-8');
|
|
5963
5957
|
const anchorLine = ${anchorLine};
|
|
@@ -5992,12 +5986,11 @@ function measureIndent(line) {
|
|
|
5992
5986
|
|
|
5993
5987
|
function isBlank(line) { return line.trim() === ''; }
|
|
5994
5988
|
function isComment(line) { return COMMENT_PREFIXES.some(p => line.trim().startsWith(p)); }
|
|
5995
|
-
function formatLine(line) { return line.length > MAX_LINE_LENGTH ? line.substring(0, MAX_LINE_LENGTH) : line; }
|
|
5996
5989
|
|
|
5997
5990
|
const records = rawLines.map((raw, i) => ({
|
|
5998
5991
|
number: i + 1,
|
|
5999
5992
|
raw,
|
|
6000
|
-
display:
|
|
5993
|
+
display: raw,
|
|
6001
5994
|
indent: measureIndent(raw)
|
|
6002
5995
|
}));
|
|
6003
5996
|
|
|
@@ -6302,7 +6295,9 @@ try {
|
|
|
6302
6295
|
if (result.exitCode !== 0) {
|
|
6303
6296
|
return result.output || `Error: File '${filePath}' not found`;
|
|
6304
6297
|
}
|
|
6305
|
-
|
|
6298
|
+
// Exact-text edits require the entire selected line, including long JSON strings.
|
|
6299
|
+
// The backend still enforces the operation output budget; never disguise clipping as a complete read.
|
|
6300
|
+
return result.truncated ? result.output + '\n[Read output truncated by the sandbox output limit. Do not use incomplete lines as exact edit text; read a smaller line range.]' : result.output;
|
|
6306
6301
|
}
|
|
6307
6302
|
/**
|
|
6308
6303
|
* Structured search results or error string for invalid input.
|
package/index.esm.js
CHANGED
|
@@ -5727,7 +5727,6 @@ if (endIndex < allEntries.length) {
|
|
|
5727
5727
|
return value.split(sep).join('/') || '.';
|
|
5728
5728
|
}
|
|
5729
5729
|
|
|
5730
|
-
const MAX_LINE_LENGTH = 500;
|
|
5731
5730
|
const MAX_GREP_LINE_LENGTH = 2000;
|
|
5732
5731
|
const GREP_RESULT_LIMIT = 100;
|
|
5733
5732
|
const GLOB_RESULT_LIMIT = 100;
|
|
@@ -5882,7 +5881,6 @@ const COMMENT_PREFIXES = [
|
|
|
5882
5881
|
const safeLimit = Number.isFinite(limit) && limit > 0 && limit < Number.MAX_SAFE_INTEGER ? Math.floor(limit) : 2000;
|
|
5883
5882
|
return `node -e "
|
|
5884
5883
|
const fs = require('fs');
|
|
5885
|
-
const MAX_LINE_LENGTH = ${MAX_LINE_LENGTH};
|
|
5886
5884
|
|
|
5887
5885
|
const filePath = Buffer.from('${pathB64}', 'base64').toString('utf-8');
|
|
5888
5886
|
const offset = ${safeOffset};
|
|
@@ -5911,10 +5909,7 @@ const selected = lines.slice(offset, offset + limit);
|
|
|
5911
5909
|
|
|
5912
5910
|
for (let i = 0; i < selected.length; i++) {
|
|
5913
5911
|
const lineNum = offset + i + 1;
|
|
5914
|
-
|
|
5915
|
-
if (line.length > MAX_LINE_LENGTH) {
|
|
5916
|
-
line = line.substring(0, MAX_LINE_LENGTH);
|
|
5917
|
-
}
|
|
5912
|
+
const line = selected[i];
|
|
5918
5913
|
console.log('L' + lineNum + ': ' + line);
|
|
5919
5914
|
}
|
|
5920
5915
|
"`;
|
|
@@ -5937,9 +5932,8 @@ for (let i = 0; i < selected.length; i++) {
|
|
|
5937
5932
|
const maxLines = (_options_max_lines = options.max_lines) != null ? _options_max_lines : safeLimit;
|
|
5938
5933
|
return `node -e "
|
|
5939
5934
|
const fs = require('fs');
|
|
5940
|
-
const MAX_LINE_LENGTH = ${MAX_LINE_LENGTH};
|
|
5941
5935
|
const TAB_WIDTH = ${TAB_WIDTH};
|
|
5942
|
-
const COMMENT_PREFIXES = ${JSON.stringify(COMMENT_PREFIXES)};
|
|
5936
|
+
const COMMENT_PREFIXES = JSON.parse(Buffer.from('${utf8ToBase64(JSON.stringify(COMMENT_PREFIXES))}', 'base64').toString('utf8'));
|
|
5943
5937
|
|
|
5944
5938
|
const filePath = Buffer.from('${pathB64}', 'base64').toString('utf-8');
|
|
5945
5939
|
const anchorLine = ${anchorLine};
|
|
@@ -5974,12 +5968,11 @@ function measureIndent(line) {
|
|
|
5974
5968
|
|
|
5975
5969
|
function isBlank(line) { return line.trim() === ''; }
|
|
5976
5970
|
function isComment(line) { return COMMENT_PREFIXES.some(p => line.trim().startsWith(p)); }
|
|
5977
|
-
function formatLine(line) { return line.length > MAX_LINE_LENGTH ? line.substring(0, MAX_LINE_LENGTH) : line; }
|
|
5978
5971
|
|
|
5979
5972
|
const records = rawLines.map((raw, i) => ({
|
|
5980
5973
|
number: i + 1,
|
|
5981
5974
|
raw,
|
|
5982
|
-
display:
|
|
5975
|
+
display: raw,
|
|
5983
5976
|
indent: measureIndent(raw)
|
|
5984
5977
|
}));
|
|
5985
5978
|
|
|
@@ -6284,7 +6277,9 @@ try {
|
|
|
6284
6277
|
if (result.exitCode !== 0) {
|
|
6285
6278
|
return result.output || `Error: File '${filePath}' not found`;
|
|
6286
6279
|
}
|
|
6287
|
-
|
|
6280
|
+
// Exact-text edits require the entire selected line, including long JSON strings.
|
|
6281
|
+
// The backend still enforces the operation output budget; never disguise clipping as a complete read.
|
|
6282
|
+
return result.truncated ? result.output + '\n[Read output truncated by the sandbox output limit. Do not use incomplete lines as exact edit text; read a smaller line range.]' : result.output;
|
|
6288
6283
|
}
|
|
6289
6284
|
/**
|
|
6290
6285
|
* Structured search results or error string for invalid input.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xpert-ai/plugin-sdk",
|
|
3
|
-
"version": "3.38.
|
|
3
|
+
"version": "3.38.1",
|
|
4
4
|
"license": "AGPL-3.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
},
|
|
81
81
|
"dependencies": {
|
|
82
82
|
"@langchain/openai": "0.6.9",
|
|
83
|
-
"@xpert-ai/contracts": "3.38.
|
|
83
|
+
"@xpert-ai/contracts": "3.38.1",
|
|
84
84
|
"express": "^4.22.1",
|
|
85
85
|
"js-tiktoken": "^1.0.21"
|
|
86
86
|
},
|
|
@@ -46,12 +46,94 @@ export interface AnalyticsProviderResult {
|
|
|
46
46
|
/** Only source-verified business approvals; never copy from Binding payload or display metadata. */
|
|
47
47
|
certification?: AnalyticalDataset['provenance']['certification'];
|
|
48
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Host-supplied scope for one model setup operation on an authorized connection.
|
|
51
|
+
* Providers use this actor and connection for source access and propagate the signal and deadline to upstream calls.
|
|
52
|
+
*/
|
|
53
|
+
export interface AnalyticsModelSetupContext {
|
|
54
|
+
/** Include models prepared through application templates when the actor has access to them. */
|
|
55
|
+
includeProvisioned?: boolean;
|
|
56
|
+
/** Only the selected connection. Rechecks the acting organization's configuration grant on every read. */
|
|
57
|
+
readConnectionOptions(): Promise<unknown>;
|
|
58
|
+
actor: DataSourceActor;
|
|
59
|
+
integrationId: string;
|
|
60
|
+
signal: AbortSignal;
|
|
61
|
+
deadlineAt: number;
|
|
62
|
+
}
|
|
63
|
+
/** Choices an administrator reviews before preparing a model from an application template. */
|
|
64
|
+
export interface AnalyticsModelBootstrapSelection {
|
|
65
|
+
workspaceId: string;
|
|
66
|
+
dataSourceId: string;
|
|
67
|
+
/** Stable ID of a preparation mode declared by the application's bootstrap template. */
|
|
68
|
+
mode: string;
|
|
69
|
+
/** Organization members selected to receive read access in this operation. Existing grants are retained. */
|
|
70
|
+
userIds: string[];
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Optional provider extension for preparing a model from the application's versioned bundle.
|
|
74
|
+
* Inspect the selected resources before confirmation. Applying the confirmed plan must support retries
|
|
75
|
+
* and preserve existing resources when their configuration conflicts with the plan.
|
|
76
|
+
*/
|
|
77
|
+
export interface AnalyticsModelBootstrap {
|
|
78
|
+
workspaces(context: AnalyticsModelSetupContext): Promise<Array<{
|
|
79
|
+
id: string;
|
|
80
|
+
label: string;
|
|
81
|
+
}>>;
|
|
82
|
+
sources(context: AnalyticsModelSetupContext, workspaceId: string): Promise<Array<{
|
|
83
|
+
id: string;
|
|
84
|
+
label: string;
|
|
85
|
+
}>>;
|
|
86
|
+
/** Describe the proposed changes without writing. The fingerprint identifies the state reviewed by the administrator. */
|
|
87
|
+
inspect(context: AnalyticsModelSetupContext, bundle: JSONValue, selection: AnalyticsModelBootstrapSelection): Promise<{
|
|
88
|
+
state: 'create' | 'resume' | 'reuse' | 'conflict';
|
|
89
|
+
modelLabel: string;
|
|
90
|
+
fingerprint: string;
|
|
91
|
+
differences: string[];
|
|
92
|
+
}>;
|
|
93
|
+
/** Recheck the fingerprint before making changes. Use the host callbacks for scoped access to the prepared model. */
|
|
94
|
+
apply(context: AnalyticsModelSetupContext, bundle: JSONValue, selection: AnalyticsModelBootstrapSelection, fingerprint: string, access: {
|
|
95
|
+
area(modelKey: string, name: string): Promise<string>;
|
|
96
|
+
prepare(resourceId: string, name: string): Promise<{
|
|
97
|
+
xpertId: string;
|
|
98
|
+
businessAreaId: string;
|
|
99
|
+
}>;
|
|
100
|
+
grant(resourceId: string, xpertId: string): Promise<void>;
|
|
101
|
+
}): Promise<{
|
|
102
|
+
id: string;
|
|
103
|
+
label: string;
|
|
104
|
+
}>;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Provider extension for choosing an authorized model and previewing an application's query recipes.
|
|
108
|
+
* The provider returns a sample and a candidate binding for each recipe. On confirmation the host binds
|
|
109
|
+
* the queries to a published definition version. Implement bootstrap to also offer model preparation.
|
|
110
|
+
*/
|
|
111
|
+
export interface AnalyticsModelSetup {
|
|
112
|
+
bootstrap?: AnalyticsModelBootstrap;
|
|
113
|
+
/** Integration provider ID the host uses to find compatible connections. */
|
|
114
|
+
integrationProvider: string;
|
|
115
|
+
models(context: AnalyticsModelSetupContext): Promise<Array<{
|
|
116
|
+
id: string;
|
|
117
|
+
label: string;
|
|
118
|
+
}>>;
|
|
119
|
+
preview(context: AnalyticsModelSetupContext, modelId: string, recipes: Record<string, JSONValue>): Promise<{
|
|
120
|
+
options: Record<string, JSONValue>;
|
|
121
|
+
modelLabel: string;
|
|
122
|
+
queries: Array<{
|
|
123
|
+
key: string;
|
|
124
|
+
binding: Omit<AnalyticsBinding, 'source'>;
|
|
125
|
+
rowCount: number;
|
|
126
|
+
sample: Array<Record<string, AnalyticsValue>>;
|
|
127
|
+
}>;
|
|
128
|
+
}>;
|
|
129
|
+
}
|
|
49
130
|
/**
|
|
50
131
|
* Plugin extension point for SQL, ontology, file or other query formats.
|
|
51
|
-
*
|
|
52
|
-
*
|
|
132
|
+
* Providers validate native payloads, enforce source permissions and execute read-only queries.
|
|
133
|
+
* The host handles scoped lookup, parameter checks, execution limits and result normalization.
|
|
53
134
|
*/
|
|
54
135
|
export interface AnalyticsQueryProvider {
|
|
136
|
+
readonly modelSetup?: AnalyticsModelSetup;
|
|
55
137
|
readonly descriptor: AnalyticsProviderDescriptor;
|
|
56
138
|
readonly configuration?: AnalyticsConfigurationEntry;
|
|
57
139
|
readonly authoring?: AnalyticsDefinitionAuthoring;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import type { XpertProjectClassification } from '@xpert-ai/contracts';
|
|
1
|
+
import type { ProjectApplicationBindings, XpertProjectClassification } from '@xpert-ai/contracts';
|
|
2
2
|
import type { RuntimeActor } from '../actor';
|
|
3
3
|
export type ProjectAccessActor = RuntimeActor;
|
|
4
4
|
export interface ProjectHumanAccess extends XpertProjectClassification {
|
|
5
5
|
projectId: string;
|
|
6
6
|
name?: string;
|
|
7
7
|
role: 'owner' | 'manager' | 'editor' | 'member' | 'assistant';
|
|
8
|
+
/** Organization installation metadata resolved on request by {@link ProjectAccessApi.assertManage}. */
|
|
9
|
+
applicationBindings?: ProjectApplicationBindings;
|
|
8
10
|
canManage: boolean;
|
|
9
11
|
archived: boolean;
|
|
10
12
|
/** Explicit Project bindings, for plugins that choose to use assignment as business policy. */
|
|
@@ -20,9 +22,16 @@ export interface ProjectAccessApi {
|
|
|
20
22
|
actor: ProjectAccessActor;
|
|
21
23
|
projectId: string;
|
|
22
24
|
}): Promise<ProjectHumanAccess>;
|
|
25
|
+
/**
|
|
26
|
+
* Require project management access and return the actor's access record for that project.
|
|
27
|
+
* By default this checks project access alone. Request installation bindings when the operation
|
|
28
|
+
* needs the current organization's role assignments or application settings.
|
|
29
|
+
*/
|
|
23
30
|
assertManage(input: {
|
|
24
31
|
actor: ProjectAccessActor;
|
|
25
32
|
projectId: string;
|
|
33
|
+
/** A matching installation must be ready. Without a matching installation, the result omits applicationBindings. */
|
|
34
|
+
includeApplicationBindings?: boolean;
|
|
26
35
|
}): Promise<ProjectHumanAccess>;
|
|
27
36
|
/** Validate an explicit Assistant connection, including published/root identity normalization. */
|
|
28
37
|
assertAssistant(input: {
|
|
@@ -15,7 +15,8 @@ export interface ToolImagesApi {
|
|
|
15
15
|
title: string;
|
|
16
16
|
}): Promise<ToolOutputPresentation>;
|
|
17
17
|
/**
|
|
18
|
-
* Project the current complete
|
|
18
|
+
* Project the current complete image round and up to three recent distinct images from
|
|
19
|
+
* the same user turn into one outbound model request. Names identify tools
|
|
19
20
|
* whose successful result must contain an image presentation; error results remain text.
|
|
20
21
|
* Never persist the returned messages. Merge requirements into the request with mergeModelRequirements.
|
|
21
22
|
*/
|