@elevasis/sdk 1.50.0 → 1.51.0

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.
@@ -1,4 +1,4 @@
1
- import { ProcessingStageStatusSchema, ListBuilderStageKeySchema, zodToJsonSchema, LLMResponseParseError, errorToString, getErrorDetails, ExecutionError2, validateEntryPoint, validateTerminalSteps, validateStepReferences, logWorkflowStart, detectCycle, WorkflowStepError, logStepStart, validateTerminalOutput, logStepSuccess, determineNextStep, logStepFailure, logExecutionPath, logWorkflowSuccess, logWorkflowFailure, estimateTokens, validateTokenConfiguration, truncationCharBudget, buildIterationResponseSchema } from './chunk-YJDXRHNP.js';
1
+ import { ProcessingStageStatusSchema, ListBuilderStageKeySchema, zodToJsonSchema, LLMResponseParseError, errorToString, getErrorDetails, ExecutionError2, validateEntryPoint, validateTerminalSteps, validateStepReferences, logWorkflowStart, detectCycle, WorkflowStepError, logStepStart, validateTerminalOutput, logStepSuccess, determineNextStep, logStepFailure, logExecutionPath, logWorkflowSuccess, logWorkflowFailure, estimateTokens, truncationCharBudget, buildIterationResponseSchema } from './chunk-NNRXVYNC.js';
2
2
  import { workerData, parentPort } from 'worker_threads';
3
3
  import { z, ZodError } from 'zod';
4
4
  import { createHmac } from 'crypto';
@@ -585,7 +585,6 @@ function withSynthesizedMessage(nextActions, message) {
585
585
  return [{ type: "message", text }, ...nextActions];
586
586
  }
587
587
  async function callLLMForAgentIteration(adapter, request) {
588
- validateTokenConfiguration(request.model, request.constraints.maxOutputTokens);
589
588
  const messages = buildAgentMessages(
590
589
  request.systemPrompt,
591
590
  request.memory,
@@ -648,7 +647,6 @@ async function callLLMForAgentIteration(adapter, request) {
648
647
  }
649
648
  }
650
649
  async function callLLMForAgentCompletion(adapter, request) {
651
- validateTokenConfiguration(request.model, request.constraints.maxOutputTokens);
652
650
  const messages = buildAgentMessages(
653
651
  request.systemPrompt,
654
652
  request.memory,
@@ -2549,7 +2547,7 @@ function handleToolResult(msg) {
2549
2547
  const code = msg.code ?? "unknown_error";
2550
2548
  pending.reject(new PlatformToolError(msg.error, code, RETRYABLE_CODES.has(code)));
2551
2549
  } else {
2552
- pending.resolve(msg.result);
2550
+ pending.resolve(msg.result, msg.usage);
2553
2551
  }
2554
2552
  }
2555
2553
  function handleCredentialResult(msg) {
@@ -2566,6 +2564,45 @@ function handleCredentialResult(msg) {
2566
2564
  });
2567
2565
  }
2568
2566
  }
