@sapiom/agent
Advanced tools
| export interface ResolveResourceHandleOptions { | ||
| readonly fallback: string; | ||
| readonly key?: string; | ||
| } | ||
| export declare function resolveResourceHandle(input: unknown, opts: ResolveResourceHandleOptions): string; |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.resolveResourceHandle = resolveResourceHandle; | ||
| function resolveResourceHandle(input, opts) { | ||
| const key = opts.key ?? "dbHandle"; | ||
| if (input && typeof input === "object") { | ||
| const raw = input[key]; | ||
| if (typeof raw === "string") { | ||
| const trimmed = raw.trim(); | ||
| if (trimmed.length > 0) | ||
| return trimmed; | ||
| } | ||
| } | ||
| return opts.fallback; | ||
| } |
| export interface ResolveResourceHandleOptions { | ||
| readonly fallback: string; | ||
| readonly key?: string; | ||
| } | ||
| export declare function resolveResourceHandle(input: unknown, opts: ResolveResourceHandleOptions): string; |
| export function resolveResourceHandle(input, opts) { | ||
| const key = opts.key ?? "dbHandle"; | ||
| if (input && typeof input === "object") { | ||
| const raw = input[key]; | ||
| if (typeof raw === "string") { | ||
| const trimmed = raw.trim(); | ||
| if (trimmed.length > 0) | ||
| return trimmed; | ||
| } | ||
| } | ||
| return opts.fallback; | ||
| } |
+15
-0
| # @sapiom/orchestration | ||
| ## 0.8.0 | ||
| ### Minor Changes | ||
| - a1e0e4f: Add `resolveResourceHandle(input, { fallback, key? })` — the single seam a step reads its chosen resource handle from. | ||
| A template declares which managed resource it opens (its `resources[].handle` in `template.json`) and Sapiom provisions it at deploy, but that declaration is a build-time artifact that never reaches step code. Templates therefore hardcoded the handle (`const DEFAULT_DB_HANDLE = "…"`) and re-read it in every step, so the declared handle and the opened handle were two independent literals that could drift, and nothing let a run open a different one. | ||
| `resolveResourceHandle` reads the handle injected into the run's entry input — the seam the setup panel's settings (and, later, its "use my own" resource picker) drive — falling back to the code-side default that keeps a zero-setup run working. It is read-only and never throws, so it is safe to call from an entry step. This is the mechanism a declared / provisioned / picked handle flows through to become the one the run actually opens. | ||
| ### Patch Changes | ||
| - Updated dependencies [a1e0e4f] | ||
| - @sapiom/tools@0.24.0 | ||
| ## 0.7.1 | ||
@@ -4,0 +19,0 @@ |
@@ -12,2 +12,4 @@ export { DIRECTIVE_KIND, isContinue, isRetry, isPause, isTerminate, isFail } from './directives.js'; | ||
| export { AgentError, UnknownStepError, StepInputValidationError, DisallowedTransitionError } from './errors.js'; | ||
| export { resolveResourceHandle } from './config.js'; | ||
| export type { ResolveResourceHandleOptions } from './config.js'; | ||
| export { zodToJsonSchema, exampleFromJsonSchema, stepInputContract, workflowInputContract } from './introspection.js'; | ||
@@ -14,0 +16,0 @@ export type { StepInputContract, AgentInputContract } from './introspection.js'; |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.assertValidGraph = exports.validateGraph = exports.buildManifest = exports.agentManifestSchema = exports.MANIFEST_PROTOCOL = exports.workflowInputContract = exports.stepInputContract = exports.exampleFromJsonSchema = exports.zodToJsonSchema = exports.DisallowedTransitionError = exports.StepInputValidationError = exports.UnknownStepError = exports.AgentError = exports.LEGACY_ORCHESTRATION_DEFINITION_BRAND = exports.isLegacyOrchestrationDefinition = exports.AGENT_DEFINITION_BRAND = exports.isAgentDefinition = exports.defineAgent = exports.InMemoryContextStore = exports.defineStep = exports.retry = exports.pauseUntilSignal = exports.terminate = exports.goto = exports.isFail = exports.isTerminate = exports.isPause = exports.isRetry = exports.isContinue = exports.DIRECTIVE_KIND = void 0; | ||
| exports.assertValidGraph = exports.validateGraph = exports.buildManifest = exports.agentManifestSchema = exports.MANIFEST_PROTOCOL = exports.workflowInputContract = exports.stepInputContract = exports.exampleFromJsonSchema = exports.zodToJsonSchema = exports.resolveResourceHandle = exports.DisallowedTransitionError = exports.StepInputValidationError = exports.UnknownStepError = exports.AgentError = exports.LEGACY_ORCHESTRATION_DEFINITION_BRAND = exports.isLegacyOrchestrationDefinition = exports.AGENT_DEFINITION_BRAND = exports.isAgentDefinition = exports.defineAgent = exports.InMemoryContextStore = exports.defineStep = exports.retry = exports.pauseUntilSignal = exports.terminate = exports.goto = exports.isFail = exports.isTerminate = exports.isPause = exports.isRetry = exports.isContinue = exports.DIRECTIVE_KIND = void 0; | ||
| var directives_js_1 = require("./directives.js"); | ||
@@ -32,2 +32,4 @@ Object.defineProperty(exports, "DIRECTIVE_KIND", { enumerable: true, get: function () { return directives_js_1.DIRECTIVE_KIND; } }); | ||
| Object.defineProperty(exports, "DisallowedTransitionError", { enumerable: true, get: function () { return errors_js_1.DisallowedTransitionError; } }); | ||
| var config_js_1 = require("./config.js"); | ||
| Object.defineProperty(exports, "resolveResourceHandle", { enumerable: true, get: function () { return config_js_1.resolveResourceHandle; } }); | ||
| var introspection_js_1 = require("./introspection.js"); | ||
@@ -34,0 +36,0 @@ Object.defineProperty(exports, "zodToJsonSchema", { enumerable: true, get: function () { return introspection_js_1.zodToJsonSchema; } }); |
@@ -12,2 +12,4 @@ export { DIRECTIVE_KIND, isContinue, isRetry, isPause, isTerminate, isFail } from './directives.js'; | ||
| export { AgentError, UnknownStepError, StepInputValidationError, DisallowedTransitionError } from './errors.js'; | ||
| export { resolveResourceHandle } from './config.js'; | ||
| export type { ResolveResourceHandleOptions } from './config.js'; | ||
| export { zodToJsonSchema, exampleFromJsonSchema, stepInputContract, workflowInputContract } from './introspection.js'; | ||
@@ -14,0 +16,0 @@ export type { StepInputContract, AgentInputContract } from './introspection.js'; |
@@ -7,4 +7,5 @@ export { DIRECTIVE_KIND, isContinue, isRetry, isPause, isTerminate, isFail } from './directives.js'; | ||
| export { AgentError, UnknownStepError, StepInputValidationError, DisallowedTransitionError } from './errors.js'; | ||
| export { resolveResourceHandle } from './config.js'; | ||
| export { zodToJsonSchema, exampleFromJsonSchema, stepInputContract, workflowInputContract } from './introspection.js'; | ||
| export { MANIFEST_PROTOCOL, agentManifestSchema } from './manifest.js'; | ||
| export { buildManifest, validateGraph, assertValidGraph } from './build-manifest.js'; |
+2
-2
| { | ||
| "name": "@sapiom/agent", | ||
| "version": "0.7.1", | ||
| "version": "0.8.0", | ||
| "description": "Versioned public contract for authoring Sapiom agents: types, directive constructors/guards, defineAgent, defineStep, InMemoryContextStore. Shared by customer agent definitions, the sandbox step-runner, and the engine.", | ||
@@ -37,3 +37,3 @@ "license": "MIT", | ||
| "dependencies": { | ||
| "@sapiom/tools": "^0.23.0" | ||
| "@sapiom/tools": "^0.24.0" | ||
| }, | ||
@@ -40,0 +40,0 @@ "peerDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
193522
1.74%47
9.3%1632
2.84%+ Added
- Removed
Updated