@elevasis/sdk 0.4.8 → 0.4.10
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 +656 -46
- package/dist/index.d.ts +4343 -3
- package/dist/templates.js +156 -33
- package/dist/types/templates.d.ts +1 -1
- package/dist/types/worker/index.d.ts +8 -2
- package/dist/worker/index.js +350 -28
- package/package.json +1 -1
- package/reference/_navigation.md +60 -58
- package/reference/deployment/command-view.mdx +154 -0
- package/reference/framework/index.mdx +1 -1
- package/reference/framework/project-structure.mdx +34 -15
- package/reference/getting-started/index.mdx +12 -6
- package/reference/platform-tools/adapters.mdx +927 -0
- package/reference/platform-tools/examples.mdx +89 -106
- package/reference/platform-tools/index.mdx +61 -47
- package/reference/resources/patterns.mdx +23 -10
- package/reference/troubleshooting/common-errors.mdx +1 -1
- package/reference/_index.md +0 -95
package/dist/worker/index.js
CHANGED
|
@@ -4744,6 +4744,250 @@ function createPostMessageAdapterFactory() {
|
|
|
4744
4744
|
return (config) => new PostMessageLLMAdapter(config.provider, config.model);
|
|
4745
4745
|
}
|
|
4746
4746
|
|
|
4747
|
+
// src/worker/adapters/create-adapter.ts
|
|
4748
|
+
function createAdapter(tool, methods, credential) {
|
|
4749
|
+
const adapter = {};
|
|
4750
|
+
for (const method of methods) {
|
|
4751
|
+
adapter[method] = (params) => platform.call({ tool, method, params: params ?? {}, credential });
|
|
4752
|
+
}
|
|
4753
|
+
return adapter;
|
|
4754
|
+
}
|
|
4755
|
+
|
|
4756
|
+
// src/worker/adapters/attio.ts
|
|
4757
|
+
var METHODS = [
|
|
4758
|
+
"createRecord",
|
|
4759
|
+
"updateRecord",
|
|
4760
|
+
"listRecords",
|
|
4761
|
+
"getRecord",
|
|
4762
|
+
"deleteRecord",
|
|
4763
|
+
"listObjects",
|
|
4764
|
+
"listAttributes",
|
|
4765
|
+
"createAttribute",
|
|
4766
|
+
"updateAttribute",
|
|
4767
|
+
"createNote",
|
|
4768
|
+
"listNotes",
|
|
4769
|
+
"deleteNote"
|
|
4770
|
+
];
|
|
4771
|
+
function createAttioAdapter(credential) {
|
|
4772
|
+
return createAdapter("attio", METHODS, credential);
|
|
4773
|
+
}
|
|
4774
|
+
|
|
4775
|
+
// src/worker/adapters/apify.ts
|
|
4776
|
+
var METHODS2 = [
|
|
4777
|
+
"runActor"
|
|
4778
|
+
];
|
|
4779
|
+
function createApifyAdapter(credential) {
|
|
4780
|
+
return createAdapter("apify", METHODS2, credential);
|
|
4781
|
+
}
|
|
4782
|
+
|
|
4783
|
+
// src/worker/adapters/dropbox.ts
|
|
4784
|
+
var METHODS3 = [
|
|
4785
|
+
"uploadFile",
|
|
4786
|
+
"createFolder"
|
|
4787
|
+
];
|
|
4788
|
+
function createDropboxAdapter(credential) {
|
|
4789
|
+
return createAdapter("dropbox", METHODS3, credential);
|
|
4790
|
+
}
|
|
4791
|
+
|
|
4792
|
+
// src/worker/adapters/gmail.ts
|
|
4793
|
+
var METHODS4 = [
|
|
4794
|
+
"sendEmail"
|
|
4795
|
+
];
|
|
4796
|
+
function createGmailAdapter(credential) {
|
|
4797
|
+
return createAdapter("gmail", METHODS4, credential);
|
|
4798
|
+
}
|
|
4799
|
+
|
|
4800
|
+
// src/worker/adapters/google-sheets.ts
|
|
4801
|
+
var METHODS5 = [
|
|
4802
|
+
"readSheet",
|
|
4803
|
+
"writeSheet",
|
|
4804
|
+
"appendRows",
|
|
4805
|
+
"clearRange",
|
|
4806
|
+
"getSpreadsheetMetadata",
|
|
4807
|
+
"batchUpdate",
|
|
4808
|
+
"getHeaders",
|
|
4809
|
+
"getLastRow",
|
|
4810
|
+
"getRowByValue",
|
|
4811
|
+
"updateRowByValue",
|
|
4812
|
+
"upsertRow",
|
|
4813
|
+
"filterRows",
|
|
4814
|
+
"deleteRowByValue"
|
|
4815
|
+
];
|
|
4816
|
+
function createGoogleSheetsAdapter(credential) {
|
|
4817
|
+
return createAdapter("google-sheets", METHODS5, credential);
|
|
4818
|
+
}
|
|
4819
|
+
|
|
4820
|
+
// src/worker/adapters/instantly.ts
|
|
4821
|
+
var METHODS6 = [
|
|
4822
|
+
"sendReply",
|
|
4823
|
+
"removeFromSubsequence",
|
|
4824
|
+
"getEmails",
|
|
4825
|
+
"updateInterestStatus",
|
|
4826
|
+
"addToCampaign"
|
|
4827
|
+
];
|
|
4828
|
+
function createInstantlyAdapter(credential) {
|
|
4829
|
+
return createAdapter("instantly", METHODS6, credential);
|
|
4830
|
+
}
|
|
4831
|
+
|
|
4832
|
+
// src/worker/adapters/mailso.ts
|
|
4833
|
+
var METHODS7 = [
|
|
4834
|
+
"verifyEmail"
|
|
4835
|
+
];
|
|
4836
|
+
function createMailsoAdapter(credential) {
|
|
4837
|
+
return createAdapter("mailso", METHODS7, credential);
|
|
4838
|
+
}
|
|
4839
|
+
|
|
4840
|
+
// src/worker/adapters/notion.ts
|
|
4841
|
+
var METHODS8 = [
|
|
4842
|
+
"listAllPages",
|
|
4843
|
+
"readPage",
|
|
4844
|
+
"createPage",
|
|
4845
|
+
"updatePageTitle",
|
|
4846
|
+
"appendBlocks",
|
|
4847
|
+
"updateBlocks",
|
|
4848
|
+
"deletePage",
|
|
4849
|
+
"deleteBlocks"
|
|
4850
|
+
];
|
|
4851
|
+
function createNotionAdapter(credential) {
|
|
4852
|
+
return createAdapter("notion", METHODS8, credential);
|
|
4853
|
+
}
|
|
4854
|
+
|
|
4855
|
+
// src/worker/adapters/resend.ts
|
|
4856
|
+
var METHODS9 = [
|
|
4857
|
+
"sendEmail",
|
|
4858
|
+
"getEmail"
|
|
4859
|
+
];
|
|
4860
|
+
function createResendAdapter(credential) {
|
|
4861
|
+
return createAdapter("resend", METHODS9, credential);
|
|
4862
|
+
}
|
|
4863
|
+
|
|
4864
|
+
// src/worker/adapters/signature-api.ts
|
|
4865
|
+
var METHODS10 = [
|
|
4866
|
+
"createEnvelope",
|
|
4867
|
+
"voidEnvelope",
|
|
4868
|
+
"downloadDocument",
|
|
4869
|
+
"getEnvelope"
|
|
4870
|
+
];
|
|
4871
|
+
function createSignatureApiAdapter(credential) {
|
|
4872
|
+
return createAdapter("signature-api", METHODS10, credential);
|
|
4873
|
+
}
|
|
4874
|
+
|
|
4875
|
+
// src/worker/adapters/stripe.ts
|
|
4876
|
+
var METHODS11 = [
|
|
4877
|
+
"createPaymentLink",
|
|
4878
|
+
"getPaymentLink",
|
|
4879
|
+
"updatePaymentLink",
|
|
4880
|
+
"listPaymentLinks",
|
|
4881
|
+
"createAutoPaymentLink",
|
|
4882
|
+
"createCheckoutSession"
|
|
4883
|
+
];
|
|
4884
|
+
function createStripeAdapter(credential) {
|
|
4885
|
+
return createAdapter("stripe", METHODS11, credential);
|
|
4886
|
+
}
|
|
4887
|
+
|
|
4888
|
+
// src/worker/adapters/trello.ts
|
|
4889
|
+
var METHODS12 = [
|
|
4890
|
+
"getBoard",
|
|
4891
|
+
"getLists",
|
|
4892
|
+
"getCards",
|
|
4893
|
+
"createCard",
|
|
4894
|
+
"updateCard",
|
|
4895
|
+
"createList",
|
|
4896
|
+
"createChecklist",
|
|
4897
|
+
"addChecklistItem",
|
|
4898
|
+
"updateChecklistItem",
|
|
4899
|
+
"getCardChecklists"
|
|
4900
|
+
];
|
|
4901
|
+
function createTrelloAdapter(credential) {
|
|
4902
|
+
return createAdapter("trello", METHODS12, credential);
|
|
4903
|
+
}
|
|
4904
|
+
|
|
4905
|
+
// src/worker/adapters/scheduler.ts
|
|
4906
|
+
var scheduler = createAdapter("scheduler", [
|
|
4907
|
+
"createSchedule",
|
|
4908
|
+
"updateAnchor",
|
|
4909
|
+
"deleteSchedule",
|
|
4910
|
+
"findByIdempotencyKey",
|
|
4911
|
+
"deleteScheduleByIdempotencyKey",
|
|
4912
|
+
"listSchedules",
|
|
4913
|
+
"getSchedule",
|
|
4914
|
+
"cancelSchedule",
|
|
4915
|
+
"cancelSchedulesByMetadata"
|
|
4916
|
+
]);
|
|
4917
|
+
|
|
4918
|
+
// src/worker/adapters/llm.ts
|
|
4919
|
+
var llm = {
|
|
4920
|
+
generate: (params) => platform.call({ tool: "llm", method: "generate", params })
|
|
4921
|
+
};
|
|
4922
|
+
|
|
4923
|
+
// src/worker/adapters/storage.ts
|
|
4924
|
+
var storage = createAdapter("storage", [
|
|
4925
|
+
"upload",
|
|
4926
|
+
"download",
|
|
4927
|
+
"createSignedUrl",
|
|
4928
|
+
"delete",
|
|
4929
|
+
"list"
|
|
4930
|
+
]);
|
|
4931
|
+
|
|
4932
|
+
// src/worker/adapters/notification.ts
|
|
4933
|
+
var notifications = createAdapter("notification", ["create"]);
|
|
4934
|
+
|
|
4935
|
+
// src/worker/adapters/lead.ts
|
|
4936
|
+
var lead = createAdapter("lead", [
|
|
4937
|
+
// List operations
|
|
4938
|
+
"listLists",
|
|
4939
|
+
"createList",
|
|
4940
|
+
"updateList",
|
|
4941
|
+
"deleteList",
|
|
4942
|
+
// Company operations
|
|
4943
|
+
"createCompany",
|
|
4944
|
+
"upsertCompany",
|
|
4945
|
+
"updateCompany",
|
|
4946
|
+
"getCompany",
|
|
4947
|
+
"listCompanies",
|
|
4948
|
+
"deleteCompany",
|
|
4949
|
+
// Contact operations
|
|
4950
|
+
"createContact",
|
|
4951
|
+
"upsertContact",
|
|
4952
|
+
"updateContact",
|
|
4953
|
+
"getContact",
|
|
4954
|
+
"getContactByEmail",
|
|
4955
|
+
"listContacts",
|
|
4956
|
+
"deleteContact",
|
|
4957
|
+
"bulkImportContacts",
|
|
4958
|
+
// Deal operations
|
|
4959
|
+
"upsertDeal",
|
|
4960
|
+
"getDealByEmail",
|
|
4961
|
+
"getDealByEnvelopeId",
|
|
4962
|
+
"updateDealEnvelopeId",
|
|
4963
|
+
"getDealByAttioId",
|
|
4964
|
+
// Deal-sync operations
|
|
4965
|
+
"updateDiscoveryData",
|
|
4966
|
+
"updateProposalData",
|
|
4967
|
+
"markProposalSent",
|
|
4968
|
+
"markProposalReviewed",
|
|
4969
|
+
"updateCloseLostReason",
|
|
4970
|
+
"updateFees",
|
|
4971
|
+
"syncDealStage",
|
|
4972
|
+
"setContactNurture",
|
|
4973
|
+
"cancelSchedulesAndHitlByEmail",
|
|
4974
|
+
"cancelHitlByDealId",
|
|
4975
|
+
"clearDealFields",
|
|
4976
|
+
"deleteDeal"
|
|
4977
|
+
]);
|
|
4978
|
+
|
|
4979
|
+
// src/worker/adapters/pdf.ts
|
|
4980
|
+
var pdf = createAdapter("pdf", ["render", "renderToBuffer"]);
|
|
4981
|
+
|
|
4982
|
+
// src/worker/adapters/approval.ts
|
|
4983
|
+
var approval = createAdapter("approval", ["create", "deleteByMetadata"]);
|
|
4984
|
+
|
|
4985
|
+
// src/worker/adapters/execution.ts
|
|
4986
|
+
var execution = createAdapter("execution", ["trigger"]);
|
|
4987
|
+
|
|
4988
|
+
// src/worker/adapters/email.ts
|
|
4989
|
+
var email = createAdapter("email", ["send"]);
|
|
4990
|
+
|
|
4747
4991
|
// src/worker/index.ts
|
|
4748
4992
|
function resolveNext(next, data) {
|
|
4749
4993
|
if (next === null) return null;
|
|
@@ -4755,11 +4999,20 @@ function resolveNext(next, data) {
|
|
|
4755
4999
|
}
|
|
4756
5000
|
async function executeWorkflow(workflow, input, context) {
|
|
4757
5001
|
const logs = [];
|
|
5002
|
+
const postLog = (level, message) => {
|
|
5003
|
+
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
5004
|
+
const entry = { level, message, timestamp };
|
|
5005
|
+
logs.push(entry);
|
|
5006
|
+
parentPort.postMessage({
|
|
5007
|
+
type: "log",
|
|
5008
|
+
entry: { level, message, timestamp, executionId: context.executionId }
|
|
5009
|
+
});
|
|
5010
|
+
};
|
|
4758
5011
|
const origLog = console.log;
|
|
4759
5012
|
const origWarn = console.warn;
|
|
4760
5013
|
const origError = console.error;
|
|
4761
5014
|
const capture = (level, orig) => (...args) => {
|
|
4762
|
-
|
|
5015
|
+
postLog(level, args.map(String).join(" "));
|
|
4763
5016
|
orig(...args);
|
|
4764
5017
|
};
|
|
4765
5018
|
console.log = capture("info", origLog);
|
|
@@ -4779,7 +5032,10 @@ async function executeWorkflow(workflow, input, context) {
|
|
|
4779
5032
|
organizationId: context.organizationId,
|
|
4780
5033
|
organizationName: context.organizationName,
|
|
4781
5034
|
resourceId: workflow.config.resourceId,
|
|
4782
|
-
|
|
5035
|
+
sessionId: context.sessionId,
|
|
5036
|
+
sessionTurnNumber: context.sessionTurnNumber,
|
|
5037
|
+
parentExecutionId: context.parentExecutionId,
|
|
5038
|
+
executionDepth: context.executionDepth,
|
|
4783
5039
|
store: /* @__PURE__ */ new Map(),
|
|
4784
5040
|
logger: {
|
|
4785
5041
|
debug: (msg) => console.log(`[debug] ${msg}`),
|
|
@@ -4801,20 +5057,41 @@ async function executeWorkflow(workflow, input, context) {
|
|
|
4801
5057
|
console.error = origError;
|
|
4802
5058
|
}
|
|
4803
5059
|
}
|
|
4804
|
-
function buildWorkerExecutionContext(
|
|
5060
|
+
function buildWorkerExecutionContext(params) {
|
|
5061
|
+
const { executionId } = params;
|
|
5062
|
+
const postLog = (level, message) => {
|
|
5063
|
+
parentPort.postMessage({
|
|
5064
|
+
type: "log",
|
|
5065
|
+
entry: { level, message, timestamp: (/* @__PURE__ */ new Date()).toISOString(), executionId }
|
|
5066
|
+
});
|
|
5067
|
+
};
|
|
4805
5068
|
return {
|
|
4806
|
-
executionId,
|
|
4807
|
-
organizationId,
|
|
4808
|
-
organizationName,
|
|
4809
|
-
resourceId,
|
|
4810
|
-
|
|
5069
|
+
executionId: params.executionId,
|
|
5070
|
+
organizationId: params.organizationId,
|
|
5071
|
+
organizationName: params.organizationName,
|
|
5072
|
+
resourceId: params.resourceId,
|
|
5073
|
+
sessionId: params.sessionId,
|
|
5074
|
+
sessionTurnNumber: params.sessionTurnNumber,
|
|
5075
|
+
parentExecutionId: params.parentExecutionId,
|
|
5076
|
+
executionDepth: params.executionDepth,
|
|
5077
|
+
signal: params.signal,
|
|
4811
5078
|
store: /* @__PURE__ */ new Map(),
|
|
4812
5079
|
logger: {
|
|
4813
|
-
debug: (msg) =>
|
|
4814
|
-
|
|
4815
|
-
|
|
4816
|
-
|
|
4817
|
-
|
|
5080
|
+
debug: (msg) => {
|
|
5081
|
+
console.log(`[debug] ${msg}`);
|
|
5082
|
+
postLog("info", msg);
|
|
5083
|
+
},
|
|
5084
|
+
info: (msg) => {
|
|
5085
|
+
console.log(`[info] ${msg}`);
|
|
5086
|
+
postLog("info", msg);
|
|
5087
|
+
},
|
|
5088
|
+
warn: (msg) => {
|
|
5089
|
+
console.warn(`[warn] ${msg}`);
|
|
5090
|
+
postLog("warn", msg);
|
|
5091
|
+
},
|
|
5092
|
+
error: (msg) => {
|
|
5093
|
+
console.error(`[error] ${msg}`);
|
|
5094
|
+
postLog("error", msg);
|
|
4818
5095
|
}
|
|
4819
5096
|
},
|
|
4820
5097
|
onMessageEvent: async (event) => {
|
|
@@ -4829,6 +5106,7 @@ function startWorker(org) {
|
|
|
4829
5106
|
const agents = new Map(
|
|
4830
5107
|
(org.agents ?? []).map((a) => [a.config.resourceId, a])
|
|
4831
5108
|
);
|
|
5109
|
+
let localAbortController = new AbortController();
|
|
4832
5110
|
console.log(`[SDK-WORKER] Worker started with ${workflows.size} workflow(s), ${agents.size} agent(s)`);
|
|
4833
5111
|
parentPort.on("message", async (msg) => {
|
|
4834
5112
|
if (msg.type === "manifest") {
|
|
@@ -4864,24 +5142,46 @@ function startWorker(org) {
|
|
|
4864
5142
|
handleCredentialResult(msg);
|
|
4865
5143
|
return;
|
|
4866
5144
|
}
|
|
5145
|
+
if (msg.type === "abort") {
|
|
5146
|
+
console.log("[SDK-WORKER] Abort requested by parent");
|
|
5147
|
+
localAbortController.abort();
|
|
5148
|
+
return;
|
|
5149
|
+
}
|
|
4867
5150
|
if (msg.type === "execute") {
|
|
4868
|
-
const {
|
|
5151
|
+
const {
|
|
5152
|
+
resourceId,
|
|
5153
|
+
executionId,
|
|
5154
|
+
input,
|
|
5155
|
+
organizationId,
|
|
5156
|
+
organizationName,
|
|
5157
|
+
sessionId,
|
|
5158
|
+
sessionTurnNumber,
|
|
5159
|
+
parentExecutionId,
|
|
5160
|
+
executionDepth
|
|
5161
|
+
} = msg;
|
|
4869
5162
|
console.log(`[SDK-WORKER] Execute request: resourceId=${resourceId}, executionId=${executionId}`);
|
|
5163
|
+
localAbortController = new AbortController();
|
|
4870
5164
|
const workflow = workflows.get(resourceId);
|
|
4871
5165
|
if (workflow) {
|
|
5166
|
+
const startTime = Date.now();
|
|
4872
5167
|
try {
|
|
4873
5168
|
console.log(`[SDK-WORKER] Running workflow '${resourceId}' (${Object.keys(workflow.steps).length} steps)`);
|
|
4874
|
-
const startTime = Date.now();
|
|
4875
5169
|
const { output, logs } = await executeWorkflow(workflow, input, {
|
|
4876
5170
|
executionId,
|
|
4877
5171
|
organizationId: organizationId ?? "",
|
|
4878
|
-
organizationName: organizationName ?? ""
|
|
5172
|
+
organizationName: organizationName ?? "",
|
|
5173
|
+
sessionId,
|
|
5174
|
+
sessionTurnNumber,
|
|
5175
|
+
parentExecutionId,
|
|
5176
|
+
executionDepth: executionDepth ?? 0
|
|
4879
5177
|
});
|
|
4880
|
-
|
|
4881
|
-
|
|
5178
|
+
const durationMs = Date.now() - startTime;
|
|
5179
|
+
console.log(`[SDK-WORKER] Workflow '${resourceId}' completed (${durationMs}ms)`);
|
|
5180
|
+
parentPort.postMessage({ type: "result", status: "completed", output, logs, metrics: { durationMs } });
|
|
4882
5181
|
} catch (err) {
|
|
4883
|
-
|
|
4884
|
-
|
|
5182
|
+
const durationMs = Date.now() - startTime;
|
|
5183
|
+
console.error(`[SDK-WORKER] Workflow '${resourceId}' failed (${durationMs}ms): ${String(err)}`);
|
|
5184
|
+
parentPort.postMessage({ type: "result", status: "failed", error: String(err), logs: [], metrics: { durationMs } });
|
|
4885
5185
|
}
|
|
4886
5186
|
return;
|
|
4887
5187
|
}
|
|
@@ -4891,32 +5191,54 @@ function startWorker(org) {
|
|
|
4891
5191
|
const origLog = console.log;
|
|
4892
5192
|
const origWarn = console.warn;
|
|
4893
5193
|
const origError = console.error;
|
|
5194
|
+
const postLog = (level, message) => {
|
|
5195
|
+
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
5196
|
+
const entry = { level, message, timestamp };
|
|
5197
|
+
logs.push(entry);
|
|
5198
|
+
parentPort.postMessage({
|
|
5199
|
+
type: "log",
|
|
5200
|
+
entry: { level, message, timestamp, executionId }
|
|
5201
|
+
});
|
|
5202
|
+
};
|
|
4894
5203
|
const capture = (level, orig) => (...args) => {
|
|
4895
|
-
|
|
5204
|
+
postLog(level, args.map(String).join(" "));
|
|
4896
5205
|
orig(...args);
|
|
4897
5206
|
};
|
|
4898
5207
|
console.log = capture("info", origLog);
|
|
4899
5208
|
console.warn = capture("warn", origWarn);
|
|
4900
5209
|
console.error = capture("error", origError);
|
|
5210
|
+
const startTime = Date.now();
|
|
4901
5211
|
try {
|
|
4902
5212
|
console.log(`[SDK-WORKER] Running agent '${resourceId}' (${agentDef.tools.length} tools)`);
|
|
4903
|
-
const startTime = Date.now();
|
|
4904
5213
|
const adapterFactory = createPostMessageAdapterFactory();
|
|
4905
5214
|
const agentInstance = new Agent(agentDef, adapterFactory);
|
|
4906
|
-
const context = buildWorkerExecutionContext(
|
|
5215
|
+
const context = buildWorkerExecutionContext({
|
|
5216
|
+
executionId,
|
|
5217
|
+
organizationId: organizationId ?? "",
|
|
5218
|
+
organizationName: organizationName ?? "",
|
|
5219
|
+
resourceId,
|
|
5220
|
+
sessionId,
|
|
5221
|
+
sessionTurnNumber,
|
|
5222
|
+
parentExecutionId,
|
|
5223
|
+
executionDepth: executionDepth ?? 0,
|
|
5224
|
+
signal: localAbortController.signal
|
|
5225
|
+
});
|
|
4907
5226
|
const output = await agentInstance.execute(input, context);
|
|
4908
|
-
|
|
4909
|
-
|
|
5227
|
+
const durationMs = Date.now() - startTime;
|
|
5228
|
+
console.log(`[SDK-WORKER] Agent '${resourceId}' completed (${durationMs}ms)`);
|
|
5229
|
+
parentPort.postMessage({ type: "result", status: "completed", output, logs, metrics: { durationMs } });
|
|
4910
5230
|
} catch (err) {
|
|
5231
|
+
const durationMs = Date.now() - startTime;
|
|
4911
5232
|
const errorMessage = err?.message ?? String(err);
|
|
4912
5233
|
err?.code ?? "unknown";
|
|
4913
5234
|
const errorName = err?.name ?? err?.constructor?.name ?? "Error";
|
|
4914
|
-
console.error(`[SDK-WORKER] Agent '${resourceId}' failed: [${errorName}] ${errorMessage}`);
|
|
5235
|
+
console.error(`[SDK-WORKER] Agent '${resourceId}' failed (${durationMs}ms): [${errorName}] ${errorMessage}`);
|
|
4915
5236
|
parentPort.postMessage({
|
|
4916
5237
|
type: "result",
|
|
4917
5238
|
status: "failed",
|
|
4918
5239
|
error: `${errorName}: ${errorMessage}`,
|
|
4919
|
-
logs
|
|
5240
|
+
logs,
|
|
5241
|
+
metrics: { durationMs }
|
|
4920
5242
|
});
|
|
4921
5243
|
} finally {
|
|
4922
5244
|
console.log = origLog;
|
|
@@ -4936,4 +5258,4 @@ function startWorker(org) {
|
|
|
4936
5258
|
});
|
|
4937
5259
|
}
|
|
4938
5260
|
|
|
4939
|
-
export { PlatformToolError, platform, startWorker };
|
|
5261
|
+
export { PlatformToolError, approval, createAdapter, createApifyAdapter, createAttioAdapter, createDropboxAdapter, createGmailAdapter, createGoogleSheetsAdapter, createInstantlyAdapter, createMailsoAdapter, createNotionAdapter, createResendAdapter, createSignatureApiAdapter, createStripeAdapter, createTrelloAdapter, email, execution, lead, llm, notifications, pdf, platform, scheduler, startWorker, storage };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elevasis/sdk",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.10",
|
|
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",
|
package/reference/_navigation.md
CHANGED
|
@@ -1,104 +1,106 @@
|
|
|
1
1
|
# SDK Reference Navigation
|
|
2
2
|
|
|
3
|
-
Auto-generated from reference file frontmatter.
|
|
3
|
+
Auto-generated from reference file frontmatter. 31 files indexed.
|
|
4
4
|
|
|
5
5
|
All paths are relative to `node_modules/@elevasis/sdk/reference/`.
|
|
6
6
|
|
|
7
7
|
## General
|
|
8
8
|
|
|
9
|
-
| Resource | Location | When to Load |
|
|
10
|
-
| --- | --- | --- |
|
|
11
|
-
| Elevasis SDK | `index.mdx` | First session or new to the SDK |
|
|
9
|
+
| Resource | Location | Description | When to Load |
|
|
10
|
+
| --- | --- | --- | --- |
|
|
11
|
+
| Elevasis SDK | `index.mdx` | Build and deploy workflows, agents, and resources with the Elevasis SDK | First session or new to the SDK |
|
|
12
12
|
|
|
13
13
|
## Cli
|
|
14
14
|
|
|
15
|
-
| Resource | Location | When to Load |
|
|
16
|
-
| --- | --- | --- |
|
|
17
|
-
| CLI Reference | `cli/index.mdx` | Running CLI operations |
|
|
15
|
+
| Resource | Location | Description | When to Load |
|
|
16
|
+
| --- | --- | --- | --- |
|
|
17
|
+
| CLI Reference | `cli/index.mdx` | Full reference for every elevasis CLI command -- scaffold, validate, deploy, execute, and inspect resources | Running CLI operations |
|
|
18
18
|
|
|
19
19
|
## Concepts
|
|
20
20
|
|
|
21
|
-
| Resource | Location | When to Load |
|
|
22
|
-
| --- | --- | --- |
|
|
23
|
-
| Concepts Reference | `concepts/index.mdx` | User asks what is or needs conceptual grounding |
|
|
21
|
+
| Resource | Location | Description | When to Load |
|
|
22
|
+
| --- | --- | --- | --- |
|
|
23
|
+
| Concepts Reference | `concepts/index.mdx` | Plain-English explanations of Elevasis SDK concepts -- glossary, workflow analogies, Zod schemas, execution model, platform tools, common errors, and design decisions | User asks what is or needs conceptual grounding |
|
|
24
24
|
|
|
25
25
|
## Deployment
|
|
26
26
|
|
|
27
|
-
| Resource | Location | When to Load |
|
|
28
|
-
| --- | --- | --- |
|
|
29
|
-
| Execution API | `deployment/api.mdx` | Calling the API directly or debugging API responses |
|
|
30
|
-
|
|
|
27
|
+
| Resource | Location | Description | When to Load |
|
|
28
|
+
| --- | --- | --- | --- |
|
|
29
|
+
| Execution API | `deployment/api.mdx` | REST endpoints for executing resources, querying execution history, and managing deployments via the Elevasis external API | Calling the API directly or debugging API responses |
|
|
30
|
+
| Command View | `deployment/command-view.mdx` | How the Command View graph works -- node types, relationships, what is enforced vs decorative, and what the platform needs to render your resource graph | Deploying resources or building resources that invoke other resources |
|
|
31
|
+
| Deploying Resources | `deployment/index.mdx` | How to deploy your Elevasis SDK resources to the platform using elevasis deploy, including configuration, validation, and environment setup | Preparing to deploy or debugging deploy failures |
|
|
31
32
|
|
|
32
33
|
## Developer
|
|
33
34
|
|
|
34
|
-
| Resource | Location | When to Load |
|
|
35
|
-
| --- | --- | --- |
|
|
36
|
-
| Interaction Guidance | `developer/interaction-guidance.mdx` | Unsure how to adapt for a skill combination |
|
|
35
|
+
| Resource | Location | Description | When to Load |
|
|
36
|
+
| --- | --- | --- | --- |
|
|
37
|
+
| Interaction Guidance | `developer/interaction-guidance.mdx` | Full dimensional adaptation rules per skill axis -- programming, TypeScript, API integration, automation concepts, domain expertise -- with growth tracking protocol | Unsure how to adapt for a skill combination |
|
|
37
38
|
|
|
38
39
|
## Framework
|
|
39
40
|
|
|
40
|
-
| Resource | Location | When to Load |
|
|
41
|
-
| --- | --- | --- |
|
|
42
|
-
| Agent System | `framework/agent.mdx` | Configuring agent behavior or capabilities |
|
|
43
|
-
| Resource Documentation | `framework/documentation.mdx` | Writing or updating project documentation |
|
|
44
|
-
| Development Framework | `framework/index.mdx` | Understanding the agent framework structure |
|
|
45
|
-
| Memory System | `framework/memory.mdx` | Working with agent memory or session state |
|
|
46
|
-
| Project Structure | `framework/project-structure.mdx` | Understanding scaffolded files or project layout |
|
|
41
|
+
| Resource | Location | Description | When to Load |
|
|
42
|
+
| --- | --- | --- | --- |
|
|
43
|
+
| Agent System | `framework/agent.mdx` | CLAUDE.md drives all agent behavior -- project instructions, slash commands, memory-based developer profile, and three-tier adaptive guidance | Configuring agent behavior or capabilities |
|
|
44
|
+
| Resource Documentation | `framework/documentation.mdx` | Write and deploy MDX documentation alongside your Elevasis resources | Writing or updating project documentation |
|
|
45
|
+
| Development Framework | `framework/index.mdx` | The SDK scaffolds a complete development environment for Claude Code -- project instructions, slash commands, cross-session memory, and template versioning | Understanding the agent framework structure |
|
|
46
|
+
| Memory System | `framework/memory.mdx` | Cross-session project knowledge stored in .claude/memory/ -- deployment state, environment, decisions, and error patterns that persist between Claude Code sessions | Working with agent memory or session state |
|
|
47
|
+
| Project Structure | `framework/project-structure.mdx` | Each file scaffolded by elevasis init and its purpose in the development workflow | Understanding scaffolded files or project layout |
|
|
47
48
|
|
|
48
49
|
## Getting-started
|
|
49
50
|
|
|
50
|
-
| Resource | Location | When to Load |
|
|
51
|
-
| --- | --- | --- |
|
|
52
|
-
| Getting Started | `getting-started/index.mdx` | Setting up a new project or onboarding |
|
|
51
|
+
| Resource | Location | Description | When to Load |
|
|
52
|
+
| --- | --- | --- | --- |
|
|
53
|
+
| Getting Started | `getting-started/index.mdx` | Install the Elevasis SDK, scaffold a project, and run your first deployment | Setting up a new project or onboarding |
|
|
53
54
|
|
|
54
55
|
## Platform-tools
|
|
55
56
|
|
|
56
|
-
| Resource | Location | When to Load |
|
|
57
|
-
| --- | --- | --- |
|
|
58
|
-
|
|
|
59
|
-
|
|
|
57
|
+
| Resource | Location | Description | When to Load |
|
|
58
|
+
| --- | --- | --- | --- |
|
|
59
|
+
| Typed Adapters | `platform-tools/adapters.mdx` | Type-safe wrappers over platform.call() for all integrations and platform tools -- Attio, Stripe, Notion, Google Sheets, Trello, and more -- with full autocomplete, compile-time checking, and zero boilerplate | Using typed adapters instead of raw platform.call(), or needs to know what adapter methods are available |
|
|
60
|
+
| Integration Examples | `platform-tools/examples.mdx` | Working code examples for email, CRM, PDF, LLM inference, resource triggering, and storage using typed adapters and platform.call() | Implementing a platform tool call in a workflow step |
|
|
61
|
+
| Platform Tools | `platform-tools/index.mdx` | Access 70+ tools across integration adapters and platform services from your SDK workflows -- typed adapters with full autocomplete for all tools, plus platform.call() as a fallback | Connecting to external services |
|
|
60
62
|
|
|
61
63
|
## Resources
|
|
62
64
|
|
|
63
|
-
| Resource | Location | When to Load |
|
|
64
|
-
| --- | --- | --- |
|
|
65
|
-
| Writing Resources | `resources/index.mdx` | Building or modifying a workflow |
|
|
66
|
-
| Common Patterns | `resources/patterns.mdx` | Building or modifying a workflow |
|
|
67
|
-
| SDK Types | `resources/types.mdx` | Looking up type signatures or SDK exports |
|
|
65
|
+
| Resource | Location | Description | When to Load |
|
|
66
|
+
| --- | --- | --- | --- |
|
|
67
|
+
| Writing Resources | `resources/index.mdx` | Guide to creating workflows and agents using WorkflowDefinition, AgentDefinition, and OrganizationResources with the Elevasis SDK | Building or modifying a workflow |
|
|
68
|
+
| Common Patterns | `resources/patterns.mdx` | Common resource patterns for Elevasis SDK developers -- sequential steps, conditional branching, platform tools, error handling, and resource status management | Building or modifying a workflow |
|
|
69
|
+
| SDK Types | `resources/types.mdx` | Complete type reference for @elevasis/sdk -- package exports, re-exported platform types, ElevasConfig interface, StepHandler context, and runtime values | Looking up type signatures or SDK exports |
|
|
68
70
|
|
|
69
71
|
## Roadmap
|
|
70
72
|
|
|
71
|
-
| Resource | Location | When to Load |
|
|
72
|
-
| --- | --- | --- |
|
|
73
|
-
| Roadmap | `roadmap/index.mdx` | Asking about future features or planned capabilities |
|
|
73
|
+
| Resource | Location | Description | When to Load |
|
|
74
|
+
| --- | --- | --- | --- |
|
|
75
|
+
| Roadmap | `roadmap/index.mdx` | Planned SDK features -- error taxonomy, retry semantics, circuit breaker, metrics, alerting, and resource lifecycle extensions | Asking about future features or planned capabilities |
|
|
74
76
|
|
|
75
77
|
## Runtime
|
|
76
78
|
|
|
77
|
-
| Resource | Location | When to Load |
|
|
78
|
-
| --- | --- | --- |
|
|
79
|
-
| Execution Runtime | `runtime/index.mdx` | Debugging execution behavior or understanding the runtime model |
|
|
80
|
-
| Resource Limits & Quotas | `runtime/limits.mdx` | Hitting resource limits or planning for scale |
|
|
79
|
+
| Resource | Location | Description | When to Load |
|
|
80
|
+
| --- | --- | --- | --- |
|
|
81
|
+
| Execution Runtime | `runtime/index.mdx` | How your code runs on the Elevasis platform -- execution lifecycle, concurrency, timeouts, cancellation, error handling, and observability | Debugging execution behavior or understanding the runtime model |
|
|
82
|
+
| Resource Limits & Quotas | `runtime/limits.mdx` | Memory limits, execution timeouts, scale quotas, networking constraints, and v1 platform limitations for SDK resources | Hitting resource limits or planning for scale |
|
|
81
83
|
|
|
82
84
|
## Security
|
|
83
85
|
|
|
84
|
-
| Resource | Location | When to Load |
|
|
85
|
-
| --- | --- | --- |
|
|
86
|
-
| Credential Security | `security/credentials.mdx` | Setting up integrations or configuring tool access |
|
|
86
|
+
| Resource | Location | Description | When to Load |
|
|
87
|
+
| --- | --- | --- | --- |
|
|
88
|
+
| Credential Security | `security/credentials.mdx` | Three-layer credential model: platform tools (server-side injection), http tool (arbitrary APIs), getCredential() (explicit opt-in raw access) -- .env scope and security boundaries | Setting up integrations or configuring tool access |
|
|
87
89
|
|
|
88
90
|
## Templates
|
|
89
91
|
|
|
90
|
-
| Resource | Location | When to Load |
|
|
91
|
-
| --- | --- | --- |
|
|
92
|
-
| Template: Data Enrichment | `templates/data-enrichment.mdx` | Applying the data-enrichment workflow template |
|
|
93
|
-
| Template: Email Sender | `templates/email-sender.mdx` | Applying the email-sender workflow template |
|
|
94
|
-
| Template: Lead Scorer | `templates/lead-scorer.mdx` | Applying the lead-scorer workflow template |
|
|
95
|
-
| Template: PDF Generator | `templates/pdf-generator.mdx` | Applying the pdf-generator workflow template |
|
|
96
|
-
| Template: Recurring Job | `templates/recurring-job.mdx` | Applying the recurring-job workflow template |
|
|
97
|
-
| Template: Text Classifier | `templates/text-classifier.mdx` | Applying the text-classifier workflow template |
|
|
98
|
-
| Template: Web Scraper | `templates/web-scraper.mdx` | Applying the web-scraper workflow template |
|
|
92
|
+
| Resource | Location | Description | When to Load |
|
|
93
|
+
| --- | --- | --- | --- |
|
|
94
|
+
| Template: Data Enrichment | `templates/data-enrichment.mdx` | LLM-powered enrichment of existing database records -- read rows, enrich each with an LLM, write results back to Supabase | Applying the data-enrichment workflow template |
|
|
95
|
+
| Template: Email Sender | `templates/email-sender.mdx` | Transactional email via Resend with template support -- send styled emails to one or multiple recipients | Applying the email-sender workflow template |
|
|
96
|
+
| Template: Lead Scorer | `templates/lead-scorer.mdx` | LLM-based lead scoring with Supabase storage -- receive a lead, score it with an LLM, store the result | Applying the lead-scorer workflow template |
|
|
97
|
+
| Template: PDF Generator | `templates/pdf-generator.mdx` | PDF generation from structured data with platform storage upload -- render a PDF from a template and upload to platform storage | Applying the pdf-generator workflow template |
|
|
98
|
+
| Template: Recurring Job | `templates/recurring-job.mdx` | Scheduler-triggered periodic workflow -- run a task on a schedule (daily, weekly, hourly, or custom cron) | Applying the recurring-job workflow template |
|
|
99
|
+
| Template: Text Classifier | `templates/text-classifier.mdx` | Multi-label text classification with structured output -- classify text into predefined categories using an LLM with JSON output | Applying the text-classifier workflow template |
|
|
100
|
+
| Template: Web Scraper | `templates/web-scraper.mdx` | Apify-based web scraper that stores results in Supabase -- fetch structured data from any website via Apify actors | Applying the web-scraper workflow template |
|
|
99
101
|
|
|
100
102
|
## Troubleshooting
|
|
101
103
|
|
|
102
|
-
| Resource | Location | When to Load |
|
|
103
|
-
| --- | --- | --- |
|
|
104
|
-
| Common Errors | `troubleshooting/common-errors.mdx` | Debugging an unknown error not found in workspace memory |
|
|
104
|
+
| Resource | Location | Description | When to Load |
|
|
105
|
+
| --- | --- | --- | --- |
|
|
106
|
+
| Common Errors | `troubleshooting/common-errors.mdx` | Static SDK-level error catalog -- CLI errors, deployment errors, schema validation, platform tool failures, and runtime errors with diagnostic steps | Debugging an unknown error not found in workspace memory |
|