@positronic/core 0.0.55 → 0.0.57

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.
Files changed (60) hide show
  1. package/dist/src/dsl/agent-messages.js +4 -75
  2. package/dist/src/dsl/brain-runner.js +131 -47
  3. package/dist/src/dsl/brain-state-machine.js +318 -482
  4. package/dist/src/dsl/builder/brain.js +35 -1
  5. package/dist/src/dsl/constants.js +14 -2
  6. package/dist/src/dsl/create-brain.js +4 -1
  7. package/dist/src/dsl/execution/constants.js +2 -2
  8. package/dist/src/dsl/execution/event-stream.js +837 -272
  9. package/dist/src/dsl/signal-validation.js +157 -0
  10. package/dist/src/dsl/types.js +2 -2
  11. package/dist/src/index.js +5 -2
  12. package/dist/src/memory/scoped-memory.js +176 -0
  13. package/dist/src/memory/types.js +12 -0
  14. package/dist/src/tools/index.js +150 -47
  15. package/dist/src/ui/generate-ui.js +6 -3
  16. package/dist/src/yaml/data-validator.js +195 -0
  17. package/dist/types/clients/types.d.ts +39 -2
  18. package/dist/types/clients/types.d.ts.map +1 -1
  19. package/dist/types/dsl/agent-messages.d.ts +8 -14
  20. package/dist/types/dsl/agent-messages.d.ts.map +1 -1
  21. package/dist/types/dsl/brain-runner.d.ts +27 -7
  22. package/dist/types/dsl/brain-runner.d.ts.map +1 -1
  23. package/dist/types/dsl/brain-state-machine.d.ts +92 -23
  24. package/dist/types/dsl/brain-state-machine.d.ts.map +1 -1
  25. package/dist/types/dsl/brain.d.ts +2 -2
  26. package/dist/types/dsl/brain.d.ts.map +1 -1
  27. package/dist/types/dsl/builder/brain.d.ts +56 -35
  28. package/dist/types/dsl/builder/brain.d.ts.map +1 -1
  29. package/dist/types/dsl/constants.d.ts +8 -0
  30. package/dist/types/dsl/constants.d.ts.map +1 -1
  31. package/dist/types/dsl/create-brain.d.ts +17 -17
  32. package/dist/types/dsl/create-brain.d.ts.map +1 -1
  33. package/dist/types/dsl/definitions/blocks.d.ts +3 -3
  34. package/dist/types/dsl/definitions/blocks.d.ts.map +1 -1
  35. package/dist/types/dsl/definitions/events.d.ts +40 -3
  36. package/dist/types/dsl/definitions/events.d.ts.map +1 -1
  37. package/dist/types/dsl/definitions/run-params.d.ts +17 -9
  38. package/dist/types/dsl/definitions/run-params.d.ts.map +1 -1
  39. package/dist/types/dsl/execution/constants.d.ts +2 -2
  40. package/dist/types/dsl/execution/constants.d.ts.map +1 -1
  41. package/dist/types/dsl/execution/event-stream.d.ts +12 -5
  42. package/dist/types/dsl/execution/event-stream.d.ts.map +1 -1
  43. package/dist/types/dsl/signal-validation.d.ts +36 -0
  44. package/dist/types/dsl/signal-validation.d.ts.map +1 -0
  45. package/dist/types/dsl/types.d.ts +91 -2
  46. package/dist/types/dsl/types.d.ts.map +1 -1
  47. package/dist/types/index.d.ts +12 -7
  48. package/dist/types/index.d.ts.map +1 -1
  49. package/dist/types/memory/scoped-memory.d.ts +22 -0
  50. package/dist/types/memory/scoped-memory.d.ts.map +1 -0
  51. package/dist/types/memory/types.d.ts +106 -0
  52. package/dist/types/memory/types.d.ts.map +1 -0
  53. package/dist/types/tools/index.d.ts +101 -32
  54. package/dist/types/tools/index.d.ts.map +1 -1
  55. package/dist/types/ui/generate-ui.d.ts.map +1 -1
  56. package/dist/types/yaml/data-validator.d.ts +27 -1
  57. package/dist/types/yaml/data-validator.d.ts.map +1 -1
  58. package/dist/types/yaml/types.d.ts +10 -0
  59. package/dist/types/yaml/types.d.ts.map +1 -1
  60. package/package.json +1 -1
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Machine state definition structure.
3
+ * This matches the structure returned by robot3 createMachine.
4
+ */
5
+ export interface MachineStateDefinition {
6
+ states: Record<string, {
7
+ transitions: Map<string, unknown>;
8
+ }>;
9
+ }
10
+ /**
11
+ * Result of signal validation.
12
+ */
13
+ export interface SignalValidationResult {
14
+ valid: boolean;
15
+ reason?: string;
16
+ }
17
+ /**
18
+ * Check if a signal is valid for the current brain state.
19
+ * Uses the state machine definition as the source of truth.
20
+ *
21
+ * @param machineDefinition - The state machine definition with states and transitions
22
+ * @param brainStatus - The current brain status (e.g., 'running', 'paused', 'complete')
23
+ * @param signalType - The signal type to validate (e.g., 'PAUSE', 'KILL', 'RESUME')
24
+ * @returns Validation result with valid flag and optional reason for rejection
25
+ */
26
+ export declare function isSignalValid(machineDefinition: MachineStateDefinition, brainStatus: string, signalType: string): SignalValidationResult;
27
+ /**
28
+ * Get the list of valid signals for a given brain status.
29
+ * Useful for debugging and for providing user feedback.
30
+ *
31
+ * @param machineDefinition - The state machine definition with states and transitions
32
+ * @param brainStatus - The current brain status
33
+ * @returns Array of valid signal types
34
+ */
35
+ export declare function getValidSignals(machineDefinition: MachineStateDefinition, brainStatus: string): string[];
36
+ //# sourceMappingURL=signal-validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signal-validation.d.ts","sourceRoot":"","sources":["../../../src/dsl/signal-validation.ts"],"names":[],"mappings":"AA8BA;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC,CAAC;CAC/D;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAC3B,iBAAiB,EAAE,sBAAsB,EACzC,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,GACjB,sBAAsB,CAyBxB;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,iBAAiB,EAAE,sBAAsB,EACzC,WAAW,EAAE,MAAM,GAClB,MAAM,EAAE,CAmBV"}
@@ -53,6 +53,39 @@ export type JsonPatch = {
53
53
  export interface AgentToolWaitFor {
54
54
  waitFor: WebhookRegistration<z.ZodSchema> | WebhookRegistration<z.ZodSchema>[];
55
55
  }
56
+ /**
57
+ * Context passed to step actions, agent config functions, and tool execute functions.
58
+ * This is the same context available throughout brain execution.
59
+ *
60
+ * Generic parameters allow type-safe access to state, options, response, and page.
61
+ * For tools (which are defined statically), use the non-generic defaults.
62
+ */
63
+ export interface StepContext<TState = object, TOptions = JsonObject, TResponse = JsonObject | undefined, TPage = import('./definitions/brain-types.js').GeneratedPage | undefined> {
64
+ /** Current brain state */
65
+ state: TState;
66
+ /** Brain options */
67
+ options: TOptions;
68
+ /** The LLM client for making AI calls */
69
+ client: import('../clients/types.js').ObjectGenerator;
70
+ /** Resource loader for accessing brain resources */
71
+ resources: import('../resources/resources.js').Resources;
72
+ /** Webhook response data (when resuming after a webhook) */
73
+ response: TResponse;
74
+ /** Generated page from a previous UI step */
75
+ page: TPage;
76
+ /** Page service for creating UI pages */
77
+ pages?: import('./pages.js').PagesService;
78
+ /** Runtime environment (origin, secrets) */
79
+ env: RuntimeEnv;
80
+ /** UI components available for generateUI */
81
+ components?: Record<string, import('../ui/types.js').UIComponent<any>>;
82
+ /** Current brain run ID (for creating unique webhook identifiers) */
83
+ brainRunId: string;
84
+ /** Current step ID (for creating unique webhook identifiers) */
85
+ stepId: string;
86
+ /** Scoped memory for storing and retrieving long-term memories */
87
+ memory?: import('../memory/types.js').ScopedMemory;
88
+ }
56
89
  /**
57
90
  * A tool definition for use in agent steps.
58
91
  * Compatible with Vercel AI SDK tool format, extended with Positronic-specific properties.
@@ -66,18 +99,31 @@ export interface AgentTool<TInput extends z.ZodSchema = z.ZodSchema> {
66
99
  * Execute function for the tool.
67
100
  * Can return a result directly, or { waitFor: webhook(...) } to suspend execution.
68
101
  * Not required for terminal tools.
102
+ * @param input - The validated input from the LLM
103
+ * @param context - Runtime context with access to client, pages, state, etc.
69
104
  */
70
- execute?: (input: z.infer<TInput>) => Promise<unknown | AgentToolWaitFor> | unknown | AgentToolWaitFor;
105
+ execute?: (input: z.infer<TInput>, context: StepContext) => Promise<unknown | AgentToolWaitFor> | unknown | AgentToolWaitFor;
71
106
  /**
72
107
  * If true, calling this tool ends the agent.
73
108
  * The tool's input becomes the agent result (merged into state).
74
109
  */
75
110
  terminal?: boolean;
76
111
  }
