@runtypelabs/sdk 11.0.1 → 11.3.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.
package/dist/index.mjs CHANGED
@@ -1,3 +1,28 @@
1
+ //#region src/sandbox-deployments-namespace.ts
2
+ /** Managed deployment authoring; acceptance records intent before the deployment becomes ready. */
3
+ var SandboxDeploymentsNamespace = class {
4
+ constructor(getClient) {
5
+ this.getClient = getClient;
6
+ }
7
+ runtimeProfiles() {
8
+ return this.getClient().get("/sandbox-deployments/runtime-profiles");
9
+ }
10
+ definition(id) {
11
+ return this.getClient().get(`/sandbox-deployments/${encodeURIComponent(id)}/definition`);
12
+ }
13
+ /** Use retained runtime and uploaded source IDs; the API resolves pins and authoring defaults. */
14
+ create(data, options) {
15
+ return this.getClient().post("/sandbox-deployments", data, { "Idempotency-Key": options.idempotencyKey });
16
+ }
17
+ /** Replace the complete config or spec without renewing retention. */
18
+ update(id, data, options) {
19
+ return this.getClient().put(`/sandbox-deployments/${encodeURIComponent(id)}`, data, {
20
+ "Idempotency-Key": options.idempotencyKey,
21
+ "If-Match": String(options.ifMatch)
22
+ });
23
+ }
24
+ };
25
+ //#endregion
1
26
  //#region src/unified-stream-adapter.ts
