@positronic/core 0.0.56 → 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.
- package/dist/src/dsl/agent-messages.js +4 -75
- package/dist/src/dsl/brain-runner.js +131 -47
- package/dist/src/dsl/brain-state-machine.js +318 -482
- package/dist/src/dsl/builder/brain.js +35 -1
- package/dist/src/dsl/constants.js +14 -2
- package/dist/src/dsl/create-brain.js +4 -1
- package/dist/src/dsl/execution/constants.js +2 -2
- package/dist/src/dsl/execution/event-stream.js +812 -270
- package/dist/src/dsl/signal-validation.js +157 -0
- package/dist/src/dsl/types.js +2 -2
- package/dist/src/index.js +5 -2
- package/dist/src/memory/scoped-memory.js +176 -0
- package/dist/src/memory/types.js +12 -0
- package/dist/src/tools/index.js +90 -37
- package/dist/src/ui/generate-ui.js +6 -3
- package/dist/src/yaml/data-validator.js +195 -0
- package/dist/types/clients/types.d.ts +39 -2
- package/dist/types/clients/types.d.ts.map +1 -1
- package/dist/types/dsl/agent-messages.d.ts +8 -14
- package/dist/types/dsl/agent-messages.d.ts.map +1 -1
- package/dist/types/dsl/brain-runner.d.ts +27 -7
- package/dist/types/dsl/brain-runner.d.ts.map +1 -1
- package/dist/types/dsl/brain-state-machine.d.ts +92 -23
- package/dist/types/dsl/brain-state-machine.d.ts.map +1 -1
- package/dist/types/dsl/brain.d.ts +2 -2
- package/dist/types/dsl/brain.d.ts.map +1 -1
- package/dist/types/dsl/builder/brain.d.ts +51 -3
- package/dist/types/dsl/builder/brain.d.ts.map +1 -1
- package/dist/types/dsl/constants.d.ts +8 -0
- package/dist/types/dsl/constants.d.ts.map +1 -1
- package/dist/types/dsl/create-brain.d.ts +13 -1
- package/dist/types/dsl/create-brain.d.ts.map +1 -1
- package/dist/types/dsl/definitions/blocks.d.ts +3 -3
- package/dist/types/dsl/definitions/blocks.d.ts.map +1 -1
- package/dist/types/dsl/definitions/events.d.ts +40 -3
- package/dist/types/dsl/definitions/events.d.ts.map +1 -1
- package/dist/types/dsl/definitions/run-params.d.ts +17 -9
- package/dist/types/dsl/definitions/run-params.d.ts.map +1 -1
- package/dist/types/dsl/execution/constants.d.ts +2 -2
- package/dist/types/dsl/execution/constants.d.ts.map +1 -1
- package/dist/types/dsl/execution/event-stream.d.ts +12 -5
- package/dist/types/dsl/execution/event-stream.d.ts.map +1 -1
- package/dist/types/dsl/signal-validation.d.ts +36 -0
- package/dist/types/dsl/signal-validation.d.ts.map +1 -0
- package/dist/types/dsl/types.d.ts +57 -1
- package/dist/types/dsl/types.d.ts.map +1 -1
- package/dist/types/index.d.ts +12 -7
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/memory/scoped-memory.d.ts +22 -0
- package/dist/types/memory/scoped-memory.d.ts.map +1 -0
- package/dist/types/memory/types.d.ts +106 -0
- package/dist/types/memory/types.d.ts.map +1 -0
- package/dist/types/tools/index.d.ts +82 -15
- package/dist/types/tools/index.d.ts.map +1 -1
- package/dist/types/ui/generate-ui.d.ts.map +1 -1
- package/dist/types/yaml/data-validator.d.ts +27 -1
- package/dist/types/yaml/data-validator.d.ts.map +1 -1
- package/dist/types/yaml/types.d.ts +10 -0
- package/dist/types/yaml/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -83,6 +83,8 @@ export interface StepContext<TState = object, TOptions = JsonObject, TResponse =
|
|
|
83
83
|
brainRunId: string;
|
|
84
84
|
/** Current step ID (for creating unique webhook identifiers) */
|
|
85
85
|
stepId: string;
|
|
86
|
+
/** Scoped memory for storing and retrieving long-term memories */
|
|
87
|
+
memory?: import('../memory/types.js').ScopedMemory;
|
|
86
88
|
}
|
|
87
89
|
/**
|
|
88
90
|
* A tool definition for use in agent steps.
|
|
@@ -107,10 +109,21 @@ export interface AgentTool<TInput extends z.ZodSchema = z.ZodSchema> {
|
|
|
107
109
|
*/
|
|
108
110
|
terminal?: boolean;
|
|
109
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
|
+
}
|
|
110
123
|
/**
|
|
111
124
|
* Configuration for an agent step.
|
|
112
125
|
*/
|
|
113
|
-
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> {
|
|
114
127
|
/** System prompt for the LLM */
|
|
115
128
|
system?: string;
|
|
116
129
|
/** Initial user prompt to start the conversation. If omitted, uses "Begin." */
|
|
@@ -119,6 +132,14 @@ export interface AgentConfig<TTools extends Record<string, AgentTool> = Record<s
|
|
|
119
132
|
tools?: TTools;
|
|
120
133
|
/** Safety valve - exit if cumulative tokens exceed this limit */
|
|
121
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;
|
|
122
143
|
}
|
|
123
144
|
/**
|
|
124
145
|
* Represents a single message in the agent conversation.
|
|
@@ -155,4 +176,39 @@ export interface RetryConfig {
|
|
|
155
176
|
/** Maximum delay in ms between retries. Default: 30000 */
|
|
156
177
|
maxDelay?: number;
|
|
157
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
|
+
}
|
|
158
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,CA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,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"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -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,
|
|
8
|
-
export type { ObjectGenerator, Message, ToolMessage } from './clients/types.js';
|
|
9
|
-
export type { State, RuntimeEnv, Secrets, AgentTool, AgentConfig, AgentMessage, AgentToolWaitFor, StepContext, 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,
|
|
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,
|
|
23
|
-
export
|
|
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,
|
|
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,eAAe,EACf,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,WAAW,EACX,aAAa,GACd,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,eAAe,EAAE,OAAO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ACX,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,YAAY,GACb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAG/D,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAGjD,OAAO,EACL,2BAA2B,EAC3B,kBAAkB,EAClB,SAAS,EACT,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EACL,aAAa,EACb,eAAe,GAChB,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACV,sBAAsB,EACtB,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"}
|
|
@@ -29,27 +29,71 @@ export declare function createTool<T extends z.ZodSchema>(config: {
|
|
|
29
29
|
}): AgentTool<T>;
|
|
30
30
|
declare const generateUIInputSchema: z.ZodObject<{
|
|
31
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>>;
|
|
32
35
|
}, "strip", z.ZodTypeAny, {
|
|
33
36
|
prompt: string;
|
|
37
|
+
data?: Record<string, unknown> | undefined;
|
|
38
|
+
hasForm?: boolean | undefined;
|
|
39
|
+
persist?: boolean | undefined;
|
|
34
40
|
}, {
|
|
35
41
|
prompt: string;
|
|
42
|
+
data?: Record<string, unknown> | undefined;
|
|
43
|
+
hasForm?: boolean | undefined;
|
|
44
|
+
persist?: boolean | undefined;
|
|
36
45
|
}>;
|
|
37
46
|
/**
|
|
38
|
-
* Generate UI tool - creates an interactive UI page
|
|
47
|
+
* Generate UI tool - creates an interactive UI page.
|
|
39
48
|
*
|
|
40
49
|
* This tool:
|
|
41
50
|
* 1. Uses an LLM to generate a UI page based on your prompt
|
|
42
51
|
* 2. Creates an HTML page with the generated components
|
|
43
|
-
* 3.
|
|
44
|
-
*
|
|
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.
|
|
45
57
|
*
|
|
46
58
|
* Requires components and pages to be configured via createBrain or withComponents().
|
|
47
59
|
*
|
|
48
60
|
* The description is enriched at runtime with available component information.
|
|
49
61
|
*/
|
|
50
62
|
export declare const generateUI: AgentTool<typeof generateUIInputSchema>;
|
|
63
|
+
declare const waitForWebhookInputSchema: z.ZodObject<{
|
|
64
|
+
slug: z.ZodString;
|
|
65
|
+
identifier: z.ZodString;
|
|
66
|
+
}, "strip", z.ZodTypeAny, {
|
|
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;
|
|
91
|
+
}, {
|
|
92
|
+
message: string;
|
|
93
|
+
}>>;
|
|
51
94
|
/**
|
|
52
|
-
* Console log tool -
|
|
95
|
+
* Console log tool - for internal server-side debugging and logging.
|
|
96
|
+
* NOT for user communication - use print for that.
|
|
53
97
|
*/
|
|
54
98
|
export declare const consoleLog: AgentTool<z.ZodObject<{
|
|
55
99
|
message: z.ZodString;
|
|
@@ -62,16 +106,16 @@ export declare const consoleLog: AgentTool<z.ZodObject<{
|
|
|
62
106
|
level?: "error" | "info" | "warn" | undefined;
|
|
63
107
|
}>>;
|
|
64
108
|
/**
|
|
65
|
-
*
|
|
66
|
-
*
|
|
109
|
+
* Default schema for the auto-generated 'done' tool when no outputSchema is provided.
|
|
110
|
+
* Used internally by the framework.
|
|
67
111
|
*/
|
|
68
|
-
export declare const
|
|
112
|
+
export declare const defaultDoneSchema: z.ZodObject<{
|
|
69
113
|
result: z.ZodString;
|
|
70
114
|
}, "strip", z.ZodTypeAny, {
|
|
71
115
|
result: string;
|
|
72
116
|
}, {
|
|
73
117
|
result: string;
|
|
74
|
-
}
|
|
118
|
+
}>;
|
|
75
119
|
/**
|
|
76
120
|
* Default tools bundle.
|
|
77
121
|
*
|
|
@@ -79,6 +123,10 @@ export declare const done: AgentTool<z.ZodObject<{
|
|
|
79
123
|
* standard tools in your brain. Tools can be extended or overridden in
|
|
80
124
|
* individual agent steps.
|
|
81
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
|
+
*
|
|
82
130
|
* @example
|
|
83
131
|
* ```typescript
|
|
84
132
|
* import { createBrain, defaultTools } from '@positronic/core';
|
|
@@ -101,10 +149,36 @@ export declare const done: AgentTool<z.ZodObject<{
|
|
|
101
149
|
export declare const defaultTools: {
|
|
102
150
|
generateUI: AgentTool<z.ZodObject<{
|
|
103
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>>;
|
|
104
155
|
}, "strip", z.ZodTypeAny, {
|
|
105
156
|
prompt: string;
|
|
157
|
+
data?: Record<string, unknown> | undefined;
|
|
158
|
+
hasForm?: boolean | undefined;
|
|
159
|
+
persist?: boolean | undefined;
|
|
106
160
|
}, {
|
|
107
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;
|
|
169
|
+
}, "strip", z.ZodTypeAny, {
|
|
170
|
+
slug: string;
|
|
171
|
+
identifier: string;
|
|
172
|
+
}, {
|
|
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;
|
|
108
182
|
}>>;
|
|
109
183
|
consoleLog: AgentTool<z.ZodObject<{
|
|
110
184
|
message: z.ZodString;
|
|
@@ -116,13 +190,6 @@ export declare const defaultTools: {
|
|
|
116
190
|
message: string;
|
|
117
191
|
level?: "error" | "info" | "warn" | undefined;
|
|
118
192
|
}>>;
|
|
119
|
-
done: AgentTool<z.ZodObject<{
|
|
120
|
-
result: z.ZodString;
|
|
121
|
-
}, "strip", z.ZodTypeAny, {
|
|
122
|
-
result: string;
|
|
123
|
-
}, {
|
|
124
|
-
result: string;
|
|
125
|
-
}>>;
|
|
126
193
|
};
|
|
127
194
|
export {};
|
|
128
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,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAKhF;;;;;;;;;;;;;;;;;;;;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,CACR,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EACjB,OAAO,EAAE,WAAW,KACjB,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC/E,QAAQ,CAAC,EAAE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;;;;;;;;;;;;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;
|
|
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,
|
|
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
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/yaml/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;CACzC;AAED;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,iBAAiB,GAAG,YAAY,CAAC;AAEzD;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACjC,QAAQ,EAAE,aAAa,EAAE,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,aAAa,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,GACrB,QAAQ,GACR,QAAQ,GACR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