112
+ /**
113
+ * Configuration for agent output schema.
114
+ * When provided, generates a terminal tool from the schema and
115
+ * namespaces the result in state under the specified key.
116
+ */
117
+ export interface AgentOutputSchema<TSchema extends z.ZodObject<any> = z.ZodObject<any>, TName extends string = string> {
118
+ /** Zod schema defining the agent's output structure */
119
+ schema: TSchema;
120
+ /** Key name to store the result under in state (use `as const` for type inference) */
121
+ name: TName;
122
+ }
77
123
  /**
78
124
  * Configuration for an agent step.
79
125
  */
80
- export interface AgentConfig<TTools extends Record<string, AgentTool> = Record<string, AgentTool>> {
126
+ export interface AgentConfig<TTools extends Record<string, AgentTool> = Record<string, AgentTool>, TOutputSchema extends AgentOutputSchema | undefined = undefined> {
81
127
  /** System prompt for the LLM */
82
128
  system?: string;
83
129
  /** Initial user prompt to start the conversation. If omitted, uses "Begin." */
@@ -86,6 +132,14 @@ export interface AgentConfig<TTools extends Record<string, AgentTool> = Record<s
86
132
  tools?: TTools;
87
133
  /** Safety valve - exit if cumulative tokens exceed this limit */
88
134
  maxTokens?: number;
135
+ /** Maximum number of agent loop iterations. Default: 100 */
136
+ maxIterations?: number;
137
+ /**
138
+ * Output schema for structured agent output.
139
+ * When provided, generates a terminal tool that validates output against the schema
140
+ * and stores the result under state[outputSchema.name].
141
+ */
142
+ outputSchema?: TOutputSchema;
89
143
  }
90
144
  /**
91
145
  * Represents a single message in the agent conversation.
@@ -122,4 +176,39 @@ export interface RetryConfig {
122
176
  /** Maximum delay in ms between retries. Default: 30000 */
123
177
  maxDelay?: number;
124
178
  }