2
27
  /**
3
28
  * @deprecated Unified events are now the only public execution-stream format.
@@ -1303,6 +1328,7 @@ var FlowBuilder = class {
1303
1328
  recordFilter: config.recordFilter,
1304
1329
  limit: config.limit,
1305
1330
  onEmpty: config.onEmpty,
1331
+ errorHandling: config.errorHandling,
1306
1332
  fieldsToInclude: config.fieldsToInclude,
1307
1333
  fieldsToExclude: config.fieldsToExclude,
1308
1334
  availableFields: config.availableFields,
@@ -10466,6 +10492,7 @@ var RuntypeFlowBuilder = class {
10466
10492
  recordFilter: config.recordFilter,
10467
10493
  limit: config.limit,
10468
10494
  onEmpty: config.onEmpty,
10495
+ errorHandling: config.errorHandling,
10469
10496
  fieldsToInclude: config.fieldsToInclude,
10470
10497
  fieldsToExclude: config.fieldsToExclude,
10471
10498
  availableFields: config.availableFields,
@@ -14103,6 +14130,9 @@ var Runtype = class {
14103
14130
  static get surfaces() {
14104
14131
  return new SurfacesNamespace(() => this.getClient());
14105
14132
  }
14133
+ static get sandboxDeployments() {
14134
+ return new SandboxDeploymentsNamespace(() => this.getClient());
14135
+ }
14106
14136
  /**
14107
14137
  * Client tokens — publishable credentials for widgets. `ensure` finds a token
14108
14138
  * by name, creates it when missing, and converges its agents, flows, origins,
@@ -14486,6 +14516,85 @@ async function promoteAgent(input) {
14486
14516
  };
14487
14517
  }
14488
14518
  //#endregion
14519
+ //#region src/simulations-namespace.ts
14520
+ const segment = encodeURIComponent;
14521
+ /**
14522
+ * Simulations tool memory and future designs (`/v1/simulations`): recorded exchanges, tool profiles,
14523
+ * design previews, synthesis review, design briefs and run episodes. Pre-GA: the API answers 404 `SIMULATIONS_DISABLED`
14524
+ * where simulations are not available (production today).
14525
+ */
14526
+ var SimulationsEndpoint = class {
14527
+ constructor(client) {
14528
+ this.client = client;
14529
+ }
14530
+ /** Change a target's name, config or recording consent (`{ enabled, retentionDays }`). */
14531
+ async updateTarget(targetId, data) {
14532
+ return this.client.patch(`/simulations/targets/${segment(targetId)}`, data);
14533
+ }
14534
+ /** Save a variant's design; `validate: true` refuses it with 422 as run admission would. */
14535
+ async updateVariant(simulationId, variantId, data) {
14536
+ return this.client.patch(`/simulations/${segment(simulationId)}/variants/${segment(variantId)}`, data);
14537
+ }
14538
+ /** What Runtype learned about one tool of a target from its recorded answers. */
14539
+ async getToolProfile(targetId, tool) {
14540
+ return this.client.get(`/simulations/targets/${segment(targetId)}/tools/${segment(tool)}/profile`);
14541
+ }
14542
+ /** A target's recorded exchanges, newest first. */
14543
+ async listExchanges(targetId, params = {}) {
14544
+ const query = {};
14545
+ if (params.tool !== void 0) query.tool = params.tool;
14546
+ if (params.published !== void 0) query.published = String(params.published);
14547
+ if (params.limit !== void 0) query.limit = params.limit;
14548
+ if (params.cursor !== void 0) query.cursor = params.cursor;
14549
+ return this.client.get(`/simulations/targets/${segment(targetId)}/exchanges`, query);
14550
+ }
14551
+ /** Record calls your server answered outside a simulation, or backfill from transcripts or tool executions. */
14552
+ async uploadExchanges(targetId, data) {
14553
+ return this.client.post(`/simulations/targets/${segment(targetId)}/exchanges`, data);
14554
+ }
14555
+ /** Delete a target's recorded exchanges, or one tool's. */
14556
+ async purgeExchanges(targetId, options = {}) {
14557
+ const query = options.tool === void 0 ? "" : `?tool=${segment(options.tool)}`;
14558
+ return this.client.delete(`/simulations/targets/${segment(targetId)}/exchanges${query}`);
14559
+ }
14560
+ /** Answer one recorded exchange as published and as the variant's design answers it. */
14561
+ async previewVariant(simulationId, variantId, data) {
14562
+ return this.client.post(`/simulations/${segment(simulationId)}/variants/${segment(variantId)}/preview`, data);
14563
+ }
14564
+ /** Discard a run variant's frozen synthesized answers so its next run synthesizes again. */
14565
+ async resynthesizeVariant(runId, variantId) {
14566
+ return this.client.post(`/simulations/runs/${segment(runId)}/variants/${segment(variantId)}/resynthesize`);
14567
+ }
14568
+ /** Mark a synthesized answer plausible or implausible; `null` clears the review. */
14569
+ async reviewSynthesizedAnswer(runId, exchangeId, plausible) {
14570
+ return this.client.post(`/simulations/runs/${segment(runId)}/exchanges/${segment(exchangeId)}/review`, { plausible });
14571
+ }
14572
+ /** Export a run's future design as a Markdown brief; exporting again returns the same brief. */
14573
+ async exportDesignBrief(runId) {
14574
+ return this.client.post(`/simulations/runs/${segment(runId)}/design-brief`);
14575
+ }
14576
+ /** A simulation's exported briefs, with each operation's adoption state and the baseline since. */
14577
+ async listDesignBriefs(simulationId) {
14578
+ return this.client.get(`/simulations/${segment(simulationId)}/design-briefs`);
14579
+ }
14580
+ /** A run's episodes with status, error, turns, tool calls and served-by; filter `status: 'failed'` to debug. */
14581
+ async listEpisodes(runId, params = {}) {
14582
+ const query = {};
14583
+ if (params.status !== void 0) query.status = params.status;
14584
+ if (params.passed !== void 0) query.passed = String(params.passed);
14585
+ if (params.variantId !== void 0) query.variantId = params.variantId;
14586
+ if (params.simulatedUserId !== void 0) query.simulatedUserId = params.simulatedUserId;
14587
+ if (params.taskId !== void 0) query.taskId = params.taskId;
14588
+ if (params.limit !== void 0) query.limit = params.limit;
14589
+ if (params.cursor !== void 0) query.cursor = params.cursor;
14590
+ return this.client.get(`/simulations/runs/${segment(runId)}/episodes`, query);
14591
+ }
14592
+ /** One episode with its transcript, grader scores and per-turn layer facts: why it failed or surprised. */
14593
+ async getEpisode(runId, episodeId) {
14594
+ return this.client.get(`/simulations/runs/${segment(runId)}/episodes/${segment(episodeId)}`);
14595
+ }
14596
+ };
14597
+ //#endregion
14489
14598
  //#region src/transform.ts
