@elevasis/sdk 0.4.7 → 0.4.8
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/cli.cjs +1 -1
- package/dist/worker/index.js +30 -5
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -43782,7 +43782,7 @@ async function apiPost(endpoint, body, apiUrl = resolveApiUrl()) {
|
|
|
43782
43782
|
}
|
|
43783
43783
|
|
|
43784
43784
|
// src/cli/version.ts
|
|
43785
|
-
var SDK_VERSION = "0.4.
|
|
43785
|
+
var SDK_VERSION = "0.4.8";
|
|
43786
43786
|
|
|
43787
43787
|
// src/cli/commands/deploy.ts
|
|
43788
43788
|
var import_meta2 = {};
|
package/dist/worker/index.js
CHANGED
|
@@ -4645,14 +4645,16 @@ var platform = {
|
|
|
4645
4645
|
credential: options.credential
|
|
4646
4646
|
};
|
|
4647
4647
|
return new Promise((resolve, reject) => {
|
|
4648
|
+
const timeoutMs = options.tool === "llm" ? 12e4 : 6e4;
|
|
4649
|
+
const timeoutLabel = options.tool === "llm" ? "120s" : "60s";
|
|
4648
4650
|
const timer = setTimeout(() => {
|
|
4649
4651
|
pendingCalls.delete(id);
|
|
4650
4652
|
reject(new PlatformToolError(
|
|
4651
|
-
`Platform tool call timed out after
|
|
4653
|
+
`Platform tool call timed out after ${timeoutLabel}: ${options.tool}.${options.method}`,
|
|
4652
4654
|
"timeout_error",
|
|
4653
4655
|
true
|
|
4654
4656
|
));
|
|
4655
|
-
},
|
|
4657
|
+
}, timeoutMs);
|
|
4656
4658
|
pendingCalls.set(id, {
|
|
4657
4659
|
resolve: (value) => {
|
|
4658
4660
|
clearTimeout(timer);
|
|
@@ -4885,6 +4887,17 @@ function startWorker(org) {
|
|
|
4885
4887
|
}
|
|
4886
4888
|
const agentDef = agents.get(resourceId);
|
|
4887
4889
|
if (agentDef) {
|
|
4890
|
+
const logs = [];
|
|
4891
|
+
const origLog = console.log;
|
|
4892
|
+
const origWarn = console.warn;
|
|
4893
|
+
const origError = console.error;
|
|
4894
|
+
const capture = (level, orig) => (...args) => {
|
|
4895
|
+
logs.push({ level, message: args.map(String).join(" ") });
|
|
4896
|
+
orig(...args);
|
|
4897
|
+
};
|
|
4898
|
+
console.log = capture("info", origLog);
|
|
4899
|
+
console.warn = capture("warn", origWarn);
|
|
4900
|
+
console.error = capture("error", origError);
|
|
4888
4901
|
try {
|
|
4889
4902
|
console.log(`[SDK-WORKER] Running agent '${resourceId}' (${agentDef.tools.length} tools)`);
|
|
4890
4903
|
const startTime = Date.now();
|
|
@@ -4893,10 +4906,22 @@ function startWorker(org) {
|
|
|
4893
4906
|
const context = buildWorkerExecutionContext(executionId, organizationId ?? "", organizationName ?? "", resourceId);
|
|
4894
4907
|
const output = await agentInstance.execute(input, context);
|
|
4895
4908
|
console.log(`[SDK-WORKER] Agent '${resourceId}' completed (${Date.now() - startTime}ms)`);
|
|
4896
|
-
parentPort.postMessage({ type: "result", status: "completed", output, logs
|
|
4909
|
+
parentPort.postMessage({ type: "result", status: "completed", output, logs });
|
|
4897
4910
|
} catch (err) {
|
|
4898
|
-
|
|
4899
|
-
|
|
4911
|
+
const errorMessage = err?.message ?? String(err);
|
|
4912
|
+
err?.code ?? "unknown";
|
|
4913
|
+
const errorName = err?.name ?? err?.constructor?.name ?? "Error";
|
|
4914
|
+
console.error(`[SDK-WORKER] Agent '${resourceId}' failed: [${errorName}] ${errorMessage}`);
|
|
4915
|
+
parentPort.postMessage({
|
|
4916
|
+
type: "result",
|
|
4917
|
+
status: "failed",
|
|
4918
|
+
error: `${errorName}: ${errorMessage}`,
|
|
4919
|
+
logs
|
|
4920
|
+
});
|
|
4921
|
+
} finally {
|
|
4922
|
+
console.log = origLog;
|
|
4923
|
+
console.warn = origWarn;
|
|
4924
|
+
console.error = origError;
|
|
4900
4925
|
}
|
|
4901
4926
|
return;
|
|
4902
4927
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elevasis/sdk",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.8",
|
|
4
4
|
"description": "SDK for building Elevasis organization resources",
|
|
5
5
|
"comment:bin": "IMPORTANT: This package shares the 'elevasis' binary name with @repo/cli. They never conflict because @elevasis/sdk must NEVER be added as a dependency of any workspace package (apps/*, packages/*, organizations/*). Workspace projects use @repo/cli for the 'elevasis' binary. External developers (outside the workspace) get this SDK's binary via npm install.",
|
|
6
6
|
"type": "module",
|