179
+ /**
180
+ * Signal types that can be sent to a running brain.
181
+ * Signals are processed in priority order: KILL > PAUSE > WEBHOOK_RESPONSE > RESUME > USER_MESSAGE
182
+ */
183
+ export type SignalType = 'KILL' | 'PAUSE' | 'USER_MESSAGE' | 'RESUME' | 'WEBHOOK_RESPONSE';
184
+ /**
185
+ * A signal that can be injected into a running brain's execution.
186
+ */
187
+ export type BrainSignal = {
188
+ type: 'KILL';
189
+ } | {
190
+ type: 'PAUSE';
191
+ } | {
192
+ type: 'USER_MESSAGE';
193
+ content: string;
194
+ } | {
195
+ type: 'RESUME';
196
+ } | {
197
+ type: 'WEBHOOK_RESPONSE';
198
+ response: JsonObject;
199
+ };
200
+ /**
201
+ * Interface for providing signals to a running brain.
202
+ * Implementations are backend-specific (in-memory, database, KV store, etc.)
203
+ */
204
+ export interface SignalProvider {
205
+ /**
206
+ * Get pending signals for the current brain run.
207
+ * Signals should be consumed (deleted) when returned.
208
+ *
209
+ * @param filter - 'CONTROL' returns only KILL/PAUSE, 'WEBHOOK' returns only WEBHOOK_RESPONSE, 'ALL' includes all signal types
210
+ * @returns Array of signals in priority order (KILL first, then PAUSE, then WEBHOOK_RESPONSE, then RESUME, then USER_MESSAGE)
211
+ */
212
+ getSignals(filter: 'CONTROL' | 'WEBHOOK' | 'ALL'): Promise<BrainSignal[]>;
213
+ }
125
214
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/dsl/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAExD,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAC7D,MAAM,MAAM,SAAS,GAAG,SAAS,EAAE,CAAC;AACpC,MAAM,MAAM,UAAU,GAAG;KAAG,GAAG,IAAI,MAAM,CAAC,CAAC,EAAE,SAAS;CAAE,CAAC;AACzD,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,SAAS,GAAG,UAAU,CAAC;AAE/D;;;;;;GAMG;AACH,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC;AAE3B;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AAQ,GAAG,aAAa,CAAC;IAC5C,4DAA4D;IAC5D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAID;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,OAAO,GAAG,cAAc,GAAG,QAAQ,GAAG,kBAAkB,CAAC;AAE3F;;GAEG;AACH,MAAM,MAAM,WAAW,GACnB;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GACjB;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACzC;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,GAClB;IAAE,IAAI,EAAE,kBAAkB,CAAC;IAAC,QAAQ,EAAE,UAAU,CAAA;CAAE,CAAC;AAEvD;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;;OAMG;IACH,UAAU,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,KAAK,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;CAC3E"}
@@ -4,9 +4,9 @@ export { createBrain } from './dsl/create-brain.js';
4
4
  export type { CreateBrainConfig } from './dsl/create-brain.js';
5
5
  export { STATUS, BRAIN_EVENTS } from './dsl/constants.js';
6
6
  export type { Adapter } from './adapters/types.js';
