@almadar/agent 3.5.6 → 3.5.11

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.
@@ -262,23 +262,33 @@ export declare function createConnectTool(workDir: string): import("@langchain/c
262
262
  export declare function createComposeTool(workDir: string): import("@langchain/core/tools").DynamicStructuredTool<z.ZodObject<{
263
263
  appName: z.ZodOptional<z.ZodString>;
264
264
  orbitalFiles: z.ZodOptional<z.ZodString>;
265
- pagesJson: z.ZodOptional<z.ZodString>;
265
+ layoutStrategy: z.ZodOptional<z.ZodEnum<["sidebar", "tabs", "dashboard", "wizard-flow", "auto"]>>;
266
+ eventWiringJson: z.ZodOptional<z.ZodString>;
267
+ entityMappingsJson: z.ZodOptional<z.ZodString>;
266
268
  }, "strip", z.ZodTypeAny, {
267
269
  appName?: string | undefined;
268
270
  orbitalFiles?: string | undefined;
269
- pagesJson?: string | undefined;
271
+ layoutStrategy?: "dashboard" | "sidebar" | "tabs" | "wizard-flow" | "auto" | undefined;
272
+ eventWiringJson?: string | undefined;
273
+ entityMappingsJson?: string | undefined;
270
274
  }, {
271
275
  appName?: string | undefined;
272
276
  orbitalFiles?: string | undefined;
273
- pagesJson?: string | undefined;
277
+ layoutStrategy?: "dashboard" | "sidebar" | "tabs" | "wizard-flow" | "auto" | undefined;
278
+ eventWiringJson?: string | undefined;
279
+ entityMappingsJson?: string | undefined;
274
280
  }>, {
275
281
  appName?: string | undefined;
276
282
  orbitalFiles?: string | undefined;
277
- pagesJson?: string | undefined;
283
+ layoutStrategy?: "dashboard" | "sidebar" | "tabs" | "wizard-flow" | "auto" | undefined;
284
+ eventWiringJson?: string | undefined;
285
+ entityMappingsJson?: string | undefined;
278
286
  }, {
279
287
  appName?: string | undefined;
280
288
  orbitalFiles?: string | undefined;
281
- pagesJson?: string | undefined;
289
+ layoutStrategy?: "dashboard" | "sidebar" | "tabs" | "wizard-flow" | "auto" | undefined;
290
+ eventWiringJson?: string | undefined;
291
+ entityMappingsJson?: string | undefined;
282
292
  }, {
283
293
  success: boolean;
284
294
  error: string;
@@ -299,4 +309,4 @@ export declare function createComposeTool(workDir: string): import("@langchain/c
299
309
  errors: string[];
300
310
  };
301
311
  error?: undefined;
302
- }, unknown, "compose_app">;
312
+ }, unknown, "compose_behaviors">;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Behavior Pipeline Orchestrator
3
+ *
4
+ * Chains BG0-A (decompose, 1 LLM call) -> BG0-B (match, 1 LLM call)
5
+ * -> BG1 -> BG2 -> BG3 (all deterministic).
6
+ *
7
+ * Total: 2 LLM calls for any app size.
8
+ *
9
+ * @packageDocumentation
10
+ */
11
+ import type { LLMClient } from '@almadar/llm';
12
+ import type { BehaviorPipelineConfig, BehaviorPipelineResult } from './types.js';
13
+ export declare function runBehaviorPipeline(client: LLMClient, prompt: string, config?: BehaviorPipelineConfig): Promise<BehaviorPipelineResult>;
14
+ /** Create the default Mistral Small client for behavior pipeline */
15
+ export declare function createBehaviorClient(): LLMClient;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Behavior Prompts (BG0)
3
+ *
4
+ * Builds system and user prompts for the behavior selection gate.
5
+ * Uses behavior catalog sections from @almadar/skills.
6
+ *
7
+ * @packageDocumentation
8
+ */
9
+ export declare function buildBG0SystemPrompt(): string;
10
+ export declare function buildBG0UserPrompt(prompt: string): string;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * BG0: Behavior Selection
3
+ *
4
+ * One LLM call. Selects behaviors from the standard library based on
5
+ * a natural language prompt and produces a BehaviorPlan.
6
+ *
7
+ * @packageDocumentation
8
+ */
9
+ import type { LLMClient } from '@almadar/llm';
10
+ import type { BehaviorPlan, BehaviorPipelineConfig } from './types.js';
11
+ export declare function runBG0(client: LLMClient, prompt: string, _config?: BehaviorPipelineConfig): Promise<BehaviorPlan>;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * BG0-A: Decompose
3
+ *
4
+ * First LLM call. Breaks a natural language prompt into a shell OrbitalSchema
5
+ * (orbital names, entity names with fields, pages). Then converts each orbital
6
+ * to a domain language paragraph for BG0-B to match against behaviors.
7
+ *
8
+ * Reuses the existing Gate 0 (decompose_app) logic.
9
+ *
10
+ * @packageDocumentation
11
+ */
12
+ import type { LLMClient } from '@almadar/llm';
13
+ import type { OrbitalSchema } from '@almadar/core/types';
14
+ import type { BehaviorPipelineConfig } from './types.js';
15
+ export interface DecomposeResult {
16
+ /** Shell schema from Gate 0 */
17
+ shellOrb: OrbitalSchema;
18
+ /** One domain language paragraph per orbital */
19
+ orbitalDescriptions: Array<{
20
+ orbitalName: string;
21
+ entityName: string;
22
+ domainText: string;
23
+ fields: Array<{
24
+ name: string;
25
+ type: string;
26
+ }>;
27
+ }>;
28
+ }
29
+ export declare function runBG0A(client: LLMClient, prompt: string, _config?: BehaviorPipelineConfig): Promise<DecomposeResult>;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * BG0-B: Per-Orbital Behavior Matching
3
+ *
4
+ * Second LLM call. For each orbital description from BG0-A, selects the
5
+ * best behavior from the catalog. One focused decision per orbital.
6
+ *
7
+ * Uses a single batched LLM call for all orbitals (not one call per orbital)
8
+ * to keep total LLM calls at 2.
9
+ *
10
+ * @packageDocumentation
11
+ */
12
+ import type { LLMClient } from '@almadar/llm';
13
+ import type { BehaviorPlan, BehaviorPipelineConfig } from './types.js';
14
+ import type { DecomposeResult } from './bg0a-decompose.js';
15
+ export declare function runBG0B(client: LLMClient, decomposed: DecomposeResult, originalPrompt: string, _config?: BehaviorPipelineConfig): Promise<BehaviorPlan>;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * BG1: Behavior Instantiation
3
+ *
4
+ * Zero LLM calls. Calls behavior pure functions from @almadar/std
5
+ * to produce OrbitalDefinitions. Falls back to golden .orb files.
6
+ *
7
+ * @packageDocumentation
8
+ */
9
+ import type { OrbitalDefinition } from '@almadar/core/types';
10
+ import type { BehaviorPlan } from './types.js';
11
+ export declare function runBG1(plan: BehaviorPlan): Promise<OrbitalDefinition[]>;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * BG2: Event Wiring
3
+ *
4
+ * Zero LLM calls. Applies cross-orbital event wiring from
5
+ * the BehaviorPlan's suggestedWiring entries.
6
+ *
7
+ * @packageDocumentation
8
+ */
9
+ import type { OrbitalDefinition } from '@almadar/core/types';
10
+ import type { BehaviorPlan } from './types.js';
11
+ export declare function runBG2(orbitals: OrbitalDefinition[], plan: BehaviorPlan): Promise<OrbitalDefinition[]>;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * BG3: Application Composition
3
+ *
4
+ * Zero LLM calls. Uses composeBehaviors from @almadar/core to
5
+ * produce a complete OrbitalSchema with pages and layout.
6
+ *
7
+ * @packageDocumentation
8
+ */
9
+ import type { ComposeBehaviorsResult } from '@almadar/core/builders';
10
+ import type { OrbitalDefinition } from '@almadar/core/types';
11
+ import type { BehaviorPlan } from './types.js';
12
+ export declare function runBG3(orbitals: OrbitalDefinition[], plan: BehaviorPlan): Promise<ComposeBehaviorsResult>;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Behavior Gate Pipeline
3
+ *
4
+ * Sequential pipeline for behavior-based application composition.
5
+ * BG0-A (decompose, 1 LLM) -> BG0-B (match, 1 LLM) -> BG1 -> BG2 -> BG3 (deterministic).
6
+ *
7
+ * @packageDocumentation
8
+ */
9
+ export { runBehaviorPipeline, createBehaviorClient } from './behavior-orchestrator.js';
10
+ export { runBG0A, type DecomposeResult } from './bg0a-decompose.js';
11
+ export { runBG0B } from './bg0b-match.js';
12
+ export { runBG0 } from './bg0-behavior-selection.js';
13
+ export { runBG1 } from './bg1-instantiation.js';
14
+ export { runBG2 } from './bg2-wiring.js';
15
+ export { runBG3 } from './bg3-composition.js';
16
+ export type { BehaviorPlan, BehaviorSelection, BehaviorPipelineConfig, BehaviorPipelineResult } from './types.js';
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Behavior Gate Pipeline Types
3
+ *
4
+ * Type definitions for the sequential BG0-BG3 behavior composition pipeline.
5
+ *
6
+ * @packageDocumentation
7
+ */
8
+ import type { OrbitalDefinition, OrbitalSchema } from '@almadar/core/types';
9
+ import type { EventWiringEntry } from '@almadar/core/builders';
10
+ export interface BehaviorSelection {
11
+ behaviorName: string;
12
+ entityName: string;
13
+ fields: Array<{
14
+ name: string;
15
+ type: string;
16
+ required?: boolean;
17
+ default?: unknown;
18
+ }>;
19
+ persistence: 'persistent' | 'runtime' | 'singleton';
20
+ pageTitle?: string;
21
+ pagePath?: string;
22
+ }
23
+ export interface BehaviorPlan {
24
+ appName: string;
25
+ selections: BehaviorSelection[];
26
+ suggestedWiring: EventWiringEntry[];
27
+ layoutStrategy?: 'sidebar' | 'tabs' | 'dashboard' | 'wizard-flow' | 'auto';
28
+ }
29
+ export interface BehaviorPipelineConfig {
30
+ workDir?: string;
31
+ validateAfterCompose?: boolean;
32
+ }
33
+ export interface BehaviorPipelineResult {
34
+ plan: BehaviorPlan;
35
+ orbitals: OrbitalDefinition[];
36
+ schema: OrbitalSchema;
37
+ layout: {
38
+ strategy: string;
39
+ pageCount: number;
40
+ };
41
+ validation: {
42
+ valid: boolean;
43
+ errors: string[];
44
+ };
45
+ timings: {
46
+ total: number;
47
+ bg0: number;
48
+ bg1: number;
49
+ bg2: number;
50
+ bg3: number;
51
+ };
52
+ llmCalls: number;
53
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Gate 3.5: Pattern Matching
3
+ *
4
+ * Selects the 10-20 most relevant UI patterns for this application.
5
+ * Two-phase approach:
6
+ * 1. Deterministic pre-filter: analyze state machine to exclude irrelevant
7
+ * categories (game patterns for CRUD apps, form patterns for read-only, etc.)
8
+ * 2. LLM selection: pick from the pre-filtered set
9
+ *
10
+ * Gate 4 then receives only these patterns with full prop details.
11
+ *
12
+ * @packageDocumentation
13
+ */
14
+ import type { LLMClient } from '@almadar/llm';
15
+ import type { OrbitalSchema } from '@almadar/core/types';
16
+ import type { GateOpts } from './types.js';
17
+ /**
18
+ * Run Gate 3.5: select relevant patterns for this application.
19
+ * Phase 1: deterministic pre-filter based on state machine analysis.
20
+ * Phase 2: LLM selects from the pre-filtered set.
21
+ * Returns an array of pattern names (always includes core patterns).
22
+ */
23
+ export declare function runGate35(client: LLMClient, orb: OrbitalSchema, _opts?: GateOpts): Promise<string[]>;
@@ -14,4 +14,4 @@ import type { GateOpts, BehaviorGateData } from './types.js';
14
14
  * Append render-ui effects to all transitions.
15
15
  * Builds slot context from state machine and passes it to every LLM call.
16
16
  */
17
- export declare function runGate4(client: LLMClient, orb: OrbitalSchema, opts?: GateOpts, _behaviorData?: BehaviorGateData): Promise<OrbitalSchema>;
17
+ export declare function runGate4(client: LLMClient, orb: OrbitalSchema, opts?: GateOpts, _behaviorData?: BehaviorGateData, matchedPatterns?: string[]): Promise<OrbitalSchema>;