@uipath/agent-tool 1.201.0 → 1.202.0-preview.136
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/dist/agent-tool-OK5DK57D-hw5d866f.js +11 -0
- package/dist/{de-5KVP66U6-f7knj511.js → de-5KVP66U6-1bnf4zt5.js} +52 -52
- package/dist/{en-4KXU7N7B-66fntxa2.js → en-X3S6IZ5J-nhkg6pwn.js} +54 -60
- package/dist/{es-MX-XAVLOQW3-9b3cp9n8.js → es-MX-XAVLOQW3-q00km2y7.js} +52 -52
- package/dist/{es-VFPNVMP5-thm0z9sr.js → es-VFPNVMP5-bx2c337j.js} +52 -52
- package/dist/executor-tool.js +5 -13
- package/dist/{fr-E5MDO4EG-exvrs7ge.js → fr-E5MDO4EG-c3mkty2t.js} +52 -52
- package/dist/{index-hsadteg4.js → index-h8cph72k.js} +4 -4
- package/dist/{index-9f8q2ege.js → index-p3vk57z7.js} +27 -27
- package/dist/{index-26bymy67.js → index-vhhz1bs5.js} +160 -88
- package/dist/index.js +7 -17
- package/dist/{ja-DPO5PPLO-s2a7j3nj.js → ja-DPO5PPLO-mysfmznx.js} +52 -52
- package/dist/{js-yaml-cggj6w7q.js → js-yaml-87cdx6bm.js} +27 -19
- package/dist/{ko-ITOPNIYI-qz39kamf.js → ko-ITOPNIYI-hmxd2asd.js} +52 -52
- package/dist/{packager-tool-h5zqhhbj.js → packager-tool-0srzfhdr.js} +1089 -690
- package/dist/{packager-tool-wckvcay0.js → packager-tool-1yh8g550.js} +9 -7
- package/dist/{packager-tool-tq9q9m77.js → packager-tool-a42jnpy5.js} +3 -9
- package/dist/{packager-tool-kwp8tznh.js → packager-tool-g8yfc7ef.js} +9227 -6826
- package/dist/{packager-tool-1zt6rezn.js → packager-tool-hwy2sxr3.js} +858 -1171
- package/dist/{packager-tool-v02mthyt.js → packager-tool-vkv0j95b.js} +637 -637
- package/dist/packager-tool-y80gnt72.js +9753 -0
- package/dist/packager-tool.js +5 -6
- package/dist/{pt-BR-BXURWX4W-dqr4dnf9.js → pt-BR-BXURWX4W-bwfcwhk1.js} +52 -52
- package/dist/{pt-YI4VE4YQ-v7gjeg82.js → pt-YI4VE4YQ-wdkn2dcf.js} +52 -52
- package/dist/{ro-RKXZUG7Z-cm3xn3fj.js → ro-RKXZUG7Z-nndrrsq7.js} +52 -52
- package/dist/{ru-WBLQ5B2U-awt245ky.js → ru-WBLQ5B2U-8r3c7v6d.js} +1 -1
- package/dist/tool.js +9 -19
- package/dist/{tr-AA6O2WSR-ga1xnymp.js → tr-AA6O2WSR-86ba4bdf.js} +52 -52
- package/dist/{zh-CN-R2KLHXQV-wttmznep.js → zh-CN-R2KLHXQV-agqr45ds.js} +52 -52
- package/dist/{zh-TW-RJGCQANM-gqn0aca0.js → zh-TW-RJGCQANM-w0x3qc1p.js} +52 -52
- package/package.json +2 -2
- package/dist/agent-project-service-j4pgc7gk.js +0 -12
- package/dist/agent-tool-OK5DK57D-zenkdkdp.js +0 -12
- package/dist/browser-strategy-16yagjhr.js +0 -99
- package/dist/index-byw2z4xp.js +0 -141
- package/dist/index-k00qjyec.js +0 -2933
- package/dist/index-p50kx6jv.js +0 -48756
- package/dist/index-rqfxg3fq.js +0 -15
- package/dist/index-t82tsh16.js +0 -53
- package/dist/index.umd.min-drpc57vn.js +0 -7814
- package/dist/integration-tool-service-n214kzdn.js +0 -297
- package/dist/is-client-a1hbz77f.js +0 -124
- package/dist/node-strategy-1r3qegaf.js +0 -350
- package/dist/packager-tool-0gctz400.js +0 -17
- package/dist/packager-tool-4fge2k9c.js +0 -419
- package/dist/packager-tool-5xdkh3vm.js +0 -2573
- package/dist/packager-tool-8xv16pb3.js +0 -20663
- package/dist/packager-tool-bpegrcj1.js +0 -5336
- package/dist/packager-tool-gkvdytpj.js +0 -5085
- package/dist/packager-tool-nsrs2tm5.js +0 -114
- package/dist/packager-tool-q42rrs00.js +0 -12
- package/dist/packager-tool-qa9gftnj.js +0 -31
- package/dist/packager-tool-wzknj3dr.js +0 -394
- package/dist/packager-tool-yv3rvyas.js +0 -239
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
// ../common/src/singleton.ts
|
|
2
|
-
var PREFIX = "@uipath/common/";
|
|
3
|
-
var _g = globalThis;
|
|
4
|
-
function singleton(ctorOrName) {
|
|
5
|
-
const name = typeof ctorOrName === "string" ? ctorOrName : ctorOrName.name;
|
|
6
|
-
const key = Symbol.for(PREFIX + name);
|
|
7
|
-
return {
|
|
8
|
-
get(fallback) {
|
|
9
|
-
return _g[key] ?? fallback;
|
|
10
|
-
},
|
|
11
|
-
set(value) {
|
|
12
|
-
_g[key] = value;
|
|
13
|
-
},
|
|
14
|
-
clear() {
|
|
15
|
-
delete _g[key];
|
|
16
|
-
},
|
|
17
|
-
getOrInit(factory, guard) {
|
|
18
|
-
const existing = _g[key];
|
|
19
|
-
if (existing != null && typeof existing === "object") {
|
|
20
|
-
if (!guard || guard(existing)) {
|
|
21
|
-
return existing;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
const instance = factory();
|
|
25
|
-
_g[key] = instance;
|
|
26
|
-
return instance;
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// ../common/src/telemetry/global-telemetry-properties.ts
|
|
32
|
-
var telemetryPropsSlot = singleton("TelemetryDefaultProps");
|
|
33
|
-
function getGlobalTelemetryProperties() {
|
|
34
|
-
return telemetryPropsSlot.get();
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// ../common/src/sdk-user-agent.ts
|
|
38
|
-
var USER_AGENT_HEADER = "User-Agent";
|
|
39
|
-
var sdkUserAgentHostToken = singleton("SdkUserAgentHostToken");
|
|
40
|
-
function userAgentPatchKey(userAgent) {
|
|
41
|
-
return Symbol.for(`@uipath/common/sdk-user-agent/${userAgent}`);
|
|
42
|
-
}
|
|
43
|
-
function splitUserAgentTokens(value) {
|
|
44
|
-
return value?.trim().split(/\s+/).filter(Boolean) ?? [];
|
|
45
|
-
}
|
|
46
|
-
function appendUserAgentToken(value, userAgent) {
|
|
47
|
-
const tokens = splitUserAgentTokens(value);
|
|
48
|
-
const seen = new Set(tokens);
|
|
49
|
-
for (const token of splitUserAgentTokens(userAgent)) {
|
|
50
|
-
if (!seen.has(token)) {
|
|
51
|
-
tokens.push(token);
|
|
52
|
-
seen.add(token);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
return tokens.join(" ");
|
|
56
|
-
}
|
|
57
|
-
function getEffectiveUserAgent(userAgent) {
|
|
58
|
-
return appendUserAgentToken(sdkUserAgentHostToken.get(), userAgent);
|
|
59
|
-
}
|
|
60
|
-
function getHeaderName(headers, headerName) {
|
|
61
|
-
return Object.keys(headers).find((key) => key.toLowerCase() === headerName.toLowerCase());
|
|
62
|
-
}
|
|
63
|
-
function getSdkUserAgentToken(pkg) {
|
|
64
|
-
const packageName = pkg.name.replace(/^@uipath\//, "");
|
|
65
|
-
return getEffectiveUserAgent(`${packageName}/${pkg.version}`);
|
|
66
|
-
}
|
|
67
|
-
function addSdkUserAgentHeader(headers, userAgent) {
|
|
68
|
-
const result = { ...headers ?? {} };
|
|
69
|
-
const headerName = getHeaderName(result, USER_AGENT_HEADER);
|
|
70
|
-
result[headerName ?? USER_AGENT_HEADER] = appendUserAgentToken(headerName ? result[headerName] : undefined, getEffectiveUserAgent(userAgent));
|
|
71
|
-
return result;
|
|
72
|
-
}
|
|
73
|
-
function asHeaderRecord(headers) {
|
|
74
|
-
return typeof headers === "object" && headers !== null ? { ...headers } : {};
|
|
75
|
-
}
|
|
76
|
-
function withForwardedHeadersInitOverride(initOverrides, forward) {
|
|
77
|
-
return async (requestContext) => {
|
|
78
|
-
const initWithHeaders = {
|
|
79
|
-
...requestContext.init,
|
|
80
|
-
headers: forward(asHeaderRecord(requestContext.init.headers))
|
|
81
|
-
};
|
|
82
|
-
const override = typeof initOverrides === "function" ? await initOverrides({
|
|
83
|
-
...requestContext,
|
|
84
|
-
init: initWithHeaders
|
|
85
|
-
}) : initOverrides;
|
|
86
|
-
return {
|
|
87
|
-
...override ?? {},
|
|
88
|
-
headers: forward(asHeaderRecord(override?.headers ?? initWithHeaders.headers))
|
|
89
|
-
};
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
function installRequestHeaderForwarding(BaseApiClass, patchKey, forward) {
|
|
93
|
-
const prototype = BaseApiClass.prototype;
|
|
94
|
-
if (prototype[patchKey]) {
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
if (typeof prototype.request !== "function") {
|
|
98
|
-
throw new Error("Generated BaseAPI request function not found.");
|
|
99
|
-
}
|
|
100
|
-
const originalRequest = prototype.request;
|
|
101
|
-
prototype.request = function requestWithForwardedHeaders(context, initOverrides) {
|
|
102
|
-
return originalRequest.call(this, context, withForwardedHeadersInitOverride(initOverrides, forward));
|
|
103
|
-
};
|
|
104
|
-
Object.defineProperty(prototype, patchKey, {
|
|
105
|
-
value: true
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
function installSdkUserAgentHeader(BaseApiClass, userAgent) {
|
|
109
|
-
installRequestHeaderForwarding(BaseApiClass, userAgentPatchKey(userAgent), (headers) => addSdkUserAgentHeader(headers, userAgent));
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
export { singleton, getGlobalTelemetryProperties, getSdkUserAgentToken, addSdkUserAgentHeader, installSdkUserAgentHeader };
|
|
113
|
-
|
|
114
|
-
//# debugId=91566926897EE08164756E2164756E21
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// ../auth/src/constants.ts
|
|
2
|
-
var UIPATH_HOME_DIR = ".uipath";
|
|
3
|
-
var AUTH_FILENAME = ".auth";
|
|
4
|
-
var DEFAULT_BASE_URL = "https://cloud.uipath.com";
|
|
5
|
-
var DEFAULT_AUTH_TIMEOUT_MS = 5 * 60 * 1000;
|
|
6
|
-
var AUTH_TIMEOUT_ERROR_CODE = "EAUTHTIMEOUT";
|
|
7
|
-
var AUTH_CANCELLED_ERROR_CODE = "EAUTHCANCELLED";
|
|
8
|
-
var DEFAULT_REDIRECT_URI = "http://localhost:8104/oidc/login";
|
|
9
|
-
|
|
10
|
-
export { UIPATH_HOME_DIR, AUTH_FILENAME, DEFAULT_BASE_URL, DEFAULT_AUTH_TIMEOUT_MS, AUTH_TIMEOUT_ERROR_CODE, AUTH_CANCELLED_ERROR_CODE, DEFAULT_REDIRECT_URI };
|
|
11
|
-
|
|
12
|
-
//# debugId=0F56C5D203AAAAAA64756E2164756E21
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
// ../auth/src/catch-error.ts
|
|
2
|
-
function isPromiseLike(value) {
|
|
3
|
-
return value !== null && typeof value === "object" && typeof value.then === "function";
|
|
4
|
-
}
|
|
5
|
-
function catchError(fnOrPromise) {
|
|
6
|
-
if (isPromiseLike(fnOrPromise)) {
|
|
7
|
-
return settlePromiseLike(fnOrPromise);
|
|
8
|
-
}
|
|
9
|
-
try {
|
|
10
|
-
const result = fnOrPromise();
|
|
11
|
-
if (isPromiseLike(result)) {
|
|
12
|
-
return settlePromiseLike(result);
|
|
13
|
-
}
|
|
14
|
-
return [undefined, result];
|
|
15
|
-
} catch (error) {
|
|
16
|
-
return [
|
|
17
|
-
error instanceof Error ? error : new Error(String(error)),
|
|
18
|
-
undefined
|
|
19
|
-
];
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
function settlePromiseLike(thenable) {
|
|
23
|
-
return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [
|
|
24
|
-
error instanceof Error ? error : new Error(String(error)),
|
|
25
|
-
undefined
|
|
26
|
-
]);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export { catchError };
|
|
30
|
-
|
|
31
|
-
//# debugId=CD090F76722F72E364756E2164756E21
|
|
@@ -1,394 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
OutputFormatter,
|
|
3
|
-
catchError
|
|
4
|
-
} from "./packager-tool-gkvdytpj.js";
|
|
5
|
-
import {
|
|
6
|
-
getFileSystem
|
|
7
|
-
} from "./packager-tool-yv3rvyas.js";
|
|
8
|
-
|
|
9
|
-
// src/services/agent-builder-migrations.ts
|
|
10
|
-
var warnedLegacyToolGuardrailPolicies = false;
|
|
11
|
-
function migrateLegacyToolGuardrailPolicies(builder) {
|
|
12
|
-
let migrated = false;
|
|
13
|
-
for (const resource of builder.resources ?? []) {
|
|
14
|
-
if (resource.$resourceType !== "tool" || !Array.isArray(resource.guardrailPolicies)) {
|
|
15
|
-
continue;
|
|
16
|
-
}
|
|
17
|
-
if (!resource.guardrail?.policies?.length) {
|
|
18
|
-
resource.guardrail = { policies: resource.guardrailPolicies };
|
|
19
|
-
migrated = true;
|
|
20
|
-
}
|
|
21
|
-
delete resource.guardrailPolicies;
|
|
22
|
-
}
|
|
23
|
-
if (migrated && !warnedLegacyToolGuardrailPolicies) {
|
|
24
|
-
OutputFormatter.log({
|
|
25
|
-
Warning: "Migrated legacy guardrailPolicies to guardrail.policies."
|
|
26
|
-
});
|
|
27
|
-
warnedLegacyToolGuardrailPolicies = true;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// src/services/agent-project-service.ts
|
|
32
|
-
class AgentProjectService {
|
|
33
|
-
fs = getFileSystem();
|
|
34
|
-
resolvedAgentDirs = new Map;
|
|
35
|
-
getAgentDir(projectPath) {
|
|
36
|
-
const cached = this.resolvedAgentDirs.get(projectPath);
|
|
37
|
-
if (cached) {
|
|
38
|
-
return cached;
|
|
39
|
-
}
|
|
40
|
-
return projectPath;
|
|
41
|
-
}
|
|
42
|
-
async resolveAgentDir(projectPath) {
|
|
43
|
-
const cached = this.resolvedAgentDirs.get(projectPath);
|
|
44
|
-
if (cached) {
|
|
45
|
-
return cached;
|
|
46
|
-
}
|
|
47
|
-
const flatAgent = this.fs.path.join(projectPath, "agent.json");
|
|
48
|
-
if (await this.fs.stat(flatAgent)) {
|
|
49
|
-
this.resolvedAgentDirs.set(projectPath, projectPath);
|
|
50
|
-
return projectPath;
|
|
51
|
-
}
|
|
52
|
-
const entries = await this.fs.readdir(projectPath);
|
|
53
|
-
for (const entry of entries) {
|
|
54
|
-
if (entry.startsWith(".") || entry === "evals" || entry === "features" || entry === "resources" || entry === "userProfile") {
|
|
55
|
-
continue;
|
|
56
|
-
}
|
|
57
|
-
const candidate = this.fs.path.join(projectPath, entry);
|
|
58
|
-
const candidateStat = await this.fs.stat(candidate);
|
|
59
|
-
if (!candidateStat?.isDirectory())
|
|
60
|
-
continue;
|
|
61
|
-
const agentStat = await this.fs.stat(this.fs.path.join(candidate, "agent.json"));
|
|
62
|
-
if (agentStat) {
|
|
63
|
-
this.resolvedAgentDirs.set(projectPath, candidate);
|
|
64
|
-
return candidate;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
this.resolvedAgentDirs.set(projectPath, projectPath);
|
|
68
|
-
return projectPath;
|
|
69
|
-
}
|
|
70
|
-
async readAgentJson(projectPath) {
|
|
71
|
-
const agentDir = this.getAgentDir(projectPath);
|
|
72
|
-
const raw = await this.fs.readFile(this.fs.path.join(agentDir, "agent.json"), "utf-8");
|
|
73
|
-
return JSON.parse(raw);
|
|
74
|
-
}
|
|
75
|
-
async writeAgentJson(projectPath, agent) {
|
|
76
|
-
const agentDir = this.getAgentDir(projectPath);
|
|
77
|
-
await this.fs.writeFile(this.fs.path.join(agentDir, "agent.json"), `${JSON.stringify(agent, null, 2)}
|
|
78
|
-
`);
|
|
79
|
-
const builderDir = this.fs.path.join(agentDir, ".agent-builder");
|
|
80
|
-
await this.safeMkdir(builderDir);
|
|
81
|
-
let existingBuilder;
|
|
82
|
-
const [builderReadError, builderRaw] = await catchError(this.fs.readFile(this.fs.path.join(builderDir, "agent.json"), "utf-8"));
|
|
83
|
-
if (!builderReadError && builderRaw) {
|
|
84
|
-
try {
|
|
85
|
-
existingBuilder = JSON.parse(builderRaw);
|
|
86
|
-
migrateLegacyToolGuardrailPolicies(existingBuilder);
|
|
87
|
-
} catch {}
|
|
88
|
-
}
|
|
89
|
-
const builderAgent = {
|
|
90
|
-
id: agent.projectId,
|
|
91
|
-
name: existingBuilder?.name ?? "Agent",
|
|
92
|
-
...agent,
|
|
93
|
-
resources: existingBuilder?.resources ?? agent.resources ?? [],
|
|
94
|
-
features: existingBuilder?.features ?? agent.features ?? []
|
|
95
|
-
};
|
|
96
|
-
await this.fs.writeFile(this.fs.path.join(builderDir, "agent.json"), `${JSON.stringify(builderAgent, null, 2)}
|
|
97
|
-
`);
|
|
98
|
-
}
|
|
99
|
-
async readEntryPoints(projectPath) {
|
|
100
|
-
const agentDir = this.getAgentDir(projectPath);
|
|
101
|
-
const raw = await this.fs.readFile(this.fs.path.join(agentDir, "entry-points.json"), "utf-8");
|
|
102
|
-
return JSON.parse(raw);
|
|
103
|
-
}
|
|
104
|
-
async writeEntryPoints(projectPath, entryPoints) {
|
|
105
|
-
const agentDir = this.getAgentDir(projectPath);
|
|
106
|
-
await this.fs.writeFile(this.fs.path.join(agentDir, "entry-points.json"), `${JSON.stringify(entryPoints, null, 2)}
|
|
107
|
-
`);
|
|
108
|
-
const builderDir = this.fs.path.join(agentDir, ".agent-builder");
|
|
109
|
-
await this.safeMkdir(builderDir);
|
|
110
|
-
await this.fs.writeFile(this.fs.path.join(builderDir, "entry-points.json"), `${JSON.stringify(entryPoints, null, 2)}
|
|
111
|
-
`);
|
|
112
|
-
}
|
|
113
|
-
async readSolutionStorage(projectPath) {
|
|
114
|
-
const raw = await this.fs.readFile(this.fs.path.join(projectPath, "SolutionStorage.json"), "utf-8");
|
|
115
|
-
return JSON.parse(raw);
|
|
116
|
-
}
|
|
117
|
-
async writeSolutionStorage(projectPath, storage) {
|
|
118
|
-
await this.fs.writeFile(this.fs.path.join(projectPath, "SolutionStorage.json"), `${JSON.stringify(storage, null, 2)}
|
|
119
|
-
`);
|
|
120
|
-
}
|
|
121
|
-
async readEvaluator(projectPath, fileName) {
|
|
122
|
-
const filePath = this.fs.path.join(this.getAgentDir(projectPath), "evals", "evaluators", fileName);
|
|
123
|
-
const raw = await this.fs.readFile(filePath, "utf-8");
|
|
124
|
-
return JSON.parse(raw);
|
|
125
|
-
}
|
|
126
|
-
async writeEvaluator(projectPath, evaluator) {
|
|
127
|
-
const dir = this.fs.path.join(this.getAgentDir(projectPath), "evals", "evaluators");
|
|
128
|
-
await this.safeMkdir(dir);
|
|
129
|
-
await this.fs.writeFile(this.fs.path.join(dir, evaluator.fileName), `${JSON.stringify(evaluator, null, 2)}
|
|
130
|
-
`);
|
|
131
|
-
}
|
|
132
|
-
async listEvaluators(projectPath) {
|
|
133
|
-
const dir = this.fs.path.join(this.getAgentDir(projectPath), "evals", "evaluators");
|
|
134
|
-
const [error, files] = await catchError(this.fs.readdir(dir));
|
|
135
|
-
if (error) {
|
|
136
|
-
return [];
|
|
137
|
-
}
|
|
138
|
-
const evaluators = [];
|
|
139
|
-
for (const file of files) {
|
|
140
|
-
if (file.endsWith(".json")) {
|
|
141
|
-
const raw = await this.fs.readFile(this.fs.path.join(dir, file), "utf-8");
|
|
142
|
-
evaluators.push(JSON.parse(raw));
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
return evaluators;
|
|
146
|
-
}
|
|
147
|
-
async deleteEvaluator(projectPath, fileName) {
|
|
148
|
-
const filePath = this.fs.path.join(this.getAgentDir(projectPath), "evals", "evaluators", fileName);
|
|
149
|
-
await this.fs.rm(filePath);
|
|
150
|
-
}
|
|
151
|
-
async readEvalSet(projectPath, fileName) {
|
|
152
|
-
const filePath = this.fs.path.join(this.getAgentDir(projectPath), "evals", "eval-sets", fileName);
|
|
153
|
-
const raw = await this.fs.readFile(filePath, "utf-8");
|
|
154
|
-
return JSON.parse(raw);
|
|
155
|
-
}
|
|
156
|
-
async writeEvalSet(projectPath, evalSet, fileName) {
|
|
157
|
-
const dir = this.fs.path.join(this.getAgentDir(projectPath), "evals", "eval-sets");
|
|
158
|
-
await this.safeMkdir(dir);
|
|
159
|
-
await this.fs.writeFile(this.fs.path.join(dir, fileName), `${JSON.stringify(evalSet, null, 2)}
|
|
160
|
-
`);
|
|
161
|
-
}
|
|
162
|
-
async listEvalSets(projectPath) {
|
|
163
|
-
const dir = this.fs.path.join(this.getAgentDir(projectPath), "evals", "eval-sets");
|
|
164
|
-
const [error, files] = await catchError(this.fs.readdir(dir));
|
|
165
|
-
if (error) {
|
|
166
|
-
return [];
|
|
167
|
-
}
|
|
168
|
-
const sets = [];
|
|
169
|
-
for (const file of files) {
|
|
170
|
-
if (file.endsWith(".json")) {
|
|
171
|
-
const raw = await this.fs.readFile(this.fs.path.join(dir, file), "utf-8");
|
|
172
|
-
sets.push(JSON.parse(raw));
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
return sets;
|
|
176
|
-
}
|
|
177
|
-
async deleteEvalSet(projectPath, fileName) {
|
|
178
|
-
const filePath = this.fs.path.join(this.getAgentDir(projectPath), "evals", "eval-sets", fileName);
|
|
179
|
-
await this.fs.rm(filePath);
|
|
180
|
-
}
|
|
181
|
-
async writeResource(projectPath, resourceName, resource) {
|
|
182
|
-
const dir = this.fs.path.join(this.getAgentDir(projectPath), "resources", resourceName);
|
|
183
|
-
await this.safeMkdir(dir);
|
|
184
|
-
await this.fs.writeFile(this.fs.path.join(dir, "resource.json"), `${JSON.stringify(resource, null, 2)}
|
|
185
|
-
`);
|
|
186
|
-
}
|
|
187
|
-
async readResource(projectPath, resourceName) {
|
|
188
|
-
const filePath = this.fs.path.join(this.getAgentDir(projectPath), "resources", resourceName, "resource.json");
|
|
189
|
-
const raw = await this.fs.readFile(filePath, "utf-8");
|
|
190
|
-
return JSON.parse(raw);
|
|
191
|
-
}
|
|
192
|
-
async listResourceDirs(projectPath) {
|
|
193
|
-
const dir = this.fs.path.join(this.getAgentDir(projectPath), "resources");
|
|
194
|
-
const [error, entries] = await catchError(this.fs.readdir(dir));
|
|
195
|
-
if (error) {
|
|
196
|
-
return [];
|
|
197
|
-
}
|
|
198
|
-
return entries;
|
|
199
|
-
}
|
|
200
|
-
async deleteResource(projectPath, resourceName) {
|
|
201
|
-
const dir = this.fs.path.join(this.getAgentDir(projectPath), "resources", resourceName);
|
|
202
|
-
await catchError(this.fs.rm(this.fs.path.join(dir, "resource.json")));
|
|
203
|
-
await catchError(this.fs.rm(dir));
|
|
204
|
-
}
|
|
205
|
-
async writeFeature(projectPath, featureName, feature) {
|
|
206
|
-
this.validateFeatureName(featureName);
|
|
207
|
-
const dir = this.fs.path.join(this.getAgentDir(projectPath), "features", featureName);
|
|
208
|
-
await this.safeMkdir(dir);
|
|
209
|
-
await this.fs.writeFile(this.fs.path.join(dir, "feature.json"), `${JSON.stringify(feature, null, 2)}
|
|
210
|
-
`);
|
|
211
|
-
}
|
|
212
|
-
async readFeature(projectPath, featureName) {
|
|
213
|
-
this.validateFeatureName(featureName);
|
|
214
|
-
const filePath = this.fs.path.join(this.getAgentDir(projectPath), "features", featureName, "feature.json");
|
|
215
|
-
const raw = await this.fs.readFile(filePath, "utf-8");
|
|
216
|
-
if (!raw) {
|
|
217
|
-
throw new Error(`Feature file not found: ${filePath}`);
|
|
218
|
-
}
|
|
219
|
-
const parsed = JSON.parse(raw);
|
|
220
|
-
if (!parsed) {
|
|
221
|
-
throw new Error(`Feature file is empty: ${filePath}`);
|
|
222
|
-
}
|
|
223
|
-
return parsed;
|
|
224
|
-
}
|
|
225
|
-
async listFeatureDirs(projectPath) {
|
|
226
|
-
const dir = this.fs.path.join(this.getAgentDir(projectPath), "features");
|
|
227
|
-
const [error, entries] = await catchError(this.fs.readdir(dir));
|
|
228
|
-
if (error) {
|
|
229
|
-
return [];
|
|
230
|
-
}
|
|
231
|
-
return entries;
|
|
232
|
-
}
|
|
233
|
-
async deleteFeature(projectPath, featureName) {
|
|
234
|
-
this.validateFeatureName(featureName);
|
|
235
|
-
const dir = this.fs.path.join(this.getAgentDir(projectPath), "features", featureName);
|
|
236
|
-
await this.fs.rm(dir);
|
|
237
|
-
}
|
|
238
|
-
async writeSolutionConnectionResource(projectPath, opts) {
|
|
239
|
-
const dir = this.fs.path.join(projectPath, "resources", "solution_folder", "connection", opts.connectorKey);
|
|
240
|
-
await this.safeMkdir(dir);
|
|
241
|
-
const fileName = `${opts.connectorName.replace(/ /g, "_")}.json`;
|
|
242
|
-
await this.fs.writeFile(this.fs.path.join(dir, fileName), `${JSON.stringify({
|
|
243
|
-
docVersion: "1.0.0",
|
|
244
|
-
resource: {
|
|
245
|
-
name: opts.connectorName,
|
|
246
|
-
kind: "connection",
|
|
247
|
-
type: opts.connectorKey,
|
|
248
|
-
apiVersion: "integrationservice.uipath.com/v1",
|
|
249
|
-
isOverridable: true,
|
|
250
|
-
dependencies: [],
|
|
251
|
-
runtimeDependencies: [],
|
|
252
|
-
files: [],
|
|
253
|
-
folders: [{ fullyQualifiedName: "solution_folder" }],
|
|
254
|
-
spec: {
|
|
255
|
-
connectorName: opts.connectorName,
|
|
256
|
-
name: opts.connectorName,
|
|
257
|
-
description: null,
|
|
258
|
-
authenticationType: "AuthenticateAfterDeployment",
|
|
259
|
-
connectorVersion: opts.connectorVersion ?? "1.0.0",
|
|
260
|
-
connectorKey: opts.connectorKey,
|
|
261
|
-
pollingInterval: 5
|
|
262
|
-
},
|
|
263
|
-
locks: [],
|
|
264
|
-
key: opts.resourceKey
|
|
265
|
-
}
|
|
266
|
-
}, null, 2)}
|
|
267
|
-
`);
|
|
268
|
-
}
|
|
269
|
-
async findSolutionConnectionResourceKey(projectPath, connectorKey) {
|
|
270
|
-
const dir = this.fs.path.join(projectPath, "resources", "solution_folder", "connection", connectorKey);
|
|
271
|
-
const [error, files] = await catchError(this.fs.readdir(dir));
|
|
272
|
-
if (error) {
|
|
273
|
-
return;
|
|
274
|
-
}
|
|
275
|
-
for (const file of files) {
|
|
276
|
-
if (file.endsWith(".json")) {
|
|
277
|
-
const raw = await this.fs.readFile(this.fs.path.join(dir, file), "utf-8");
|
|
278
|
-
const data = JSON.parse(raw);
|
|
279
|
-
if (data?.resource?.key) {
|
|
280
|
-
return data.resource.key;
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
return;
|
|
285
|
-
}
|
|
286
|
-
async projectExists(projectPath) {
|
|
287
|
-
await this.resolveAgentDir(projectPath);
|
|
288
|
-
const [error] = await catchError(this.fs.stat(this.fs.path.join(this.getAgentDir(projectPath), "agent.json")));
|
|
289
|
-
if (error) {
|
|
290
|
-
return false;
|
|
291
|
-
}
|
|
292
|
-
return true;
|
|
293
|
-
}
|
|
294
|
-
async validateProjectStructure(projectPath) {
|
|
295
|
-
const errors = [];
|
|
296
|
-
await this.resolveAgentDir(projectPath);
|
|
297
|
-
const agentDir = this.getAgentDir(projectPath);
|
|
298
|
-
const requiredFiles = [
|
|
299
|
-
"agent.json",
|
|
300
|
-
"entry-points.json",
|
|
301
|
-
"project.uiproj"
|
|
302
|
-
];
|
|
303
|
-
for (const file of requiredFiles) {
|
|
304
|
-
const [statError] = await catchError(this.fs.stat(this.fs.path.join(agentDir, file)));
|
|
305
|
-
if (statError) {
|
|
306
|
-
errors.push(`Missing required file: Agent/${file}`);
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
if (errors.length === 0 || !errors.some((e) => e.includes("agent.json"))) {
|
|
310
|
-
const [agentError, agent] = await catchError(this.readAgentJson(projectPath));
|
|
311
|
-
if (agentError) {
|
|
312
|
-
errors.push(`Failed to parse agent.json: ${agentError.message}`);
|
|
313
|
-
} else if (!agent) {
|
|
314
|
-
errors.push("Failed to parse agent.json: file is empty or unreadable");
|
|
315
|
-
} else {
|
|
316
|
-
if (agent.type !== "lowCode") {
|
|
317
|
-
errors.push(`agent.json type must be "lowCode", got "${agent.type}"`);
|
|
318
|
-
}
|
|
319
|
-
if (!agent.projectId) {
|
|
320
|
-
errors.push("agent.json missing projectId");
|
|
321
|
-
}
|
|
322
|
-
if (!agent.messages || agent.messages.length === 0) {
|
|
323
|
-
errors.push("agent.json missing messages");
|
|
324
|
-
}
|
|
325
|
-
if (!agent.metadata?.storageVersion) {
|
|
326
|
-
errors.push("agent.json missing metadata.storageVersion");
|
|
327
|
-
}
|
|
328
|
-
if (!agent.settings?.model) {
|
|
329
|
-
errors.push("agent.json missing settings.model");
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
const [solutionStatError] = await catchError(this.fs.stat(this.fs.path.join(projectPath, "SolutionStorage.json")));
|
|
334
|
-
if (solutionStatError) {
|
|
335
|
-
errors.push("Missing SolutionStorage.json at project root");
|
|
336
|
-
}
|
|
337
|
-
return { valid: errors.length === 0, errors };
|
|
338
|
-
}
|
|
339
|
-
async writeDebugOverwrites(projectPath, opts) {
|
|
340
|
-
const dir = this.fs.path.join(projectPath, "userProfile", opts.userId);
|
|
341
|
-
await this.safeMkdir(dir);
|
|
342
|
-
const overwrites = {
|
|
343
|
-
docVersion: "1.0.0",
|
|
344
|
-
tenants: [
|
|
345
|
-
{
|
|
346
|
-
tenantKey: opts.tenantKey,
|
|
347
|
-
resources: opts.resources.map((r) => ({
|
|
348
|
-
solutionResourceKey: r.solutionResourceKey,
|
|
349
|
-
reprovisioningIndex: 0,
|
|
350
|
-
overwrite: {
|
|
351
|
-
resourceKey: r.solutionResourceKey,
|
|
352
|
-
resourceName: r.resourceName,
|
|
353
|
-
folderKey: r.folderKey,
|
|
354
|
-
folderFullyQualifiedName: r.folderFullyQualifiedName,
|
|
355
|
-
folderPath: r.folderPath,
|
|
356
|
-
type: "Reference",
|
|
357
|
-
kind: "connection"
|
|
358
|
-
}
|
|
359
|
-
}))
|
|
360
|
-
}
|
|
361
|
-
]
|
|
362
|
-
};
|
|
363
|
-
await this.fs.writeFile(this.fs.path.join(dir, "debug_overwrites.json"), `${JSON.stringify(overwrites, null, 2)}
|
|
364
|
-
`);
|
|
365
|
-
}
|
|
366
|
-
async readDebugOverwrites(projectPath, userId) {
|
|
367
|
-
const filePath = this.fs.path.join(projectPath, "userProfile", userId, "debug_overwrites.json");
|
|
368
|
-
const [error, raw] = await catchError(this.fs.readFile(filePath, "utf-8"));
|
|
369
|
-
if (error || !raw) {
|
|
370
|
-
return null;
|
|
371
|
-
}
|
|
372
|
-
const [parseError, parsed] = catchError(() => JSON.parse(raw));
|
|
373
|
-
if (parseError) {
|
|
374
|
-
return null;
|
|
375
|
-
}
|
|
376
|
-
return parsed;
|
|
377
|
-
}
|
|
378
|
-
async safeMkdir(dir) {
|
|
379
|
-
await this.fs.mkdir(dir);
|
|
380
|
-
}
|
|
381
|
-
async writeJsonFile(filePath, data) {
|
|
382
|
-
await this.fs.writeFile(filePath, `${JSON.stringify(data, null, 2)}
|
|
383
|
-
`);
|
|
384
|
-
}
|
|
385
|
-
validateFeatureName(featureName) {
|
|
386
|
-
if (featureName.trim().length === 0 || featureName === "." || featureName === ".." || featureName.includes("/") || featureName.includes("\\") || featureName.includes("\x00") || featureName !== this.fs.path.basename(featureName)) {
|
|
387
|
-
throw new Error(`Invalid feature name: "${featureName}"`);
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
export { migrateLegacyToolGuardrailPolicies, AgentProjectService };
|
|
393
|
-
|
|
394
|
-
//# debugId=928DD1C08DB2CF9164756E2164756E21
|