7
- export type { BrainEvent, SerializedStep, InitialRunParams, RerunParams, BrainStartEvent, BrainCompleteEvent, BrainErrorEvent, StepStatusEvent, StepStartedEvent, StepCompletedEvent, StepRetryEvent, BrainStructure, BrainConfig, GeneratedPage, } from './dsl/brain.js';
8
- export type { ObjectGenerator, Message, ToolMessage } from './clients/types.js';
9
- export type { State, RuntimeEnv, Secrets, AgentTool, AgentConfig, AgentMessage, AgentToolWaitFor, ExtractTerminalInput, RetryConfig, } from './dsl/types.js';
7
+ export type { BrainEvent, SerializedStep, InitialRunParams, ResumeRunParams, ResumeContext, BrainStartEvent, BrainCompleteEvent, BrainErrorEvent, StepStatusEvent, StepStartedEvent, StepCompletedEvent, StepRetryEvent, BrainStructure, BrainConfig, GeneratedPage, } from './dsl/brain.js';
8
+ export type { ObjectGenerator, Message, ToolMessage, ToolCall, ResponseMessage } from './clients/types.js';
9
+ export type { State, RuntimeEnv, Secrets, AgentTool, AgentConfig, AgentOutputSchema, AgentMessage, AgentToolWaitFor, StepContext, ExtractTerminalInput, RetryConfig, SignalType, BrainSignal, SignalProvider, } from './dsl/types.js';
10
10
  export { applyPatches } from './dsl/json-patch.js';
11
11
  export { z } from 'zod';
12
12
  export type { ResourceLoader } from './resources/resource-loader.js';
@@ -16,9 +16,14 @@ export type { WebhookFunction, WebhookRegistration } from './dsl/webhook.js';
16
16
  export type { PagesService, Page, PageCreateOptions } from './dsl/pages.js';
17
17
  export type { Manifest as ResourceManifest, Entry as ResourceEntry, ResourceType, } from './resources/resources.js';
18
18
  export { RESOURCE_TYPES } from './resources/resources.js';
19
- export type { AgentStartEvent, AgentIterationEvent, AgentToolCallEvent, AgentToolResultEvent, AgentAssistantMessageEvent, AgentCompleteEvent, AgentTokenLimitEvent, AgentWebhookEvent, WebhookResponseEvent, } from './dsl/definitions/events.js';
20
- export { createTool, defaultTools, generateUI, consoleLog, done } from './tools/index.js';
19
+ export type { AgentStartEvent, AgentIterationEvent, AgentToolCallEvent, AgentToolResultEvent, AgentAssistantMessageEvent, AgentCompleteEvent, AgentTokenLimitEvent, AgentIterationLimitEvent, AgentWebhookEvent, AgentRawResponseMessageEvent, AgentUserMessageEvent, WebhookResponseEvent, BrainPausedEvent, } from './dsl/definitions/events.js';
20
+ export { createTool, defaultTools, defaultDoneSchema, generateUI, waitForWebhook, print, consoleLog } from './tools/index.js';
21
+ export type { Memory, MemoryMessage, MemoryScope, MemorySearchOptions, MemoryAddOptions, MemoryProvider, ScopedMemory, } from './memory/types.js';
22
+ export { createScopedMemory } from './memory/scoped-memory.js';
21
23
  export type { UIComponent } from './ui/types.js';