2567
+ async function sendToolCall(options) {
2568
+ if (!parentPort) {
2569
+ throw new PlatformToolError("platform.call() can only be used inside a worker thread", "service_unavailable", false);
2570
+ }
2571
+ const id = `tc_${++callCounter}_${Date.now()}`;
2572
+ const message = {
2573
+ type: "tool-call",
2574
+ id,
2575
+ tool: options.tool,
2576
+ method: options.method,
2577
+ params: options.params ?? {},
2578
+ credential: options.credential
2579
+ };
2580
+ return new Promise((resolve, reject) => {
2581
+ const timeoutMs = 18e5;
2582
+ const timeoutLabel = "1800s";
2583
+ const timer = setTimeout(() => {
2584
+ pendingCalls.delete(id);
2585
+ reject(
2586
+ new PlatformToolError(
2587
+ `Platform tool call timed out after ${timeoutLabel}: ${options.tool}.${options.method}`,
2588
+ "timeout_error",
2589
+ true
2590
+ )
2591
+ );
2592
+ }, timeoutMs);
2593
+ pendingCalls.set(id, {
2594
+ resolve: (value, usage) => {
2595
+ clearTimeout(timer);
2596
+ resolve({ result: value, usage });
2597
+ },
2598
+ reject: (error) => {
2599
+ clearTimeout(timer);
2600
+ reject(error);
2601
+ }
2602
+ });
2603
+ parentPort.postMessage(message);
2604
+ });
2605
+ }
2569
2606
  var platform = {
2570
2607
  /**
2571
2608
  * Call a platform tool from the worker thread.
@@ -2578,47 +2615,24 @@ var platform = {
2578
2615
  * @throws PlatformToolError on failure (with code and retryable fields)
2579
2616
  */
2580
2617
  async call(options) {
2581
- if (!parentPort) {
2582
- throw new PlatformToolError(
2583
- "platform.call() can only be used inside a worker thread",
2584
- "service_unavailable",
2585
- false
2586
- );
2587
- }
2588
- const id = `tc_${++callCounter}_${Date.now()}`;
2589
- const message = {
2590
- type: "tool-call",
2591
- id,
2592
- tool: options.tool,
2593
- method: options.method,
2594
- params: options.params ?? {},
2595
- credential: options.credential
2596
- };
2597
- return new Promise((resolve, reject) => {
2598
- const timeoutMs = 18e5;
2599
- const timeoutLabel = "1800s";
2600
- const timer = setTimeout(() => {
2601
- pendingCalls.delete(id);
2602
- reject(
2603
- new PlatformToolError(
2604
- `Platform tool call timed out after ${timeoutLabel}: ${options.tool}.${options.method}`,
2605
- "timeout_error",
2606
- true
2607
- )
2608
- );
2609
- }, timeoutMs);
2610
- pendingCalls.set(id, {
2611
- resolve: (value) => {
2612
- clearTimeout(timer);
2613
- resolve(value);
2614
- },
2615
- reject: (error) => {
2616
- clearTimeout(timer);
2617
- reject(error);
2618
- }
2619
- });
2620
- parentPort.postMessage(message);
2621
- });
2618
+ const { result } = await sendToolCall(options);
2619
+ return result;
2620
+ },
2621
+ /**
2622
+ * Call a platform tool and also surface any `usage` (token/cost) metadata the parent attached
2623
+ * to the response -- e.g. the `llm` tool's real provider usage from the API-side
2624
+ * `dispatchToolCall` in `tool-dispatcher.ts`. Bare `result` is unchanged from `call()`; `usage` is `undefined` whenever the
2625
+ * parent's response didn't carry one, exactly like today's `call()` behavior for that result.
2626
+ *
2627
+ * @param options.tool - Tool name (e.g., 'llm')
2628
+ * @param options.method - Method name (e.g., 'generate')
2629
+ * @param options.params - Method parameters
2630
+ * @param options.credential - Credential name (required for integration tools)
2631
+ * @returns Promise resolving to `{ result, usage }`
2632
+ * @throws PlatformToolError on failure (with code and retryable fields)
2633
+ */
2634
+ async callWithUsage(options) {
2635
+ return sendToolCall(options);
2622
2636
  },
2623
2637
  /**
2624
2638
  * Request raw credential access from the platform.
@@ -2673,7 +2687,7 @@ var PostMessageLLMAdapter = class {
2673
2687
  this.model = model;
2674
2688
  }
2675
2689
  async generate(request) {
2676
- const result = await platform.call({
2690
+ const { result, usage } = await platform.callWithUsage({
2677
2691
  tool: "llm",
2678
2692
  method: "generate",
2679
2693
  params: {
@@ -2689,7 +2703,17 @@ var PostMessageLLMAdapter = class {
2689
2703
  maxOutputTokens: request.maxOutputTokens
2690
2704
  }
2691
2705
  });
2692
- return { output: result };
2706
+ return {
2707
+ output: result,
2708
+ ...usage && {
2709
+ usage: {
2710
+ inputTokens: usage.inputTokens,
2711
+ outputTokens: usage.outputTokens,
2712
+ totalTokens: usage.inputTokens + usage.outputTokens
2713
+ }
2714
+ },
2715
+ ...usage?.cost !== void 0 && { cost: usage.cost }
2716
+ };
2693
2717
  }
2694
2718
  };
2695
2719
  function createPostMessageAdapterFactory() {
@@ -7898,4 +7898,4 @@ function defineWorkflowConfig(resourceId, descriptors, actionRegistry = []) {
7898
7898
  }
7899
7899
  var ListBuilderStageKeySchema = z.string().min(1);
7900
7900
 
7901
- export { ActivityEventSchema, BuildPlanSnapshotStepSchema, ContractRefResolutionError, CrmStageKeySchema, CrmStateKeySchema, EmailSchema, ExecutionError, ExecutionError2, LLMResponseParseError, ListBuilderStageKeySchema, ProcessingStageStatusSchema, ProspectingBuildTemplateSchema, RegistryValidationError, ResourceRegistry, StepType, ToolingError, WorkflowStepError, bindResourceDescriptor, buildIterationResponseSchema, compileBusinessOntologyValidationIndex, concurrentPool, createLeadGenStageValidators, defineContract, defineResource, defineResourceOntology, defineResources, defineStep, defineTopology, defineTopologyRelationship, defineWorkflow, defineWorkflowConfig, deriveActions, detectCycle, determineNextStep, diagnosticOutput, errorToString, estimateTokens, getErrorDetails, integrationInput, isBuiltInReadinessProfile, isZodType, logExecutionPath, logStepFailure, logStepStart, logStepSuccess, logWorkflowFailure, logWorkflowStart, logWorkflowSuccess, lookupReadinessProfile, parseTopologyNodeRef, registerReadinessProfile, resolveContractRef, runDiagnostic, splitName, topologyRef, topologyRelationship, truncationCharBudget, validateDeclaredSystemInterfaceReadiness, validateDeploymentSpec, validateEntryPoint, validateRelationships, validateResourceGovernance, validateStepReferences, validateTerminalOutput, validateTerminalSteps, validateTokenConfiguration, zodToJsonSchema };
7901
+ export { ActivityEventSchema, BuildPlanSnapshotStepSchema, ContractRefResolutionError, CrmStageKeySchema, CrmStateKeySchema, EmailSchema, ExecutionError, ExecutionError2, LLMResponseParseError, ListBuilderStageKeySchema, ProcessingStageStatusSchema, ProspectingBuildTemplateSchema, RegistryValidationError, ResourceRegistry, StepType, ToolingError, WorkflowStepError, bindResourceDescriptor, buildIterationResponseSchema, compileBusinessOntologyValidationIndex, concurrentPool, createLeadGenStageValidators, defineContract, defineResource, defineResourceOntology, defineResources, defineStep, defineTopology, defineTopologyRelationship, defineWorkflow, defineWorkflowConfig, deriveActions, detectCycle, determineNextStep, diagnosticOutput, errorToString, estimateTokens, getErrorDetails, integrationInput, isBuiltInReadinessProfile, isZodType, logExecutionPath, logStepFailure, logStepStart, logStepSuccess, logWorkflowFailure, logWorkflowStart, logWorkflowSuccess, lookupReadinessProfile, parseTopologyNodeRef, registerReadinessProfile, resolveContractRef, runDiagnostic, splitName, topologyRef, topologyRelationship, truncationCharBudget, validateDeclaredSystemInterfaceReadiness, validateDeploymentSpec, validateEntryPoint, validateRelationships, validateResourceGovernance, validateStepReferences, validateTerminalOutput, validateTerminalSteps, zodToJsonSchema };
package/dist/cli.cjs CHANGED
@@ -49298,7 +49298,7 @@ var init_package = __esm({
49298
49298
  "package.json"() {
49299
49299
  package_default = {
49300
49300
  name: "@elevasis/sdk",
49301
- version: "1.50.0",
49301
+ version: "1.51.0",
49302
49302
  description: "SDK for building Elevasis organization resources",
49303
49303
  type: "module",
49304
49304
  bin: {
@@ -52022,9 +52022,10 @@ Credentials (${data.credentials.length}):
52022
52022
  // src/cli/commands/creds/creds-create.ts
52023
52023
  init_source();
52024
52024
  init_ora();
52025
+ init_src();
52025
52026
  init_api_client();
52026
52027
  var CREDENTIAL_NAME_REGEX = /^[a-z0-9]+(-[a-z0-9]+)*$/;
52027
- var VALID_TYPES = ["api-key", "webhook-secret"];
52028
+ var VALID_TYPES = CredentialTypeSchema.options.filter((type) => type !== "oauth");
52028
52029
  async function createCreds(apiUrl, name, type, valueJson) {
52029
52030
  if (!name || name.length < 1 || name.length > 100) {
52030
52031
  throw new Error("Credential name must be 1-100 characters");
@@ -52044,6 +52045,8 @@ Note: OAuth credentials must be created through the Command Center UI`
52044
52045
  if (!valueJson) {
52045
52046
  throw new Error(
52046
52047
  `Credential value is required. Provide it with --value '{"apiKey":"sk-..."}'
52048
+ For a secret you do not want in shell history, write it to a file and pass
52049
+ --value @json:tmp/credential.json instead.
52047
52050
  Value must be a valid JSON object.`
52048
52051
  );
52049
52052
  }
@@ -52063,11 +52066,7 @@ Example: --value '{"apiKey":"sk-abc123"}'`
52063
52066
  throw new Error("Credential value must not be empty");
52064
52067
  }
52065
52068
  const spinner = ora("Creating credential...").start();
52066
- const result = await apiPost(
52067
- "/api/external/credentials",
52068
- { name, type, value },
52069
- apiUrl
52070
- );
52069
+ const result = await apiPost("/api/external/credentials", { name, type, value }, apiUrl);
52071
52070
  spinner.stop();
52072
52071
  console.log(source_default.green(`
52073
52072
  Credential created successfully!`));
@@ -52101,10 +52100,8 @@ Example: --value '{"apiKey":"sk-new-key"}'`
52101
52100
  const credential = data.credentials.find((c) => c.name === name);
52102
52101
  if (!credential) {
52103
52102
  spinner.stop();
52104
- throw new Error(
52105
- `Credential '${name}' not found.
52106
- Run "elevasis-sdk creds list" to see available credentials.`
52107
- );
52103
+ throw new Error(`Credential '${name}' not found.
52104
+ Run "elevasis-sdk creds list" to see available credentials.`);
52108
52105
  }
52109
52106
  await apiPatch(`/api/external/credentials/${credential.id}`, { value }, apiUrl);
52110
52107
  spinner.stop();
@@ -52199,21 +52196,31 @@ Credential '${name}' deleted successfully.`));
52199
52196
  // src/cli/commands/creds/creds.ts
52200
52197
  function registerCredsCommand(program3) {
52201
52198
  const creds = program3.command("creds").description("Manage organization credentials");
52202
- creds.command("list").description("List all credentials (metadata only, no secrets)").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API URL").option("--json", "Output as JSON").action(wrapAction("creds list", async (options) => {
52203
- await listCreds(resolveApiUrl(options.apiUrl, options.prod), options.json);
52204
- }));
52205
- creds.command("create").description("Create a new credential").requiredOption("--name <name>", "Credential name (lowercase, digits, hyphens)").requiredOption("--type <type>", "Credential type (api-key, webhook-secret)").option("--value <json>", "Credential value as JSON string").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API URL").action(wrapAction("creds create", async (options) => {
52206
- await createCreds(resolveApiUrl(options.apiUrl, options.prod), options.name, options.type, options.value);
52207
- }));
52208
- creds.command("update <name>").description("Update a credential value").requiredOption("--value <json>", "New credential value as JSON string").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API URL").action(wrapAction("creds update", async (name, options) => {
52209
- await updateCreds(resolveApiUrl(options.apiUrl, options.prod), name, options.value);
52210
- }));
52211
- creds.command("rename <name>").description("Rename a credential").requiredOption("--to <newName>", "New credential name").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API URL").action(wrapAction("creds rename", async (name, options) => {
52212
- await renameCreds(resolveApiUrl(options.apiUrl, options.prod), name, options.to);
52213
- }));
52214
- creds.command("delete <name>").description("Delete a credential").option("--force", "Skip confirmation prompt").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API URL").action(wrapAction("creds delete", async (name, options) => {
52215
- await deleteCreds(resolveApiUrl(options.apiUrl, options.prod), name, options.force);
52216
- }));
52199
+ creds.command("list").description("List all credentials (metadata only, no secrets)").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API URL").option("--json", "Output as JSON").action(
52200
+ wrapAction("creds list", async (options) => {
52201
+ await listCreds(resolveApiUrl(options.apiUrl, options.prod), options.json);
52202
+ })
52203
+ );
52204
+ creds.command("create").description("Create a new credential").requiredOption("--name <name>", "Credential name (lowercase, digits, hyphens)").requiredOption("--type <type>", "Credential type (api-key, webhook-secret, api-key-secret, clickup, instagram)").option("--value <json>", "Credential value as JSON string (or @json:<path> to read it from a file)").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API URL").action(
52205
+ wrapAction("creds create", async (options) => {
52206
+ await createCreds(resolveApiUrl(options.apiUrl, options.prod), options.name, options.type, options.value);
52207
+ })
52208
+ );
52209
+ creds.command("update <name>").description("Update a credential value").requiredOption("--value <json>", "New credential value as JSON string (or @json:<path> to read it from a file)").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API URL").action(
52210
+ wrapAction("creds update", async (name, options) => {
52211
+ await updateCreds(resolveApiUrl(options.apiUrl, options.prod), name, options.value);
52212
+ })
52213
+ );
52214
+ creds.command("rename <name>").description("Rename a credential").requiredOption("--to <newName>", "New credential name").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API URL").action(
52215
+ wrapAction("creds rename", async (name, options) => {
52216
+ await renameCreds(resolveApiUrl(options.apiUrl, options.prod), name, options.to);
52217
+ })
52218
+ );
52219
+ creds.command("delete <name>").description("Delete a credential").option("--force", "Skip confirmation prompt").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API URL").action(
52220
+ wrapAction("creds delete", async (name, options) => {
52221
+ await deleteCreds(resolveApiUrl(options.apiUrl, options.prod), name, options.force);
52222
+ })
52223
+ );
52217
52224
  }
52218
52225
 
52219
52226
  // src/cli/commands/error/error.ts
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { ActivityEventSchema, BuildPlanSnapshotStepSchema, ProspectingBuildTemplateSchema as BuildTemplateSchema, ContractRefResolutionError, CrmStageKeySchema, CrmStateKeySchema, EmailSchema, ExecutionError, ListBuilderStageKeySchema, ProcessingStageStatusSchema, RegistryValidationError, ResourceRegistry, StepType, ToolingError, bindResourceDescriptor, compileBusinessOntologyValidationIndex, concurrentPool, createLeadGenStageValidators, defineContract, defineResource, defineResourceOntology, defineResources, defineStep, defineTopology, defineTopologyRelationship, defineWorkflow, defineWorkflowConfig, deriveActions, diagnosticOutput, integrationInput, isBuiltInReadinessProfile, isZodType, lookupReadinessProfile, parseTopologyNodeRef, registerReadinessProfile, resolveContractRef, runDiagnostic, splitName, topologyRef, topologyRelationship, validateDeclaredSystemInterfaceReadiness, validateResourceGovernance } from './chunk-YJDXRHNP.js';
1
+ export { ActivityEventSchema, BuildPlanSnapshotStepSchema, ProspectingBuildTemplateSchema as BuildTemplateSchema, ContractRefResolutionError, CrmStageKeySchema, CrmStateKeySchema, EmailSchema, ExecutionError, ListBuilderStageKeySchema, ProcessingStageStatusSchema, RegistryValidationError, ResourceRegistry, StepType, ToolingError, bindResourceDescriptor, compileBusinessOntologyValidationIndex, concurrentPool, createLeadGenStageValidators, defineContract, defineResource, defineResourceOntology, defineResources, defineStep, defineTopology, defineTopologyRelationship, defineWorkflow, defineWorkflowConfig, deriveActions, diagnosticOutput, integrationInput, isBuiltInReadinessProfile, isZodType, lookupReadinessProfile, parseTopologyNodeRef, registerReadinessProfile, resolveContractRef, runDiagnostic, splitName, topologyRef, topologyRelationship, validateDeclaredSystemInterfaceReadiness, validateResourceGovernance } from './chunk-NNRXVYNC.js';
2
2
  export { projectDeploymentSpec, projectTopologyRelationships, toSdkResourceDescriptor, withPlatformAgentResourceDescriptor, withPlatformAgentResourceDescriptors, withPlatformIntegrationResourceDescriptor, withPlatformIntegrationResourceDescriptors, withPlatformResourceDescriptor, withPlatformResourceDescriptors } from './chunk-VYWGWJRW.js';
@@ -1,5 +1,5 @@
1
- import { executeWorkflow } from '../chunk-MGZZ4HL4.js';
2
- import { validateDeploymentSpec, validateRelationships } from '../chunk-YJDXRHNP.js';
1
+ import { executeWorkflow } from '../chunk-HIVK54X6.js';
2
+ import { validateDeploymentSpec, validateRelationships } from '../chunk-NNRXVYNC.js';
3
3
  import '../chunk-VYWGWJRW.js';
4
4
  import { vi } from 'vitest';
5
5
 
@@ -1,6 +1,20 @@
1
1
  import { AttioToolMap, ApifyToolMap, ClickUpToolMap, DropboxToolMap, GmailToolMap, GoogleSheetsToolMap, InstagramToolMap, InstantlyToolMap, MillionVerifierToolMap, AnymailfinderToolMap, TombaToolMap, ResendToolMap, SignatureApiToolMap, StripeToolMap, SchedulerToolMap, LLMGenerateRequest, LLMModel, LLMGenerateResponse, StorageToolMap, NotificationSDKInput, NotificationToolMap, LeadToolMap, ProjectsToolMap, CrmToolMap, ListToolMap, ArtifactsToolMap, ContentToolMap, PdfToolMap, ApprovalToolMap, ExecutionToolMap, EmailToolMap, WorkflowDefinition, WorkflowConfig, ListBuilderStep, LeadGenStageValidators, ResourceStatus, DeploymentSpec } from '@elevasis/sdk';
2
2
  import { z } from 'zod';
3
3
 
4
+ /**
5
+ * Platform Tool Proxy (Worker Side)
6
+ *
7
+ * Provides platform.call() for external developers to invoke platform tools
8
+ * from within worker threads. Communicates with the parent process via
9
+ * postMessage() -- the parent dispatches to the real service layer.
10
+ */
11
+ /** Token usage metadata returned for tool calls with cost accounting. */
12
+ interface TokenUsage {
13
+ inputTokens: number;
14
+ outputTokens: number;
15
+ cost?: number;
16
+ model?: string;
17
+ }
4
18
  /** Resolved credential returned by platform.getCredential() */
5
19
  interface PlatformCredential {
6
20
  provider: string;
@@ -34,6 +48,28 @@ declare const platform: {
34
48
  params?: unknown;
35
49
  credential?: string;
36
50
  }): Promise<unknown>;
51
+ /**
52
+ * Call a platform tool and also surface any `usage` (token/cost) metadata the parent attached
53
+ * to the response -- e.g. the `llm` tool's real provider usage from the API-side
54
+ * `dispatchToolCall` in `tool-dispatcher.ts`. Bare `result` is unchanged from `call()`; `usage` is `undefined` whenever the
55
+ * parent's response didn't carry one, exactly like today's `call()` behavior for that result.
56
+ *
57
+ * @param options.tool - Tool name (e.g., 'llm')
58
+ * @param options.method - Method name (e.g., 'generate')
59
+ * @param options.params - Method parameters
60
+ * @param options.credential - Credential name (required for integration tools)
61
+ * @returns Promise resolving to `{ result, usage }`
62
+ * @throws PlatformToolError on failure (with code and retryable fields)
63
+ */
64
+ callWithUsage(options: {
65
+ tool: string;
66
+ method: string;
67
+ params?: unknown;
68
+ credential?: string;
69
+ }): Promise<{
70
+ result: unknown;
71
+ usage?: TokenUsage;
72
+ }>;
37
73
  /**
38
74
  * Request raw credential access from the platform.
39
75
  *
@@ -1,3 +1,3 @@
1
- export { ListBuilderResultSchema, ListBuilderResultsSchema, PlatformToolError, acqDb, approval, artifacts, classifyPlatformToolError, content, createAdapter, createAnymailfinderAdapter, createApifyAdapter, createAttioAdapter, createCaptionGenerationWorkflow, createCaptureInstagramMetricsWorkflow, createClickUpAdapter, createDropboxAdapter, createGmailAdapter, createGoogleSheetsAdapter, createImageAnalysisWorkflow, createInstagramAdapter, createInstantlyAdapter, createMillionVerifierAdapter, createPublishInstagramWorkflow, createResendAdapter, createSignatureApiAdapter, createStripeAdapter, createTombaAdapter, crm, email, executeWorkflow, execution, generateHmacToken, list, listBuilderWorkflow, llm, notifications, pdf, platform, projects, scheduler, startWorker, storage, toContentMetrics } from '../chunk-MGZZ4HL4.js';
2
- import '../chunk-YJDXRHNP.js';
1
+ export { ListBuilderResultSchema, ListBuilderResultsSchema, PlatformToolError, acqDb, approval, artifacts, classifyPlatformToolError, content, createAdapter, createAnymailfinderAdapter, createApifyAdapter, createAttioAdapter, createCaptionGenerationWorkflow, createCaptureInstagramMetricsWorkflow, createClickUpAdapter, createDropboxAdapter, createGmailAdapter, createGoogleSheetsAdapter, createImageAnalysisWorkflow, createInstagramAdapter, createInstantlyAdapter, createMillionVerifierAdapter, createPublishInstagramWorkflow, createResendAdapter, createSignatureApiAdapter, createStripeAdapter, createTombaAdapter, crm, email, executeWorkflow, execution, generateHmacToken, list, listBuilderWorkflow, llm, notifications, pdf, platform, projects, scheduler, startWorker, storage, toContentMetrics } from '../chunk-HIVK54X6.js';
2
+ import '../chunk-NNRXVYNC.js';
3
3
  import '../chunk-VYWGWJRW.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elevasis/sdk",
3
- "version": "1.50.0",
3
+ "version": "1.51.0",
4
4
  "description": "SDK for building Elevasis organization resources",
5
5
  "type": "module",
6
6
  "bin": {
@@ -63,7 +63,7 @@
63
63
  "typescript": "5.9.2",
64
64
  "vitest": "^3.2.4",
65
65
  "zod": "^4.1.0",
66
- "@repo/core": "0.65.0",
66
+ "@repo/core": "0.67.0",
67
67
  "@repo/eslint-config": "0.0.0",
68
68
  "@repo/typescript-config": "0.0.0"
69
69
  },
@@ -31,10 +31,29 @@ import {
31
31
  type ReadinessProfileValidator,
32
32
  type ReadinessOntologyIndex,
33
33
  type ReadinessInterfaceMarkerResolver,
34
- type SystemInterfaceMarker
34
+ type SystemInterfaceMarker,
35
+ // What to do about a failure, shared by the API's 503 message and the UI alert
36
+ resolveReadinessRemedy,
37
+ describeReadinessFailure,
38
+ isResolutionIssue,
39
+ REDEPLOY_REMEDY,
40
+ RESOLUTION_ISSUE_CODES,
41
+ type ResolutionIssueCode
35
42
  } from '@elevasis/core/organization-model/readiness'
36
43
  ```
37
44
 
45
+ ## Remedies live here, not at each consumer
46
+
47
+ `remedies.ts` maps a readiness issue to the one sentence telling an operator what to do about it,
48
+ keyed exhaustively over the family union so a new family cannot be added without deciding its answer.
49
+ Both consumers read it: `createInterfaceReadinessApiError` builds the 503's message from
50
+ `describeReadinessFailure`, and `@repo/ui`'s `SystemReadinessAlert` renders `resolveReadinessRemedy`.
51
+
52
+ It keys on the issue's `code` before its `family` because the two can disagree.
53
+ `MODEL_PARSE_FAILED` arrives under `SYSTEM_INTERFACE_INVALID`, whose family-level answer is "fix your
54
+ declaration" — and the declaration is fine; the stored snapshot is what could not be read. Keying on
55
+ family alone is exactly the bug this module was extracted to prevent.
56
+
38
57
  This subpath exists so the extension point can be reached without pulling in the rest of `@elevasis/core`. It points at the same module workspace consumers import, deliberately — the two surfaces cannot drift apart.
39
58
 
40
59
  ## Layering constraint
@@ -520,7 +520,7 @@ Manage credentials for your organization. Credentials store API keys and secrets
520
520
 
521
521
  ```
522
522
  elevasis-sdk creds list
523
- elevasis-sdk creds create --name <name> --type <type> [--value <json>]
523
+ elevasis-sdk creds create --name <name> --type <type> --value <json>
524
524
  elevasis-sdk creds update <name> --value <json>
525
525
  elevasis-sdk creds rename <name> --to <newName>
526
526
  elevasis-sdk creds delete <name> [--force]
@@ -539,20 +539,33 @@ elevasis-sdk creds delete <name> [--force]
539
539
  | Flag | Description |
540
540
  | ----------------- | ------------------------------------------------------------------------------- |
541
541
  | `--name <name>` | Credential name: lowercase letters, digits, and hyphens only (create: required) |
542
- | `--type <type>` | Credential type: `api-key` or `webhook-secret` (create: required) |
542
+ | `--type <type>` | Credential type (create: required). See the table below |
543
543
  | `--value <json>` | Credential value as a JSON string (create and update: required) |
544
544
  | `--to <newName>` | New name (rename: required) |
545
545
  | `--force` | Skip confirmation prompt (delete) |
546
546
  | `--prod` | Target production (overrides `NODE_ENV=development`) |
547
547
  | `--api-url <url>` | Override the API base URL |
548
548
 
549
- OAuth credentials cannot be created through the CLI -- they require the Command Center's browser OAuth flow. See [Command Center](deployment/command-center.mdx#credentials).
549
+ **Keep long-lived secrets out of `--value`.** A value passed literally survives in shell history and in the transcript of whatever ran the command. Write the JSON to a file and pass `--value @json:tmp/credential.json` instead -- the `@json:` prefix works on any flag of any `elevasis-sdk` command, resolves relative paths against the project root, and expands inside the CLI process, so the secret never appears in the invocation. Delete the file afterwards.
550
+
551
+ **Credential types.** The accepted values are the platform's own `CredentialTypeSchema`, minus `oauth`:
552
+
553
+ | Type | Shape |
554
+ | ---------------- | -------------------------------------------------- |
555
+ | `api-key` | Single-field API key |
556
+ | `api-key-secret` | Key and secret pair |
557
+ | `webhook-secret` | Webhook signing secret |
558
+ | `clickup` | ClickUp personal token |
559
+ | `instagram` | `{ accessToken, igUserId }` for Content Publishing |
560
+
561
+ OAuth credentials cannot be created through the CLI -- they need a `provider`, which the external create route does not accept, and they require the Command Center's browser OAuth flow. See [Command Center](deployment/command-center.mdx#credentials).
550
562
 
551
563
  **Examples:**
552
564
 
553
565
  ```bash
554
566
  elevasis-sdk creds list
555
567
  elevasis-sdk creds create --name openai-key --type api-key --value '{"key":"sk-proj-***"}'
568
+ elevasis-sdk creds create --name my-instagram --type instagram --value @json:tmp/ig.json --prod
556
569
  elevasis-sdk creds update openai-key --value '{"key":"sk-proj-new"}'
557
570
  elevasis-sdk creds rename openai-key --to openai-prod-key
558
571
  elevasis-sdk creds delete openai-prod-key --force