@elevasis/sdk 1.0.0 → 1.0.2
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 +235 -202
- package/dist/index.d.ts +12 -5
- package/dist/index.js +5 -3
- package/dist/templates.js +1 -1
- package/dist/types/worker/index.d.ts +2 -2
- package/package.json +1 -1
- package/reference/_navigation.md +1 -1
- package/reference/deployment/command-center.mdx +6 -6
- package/reference/framework/project-structure.mdx +4 -4
- package/reference/resources/index.mdx +6 -6
- package/reference/resources/patterns.mdx +2 -2
- package/reference/resources/types.mdx +1 -1
- package/reference/runtime.mdx +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -40455,7 +40455,7 @@ var RegistryValidationError = class extends Error {
|
|
|
40455
40455
|
this.name = "RegistryValidationError";
|
|
40456
40456
|
}
|
|
40457
40457
|
};
|
|
40458
|
-
function
|
|
40458
|
+
function validateDeploymentSpec(orgName, resources) {
|
|
40459
40459
|
const seenIds = /* @__PURE__ */ new Set();
|
|
40460
40460
|
resources.workflows?.forEach((workflow) => {
|
|
40461
40461
|
const id = workflow.config.resourceId;
|
|
@@ -40587,7 +40587,8 @@ function isZodOptional(schema) {
|
|
|
40587
40587
|
return schema.isOptional();
|
|
40588
40588
|
}
|
|
40589
40589
|
function validateRelationships(orgName, resources) {
|
|
40590
|
-
if (!resources.relationships && !resources.triggers && !resources.externalResources && !resources.humanCheckpoints)
|
|
40590
|
+
if (!resources.relationships && !resources.triggers && !resources.externalResources && !resources.humanCheckpoints)
|
|
40591
|
+
return;
|
|
40591
40592
|
const validAgentIds = new Set(resources.agents?.map((a) => a.config.resourceId) ?? []);
|
|
40592
40593
|
const validWorkflowIds = new Set(resources.workflows?.map((w) => w.config.resourceId) ?? []);
|
|
40593
40594
|
const validIntegrationIds = new Set(resources.integrations?.map((i) => i.resourceId) ?? []);
|
|
@@ -43100,6 +43101,7 @@ function serializeOrganization(resources) {
|
|
|
43100
43101
|
const humanCheckpoints = resources.humanCheckpoints ?? [];
|
|
43101
43102
|
const domainDefinitions = deriveDomainDefinitions(resources);
|
|
43102
43103
|
return {
|
|
43104
|
+
version: resources.version,
|
|
43103
43105
|
resources: {
|
|
43104
43106
|
workflows: workflowResources,
|
|
43105
43107
|
agents: agentResources,
|
|
@@ -43258,7 +43260,7 @@ var ResourceRegistry = class {
|
|
|
43258
43260
|
*/
|
|
43259
43261
|
validateRegistry() {
|
|
43260
43262
|
for (const [orgName, resources] of Object.entries(this.registry)) {
|
|
43261
|
-
|
|
43263
|
+
validateDeploymentSpec(orgName, resources);
|
|
43262
43264
|
}
|
|
43263
43265
|
}
|
|
43264
43266
|
/**
|
|
@@ -43891,7 +43893,7 @@ function wrapAction(commandName, fn) {
|
|
|
43891
43893
|
// package.json
|
|
43892
43894
|
var package_default = {
|
|
43893
43895
|
name: "@elevasis/sdk",
|
|
43894
|
-
version: "1.0.
|
|
43896
|
+
version: "1.0.2",
|
|
43895
43897
|
description: "SDK for building Elevasis organization resources",
|
|
43896
43898
|
type: "module",
|
|
43897
43899
|
bin: {
|
|
@@ -44008,6 +44010,17 @@ function extractResourceMetadata(resource, schemaWarnings) {
|
|
|
44008
44010
|
}
|
|
44009
44011
|
return meta;
|
|
44010
44012
|
}
|
|
44013
|
+
function bumpVersion(current, type) {
|
|
44014
|
+
const [major, minor, patch] = current.split(".").map(Number);
|
|
44015
|
+
switch (type) {
|
|
44016
|
+
case "major":
|
|
44017
|
+
return `${major + 1}.0.0`;
|
|
44018
|
+
case "minor":
|
|
44019
|
+
return `${major}.${minor + 1}.0`;
|
|
44020
|
+
case "patch":
|
|
44021
|
+
return `${major}.${minor}.${patch + 1}`;
|
|
44022
|
+
}
|
|
44023
|
+
}
|
|
44011
44024
|
var IGNORED_DOC_DIRS = /* @__PURE__ */ new Set([".archive"]);
|
|
44012
44025
|
async function scanDocumentation() {
|
|
44013
44026
|
const docsDir = (0, import_path.resolve)("docs");
|
|
@@ -44486,218 +44499,238 @@ async function generateNavigationMap(docs) {
|
|
|
44486
44499
|
function registerDeployCommand(program3) {
|
|
44487
44500
|
program3.command("deploy").description(
|
|
44488
44501
|
"Validate, bundle, upload, and deploy project resources\n Example: elevasis-sdk deploy --api-url http://localhost:5170"
|
|
44489
|
-
).option("--api-url <url>", "API URL").option("--entry <path>", "Path to entry file (default: ./src/index.ts)").option("--prod", "Deploy to production (overrides NODE_ENV=development)").action(
|
|
44490
|
-
wrapAction(
|
|
44491
|
-
|
|
44492
|
-
|
|
44493
|
-
|
|
44494
|
-
|
|
44495
|
-
|
|
44496
|
-
|
|
44497
|
-
|
|
44498
|
-
|
|
44499
|
-
|
|
44500
|
-
|
|
44501
|
-
|
|
44502
|
-
|
|
44503
|
-
|
|
44504
|
-
|
|
44505
|
-
|
|
44506
|
-
|
|
44507
|
-
const
|
|
44508
|
-
|
|
44509
|
-
|
|
44510
|
-
|
|
44511
|
-
|
|
44512
|
-
|
|
44502
|
+
).option("--api-url <url>", "API URL").option("--entry <path>", "Path to entry file (default: ./src/index.ts)").option("--prod", "Deploy to production (overrides NODE_ENV=development)").option("--major", "Bump major version before deploying (1.0.0 \u2192 2.0.0)").option("--minor", "Bump minor version before deploying (1.0.0 \u2192 1.1.0)").option("--patch", "Bump patch version before deploying (1.0.0 \u2192 1.0.1)").action(
|
|
44503
|
+
wrapAction(
|
|
44504
|
+
"deploy",
|
|
44505
|
+
async (options2) => {
|
|
44506
|
+
const startTime = Date.now();
|
|
44507
|
+
const apiUrl = resolveApiUrl(options2.apiUrl, options2.prod);
|
|
44508
|
+
const env2 = resolveEnvironment(options2.prod);
|
|
44509
|
+
const entryPath = options2.entry ?? "./src/index.ts";
|
|
44510
|
+
const authSpinner = ora("Authenticating...").start();
|
|
44511
|
+
let orgName;
|
|
44512
|
+
try {
|
|
44513
|
+
const me = await apiGet("/api/external/me", apiUrl);
|
|
44514
|
+
orgName = me.organizationName;
|
|
44515
|
+
authSpinner.succeed(
|
|
44516
|
+
source_default.green("Authenticating...") + source_default.white(" done") + source_default.gray(` (${orgName})`)
|
|
44517
|
+
);
|
|
44518
|
+
} catch (error46) {
|
|
44519
|
+
authSpinner.fail(source_default.red("Authentication failed"));
|
|
44520
|
+
const errMsg = error46 instanceof Error ? error46.message : String(error46);
|
|
44521
|
+
if (errMsg.includes("401") || errMsg.toLowerCase().includes("unauthorized")) {
|
|
44522
|
+
const keyVar = !options2.prod && process.env.NODE_ENV === "development" && process.env.ELEVASIS_PLATFORM_KEY_DEV ? "ELEVASIS_PLATFORM_KEY_DEV" : "ELEVASIS_PLATFORM_KEY";
|
|
44523
|
+
console.error(source_default.red(" Invalid API key."));
|
|
44524
|
+
console.error(source_default.gray(` Your ${keyVar} was rejected by the server.`));
|
|
44525
|
+
console.error(source_default.gray(" Check your .env file and verify the key in the Elevasis dashboard."));
|
|
44526
|
+
} else {
|
|
44527
|
+
console.error(source_default.gray(" Check your API key and API URL."));
|
|
44528
|
+
}
|
|
44529
|
+
throw error46;
|
|
44513
44530
|
}
|
|
44514
|
-
|
|
44515
|
-
|
|
44516
|
-
|
|
44517
|
-
|
|
44518
|
-
|
|
44519
|
-
|
|
44520
|
-
|
|
44521
|
-
|
|
44522
|
-
|
|
44523
|
-
|
|
44524
|
-
|
|
44525
|
-
|
|
44526
|
-
|
|
44527
|
-
|
|
44528
|
-
|
|
44529
|
-
|
|
44530
|
-
|
|
44531
|
-
|
|
44532
|
-
|
|
44533
|
-
|
|
44534
|
-
|
|
44535
|
-
|
|
44536
|
-
|
|
44537
|
-
|
|
44531
|
+
const validateSpinner = ora("Validating...").start();
|
|
44532
|
+
let org;
|
|
44533
|
+
let activeWorkflows = [];
|
|
44534
|
+
let activeAgents = [];
|
|
44535
|
+
try {
|
|
44536
|
+
const entryModule = await loadTsModule(entryPath);
|
|
44537
|
+
org = entryModule.default;
|
|
44538
|
+
if (!org) {
|
|
44539
|
+
validateSpinner.fail("Invalid entry: no default export found");
|
|
44540
|
+
console.error(source_default.gray(` Entry file: ${(0, import_path.resolve)(entryPath)}`));
|
|
44541
|
+
throw new Error("Invalid entry: no default export found");
|
|
44542
|
+
}
|
|
44543
|
+
new ResourceRegistry({ [orgName]: org });
|
|
44544
|
+
activeWorkflows = (org.workflows ?? []).filter((w) => !w.config.archived);
|
|
44545
|
+
activeAgents = (org.agents ?? []).filter((a) => !a.config.archived);
|
|
44546
|
+
const archivedCount = (org.workflows?.length ?? 0) + (org.agents?.length ?? 0) - activeWorkflows.length - activeAgents.length;
|
|
44547
|
+
const totalCount = activeWorkflows.length + activeAgents.length;
|
|
44548
|
+
validateSpinner.succeed(
|
|
44549
|
+
source_default.green("Validating...") + source_default.white(" done") + source_default.gray(` (${totalCount} resource${totalCount !== 1 ? "s" : ""}, 0 errors)`)
|
|
44550
|
+
);
|
|
44551
|
+
if (archivedCount > 0) {
|
|
44552
|
+
console.log(source_default.gray(` Skipping ${archivedCount} archived resource${archivedCount !== 1 ? "s" : ""}`));
|
|
44553
|
+
}
|
|
44554
|
+
const bumpType = options2.major ? "major" : options2.minor ? "minor" : options2.patch ? "patch" : null;
|
|
44555
|
+
const currentVersion = org.version;
|
|
44556
|
+
if (bumpType !== null) {
|
|
44557
|
+
const newVersion = bumpVersion(currentVersion, bumpType);
|
|
44558
|
+
const absEntryPath = (0, import_path.resolve)(entryPath);
|
|
44559
|
+
const entryContent = await (0, import_promises.readFile)(absEntryPath, "utf-8");
|
|
44560
|
+
const updatedContent = entryContent.replace(
|
|
44561
|
+
/version:\s*['"][\d]+\.[\d]+\.[\d]+['"]/,
|
|
44562
|
+
`version: '${newVersion}'`
|
|
44563
|
+
);
|
|
44564
|
+
await (0, import_promises.writeFile)(absEntryPath, updatedContent, "utf-8");
|
|
44565
|
+
org.version = newVersion;
|
|
44566
|
+
}
|
|
44567
|
+
console.log("");
|
|
44568
|
+
console.log(source_default.gray(` Org: ${orgName}`));
|
|
44569
|
+
console.log(source_default.gray(` Target: ${apiUrl} (${env2})`));
|
|
44570
|
+
console.log(
|
|
44571
|
+
source_default.gray(` Version: ${source_default.white(org.version)}${bumpType !== null ? ` (${bumpType} bump)` : ""}`)
|
|
44572
|
+
);
|
|
44573
|
+
console.log("");
|
|
44574
|
+
for (const w of activeWorkflows) {
|
|
44575
|
+
console.log(source_default.gray(` workflow ${source_default.white(w.config.resourceId)} v${w.config.version}`));
|
|
44576
|
+
}
|
|
44577
|
+
for (const a of activeAgents) {
|
|
44578
|
+
console.log(source_default.gray(` agent ${source_default.white(a.config.resourceId)} v${a.config.version}`));
|
|
44579
|
+
}
|
|
44580
|
+
console.log("");
|
|
44581
|
+
} catch (error46) {
|
|
44582
|
+
if (error46 instanceof RegistryValidationError) {
|
|
44583
|
+
validateSpinner.fail(source_default.red("Validation failed"));
|
|
44584
|
+
console.error("");
|
|
44585
|
+
console.error(source_default.red(` ERROR ${error46.message}`));
|
|
44586
|
+
if (error46.resourceId) {
|
|
44587
|
+
console.error(source_default.gray(` Resource: ${error46.resourceId}`));
|
|
44588
|
+
}
|
|
44589
|
+
console.error("");
|
|
44590
|
+
console.error(source_default.gray(" Deploy aborted."));
|
|
44591
|
+
}
|
|
44592
|
+
throw error46;
|
|
44538
44593
|
}
|
|
44539
|
-
|
|
44540
|
-
|
|
44541
|
-
|
|
44542
|
-
|
|
44543
|
-
|
|
44544
|
-
|
|
44594
|
+
await generateResourceMap(org);
|
|
44595
|
+
await generateProjectMap(org);
|
|
44596
|
+
let documentation = await scanDocumentation();
|
|
44597
|
+
if (documentation) {
|
|
44598
|
+
await generateNavigationMap(documentation);
|
|
44599
|
+
documentation = await scanDocumentation();
|
|
44600
|
+
console.log(
|
|
44601
|
+
source_default.gray(
|
|
44602
|
+
` docs ${source_default.white(String(documentation.length))} file${documentation.length !== 1 ? "s" : ""}`
|
|
44603
|
+
)
|
|
44604
|
+
);
|
|
44545
44605
|
}
|
|
44546
|
-
|
|
44547
|
-
|
|
44606
|
+
const triggerCount = org.triggers?.length ?? 0;
|
|
44607
|
+
const integrationCount = org.integrations?.length ?? 0;
|
|
44608
|
+
const checkpointCount = org.humanCheckpoints?.length ?? 0;
|
|
44609
|
+
if (triggerCount > 0) console.log(source_default.gray(` triggers ${source_default.white(String(triggerCount))}`));
|
|
44610
|
+
if (integrationCount > 0) console.log(source_default.gray(` integrations ${source_default.white(String(integrationCount))}`));
|
|
44611
|
+
if (checkpointCount > 0) console.log(source_default.gray(` checkpoints ${source_default.white(String(checkpointCount))}`));
|
|
44612
|
+
const relationshipCount = org.relationships ? Object.keys(org.relationships).length : 0;
|
|
44613
|
+
if (relationshipCount > 0) {
|
|
44614
|
+
console.log(
|
|
44615
|
+
source_default.gray(
|
|
44616
|
+
` rels ${source_default.white(String(relationshipCount))} resource${relationshipCount !== 1 ? "s" : ""}`
|
|
44617
|
+
)
|
|
44618
|
+
);
|
|
44548
44619
|
}
|
|
44549
|
-
|
|
44550
|
-
|
|
44551
|
-
|
|
44552
|
-
|
|
44553
|
-
|
|
44554
|
-
|
|
44555
|
-
if (error46.resourceId) {
|
|
44556
|
-
console.error(source_default.gray(` Resource: ${error46.resourceId}`));
|
|
44620
|
+
const schemaWarnings = [];
|
|
44621
|
+
const workflows = activeWorkflows.map((w) => extractResourceMetadata(w, schemaWarnings));
|
|
44622
|
+
const agents = activeAgents.map((a) => extractResourceMetadata(a, schemaWarnings));
|
|
44623
|
+
if (schemaWarnings.length > 0) {
|
|
44624
|
+
for (const warning of schemaWarnings) {
|
|
44625
|
+
console.log(source_default.yellow(` warn ${warning}`));
|
|
44557
44626
|
}
|
|
44558
|
-
console.
|
|
44559
|
-
console.
|
|
44560
|
-
}
|
|
44561
|
-
throw error46;
|
|
44562
|
-
}
|
|
44563
|
-
await generateResourceMap(org);
|
|
44564
|
-
await generateProjectMap(org);
|
|
44565
|
-
let documentation = await scanDocumentation();
|
|
44566
|
-
if (documentation) {
|
|
44567
|
-
await generateNavigationMap(documentation);
|
|
44568
|
-
documentation = await scanDocumentation();
|
|
44569
|
-
console.log(
|
|
44570
|
-
source_default.gray(
|
|
44571
|
-
` docs ${source_default.white(String(documentation.length))} file${documentation.length !== 1 ? "s" : ""}`
|
|
44572
|
-
)
|
|
44573
|
-
);
|
|
44574
|
-
}
|
|
44575
|
-
const triggerCount = org.triggers?.length ?? 0;
|
|
44576
|
-
const integrationCount = org.integrations?.length ?? 0;
|
|
44577
|
-
const checkpointCount = org.humanCheckpoints?.length ?? 0;
|
|
44578
|
-
if (triggerCount > 0) console.log(source_default.gray(` triggers ${source_default.white(String(triggerCount))}`));
|
|
44579
|
-
if (integrationCount > 0) console.log(source_default.gray(` integrations ${source_default.white(String(integrationCount))}`));
|
|
44580
|
-
if (checkpointCount > 0) console.log(source_default.gray(` checkpoints ${source_default.white(String(checkpointCount))}`));
|
|
44581
|
-
const relationshipCount = org.relationships ? Object.keys(org.relationships).length : 0;
|
|
44582
|
-
if (relationshipCount > 0) {
|
|
44583
|
-
console.log(
|
|
44584
|
-
source_default.gray(
|
|
44585
|
-
` rels ${source_default.white(String(relationshipCount))} resource${relationshipCount !== 1 ? "s" : ""}`
|
|
44586
|
-
)
|
|
44587
|
-
);
|
|
44588
|
-
}
|
|
44589
|
-
const schemaWarnings = [];
|
|
44590
|
-
const workflows = activeWorkflows.map((w) => extractResourceMetadata(w, schemaWarnings));
|
|
44591
|
-
const agents = activeAgents.map((a) => extractResourceMetadata(a, schemaWarnings));
|
|
44592
|
-
if (schemaWarnings.length > 0) {
|
|
44593
|
-
for (const warning of schemaWarnings) {
|
|
44594
|
-
console.log(source_default.yellow(` warn ${warning}`));
|
|
44627
|
+
console.log(source_default.gray(" Schemas will be unavailable on the platform for these resources."));
|
|
44628
|
+
console.log("");
|
|
44595
44629
|
}
|
|
44596
|
-
|
|
44597
|
-
|
|
44598
|
-
|
|
44599
|
-
|
|
44600
|
-
|
|
44601
|
-
|
|
44602
|
-
try {
|
|
44603
|
-
const entryImport = entryPath.replace(/\.ts$/, ".js");
|
|
44604
|
-
const wrapperContent = `import org from ${JSON.stringify(entryImport)}
|
|
44630
|
+
const bundleSpinner = ora("Bundling...").start();
|
|
44631
|
+
const wrapperPath = (0, import_path.resolve)("__elevasis_worker.ts");
|
|
44632
|
+
const bundleOutfile = (0, import_path.resolve)("dist/bundle.js");
|
|
44633
|
+
try {
|
|
44634
|
+
const entryImport = entryPath.replace(/\.ts$/, ".js");
|
|
44635
|
+
const wrapperContent = `import org from ${JSON.stringify(entryImport)}
|
|
44605
44636
|
import { startWorker } from '@elevasis/sdk/worker'
|
|
44606
44637
|
startWorker(org)
|
|
44607
44638
|
`;
|
|
44608
|
-
|
|
44609
|
-
|
|
44610
|
-
|
|
44611
|
-
|
|
44612
|
-
|
|
44613
|
-
|
|
44614
|
-
|
|
44615
|
-
|
|
44616
|
-
|
|
44617
|
-
|
|
44618
|
-
await (0, import_promises.unlink)(wrapperPath);
|
|
44619
|
-
const bundleBuffer = await (0, import_promises.readFile)(bundleOutfile);
|
|
44620
|
-
const bundleSizeKB = Math.round(bundleBuffer.length / 1024);
|
|
44621
|
-
bundleSpinner.succeed(
|
|
44622
|
-
source_default.green("Bundling...") + source_default.white(" done") + source_default.gray(` (${bundleSizeKB} KB)`)
|
|
44623
|
-
);
|
|
44624
|
-
} catch (error46) {
|
|
44625
|
-
try {
|
|
44639
|
+
await (0, import_promises.writeFile)(wrapperPath, wrapperContent, "utf-8");
|
|
44640
|
+
await (0, import_promises.mkdir)((0, import_path.resolve)("dist"), { recursive: true });
|
|
44641
|
+
const esbuild = getEsbuild();
|
|
44642
|
+
await esbuild.build({
|
|
44643
|
+
entryPoints: [wrapperPath],
|
|
44644
|
+
bundle: true,
|
|
44645
|
+
platform: "node",
|
|
44646
|
+
format: "cjs",
|
|
44647
|
+
outfile: bundleOutfile
|
|
44648
|
+
});
|
|
44626
44649
|
await (0, import_promises.unlink)(wrapperPath);
|
|
44627
|
-
|
|
44628
|
-
|
|
44629
|
-
|
|
44630
|
-
|
|
44631
|
-
|
|
44632
|
-
|
|
44633
|
-
|
|
44634
|
-
|
|
44635
|
-
|
|
44636
|
-
if (!apiKey) {
|
|
44637
|
-
uploadSpinner.fail(source_default.red("Missing API key environment variable"));
|
|
44638
|
-
console.error(source_default.gray(" Set it in your .env file or shell environment:"));
|
|
44639
|
-
if (!options2.prod && process.env.NODE_ENV === "development") {
|
|
44640
|
-
console.error(source_default.gray(" ELEVASIS_PLATFORM_KEY_DEV=sk_... (or ELEVASIS_PLATFORM_KEY as fallback)"));
|
|
44641
|
-
} else {
|
|
44642
|
-
console.error(source_default.gray(" ELEVASIS_PLATFORM_KEY=sk_..."));
|
|
44650
|
+
const bundleBuffer = await (0, import_promises.readFile)(bundleOutfile);
|
|
44651
|
+
const bundleSizeKB = Math.round(bundleBuffer.length / 1024);
|
|
44652
|
+
bundleSpinner.succeed(
|
|
44653
|
+
source_default.green("Bundling...") + source_default.white(" done") + source_default.gray(` (${bundleSizeKB} KB)`)
|
|
44654
|
+
);
|
|
44655
|
+
} catch (error46) {
|
|
44656
|
+
try {
|
|
44657
|
+
await (0, import_promises.unlink)(wrapperPath);
|
|
44658
|
+
} catch {
|
|
44643
44659
|
}
|
|
44644
|
-
|
|
44660
|
+
bundleSpinner.fail(source_default.red("Bundling failed"));
|
|
44661
|
+
throw error46;
|
|
44645
44662
|
}
|
|
44646
|
-
const
|
|
44647
|
-
|
|
44648
|
-
|
|
44649
|
-
|
|
44650
|
-
|
|
44651
|
-
|
|
44652
|
-
|
|
44653
|
-
|
|
44654
|
-
|
|
44655
|
-
|
|
44656
|
-
|
|
44657
|
-
|
|
44658
|
-
|
|
44659
|
-
|
|
44660
|
-
|
|
44661
|
-
if (!response.ok) {
|
|
44662
|
-
const errorText = await response.text();
|
|
44663
|
-
uploadSpinner.fail(source_default.red("Upload failed"));
|
|
44664
|
-
console.error(source_default.red(` ${response.status}: ${errorText}`));
|
|
44665
|
-
throw new Error(`Deploy upload failed (${response.status}): ${errorText}`);
|
|
44666
|
-
}
|
|
44667
|
-
const result = await response.json();
|
|
44668
|
-
uploadSpinner.succeed(source_default.green("Uploading...") + source_default.white(" done"));
|
|
44669
|
-
const totalResources = activeWorkflows.length + activeAgents.length;
|
|
44670
|
-
const elapsed = ((Date.now() - startTime) / 1e3).toFixed(1);
|
|
44671
|
-
if (result.status === "active") {
|
|
44672
|
-
console.log("");
|
|
44673
|
-
console.log(
|
|
44674
|
-
source_default.green.bold(` Deployed! ${totalResources} resource${totalResources !== 1 ? "s" : ""} live.`)
|
|
44675
|
-
);
|
|
44676
|
-
if (result.deployId) {
|
|
44677
|
-
console.log(source_default.gray(` Version: ${result.deployId}`));
|
|
44663
|
+
const uploadSpinner = ora("Uploading...").start();
|
|
44664
|
+
try {
|
|
44665
|
+
const bundleBuffer = await (0, import_promises.readFile)(bundleOutfile);
|
|
44666
|
+
const apiKey = resolveApiKey(options2.prod);
|
|
44667
|
+
if (!apiKey) {
|
|
44668
|
+
uploadSpinner.fail(source_default.red("Missing API key environment variable"));
|
|
44669
|
+
console.error(source_default.gray(" Set it in your .env file or shell environment:"));
|
|
44670
|
+
if (!options2.prod && process.env.NODE_ENV === "development") {
|
|
44671
|
+
console.error(
|
|
44672
|
+
source_default.gray(" ELEVASIS_PLATFORM_KEY_DEV=sk_... (or ELEVASIS_PLATFORM_KEY as fallback)")
|
|
44673
|
+
);
|
|
44674
|
+
} else {
|
|
44675
|
+
console.error(source_default.gray(" ELEVASIS_PLATFORM_KEY=sk_..."));
|
|
44676
|
+
}
|
|
44677
|
+
throw new Error("Missing API key environment variable");
|
|
44678
44678
|
}
|
|
44679
|
-
|
|
44680
|
-
|
|
44681
|
-
|
|
44682
|
-
|
|
44683
|
-
|
|
44684
|
-
|
|
44679
|
+
const metadata = {
|
|
44680
|
+
sdkVersion: SDK_VERSION,
|
|
44681
|
+
deploymentVersion: org.version,
|
|
44682
|
+
mode: env2,
|
|
44683
|
+
resources: { workflows, agents },
|
|
44684
|
+
...documentation ? { documentation } : {},
|
|
44685
|
+
...org.relationships ? { relationships: org.relationships } : {}
|
|
44686
|
+
};
|
|
44687
|
+
const form = new FormData();
|
|
44688
|
+
form.append("bundle", new Blob([bundleBuffer]), "bundle.js");
|
|
44689
|
+
form.append("metadata", JSON.stringify(metadata));
|
|
44690
|
+
const response = await fetch(`${apiUrl}/api/external/deploy`, {
|
|
44691
|
+
method: "POST",
|
|
44692
|
+
headers: { Authorization: `Bearer ${apiKey}` },
|
|
44693
|
+
body: form
|
|
44694
|
+
});
|
|
44695
|
+
if (!response.ok) {
|
|
44696
|
+
const errorText = await response.text();
|
|
44697
|
+
uploadSpinner.fail(source_default.red("Upload failed"));
|
|
44698
|
+
console.error(source_default.red(` ${response.status}: ${errorText}`));
|
|
44699
|
+
throw new Error(`Deploy upload failed (${response.status}): ${errorText}`);
|
|
44700
|
+
}
|
|
44701
|
+
const result = await response.json();
|
|
44702
|
+
uploadSpinner.succeed(source_default.green("Uploading...") + source_default.white(" done"));
|
|
44703
|
+
const totalResources = activeWorkflows.length + activeAgents.length;
|
|
44704
|
+
const elapsed = ((Date.now() - startTime) / 1e3).toFixed(1);
|
|
44705
|
+
if (result.status === "active") {
|
|
44706
|
+
console.log("");
|
|
44707
|
+
console.log(
|
|
44708
|
+
source_default.green.bold(` Deployed! ${totalResources} resource${totalResources !== 1 ? "s" : ""} live.`)
|
|
44709
|
+
);
|
|
44710
|
+
console.log(source_default.gray(` Version: ${source_default.white(`v${org.version}`)}`));
|
|
44711
|
+
console.log(source_default.gray(` Duration: ${elapsed}s`));
|
|
44712
|
+
} else if (result.status === "failed") {
|
|
44713
|
+
console.log("");
|
|
44714
|
+
console.log(source_default.red.bold(" Deploy failed."));
|
|
44715
|
+
if (result.error) {
|
|
44716
|
+
console.error(source_default.red(` ${result.error}`));
|
|
44717
|
+
}
|
|
44718
|
+
throw new Error(`Deploy failed: ${result.error ?? "unknown error"}`);
|
|
44719
|
+
} else {
|
|
44720
|
+
console.log("");
|
|
44721
|
+
console.log(source_default.yellow(` Deploy status: ${result.status ?? "unknown"}`));
|
|
44722
|
+
if (result.deployId) {
|
|
44723
|
+
console.log(source_default.gray(` Version: ${result.deployId}`));
|
|
44724
|
+
}
|
|
44685
44725
|
}
|
|
44686
|
-
|
|
44687
|
-
|
|
44688
|
-
|
|
44689
|
-
console.log(source_default.yellow(` Deploy status: ${result.status ?? "unknown"}`));
|
|
44690
|
-
if (result.deployId) {
|
|
44691
|
-
console.log(source_default.gray(` Version: ${result.deployId}`));
|
|
44726
|
+
} catch (error46) {
|
|
44727
|
+
if (uploadSpinner.isSpinning) {
|
|
44728
|
+
uploadSpinner.fail(source_default.red("Deploy failed"));
|
|
44692
44729
|
}
|
|
44730
|
+
throw error46;
|
|
44693
44731
|
}
|
|
44694
|
-
} catch (error46) {
|
|
44695
|
-
if (uploadSpinner.isSpinning) {
|
|
44696
|
-
uploadSpinner.fail(source_default.red("Deploy failed"));
|
|
44697
|
-
}
|
|
44698
|
-
throw error46;
|
|
44699
44732
|
}
|
|
44700
|
-
|
|
44733
|
+
)
|
|
44701
44734
|
);
|
|
44702
44735
|
}
|
|
44703
44736
|
|
|
@@ -47024,7 +47057,7 @@ paths:
|
|
|
47024
47057
|
- Organize by business domain: \`src/<domain>/\` (e.g., \`src/operations/\`, \`src/acquisition/\`)
|
|
47025
47058
|
- Each domain barrel (\`src/<domain>/index.ts\`) exports \`workflows\` and \`agents\` arrays
|
|
47026
47059
|
- Cross-domain utilities go in \`src/shared/\`; domain-specific utilities in \`src/<domain>/shared/\`
|
|
47027
|
-
- The default export in \`src/index.ts\` must be
|
|
47060
|
+
- The default export in \`src/index.ts\` must be a \`DeploymentSpec\` object
|
|
47028
47061
|
- \`resourceId\` must be lowercase with hyphens, unique per organization
|
|
47029
47062
|
- \`dist/\` is generated by deploy -- never commit it
|
|
47030
47063
|
|
|
@@ -47483,11 +47516,11 @@ process.exit(0)
|
|
|
47483
47516
|
|
|
47484
47517
|
// src/cli/commands/templates/core/resources.ts
|
|
47485
47518
|
function starterTemplate() {
|
|
47486
|
-
return `import type {
|
|
47519
|
+
return `import type { DeploymentSpec } from '@elevasis/sdk'
|
|
47487
47520
|
import * as operations from './operations/index.js'
|
|
47488
47521
|
import * as example from './example/index.js'
|
|
47489
47522
|
|
|
47490
|
-
const org:
|
|
47523
|
+
const org: DeploymentSpec = {
|
|
47491
47524
|
workflows: [
|
|
47492
47525
|
...operations.workflows,
|
|
47493
47526
|
...example.workflows,
|
package/dist/index.d.ts
CHANGED
|
@@ -2310,6 +2310,7 @@ type Database = {
|
|
|
2310
2310
|
Row: {
|
|
2311
2311
|
compiled_docs: Json | null;
|
|
2312
2312
|
created_at: string;
|
|
2313
|
+
deployment_version: string | null;
|
|
2313
2314
|
documentation: Json | null;
|
|
2314
2315
|
error_message: string | null;
|
|
2315
2316
|
id: string;
|
|
@@ -2324,6 +2325,7 @@ type Database = {
|
|
|
2324
2325
|
Insert: {
|
|
2325
2326
|
compiled_docs?: Json | null;
|
|
2326
2327
|
created_at?: string;
|
|
2328
|
+
deployment_version?: string | null;
|
|
2327
2329
|
documentation?: Json | null;
|
|
2328
2330
|
error_message?: string | null;
|
|
2329
2331
|
id?: string;
|
|
@@ -2338,6 +2340,7 @@ type Database = {
|
|
|
2338
2340
|
Update: {
|
|
2339
2341
|
compiled_docs?: Json | null;
|
|
2340
2342
|
created_at?: string;
|
|
2343
|
+
deployment_version?: string | null;
|
|
2341
2344
|
documentation?: Json | null;
|
|
2342
2345
|
error_message?: string | null;
|
|
2343
2346
|
id?: string;
|
|
@@ -3475,6 +3478,8 @@ interface RemoteOrgConfig {
|
|
|
3475
3478
|
toolCredentials?: Record<string, string>;
|
|
3476
3479
|
/** SDK version used to deploy this bundle */
|
|
3477
3480
|
sdkVersion?: string;
|
|
3481
|
+
/** Deployment version (semver) of the deployed bundle */
|
|
3482
|
+
deploymentVersion?: string;
|
|
3478
3483
|
}
|
|
3479
3484
|
/**
|
|
3480
3485
|
* Organization-specific resource collection
|
|
@@ -3482,7 +3487,9 @@ interface RemoteOrgConfig {
|
|
|
3482
3487
|
* Complete manifest of all automation resources for an organization.
|
|
3483
3488
|
* Used by ResourceRegistry for discovery and Command View for visualization.
|
|
3484
3489
|
*/
|
|
3485
|
-
interface
|
|
3490
|
+
interface DeploymentSpec {
|
|
3491
|
+
/** Deployment version (semver) */
|
|
3492
|
+
version: string;
|
|
3486
3493
|
/** Workflow definitions */
|
|
3487
3494
|
workflows?: WorkflowDefinition[];
|
|
3488
3495
|
/** Agent definitions */
|
|
@@ -3501,7 +3508,7 @@ interface OrganizationResources {
|
|
|
3501
3508
|
/**
|
|
3502
3509
|
* Organization Registry type
|
|
3503
3510
|
*/
|
|
3504
|
-
type OrganizationRegistry = Record<string,
|
|
3511
|
+
type OrganizationRegistry = Record<string, DeploymentSpec>;
|
|
3505
3512
|
declare class ResourceRegistry {
|
|
3506
3513
|
private registry;
|
|
3507
3514
|
/**
|
|
@@ -3568,7 +3575,7 @@ declare class ResourceRegistry {
|
|
|
3568
3575
|
* @throws Error if incoming resourceId conflicts with a static resource
|
|
3569
3576
|
* @throws Error if incoming deployment contains duplicate resourceIds
|
|
3570
3577
|
*/
|
|
3571
|
-
registerOrganization(orgName: string, org:
|
|
3578
|
+
registerOrganization(orgName: string, org: DeploymentSpec, remote: RemoteOrgConfig): void;
|
|
3572
3579
|
/**
|
|
3573
3580
|
* Patch serialized cache with pre-serialized schemas from an external manifest.
|
|
3574
3581
|
*
|
|
@@ -3603,7 +3610,7 @@ declare class ResourceRegistry {
|
|
|
3603
3610
|
* @param orgName - Organization name
|
|
3604
3611
|
* @param org - Resource definitions with real handlers (not stubs)
|
|
3605
3612
|
*/
|
|
3606
|
-
registerStaticResources(orgName: string, org:
|
|
3613
|
+
registerStaticResources(orgName: string, org: DeploymentSpec): void;
|
|
3607
3614
|
/**
|
|
3608
3615
|
* Unregister runtime-registered resources for an organization
|
|
3609
3616
|
*
|
|
@@ -7398,4 +7405,4 @@ declare class ToolingError extends ExecutionError {
|
|
|
7398
7405
|
}
|
|
7399
7406
|
|
|
7400
7407
|
export { ExecutionError, RegistryValidationError, ResourceRegistry, StepType, ToolingError };
|
|
7401
|
-
export type { AbsoluteScheduleConfig, AcqCompany, AcqContact, AcqDeal, AcqList, AddToCampaignLead, AddToCampaignParams, AddToCampaignResult, AgentConfig, AgentConstraints, AgentDefinition, AgentMemory, FindCompanyEmailParams as AnymailfinderFindCompanyEmailParams, FindCompanyEmailResult as AnymailfinderFindCompanyEmailResult, FindDecisionMakerEmailParams as AnymailfinderFindDecisionMakerEmailParams, FindDecisionMakerEmailResult as AnymailfinderFindDecisionMakerEmailResult, FindPersonEmailParams as AnymailfinderFindPersonEmailParams, FindPersonEmailResult as AnymailfinderFindPersonEmailResult, AnymailfinderToolMap, VerifyEmailParams as AnymailfinderVerifyEmailParams, VerifyEmailResult as AnymailfinderVerifyEmailResult, ApifyToolMap, ApifyWebhookConfig, AppendRowsParams, AppendRowsResult, ApprovalToolMap, AttioToolMap, BatchUpdateParams, BatchUpdateResult, BulkDeleteLeadsParams, BulkDeleteLeadsResult, BulkImportParams, BulkImportResult, CancelHitlByDealIdParams, CancelSchedulesAndHitlByEmailParams, ClearDealFieldsParams, ClearRangeParams, ClearRangeResult, CompanyFilters, ConditionalNext, ContactFilters, Contract, CreateAttributeParams, CreateAttributeResult, CreateAutoPaymentLinkParams, CreateAutoPaymentLinkResult, CreateCheckoutSessionParams, CreateCheckoutSessionResult, CreateCompanyParams, CreateContactParams, CreateEnvelopeParams, CreateEnvelopeResult, CreateFolderParams, CreateFolderResult, CreateListParams, CreateNoteParams, CreateNoteResult, CreatePaymentLinkParams, CreatePaymentLinkResult, CreateRecordParams, CreateRecordResult, CreateScheduleInput, DeleteDealParams, DeleteNoteParams, DeleteNoteResult, DeleteRecordParams, DeleteRecordResult, DeleteRowByValueParams, DeleteRowByValueResult, DomainDefinition, DownloadDocumentParams, DownloadDocumentResult, DropboxToolMap, ElevasConfig, EmailToolMap, EnvelopeDocument, EventTriggerConfig, ExecutionContext, ExecutionInterface, ExecutionMetadata, ExecutionToolMap, FilterExpression, FilterRowsParams, FilterRowsResult, FormField, FormFieldType, FormSchema, GetDailyCampaignAnalyticsParams, GetDailyCampaignAnalyticsResult, GetEmailsParams, GetEmailsResult, GetEnvelopeParams, GetEnvelopeResult, GetHeadersParams, GetHeadersResult, GetLastRowParams, GetLastRowResult, GetPaymentLinkParams, GetPaymentLinkResult, GetRecordParams, GetRecordResult, GetRowByValueParams, GetRowByValueResult, GetSpreadsheetMetadataParams, GetSpreadsheetMetadataResult, GmailSendEmailParams, GmailSendEmailResult, GmailToolMap, GoogleSheetsToolMap, HumanCheckpointDefinition, InstantlyToolMap, IntegrationDefinition, LLMAdapterFactory, LLMGenerateRequest, LLMGenerateResponse, LLMMessage, LLMModel, LeadToolMap, LinearNext, ListAttributesParams, ListAttributesResult, ListLeadsParams, ListLeadsResult, ListNotesParams, ListNotesResult, ListObjectsResult, ListPaymentLinksParams, ListPaymentLinksResult, MarkProposalReviewedParams, MarkProposalSentParams, MethodEntry, MillionVerifierToolMap, ModelConfig, NextConfig, NotificationSDKInput, NotificationToolMap,
|
|
7408
|
+
export type { AbsoluteScheduleConfig, AcqCompany, AcqContact, AcqDeal, AcqList, AddToCampaignLead, AddToCampaignParams, AddToCampaignResult, AgentConfig, AgentConstraints, AgentDefinition, AgentMemory, FindCompanyEmailParams as AnymailfinderFindCompanyEmailParams, FindCompanyEmailResult as AnymailfinderFindCompanyEmailResult, FindDecisionMakerEmailParams as AnymailfinderFindDecisionMakerEmailParams, FindDecisionMakerEmailResult as AnymailfinderFindDecisionMakerEmailResult, FindPersonEmailParams as AnymailfinderFindPersonEmailParams, FindPersonEmailResult as AnymailfinderFindPersonEmailResult, AnymailfinderToolMap, VerifyEmailParams as AnymailfinderVerifyEmailParams, VerifyEmailResult as AnymailfinderVerifyEmailResult, ApifyToolMap, ApifyWebhookConfig, AppendRowsParams, AppendRowsResult, ApprovalToolMap, AttioToolMap, BatchUpdateParams, BatchUpdateResult, BulkDeleteLeadsParams, BulkDeleteLeadsResult, BulkImportParams, BulkImportResult, CancelHitlByDealIdParams, CancelSchedulesAndHitlByEmailParams, ClearDealFieldsParams, ClearRangeParams, ClearRangeResult, CompanyFilters, ConditionalNext, ContactFilters, Contract, CreateAttributeParams, CreateAttributeResult, CreateAutoPaymentLinkParams, CreateAutoPaymentLinkResult, CreateCheckoutSessionParams, CreateCheckoutSessionResult, CreateCompanyParams, CreateContactParams, CreateEnvelopeParams, CreateEnvelopeResult, CreateFolderParams, CreateFolderResult, CreateListParams, CreateNoteParams, CreateNoteResult, CreatePaymentLinkParams, CreatePaymentLinkResult, CreateRecordParams, CreateRecordResult, CreateScheduleInput, DeleteDealParams, DeleteNoteParams, DeleteNoteResult, DeleteRecordParams, DeleteRecordResult, DeleteRowByValueParams, DeleteRowByValueResult, DeploymentSpec, DomainDefinition, DownloadDocumentParams, DownloadDocumentResult, DropboxToolMap, ElevasConfig, EmailToolMap, EnvelopeDocument, EventTriggerConfig, ExecutionContext, ExecutionInterface, ExecutionMetadata, ExecutionToolMap, FilterExpression, FilterRowsParams, FilterRowsResult, FormField, FormFieldType, FormSchema, GetDailyCampaignAnalyticsParams, GetDailyCampaignAnalyticsResult, GetEmailsParams, GetEmailsResult, GetEnvelopeParams, GetEnvelopeResult, GetHeadersParams, GetHeadersResult, GetLastRowParams, GetLastRowResult, GetPaymentLinkParams, GetPaymentLinkResult, GetRecordParams, GetRecordResult, GetRowByValueParams, GetRowByValueResult, GetSpreadsheetMetadataParams, GetSpreadsheetMetadataResult, GmailSendEmailParams, GmailSendEmailResult, GmailToolMap, GoogleSheetsToolMap, HumanCheckpointDefinition, InstantlyToolMap, IntegrationDefinition, LLMAdapterFactory, LLMGenerateRequest, LLMGenerateResponse, LLMMessage, LLMModel, LeadToolMap, LinearNext, ListAttributesParams, ListAttributesResult, ListLeadsParams, ListLeadsResult, ListNotesParams, ListNotesResult, ListObjectsResult, ListPaymentLinksParams, ListPaymentLinksResult, MarkProposalReviewedParams, MarkProposalSentParams, MethodEntry, MillionVerifierToolMap, ModelConfig, NextConfig, NotificationSDKInput, NotificationToolMap, PaginatedResult, PaginationParams, PdfToolMap, QueryRecordsParams, QueryRecordsResult, ReadSheetParams, ReadSheetResult, Recipient, RecurringScheduleConfig, RelationshipDeclaration, RelativeScheduleConfig, RemoveFromSubsequenceParams, RemoveFromSubsequenceResult, ResendGetEmailParams, ResendGetEmailResult, ResendSendEmailParams, ResendSendEmailResult, ResendToolMap, ResourceDefinition, ResourceDomain, ResourceMetricsConfig, ResourceRelationships, ResourceStatus$1 as ResourceStatus, ResourceType, RunActorParams, RunActorResult, SDKLLMGenerateParams, ScheduleOriginTracking, ScheduleTarget, ScheduleTriggerConfig, SchedulerToolMap, SendReplyParams, SendReplyResult, SetContactNurtureParams, SheetInfo, SignatureApiFieldType, SignatureApiToolMap, SigningPlace, SortCriteria, StartActorParams, StartActorResult, StepHandler, StorageDeleteInput, StorageDeleteOutput, StorageDownloadInput, StorageDownloadOutput, StorageListInput, StorageListOutput, StorageSignedUrlInput, StorageSignedUrlOutput, StorageToolMap, StorageUploadInput, StorageUploadOutput, StripeToolMap, SyncDealStageParams, TaskSchedule, TaskScheduleConfig, TombaToolMap, Tool, ToolExecutionOptions, ToolMethodMap, ToolingErrorType, TriggerConfig, TriggerDefinition, UpdateAttributeParams, UpdateAttributeResult, UpdateCloseLostReasonParams, UpdateCompanyParams, UpdateContactParams, UpdateDiscoveryDataParams, UpdateFeesParams, UpdateInterestStatusParams, UpdateInterestStatusResult, UpdateListParams, UpdatePaymentLinkParams, UpdatePaymentLinkResult, UpdateProposalDataParams, UpdateRecordParams, UpdateRecordResult, UpdateRowByValueParams, UpdateRowByValueResult, UploadFileParams, UploadFileResult, UpsertCompanyParams, UpsertContactParams, UpsertDealParams, UpsertRowParams, UpsertRowResult, VoidEnvelopeParams, VoidEnvelopeResult, WebhookProviderType, WebhookTriggerConfig, WorkflowConfig, WorkflowDefinition, WorkflowStep, WriteSheetParams, WriteSheetResult };
|
package/dist/index.js
CHANGED
|
@@ -426,7 +426,7 @@ var RegistryValidationError = class extends Error {
|
|
|
426
426
|
this.name = "RegistryValidationError";
|
|
427
427
|
}
|
|
428
428
|
};
|
|
429
|
-
function
|
|
429
|
+
function validateDeploymentSpec(orgName, resources) {
|
|
430
430
|
const seenIds = /* @__PURE__ */ new Set();
|
|
431
431
|
resources.workflows?.forEach((workflow) => {
|
|
432
432
|
const id = workflow.config.resourceId;
|
|
@@ -558,7 +558,8 @@ function isZodOptional(schema) {
|
|
|
558
558
|
return schema.isOptional();
|
|
559
559
|
}
|
|
560
560
|
function validateRelationships(orgName, resources) {
|
|
561
|
-
if (!resources.relationships && !resources.triggers && !resources.externalResources && !resources.humanCheckpoints)
|
|
561
|
+
if (!resources.relationships && !resources.triggers && !resources.externalResources && !resources.humanCheckpoints)
|
|
562
|
+
return;
|
|
562
563
|
const validAgentIds = new Set(resources.agents?.map((a) => a.config.resourceId) ?? []);
|
|
563
564
|
const validWorkflowIds = new Set(resources.workflows?.map((w) => w.config.resourceId) ?? []);
|
|
564
565
|
const validIntegrationIds = new Set(resources.integrations?.map((i) => i.resourceId) ?? []);
|
|
@@ -3027,6 +3028,7 @@ function serializeOrganization(resources) {
|
|
|
3027
3028
|
const humanCheckpoints = resources.humanCheckpoints ?? [];
|
|
3028
3029
|
const domainDefinitions = deriveDomainDefinitions(resources);
|
|
3029
3030
|
return {
|
|
3031
|
+
version: resources.version,
|
|
3030
3032
|
resources: {
|
|
3031
3033
|
workflows: workflowResources,
|
|
3032
3034
|
agents: agentResources,
|
|
@@ -3185,7 +3187,7 @@ var ResourceRegistry = class {
|
|
|
3185
3187
|
*/
|
|
3186
3188
|
validateRegistry() {
|
|
3187
3189
|
for (const [orgName, resources] of Object.entries(this.registry)) {
|
|
3188
|
-
|
|
3190
|
+
validateDeploymentSpec(orgName, resources);
|
|
3189
3191
|
}
|
|
3190
3192
|
}
|
|
3191
3193
|
/**
|
package/dist/templates.js
CHANGED
|
@@ -1657,7 +1657,7 @@ paths:
|
|
|
1657
1657
|
- Organize by business domain: \`src/<domain>/\` (e.g., \`src/operations/\`, \`src/acquisition/\`)
|
|
1658
1658
|
- Each domain barrel (\`src/<domain>/index.ts\`) exports \`workflows\` and \`agents\` arrays
|
|
1659
1659
|
- Cross-domain utilities go in \`src/shared/\`; domain-specific utilities in \`src/<domain>/shared/\`
|
|
1660
|
-
- The default export in \`src/index.ts\` must be
|
|
1660
|
+
- The default export in \`src/index.ts\` must be a \`DeploymentSpec\` object
|
|
1661
1661
|
- \`resourceId\` must be lowercase with hyphens, unique per organization
|
|
1662
1662
|
- \`dist/\` is generated by deploy -- never commit it
|
|
1663
1663
|
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
* Worker -> Parent: { type: 'credential-request', id, name }
|
|
27
27
|
* Parent -> Worker: { type: 'credential-result', id, provider?, credentials?, error?, code? }
|
|
28
28
|
*/
|
|
29
|
-
import type {
|
|
29
|
+
import type { DeploymentSpec } from '../index.js';
|
|
30
30
|
export { platform, PlatformToolError } from './platform.js';
|
|
31
31
|
export type { PlatformCredential } from './platform.js';
|
|
32
32
|
export * from './adapters/index.js';
|
|
33
|
-
export declare function startWorker(org:
|
|
33
|
+
export declare function startWorker(org: DeploymentSpec): void;
|
package/package.json
CHANGED
package/reference/_navigation.md
CHANGED
|
@@ -48,7 +48,7 @@ All paths are relative to `node_modules/@elevasis/sdk/reference/`.
|
|
|
48
48
|
|
|
49
49
|
| Resource | Location | Description | When to Load |
|
|
50
50
|
| --- | --- | --- | --- |
|
|
51
|
-
| Writing Resources | `resources/index.mdx` | Guide to creating workflows and agents using WorkflowDefinition, AgentDefinition, and
|
|
51
|
+
| Writing Resources | `resources/index.mdx` | Guide to creating workflows and agents using WorkflowDefinition, AgentDefinition, and DeploymentSpec with the Elevasis SDK | Building or modifying a workflow |
|
|
52
52
|
| 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 |
|
|
53
53
|
| 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 |
|
|
54
54
|
|
|
@@ -23,7 +23,7 @@ The Command Center is the browser UI for interacting with deployed resources. Af
|
|
|
23
23
|
|
|
24
24
|
## Command View
|
|
25
25
|
|
|
26
|
-
The Command View is a visual graph of your deployed resources. Each node is a resource (workflow, agent, trigger, integration). Edges are the relationships you declared in `
|
|
26
|
+
The Command View is a visual graph of your deployed resources. Each node is a resource (workflow, agent, trigger, integration). Edges are the relationships you declared in `DeploymentSpec`.
|
|
27
27
|
|
|
28
28
|
**What you can do here:**
|
|
29
29
|
|
|
@@ -54,10 +54,10 @@ Every resource you deploy becomes a node in the graph. Some nodes are executable
|
|
|
54
54
|
|
|
55
55
|
### Relationships
|
|
56
56
|
|
|
57
|
-
Relationships are edges in the graph. Declare them in `
|
|
57
|
+
Relationships are edges in the graph. Declare them in `DeploymentSpec`:
|
|
58
58
|
|
|
59
59
|
```typescript
|
|
60
|
-
const org:
|
|
60
|
+
const org: DeploymentSpec = {
|
|
61
61
|
workflows: [scoreLeadWorkflow, sendProposalWorkflow],
|
|
62
62
|
relationships: {
|
|
63
63
|
'score-lead': {
|
|
@@ -98,7 +98,7 @@ Keep relationships in sync with your handler code. When you add an `execution.tr
|
|
|
98
98
|
`elevasis-sdk deploy` and `elevasis-sdk check` both validate:
|
|
99
99
|
|
|
100
100
|
- Duplicate resource IDs
|
|
101
|
-
- Relationship targets must exist in the same `
|
|
101
|
+
- Relationship targets must exist in the same `DeploymentSpec`
|
|
102
102
|
- Agent model params (provider, model name, temperature bounds)
|
|
103
103
|
- Workflow step chains (`next.target` must point to existing step names)
|
|
104
104
|
|
|
@@ -106,14 +106,14 @@ Keep relationships in sync with your handler code. When you add an `execution.tr
|
|
|
106
106
|
|
|
107
107
|
```
|
|
108
108
|
ERROR Relationship target 'send-proposal' not found in organization resources
|
|
109
|
-
ERROR Duplicate resource ID 'score-lead' in
|
|
109
|
+
ERROR Duplicate resource ID 'score-lead' in deployment
|
|
110
110
|
```
|
|
111
111
|
|
|
112
112
|
### Graph Serialization
|
|
113
113
|
|
|
114
114
|
The platform converts your definitions into `CommandViewNode` (one per resource) and `CommandViewEdge` (one per relationship) structures. `buildEdges()` reads your `relationships` declarations and produces edges as a pure transformation -- no runtime behavior is inferred.
|
|
115
115
|
|
|
116
|
-
> **SDK takeaway:** Declare relationships in `
|
|
116
|
+
> **SDK takeaway:** Declare relationships in `DeploymentSpec` to keep the Command View accurate as your system grows. Update declarations whenever you add or remove `execution.trigger()` calls.
|
|
117
117
|
|
|
118
118
|
---
|
|
119
119
|
|
|
@@ -12,14 +12,14 @@ loadWhen: "Understanding scaffolded files or project layout"
|
|
|
12
12
|
|
|
13
13
|
### `src/index.ts`
|
|
14
14
|
|
|
15
|
-
The registry entry point for your workspace. This file aggregates resources from domain barrel files and re-exports them as
|
|
15
|
+
The registry entry point for your workspace. This file aggregates resources from domain barrel files and re-exports them as a `DeploymentSpec` default export. It does not contain workflow logic itself -- its sole job is aggregation:
|
|
16
16
|
|
|
17
17
|
```ts
|
|
18
|
-
import type {
|
|
18
|
+
import type { DeploymentSpec } from '@elevasis/sdk'
|
|
19
19
|
import * as operations from './operations/index.js'
|
|
20
20
|
import * as example from './example/index.js'
|
|
21
21
|
|
|
22
|
-
const org:
|
|
22
|
+
const org: DeploymentSpec = {
|
|
23
23
|
workflows: [
|
|
24
24
|
...operations.workflows,
|
|
25
25
|
...example.workflows,
|
|
@@ -187,7 +187,7 @@ The most important file for AI-assisted development. It provides Claude Code wit
|
|
|
187
187
|
|
|
188
188
|
- **Project orientation** -- what an Elevasis SDK project is and how it works
|
|
189
189
|
- **Project structure** -- which files contain resources, documentation, and configuration
|
|
190
|
-
- **SDK patterns** -- working code examples for resource definitions, Zod schemas, and the `
|
|
190
|
+
- **SDK patterns** -- working code examples for resource definitions, Zod schemas, and the `DeploymentSpec` export
|
|
191
191
|
- **CLI reference** -- all commands with flags (`check`, `deploy`, `exec`, `resources`, `executions`, `execution`, `deployments`, `env list/set/remove`)
|
|
192
192
|
- **Development rules** -- conventions the agent should enforce (source in `src/`, docs in `docs/`, use `@elevasis/sdk` types only)
|
|
193
193
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Writing Resources
|
|
3
|
-
description: Guide to creating workflows and agents using WorkflowDefinition, AgentDefinition, and
|
|
3
|
+
description: Guide to creating workflows and agents using WorkflowDefinition, AgentDefinition, and DeploymentSpec with the Elevasis SDK
|
|
4
4
|
loadWhen: "Building or modifying a workflow"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
Resources are the building blocks of your Elevasis project. A resource is a workflow or agent definition that the platform can execute on your behalf. You define them in TypeScript, export them from a single entry point, and the platform handles scheduling, retries, logging, and execution.
|
|
8
8
|
|
|
9
|
-
This page covers how to structure your resources, write step handlers, and export everything through `
|
|
9
|
+
This page covers how to structure your resources, write step handlers, and export everything through `DeploymentSpec`.
|
|
10
10
|
|
|
11
11
|
## WorkflowDefinition
|
|
12
12
|
|
|
@@ -289,14 +289,14 @@ const myAgent: AgentDefinition = {
|
|
|
289
289
|
|
|
290
290
|
---
|
|
291
291
|
|
|
292
|
-
##
|
|
292
|
+
## DeploymentSpec
|
|
293
293
|
|
|
294
|
-
All resources must be exported through
|
|
294
|
+
All resources must be exported through a `DeploymentSpec` default export from `src/index.ts`. This is the entry point the platform reads when you deploy.
|
|
295
295
|
|
|
296
296
|
```typescript
|
|
297
|
-
import type {
|
|
297
|
+
import type { DeploymentSpec } from '@elevasis/sdk';
|
|
298
298
|
|
|
299
|
-
const org:
|
|
299
|
+
const org: DeploymentSpec = {
|
|
300
300
|
workflows: [echoWorkflow, pipeline],
|
|
301
301
|
agents: [
|
|
302
302
|
// myAgent,
|
|
@@ -330,11 +330,11 @@ export const workflows = [sendInvoice];
|
|
|
330
330
|
export const agents = [];
|
|
331
331
|
|
|
332
332
|
// src/index.ts
|
|
333
|
-
import type {
|
|
333
|
+
import type { DeploymentSpec } from '@elevasis/sdk';
|
|
334
334
|
import * as orders from './orders/index.js';
|
|
335
335
|
import * as billing from './billing/index.js';
|
|
336
336
|
|
|
337
|
-
const org:
|
|
337
|
+
const org: DeploymentSpec = {
|
|
338
338
|
workflows: [
|
|
339
339
|
...orders.workflows,
|
|
340
340
|
...billing.workflows,
|
|
@@ -45,7 +45,7 @@ All types come from the platform core. The SDK re-exports them grouped by source
|
|
|
45
45
|
| `ResourceStatus` | Enum: `'dev' | 'prod'` |
|
|
46
46
|
| `ResourceDomain` | Domain classification for a resource |
|
|
47
47
|
| `DomainDefinition` | Structure for grouping resources by domain |
|
|
48
|
-
| `
|
|
48
|
+
| `DeploymentSpec` | Top-level export shape: `{ workflows, agents }` |
|
|
49
49
|
| `TriggerDefinition` | Base for trigger configuration |
|
|
50
50
|
| `IntegrationDefinition` | Integration configuration structure |
|
|
51
51
|
| `WebhookProviderType` | Supported webhook providers |
|
package/reference/runtime.mdx
CHANGED
|
@@ -109,7 +109,7 @@ v1 versioning is intentionally simple:
|
|
|
109
109
|
|
|
110
110
|
### Deletion
|
|
111
111
|
|
|
112
|
-
- **Via CLI:** Remove the resource from your `
|
|
112
|
+
- **Via CLI:** Remove the resource from your `DeploymentSpec` export and run `elevasis-sdk deploy`. Resources absent from the new bundle are automatically deregistered from the platform.
|
|
113
113
|
- **Via AI Studio:** The delete button unregisters the resource immediately and marks the deployment stopped.
|
|
114
114
|
- **In-flight executions:** Workers already running complete normally. Deletion affects only new execution attempts.
|
|
115
115
|
- **Data retention:** Execution logs and history for a deleted resource are retained for 30 days, then purged.
|