22
- export { createBrainExecutionMachine, createBrainMachine, sendEvent, getDepth, isTopLevel, getCurrentStep, getBrainStack, getBrainRunId, getExecutionState, getPendingWebhooks, getError, getCompletedSteps, } from './dsl/brain-state-machine.js';
23
- export type { BrainStateMachine, BrainExecutionContext, BrainStackEntry, RunningBrain, StepInfo, ExecutionState, CreateMachineOptions, } from './dsl/brain-state-machine.js';
24
+ export { createBrainExecutionMachine, createBrainMachine, sendEvent, reconstructBrainTree, brainMachineDefinition, } from './dsl/brain-state-machine.js';
25
+ export { isSignalValid, getValidSignals, } from './dsl/signal-validation.js';
26
+ export type { MachineStateDefinition, SignalValidationResult, } from './dsl/signal-validation.js';
27
+ export type { BrainStateMachine, BrainExecutionContext, BrainStackEntry, BrainEntry, ExecutionStackEntry, RunningBrain, StepInfo, ExecutionState, CreateMachineOptions, AgentContext, ExecutionNode, } from './dsl/brain-state-machine.js';
28
+ export type { AgentResumeContext } from './dsl/agent-messages.js';
24
29
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,YAAY,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC1D,YAAY,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,YAAY,EACV,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,WAAW,EACX,aAAa,GACd,M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B,sBAAsB,GACvB,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACV,iBAAiB,EACjB,qBAAqB,EACrB,eAAe,EACf,UAAU,EACV,mBAAmB,EACnB,YAAY,EACZ,QAAQ,EACR,cAAc,EACd,oBAAoB,EACpB,YAAY,EACZ,aAAa,GACd,MAAM,8BAA8B,CAAC;AACtC,YAAY,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,22 @@
1
+ import type { MemoryProvider, ScopedMemory } from './types.js';
2
+ /**
3
+ * Creates a scoped memory instance with the agentId pre-bound.
4
+ *
5
+ * This wraps a MemoryProvider and automatically includes the agentId
6
+ * in all calls, so brain steps don't need to pass it explicitly.
7
+ *
8
+ * @param provider - The underlying memory provider
9
+ * @param agentId - The agent/brain ID to scope memories to
10
+ * @returns A ScopedMemory instance
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * const provider = createMem0Provider({ apiKey: '...' });
15
+ * const scopedMemory = createScopedMemory(provider, 'my-brain');
16
+ *
17
+ * // Now search without passing agentId
18
+ * const memories = await scopedMemory.search('user preferences');
19
+ * ```
20
+ */
21
+ export declare function createScopedMemory(provider: MemoryProvider, agentId: string): ScopedMemory;
22
+ //# sourceMappingURL=scoped-memory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scoped-memory.d.ts","sourceRoot":"","sources":["../../../src/memory/scoped-memory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EAKb,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,cAAc,EACxB,OAAO,EAAE,MAAM,GACd,YAAY,CAwBd"}
@@ -0,0 +1,106 @@
1
+ /**
2
+ * Memory types for the Positronic memory system.
3
+ *
4
+ * The memory system provides a provider-agnostic interface for storing and
5
+ * retrieving long-term memories. Memory providers implement the raw interface,
6
+ * and brain steps receive a scoped memory instance with the agent ID pre-bound.
7
+ */
8
+ /**
9
+ * A single memory entry returned from search operations.
10
+ */
11
+ export interface Memory {
12
+ /** Unique identifier for this memory */
13
+ id: string;
14
+ /** The memory content */
15
+ content: string;
16
+ /** Relevance score from 0-1 (optional, provider-dependent) */
17
+ score?: number;
18
+ /** Additional metadata about the memory */
19
+ metadata?: Record<string, unknown>;
20
+ }
21
+ /**
22
+ * Message format for adding memories.
23
+ * Compatible with common conversation formats.
24
+ */
25
+ export interface MemoryMessage {
26
+ role: 'user' | 'assistant' | 'system';
27
+ content: string;
28
+ }
29
+ /**
30
+ * Scope parameters for memory operations.
31
+ * Used to namespace memories by agent and optionally by user.
32
+ */
33
+ export interface MemoryScope {
34
+ /** The agent/brain ID this memory belongs to */
35
+ agentId: string;
36
+ /** Optional user ID for user-specific memories */
37
+ userId?: string;
38
+ }
39
+ /**
40
+ * Search options for memory retrieval.
41
+ */
42
+ export interface MemorySearchOptions {
43
+ /** Optional user ID to scope the search */
44
+ userId?: string;
45
+ /** Maximum number of memories to return */
46
+ limit?: number;
47
+ }
48
+ /**
49
+ * Options for adding memories.
50
+ */
51
+ export interface MemoryAddOptions {
52
+ /** Optional user ID to scope the memory */
53
+ userId?: string;
54
+ /** Additional metadata to store with the memory */
55
+ metadata?: Record<string, unknown>;
56
+ }
57
+ /**
58
+ * Raw memory provider interface.
59
+ * Implementations handle the actual storage and retrieval of memories.
60
+ * All methods take the full scope (agentId + optional userId).
61
+ */
62
+ export interface MemoryProvider {
63
+ /**
64
+ * Search for relevant memories.
65
+ *
66
+ * @param query - The search query
67
+ * @param scope - The scope including agentId and optional userId
68
+ * @param options - Additional search options
69
+ * @returns Array of matching memories
70
+ */
71
+ search(query: string, scope: MemoryScope, options?: {
72
+ limit?: number;
73
+ }): Promise<Memory[]>;
74
+ /**
75
+ * Add memories from a conversation.
76
+ *
77
+ * @param messages - Array of messages to extract memories from
78
+ * @param scope - The scope including agentId and optional userId
79
+ * @param options - Additional options like metadata
80
+ */
81
+ add(messages: MemoryMessage[], scope: MemoryScope, options?: {
82
+ metadata?: Record<string, unknown>;
83
+ }): Promise<void>;
84
+ }
85
+ /**
86
+ * Scoped memory interface with agentId pre-bound.
87
+ * This is what brain steps receive - they don't need to pass agentId.
88
+ */
89
+ export interface ScopedMemory {
90
+ /**
91
+ * Search for relevant memories.
92
+ *
93
+ * @param query - The search query
94
+ * @param options - Optional search options (userId, limit)
95
+ * @returns Array of matching memories
96
+ */
97
+ search(query: string, options?: MemorySearchOptions): Promise<Memory[]>;
98
+ /**
99
+ * Add memories from messages.
100
+ *
101
+ * @param messages - Array of messages to extract memories from
102
+ * @param options - Optional options (userId, metadata)
103
+ */
104
+ add(messages: MemoryMessage[], options?: MemoryAddOptions): Promise<void>;
105
+ }
106
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/memory/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AACH,MAAM,WAAW,MAAM;IACrB,wCAAwC;IACxC,EAAE,EAAE,MAAM,CAAC;IACX,yBAAyB;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,8DAA8D;IAC9D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAC;IACtC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,gDAAgD;IAChD,OAAO,EAAE,MAAM,CAAC;IAChB,kDAAkD;IAClD,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,2CAA2C;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,2CAA2C;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mDAAmD;IACnD,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;;;OAOG;IACH,MAAM,CACJ,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,WAAW,EAClB,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAC3B,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAErB;;;;;;OAMG;IACH,GAAG,CACD,QAAQ,EAAE,aAAa,EAAE,EACzB,KAAK,EAAE,WAAW,EAClB,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,GAC/C,OAAO,CAAC,IAAI,CAAC,CAAC;CAClB;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;;;OAMG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAExE;;;;;OAKG;IACH,GAAG,CAAC,QAAQ,EAAE,aAAa,EAAE,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3E"}
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import type { AgentTool, AgentToolWaitFor } from '../dsl/types.js';
2
+ import type { AgentTool, AgentToolWaitFor, StepContext } from '../dsl/types.js';
3
3
  /**
4
4
  * Helper function to create tools with proper type inference.
5
5
  *
@@ -14,7 +14,7 @@ import type { AgentTool, AgentToolWaitFor } from '../dsl/types.js';
14
14
  * message: z.string().describe('The notification message'),
15
15
  * clickUrl: z.string().optional().describe('URL to open on click'),
16
16
  * }),
17
- * execute: async ({ message, clickUrl }) => { // Types inferred!
17
+ * execute: async ({ message, clickUrl }, context) => {
18
18
  * await ntfy.send(message, clickUrl);
19
19
  * return { sent: true };
20
20
  * },
@@ -24,28 +24,76 @@ import type { AgentTool, AgentToolWaitFor } from '../dsl/types.js';
24
24
  export declare function createTool<T extends z.ZodSchema>(config: {
25
25
  description: string;
26
26
  inputSchema: T;
27
- execute?: (input: z.infer<T>) => unknown | Promise<unknown> | AgentToolWaitFor | Promise<AgentToolWaitFor>;
27
+ execute?: (input: z.infer<T>, context: StepContext) => unknown | Promise<unknown> | AgentToolWaitFor | Promise<AgentToolWaitFor>;
28
28
  terminal?: boolean;
29
29
  }): AgentTool<T>;
30
+ declare const generateUIInputSchema: z.ZodObject<{
31
+ prompt: z.ZodString;
32
+ hasForm: z.ZodOptional<z.ZodBoolean>;
33
+ persist: z.ZodOptional<z.ZodBoolean>;
34
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
35
+ }, "strip", z.ZodTypeAny, {
36
+ prompt: string;
37
+ data?: Record<string, unknown> | undefined;
38
+ hasForm?: boolean | undefined;
39
+ persist?: boolean | undefined;
40
+ }, {
41
+ prompt: string;
42
+ data?: Record<string, unknown> | undefined;
43
+ hasForm?: boolean | undefined;
44
+ persist?: boolean | undefined;
45
+ }>;
30
46
  /**
31
- * Default generateUI tool - gets enriched with component metadata at runtime.
47
+ * Generate UI tool - creates an interactive UI page.
48
+ *
49
+ * This tool:
50
+ * 1. Uses an LLM to generate a UI page based on your prompt
51
+ * 2. Creates an HTML page with the generated components
52
+ * 3. Returns the page URL and webhook info (if hasForm is true)
53
+ *
54
+ * IMPORTANT: This tool does NOT pause execution. After generating a page with a form,
55
+ * you must call waitForWebhook to pause and wait for the form submission.
56
+ * Before calling waitForWebhook, ensure the user knows the page URL.
32
57
  *
33
- * This tool allows the LLM to generate a UI and wait for user response.
34
- * The actual component list and descriptions are injected at runtime
35
- * based on the components registered with .withComponents().
58
+ * Requires components and pages to be configured via createBrain or withComponents().
59
+ *
60
+ * The description is enriched at runtime with available component information.
36
61
  */