14490
14599
  /**
14491
14600
  * Transform URL query parameters
@@ -14500,7 +14609,7 @@ function transformQueryParams(params) {
14500
14609
  }
14501
14610
  //#endregion
14502
14611
  //#region src/version.ts
14503
- const SDK_VERSION = "11.0.1";
14612
+ const SDK_VERSION = "11.3.0";
14504
14613
  /**
14505
14614
  * Canonical client identity the API uses for attribution
14506
14615
  * (`detectActorSource` in apps/api/src/lib/audit-log.ts keys `'sdk'` off the
@@ -14552,6 +14661,7 @@ var RuntypeClient = class {
14552
14661
  ...config.headers || {}
14553
14662
  };
14554
14663
  if (config.apiKey) this.headers.Authorization = `Bearer ${config.apiKey}`;
14664
+ this.sandboxDeployments = new SandboxDeploymentsNamespace(() => this);
14555
14665
  this.flows = new FlowsEndpoint(this);
14556
14666
  this.prompts = new PromptsEndpoint(this);
14557
14667
  this.records = new RecordsEndpoint(this);
@@ -14579,6 +14689,7 @@ var RuntypeClient = class {
14579
14689
  this.flowVersions = new FlowVersionsEndpoint(this);
14580
14690
  this.integrations = new IntegrationsEndpoint(this);
14581
14691
  this.billing = new BillingEndpoint(this);
14692
+ this.simulations = new SimulationsEndpoint(this);
14582
14693
  this.toolApprovalGrants = new ToolApprovalGrantsEndpoint(this);
14583
14694
  }
14584
14695
  /**
@@ -15929,6 +16040,10 @@ const STEP_FIELD_REGISTRY = {
15929
16040
  format: "json",
15930
16041
  skipDefault: "succeed"
15931
16042
  },
16043
+ {
16044
+ key: "errorHandling",
16045
+ format: "value"
16046
+ },
15932
16047
  {
15933
16048
  key: "fieldsToInclude",
15934
16049
  format: "json"
@@ -16712,5 +16827,5 @@ const STEP_TYPE_TO_METHOD = {
16712
16827
  "memory-summary": "memorySummary"
16713
16828
  };
16714
16829
  //#endregion
16715
- export { AgentAliasDependencyError, AgentAliasNotFoundError, AgentAliasRevisionMismatchError, AgentAliasRevisionRequiredError, AgentAliasesNamespace, AgentDeploymentsNamespace, AgentDriftError, AgentEnsureConflictError, AgentPromotionError, AgentVersionsEndpoint, AgentsEndpoint, AgentsNamespace, AnalyticsEndpoint, ApiKeyRequestsEndpoint, ApiKeysEndpoint, BatchBuilder, BatchesNamespace, BillingEndpoint, ChatEndpoint, ClientBatchBuilder, ClientEvalBuilder, ClientFlowBuilder, ClientTokenDriftError, ClientTokenEnsureError, ClientTokensEndpoint, ClientTokensNamespace, CollectionDriftError, CollectionEnsureConflictError, CollectionsEndpoint, ContextTemplatesEndpoint, ConversationsEndpoint, DEFAULT_MAX_DETACHED_RECONNECTS, DEFAULT_RECOVERY_AFTER_EMPTY_SESSIONS, DEFAULT_STALL_STOP_AFTER, DispatchEndpoint, ENSURE_RELEASE_DEPLOY_CONFLICT_MESSAGE, EvalBuilder, EvalDriftError, EvalEndpoint, EvalEnsureConflictError, EvalRunner, EvalSuitesNamespace, EvalsNamespace, ExecutionsEndpoint, ExecutionsNamespace, FlowBuilder, FlowDriftError, FlowEnsureConflictError, FlowResult, FlowStepsEndpoint, FlowVersionsEndpoint, FlowsEndpoint, FlowsNamespace, FpoDriftError, IntegrationsEndpoint, LEDGER_ARTIFACT_LINE_PREFIX, LIVE_AGENT_ALIAS, LogsEndpoint, ModelConfigsEndpoint, ProductDriftError, ProductEnsureConflictError, ProductsNamespace, PromptsEndpoint, PromptsNamespace, ProviderKeysEndpoint, QuestionSetDriftError, QuestionSetEnsureConflictError, QuestionSetsNamespace, RUNTYPE_CLIENT_KIND, RecordsEndpoint, RunsNamespace, Runtype, RuntypeApiError, RuntypeClient, RuntypeFlowBuilder, SDK_USER_AGENT, SDK_VERSION, STEP_FIELD_REGISTRY, STEP_TYPE_TO_METHOD, ScheduleDriftError, ScheduleEnsureConflictError, SchedulesEndpoint, SecretsEndpoint, SkillDriftError, SkillEnsureConflictError, SkillProposalsNamespace, SkillsNamespace, SurfaceDriftError, SurfaceEnsureConflictError, SurfacesEndpoint, SurfacesNamespace, ToolApprovalGrantsEndpoint, ToolDriftError, ToolEnsureConflictError, ToolsEndpoint, ToolsNamespace, TypedRecordsScope, UNIFIED_EVENTS_QUERY, UsersEndpoint, activateAgentPromotion, agentAliasErrorCode, applyGeneratedRuntimeToolProposalToDispatchRequest, attachRuntimeToolsToDispatchRequest, buildAgentAdmissionHeaders, buildEmptySessionNudge, buildExecutionEventsPath, buildGeneratedRuntimeToolGateOutput, buildLedgerOffloadReference, buildObservationMaskMarker, buildPolicyGuidance, buildSendViewOffloadMarker, calledTool, combineAbortSignals, compileWorkflowConfig, completed, computeAgentContentHash, computeEvalContentHash, computeFlowContentHash, computeFpoContentHash, computeProductContentHash, computeQuestionSetContentHash, computeRecordCollectionContentHash, computeScheduleContentHash, computeScheduleDefinitionHash, computeSkillContentHash, computeSurfaceContentHash, computeToolContentHash, contains, cost, createA2AHandler, createAgentEventTranslator, createClient, createExternalTool, createFlowEventTranslator, defaultWorkflow, defaultWorkflowConfig, defineAgent, defineEval, defineFlow, defineFpo, definePlaybook, defineProduct, defineQuestionSet, defineSchedule, defineSkill, defineSurface, defineTool, deployWorkflow, ensureDefaultWorkflowHooks, ensureEval, ensureFpo, ensureSchedule, evaluateGeneratedRuntimeToolProposal, extractDeclaredToolResultChars, fpoPlanHasDrift, gameWorkflow, getDefaultPlanPath, getLikelySupportingCandidatePaths, interpolateWorkflowTemplate, isBuiltinToolExecuteResponse, isCatalogClientToolRef, isDiscoveryToolName, isMarathonArtifactPath, isPreservationSensitiveTask, isUnifiedEventType, isWorkflowHookRef, jsonField, judge, judges, latency, length, listWorkflowHooks, matchesExpected, maxToolCalls, noError, normalizeAgentDefinition, normalizeCandidatePath, normalizeFpoDefinition, normalizeProductDefinition, normalizeQuestionSetDefinition, normalizeRecordCollectionDefinition, normalizeScheduleContent, normalizeSkillDefinition, normalizeSurfaceDefinition, normalizeToolDefinition, notCalledTool, notContains, parseFinalBuffer, parseLedgerArtifactRelativePath, parseOffloadedOutputId, parseSSEChunk, prepareAgentPromotion, processStream, promoteAgent, promotionIdempotencyKey, pullEval, pullFpo, pullSchedule, ranStep, regex, registerWorkflowHook, resolveStallStopAfter, resolveWorkflowHook, runEvalSuite, sanitizeTaskSlug, shouldInjectEmptySessionNudge, shouldRequestModelEscalation, stepOrder, streamEvents, toolOrder, unregisterWorkflowHook, usedNoTools, validJson, validateAgentPromotion, withDetachedReconnect, withUnifiedEvents };
16830
+ export { AgentAliasDependencyError, AgentAliasNotFoundError, AgentAliasRevisionMismatchError, AgentAliasRevisionRequiredError, AgentAliasesNamespace, AgentDeploymentsNamespace, AgentDriftError, AgentEnsureConflictError, AgentPromotionError, AgentVersionsEndpoint, AgentsEndpoint, AgentsNamespace, AnalyticsEndpoint, ApiKeyRequestsEndpoint, ApiKeysEndpoint, BatchBuilder, BatchesNamespace, BillingEndpoint, ChatEndpoint, ClientBatchBuilder, ClientEvalBuilder, ClientFlowBuilder, ClientTokenDriftError, ClientTokenEnsureError, ClientTokensEndpoint, ClientTokensNamespace, CollectionDriftError, CollectionEnsureConflictError, CollectionsEndpoint, ContextTemplatesEndpoint, ConversationsEndpoint, DEFAULT_MAX_DETACHED_RECONNECTS, DEFAULT_RECOVERY_AFTER_EMPTY_SESSIONS, DEFAULT_STALL_STOP_AFTER, DispatchEndpoint, ENSURE_RELEASE_DEPLOY_CONFLICT_MESSAGE, EvalBuilder, EvalDriftError, EvalEndpoint, EvalEnsureConflictError, EvalRunner, EvalSuitesNamespace, EvalsNamespace, ExecutionsEndpoint, ExecutionsNamespace, FlowBuilder, FlowDriftError, FlowEnsureConflictError, FlowResult, FlowStepsEndpoint, FlowVersionsEndpoint, FlowsEndpoint, FlowsNamespace, FpoDriftError, IntegrationsEndpoint, LEDGER_ARTIFACT_LINE_PREFIX, LIVE_AGENT_ALIAS, LogsEndpoint, ModelConfigsEndpoint, ProductDriftError, ProductEnsureConflictError, ProductsNamespace, PromptsEndpoint, PromptsNamespace, ProviderKeysEndpoint, QuestionSetDriftError, QuestionSetEnsureConflictError, QuestionSetsNamespace, RUNTYPE_CLIENT_KIND, RecordsEndpoint, RunsNamespace, Runtype, RuntypeApiError, RuntypeClient, RuntypeFlowBuilder, SDK_USER_AGENT, SDK_VERSION, STEP_FIELD_REGISTRY, STEP_TYPE_TO_METHOD, SandboxDeploymentsNamespace, ScheduleDriftError, ScheduleEnsureConflictError, SchedulesEndpoint, SecretsEndpoint, SimulationsEndpoint, SkillDriftError, SkillEnsureConflictError, SkillProposalsNamespace, SkillsNamespace, SurfaceDriftError, SurfaceEnsureConflictError, SurfacesEndpoint, SurfacesNamespace, ToolApprovalGrantsEndpoint, ToolDriftError, ToolEnsureConflictError, ToolsEndpoint, ToolsNamespace, TypedRecordsScope, UNIFIED_EVENTS_QUERY, UsersEndpoint, activateAgentPromotion, agentAliasErrorCode, applyGeneratedRuntimeToolProposalToDispatchRequest, attachRuntimeToolsToDispatchRequest, buildAgentAdmissionHeaders, buildEmptySessionNudge, buildExecutionEventsPath, buildGeneratedRuntimeToolGateOutput, buildLedgerOffloadReference, buildObservationMaskMarker, buildPolicyGuidance, buildSendViewOffloadMarker, calledTool, combineAbortSignals, compileWorkflowConfig, completed, computeAgentContentHash, computeEvalContentHash, computeFlowContentHash, computeFpoContentHash, computeProductContentHash, computeQuestionSetContentHash, computeRecordCollectionContentHash, computeScheduleContentHash, computeScheduleDefinitionHash, computeSkillContentHash, computeSurfaceContentHash, computeToolContentHash, contains, cost, createA2AHandler, createAgentEventTranslator, createClient, createExternalTool, createFlowEventTranslator, defaultWorkflow, defaultWorkflowConfig, defineAgent, defineEval, defineFlow, defineFpo, definePlaybook, defineProduct, defineQuestionSet, defineSchedule, defineSkill, defineSurface, defineTool, deployWorkflow, ensureDefaultWorkflowHooks, ensureEval, ensureFpo, ensureSchedule, evaluateGeneratedRuntimeToolProposal, extractDeclaredToolResultChars, fpoPlanHasDrift, gameWorkflow, getDefaultPlanPath, getLikelySupportingCandidatePaths, interpolateWorkflowTemplate, isBuiltinToolExecuteResponse, isCatalogClientToolRef, isDiscoveryToolName, isMarathonArtifactPath, isPreservationSensitiveTask, isUnifiedEventType, isWorkflowHookRef, jsonField, judge, judges, latency, length, listWorkflowHooks, matchesExpected, maxToolCalls, noError, normalizeAgentDefinition, normalizeCandidatePath, normalizeFpoDefinition, normalizeProductDefinition, normalizeQuestionSetDefinition, normalizeRecordCollectionDefinition, normalizeScheduleContent, normalizeSkillDefinition, normalizeSurfaceDefinition, normalizeToolDefinition, notCalledTool, notContains, parseFinalBuffer, parseLedgerArtifactRelativePath, parseOffloadedOutputId, parseSSEChunk, prepareAgentPromotion, processStream, promoteAgent, promotionIdempotencyKey, pullEval, pullFpo, pullSchedule, ranStep, regex, registerWorkflowHook, resolveStallStopAfter, resolveWorkflowHook, runEvalSuite, sanitizeTaskSlug, shouldInjectEmptySessionNudge, shouldRequestModelEscalation, stepOrder, streamEvents, toolOrder, unregisterWorkflowHook, usedNoTools, validJson, validateAgentPromotion, withDetachedReconnect, withUnifiedEvents };
16716
16831
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runtypelabs/sdk",
3
- "version": "11.0.1",
3
+ "version": "11.3.0",
4
4
  "type": "module",
5
5
  "description": "TypeScript SDK for the Runtype API with fluent methods. Use it to quickly realize AI products, agents, and workflows.",
6
6
  "main": "dist/index.cjs",
@@ -24,7 +24,7 @@
24
24
  ],
25
25
  "dependencies": {},
26
26
  "devDependencies": {
27
- "@runtypelabs/shared": "3.86.0",
27
+ "@runtypelabs/shared": "3.89.0",
28
28
  "openapi-typescript": "^7.13.0",
29
29
  "tsdown": "^0.23.0",
30
30
  "typescript": "^6.0.3",