37
- export declare const generateUI: AgentTool<z.ZodObject<{
38
- component: z.ZodString;
39
- props: z.ZodRecord<z.ZodString, z.ZodUnknown>;
62
+ export declare const generateUI: AgentTool<typeof generateUIInputSchema>;
63
+ declare const waitForWebhookInputSchema: z.ZodObject<{
64
+ slug: z.ZodString;
65
+ identifier: z.ZodString;
40
66
  }, "strip", z.ZodTypeAny, {
41
- component: string;
42
- props: Record<string, unknown>;
67
+ slug: string;
68
+ identifier: string;
69
+ }, {
70
+ slug: string;
71
+ identifier: string;
72
+ }>;
73
+ /**
74
+ * Wait for webhook tool - pauses execution until a webhook receives a response.
75
+ *
76
+ * Use this after generating a UI page with a form to wait for the user's submission.
77
+ * The form data will be returned as the tool result when the webhook fires.
78
+ *
79
+ * IMPORTANT: Before calling this tool, ensure the user knows the page URL
80
+ * so they can access and submit the form.
81
+ */
82
+ export declare const waitForWebhook: AgentTool<typeof waitForWebhookInputSchema>;
83
+ /**
84
+ * Print tool - the simplest way for agents to communicate with users.
85
+ * Like PRINT in BASIC - outputs a message that users can see.
86
+ */
87
+ export declare const print: AgentTool<z.ZodObject<{
88
+ message: z.ZodString;
89
+ }, "strip", z.ZodTypeAny, {
90
+ message: string;
43
91
  }, {
44
- component: string;
45
- props: Record<string, unknown>;
92
+ message: string;
46
93
  }>>;
47
94
  /**
48
- * Console log tool - useful for debugging and logging information during agent execution.
95
+ * Console log tool - for internal server-side debugging and logging.
96
+ * NOT for user communication - use print for that.
49
97
  */
50
98
  export declare const consoleLog: AgentTool<z.ZodObject<{
51
99
  message: z.ZodString;
@@ -58,16 +106,16 @@ export declare const consoleLog: AgentTool<z.ZodObject<{
58
106
  level?: "error" | "info" | "warn" | undefined;
59
107
  }>>;
60
108
  /**
61
- * Done tool - a simple terminal tool for completing agent execution.
62
- * The result becomes part of the brain state.
109
+ * Default schema for the auto-generated 'done' tool when no outputSchema is provided.
110
+ * Used internally by the framework.
63
111
  */
64
- export declare const done: AgentTool<z.ZodObject<{
112
+ export declare const defaultDoneSchema: z.ZodObject<{
65
113
  result: z.ZodString;
66
114
  }, "strip", z.ZodTypeAny, {
67
115
  result: string;
68
116
  }, {
69
117
  result: string;
70
- }>>;
118
+ }>;
71
119
  /**
72
120
  * Default tools bundle.
73
121
  *
@@ -75,6 +123,10 @@ export declare const done: AgentTool<z.ZodObject<{
75
123
  * standard tools in your brain. Tools can be extended or overridden in
76
124
  * individual agent steps.
77
125
  *
126
+ * Note: A 'done' terminal tool is automatically generated for every agent.
127
+ * If you provide an outputSchema, 'done' will use that schema. Otherwise,
128
+ * it uses a default schema expecting { result: string }.
129
+ *
78
130
  * @example
79
131
  * ```typescript
80
132
  * import { createBrain, defaultTools } from '@positronic/core';
@@ -96,14 +148,37 @@ export declare const done: AgentTool<z.ZodObject<{
96
148
  */
97
149
  export declare const defaultTools: {
98
150
  generateUI: AgentTool<z.ZodObject<{
99
- component: z.ZodString;
100
- props: z.ZodRecord<z.ZodString, z.ZodUnknown>;
151
+ prompt: z.ZodString;
152
+ hasForm: z.ZodOptional<z.ZodBoolean>;
153
+ persist: z.ZodOptional<z.ZodBoolean>;
154
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
155
+ }, "strip", z.ZodTypeAny, {
156
+ prompt: string;
157
+ data?: Record<string, unknown> | undefined;
158
+ hasForm?: boolean | undefined;
159
+ persist?: boolean | undefined;
160
+ }, {
161
+ prompt: string;
162
+ data?: Record<string, unknown> | undefined;
163
+ hasForm?: boolean | undefined;
164
+ persist?: boolean | undefined;
165
+ }>>;
166
+ waitForWebhook: AgentTool<z.ZodObject<{
167
+ slug: z.ZodString;
168
+ identifier: z.ZodString;
101
169
  }, "strip", z.ZodTypeAny, {
102
- component: string;
103
- props: Record<string, unknown>;
170
+ slug: string;
171
+ identifier: string;
104
172
  }, {
105
- component: string;
106
- props: Record<string, unknown>;
173
+ slug: string;
174
+ identifier: string;
175
+ }>>;
176
+ print: AgentTool<z.ZodObject<{
177
+ message: z.ZodString;
178
+ }, "strip", z.ZodTypeAny, {
179
+ message: string;
180
+ }, {
181
+ message: string;
107
182
  }>>;
108
183
  consoleLog: AgentTool<z.ZodObject<{
109
184
  message: z.ZodString;
@@ -115,12 +190,6 @@ export declare const defaultTools: {
115
190
  message: string;
116
191
  level?: "error" | "info" | "warn" | undefined;
117
192
  }>>;
118
- done: AgentTool<z.ZodObject<{
119
- result: z.ZodString;
120
- }, "strip", z.ZodTypeAny, {
121
- result: string;
122
- }, {
123
- result: string;
124
- }>>;
125
193
  };
194
+ export {};
126
195
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAGnE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,EAAE,MAAM,EAAE;IACxD,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,CAAC,CAAC;IACf,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC3G,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,GAAG,SAAS,CAAC,CAAC,CAAC,CAEf;AAED;;;;;;GAMG;AACH,eAAO,MAAM,UAAU;;;;;;;;;GAwBrB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,UAAU;;;;;;;;;GAWrB,CAAC;AAEH;;;GAGG;AACH,eAAO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AM,iBAAiB;;;;;;EAM5B,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAKxB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"generate-ui.d.ts","sourceRoot":"","sources":["../../../src/ui/generate-ui.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AA0DrE;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;CAChC;AAgUD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,UAAU,CAAC,MAAM,EAAE;IACvC,MAAM,EAAE,eAAe,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7C,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAqD5B"}
1
+ {"version":3,"file":"generate-ui.d.ts","sourceRoot":"","sources":["../../../src/ui/generate-ui.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAkErE;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;CAChC;AAuUD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,UAAU,CAAC,MAAM,EAAE;IACvC,MAAM,EAAE,eAAe,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7C,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAqD5B"}
@@ -4,7 +4,7 @@
4
4
  * Validates that template bindings (like {{email.subject}}) reference
5
5
  * valid paths in the provided data structure.
6
6
  */
7
- import type { ComponentNode, DataType, ValidationResult } from './types.js';
7
+ import type { ComponentNode, DataType, ResolvedBinding, ValidationResult } from './types.js';
8
8
  /**
9
9
  * Loop context tracks variables introduced by List/Each components.
10
10
  * Maps variable name to the element type of the array being iterated.
@@ -31,5 +31,31 @@ export declare function resolvePathType(path: string, rootType: DataType, loopCo
31
31
  * @returns ValidationResult with any errors found
32
32
  */
33
33
  export declare function validateDataBindings(root: ComponentNode, dataType: DataType): ValidationResult;
34
+ /**
35
+ * Loop data context maps loop variable names to their sample values.
36
+ */
37
+ type LoopDataContext = Map<string, unknown>;
38
+ /**
39
+ * Resolve a binding path against actual data, considering loop context.
40
+ *
41
+ * @param path - The binding path like "email.subject"
42
+ * @param rootData - The root data object
43
+ * @param loopDataContext - Map of loop variable names to sample values
44
+ * @returns The resolved value, or undefined if the path doesn't resolve
45
+ */
46
+ export declare function resolvePathValue(path: string, rootData: Record<string, unknown>, loopDataContext: LoopDataContext): unknown;
47
+ /**
48
+ * Summarize a value for LLM consumption.
49
+ * Keeps output compact — no full data dumps.
50
+ */
51
+ export declare function summarizeValue(value: unknown): string;
52
+ /**
53
+ * Walk the ComponentNode tree and resolve every binding against real data.
54
+ *
55
+ * @param root - The root ComponentNode
56
+ * @param data - The actual data object
57
+ * @returns Array of ResolvedBinding entries
58
+ */
59
+ export declare function resolveBindings(root: ComponentNode, data: Record<string, unknown>): ResolvedBinding[];
34
60
  export {};
35
61
  //# sourceMappingURL=data-validator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"data-validator.d.ts","sourceRoot":"","sources":["../../../src/yaml/data-validator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,aAAa,EACb,QAAQ,EAER,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAEpB;;;GAGG;AACH,KAAK,WAAW,GAAG,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AAEzC;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,CAkCtD;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,WAAW,GACvB,QAAQ,GAAG,IAAI,CA+BjB;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,aAAa,EACnB,QAAQ,EAAE,QAAQ,GACjB,gBAAgB,CAyDlB"}
1
+ {"version":3,"file":"data-validator.d.ts","sourceRoot":"","sources":["../../../src/yaml/data-validator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,aAAa,EACb,QAAQ,EACR,eAAe,EAEf,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAEpB;;;GAGG;AACH,KAAK,WAAW,GAAG,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AAEzC;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,CAkCtD;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,WAAW,GACvB,QAAQ,GAAG,IAAI,CA+BjB;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,aAAa,EACnB,QAAQ,EAAE,QAAQ,GACjB,gBAAgB,CAyDlB;AAED;;GAEG;AACH,KAAK,eAAe,GAAG,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE5C;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,eAAe,EAAE,eAAe,GAC/B,OAAO,CA0BT;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CA2BrD;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,aAAa,EACnB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,eAAe,EAAE,CA4DnB"}
@@ -71,6 +71,16 @@ export interface ValidationResult {
71
71
  valid: boolean;
72
72
  errors: ValidationError[];
73
73
  }
74
+ /**
75
+ * Result of resolving a binding against actual data at dry-run time.
76
+ */
77
+ export interface ResolvedBinding {
78
+ path: string;
79
+ component: string;
80
+ prop: string;
81
+ value: string;
82
+ resolved: boolean;
83
+ }
74
84
  /**
75
85
  * Data type inference for validating bindings.
76
86
  */