@positronic/core 0.0.76 → 0.0.78

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 (130) hide show
  1. package/dist/src/dsl/brain-runner.js +37 -182
  2. package/dist/src/dsl/brain-state-machine.js +58 -112
  3. package/dist/src/dsl/brain.js +1 -0
  4. package/dist/src/dsl/builder/brain.js +250 -404
  5. package/dist/src/dsl/builder/continuation.js +67 -0
  6. package/dist/src/dsl/constants.js +16 -17
  7. package/dist/src/dsl/create-brain.js +29 -45
  8. package/dist/src/dsl/example-webhook.js +1 -1
  9. package/dist/src/dsl/execution/constants.js +0 -4
  10. package/dist/src/dsl/execution/event-channel.js +77 -0
  11. package/dist/src/dsl/execution/event-stream.js +1625 -1462
  12. package/dist/src/dsl/signal-validation.js +0 -1
  13. package/dist/src/dsl/webhook.js +4 -1
  14. package/dist/src/files/event-wrapper.js +268 -0
  15. package/dist/src/files/index.js +1 -0
  16. package/dist/src/files/mime.js +31 -0
  17. package/dist/src/files/types.js +13 -0
  18. package/dist/src/index.js +10 -3
  19. package/dist/src/jsx-runtime.js +49 -0
  20. package/dist/src/memory/{scoped-memory.js → create-memory.js} +5 -5
  21. package/dist/src/plugins/collect-webhooks.js +49 -0
  22. package/dist/src/plugins/define-plugin.js +15 -0
  23. package/dist/src/plugins/index.js +1 -0
  24. package/dist/src/plugins/types.js +4 -0
  25. package/dist/src/store/types.js +2 -3
  26. package/dist/src/template/render-html.js +282 -0
  27. package/dist/src/template/render.js +357 -0
  28. package/dist/src/tools/index.js +88 -27
  29. package/dist/src/ui/generate-page-html.js +6 -6
  30. package/dist/src/ui/{generate-ui.js → generate-page.js} +24 -12
  31. package/dist/src/ui/parse-form-data.js +1 -11
  32. package/dist/src/ui/types.js +0 -123
  33. package/dist/src/yaml/data-validator.js +0 -27
  34. package/dist/src/yaml/type-inference.js +10 -9
  35. package/dist/types/clients/types.d.ts +15 -5
  36. package/dist/types/clients/types.d.ts.map +1 -1
  37. package/dist/types/dsl/brain-runner.d.ts +9 -14
  38. package/dist/types/dsl/brain-runner.d.ts.map +1 -1
  39. package/dist/types/dsl/brain-state-machine.d.ts +18 -28
  40. package/dist/types/dsl/brain-state-machine.d.ts.map +1 -1
  41. package/dist/types/dsl/brain.d.ts +3 -2
  42. package/dist/types/dsl/brain.d.ts.map +1 -1
  43. package/dist/types/dsl/builder/brain.d.ts +87 -230
  44. package/dist/types/dsl/builder/brain.d.ts.map +1 -1
  45. package/dist/types/dsl/builder/continuation.d.ts +16 -0
  46. package/dist/types/dsl/builder/continuation.d.ts.map +1 -0
  47. package/dist/types/dsl/constants.d.ts +12 -12
  48. package/dist/types/dsl/constants.d.ts.map +1 -1
  49. package/dist/types/dsl/create-brain.d.ts +17 -57
  50. package/dist/types/dsl/create-brain.d.ts.map +1 -1
  51. package/dist/types/dsl/definitions/blocks.d.ts +67 -55
  52. package/dist/types/dsl/definitions/blocks.d.ts.map +1 -1
  53. package/dist/types/dsl/definitions/brain-types.d.ts +8 -11
  54. package/dist/types/dsl/definitions/brain-types.d.ts.map +1 -1
  55. package/dist/types/dsl/definitions/events.d.ts +61 -55
  56. package/dist/types/dsl/definitions/events.d.ts.map +1 -1
  57. package/dist/types/dsl/definitions/run-params.d.ts +20 -21
  58. package/dist/types/dsl/definitions/run-params.d.ts.map +1 -1
  59. package/dist/types/dsl/definitions/steps.d.ts +1 -1
  60. package/dist/types/dsl/definitions/steps.d.ts.map +1 -1
  61. package/dist/types/dsl/example-webhook.d.ts +3 -3
  62. package/dist/types/dsl/example-webhook.d.ts.map +1 -1
  63. package/dist/types/dsl/execution/constants.d.ts +0 -5
  64. package/dist/types/dsl/execution/constants.d.ts.map +1 -1
  65. package/dist/types/dsl/execution/event-channel.d.ts +16 -0
  66. package/dist/types/dsl/execution/event-channel.d.ts.map +1 -0
  67. package/dist/types/dsl/execution/event-stream.d.ts +46 -34
  68. package/dist/types/dsl/execution/event-stream.d.ts.map +1 -1
  69. package/dist/types/dsl/signal-validation.d.ts.map +1 -1
  70. package/dist/types/dsl/types.d.ts +21 -83
  71. package/dist/types/dsl/types.d.ts.map +1 -1
  72. package/dist/types/dsl/webhook.d.ts +12 -2
  73. package/dist/types/dsl/webhook.d.ts.map +1 -1
  74. package/dist/types/files/event-wrapper.d.ts +20 -0
  75. package/dist/types/files/event-wrapper.d.ts.map +1 -0
  76. package/dist/types/files/index.d.ts +2 -0
  77. package/dist/types/files/index.d.ts.map +1 -0
  78. package/dist/types/files/mime.d.ts +2 -0
  79. package/dist/types/files/mime.d.ts.map +1 -0
  80. package/dist/types/files/types.d.ts +88 -0
  81. package/dist/types/files/types.d.ts.map +1 -0
  82. package/dist/types/index.d.ts +22 -12
  83. package/dist/types/index.d.ts.map +1 -1
  84. package/dist/types/jsx-runtime.d.ts +35 -0
  85. package/dist/types/jsx-runtime.d.ts.map +1 -0
  86. package/dist/types/memory/{scoped-memory.d.ts → create-memory.d.ts} +7 -7
  87. package/dist/types/memory/create-memory.d.ts.map +1 -0
  88. package/dist/types/memory/types.d.ts +4 -4
  89. package/dist/types/memory/types.d.ts.map +1 -1
  90. package/dist/types/plugins/collect-webhooks.d.ts +8 -0
  91. package/dist/types/plugins/collect-webhooks.d.ts.map +1 -0
  92. package/dist/types/plugins/define-plugin.d.ts +25 -0
  93. package/dist/types/plugins/define-plugin.d.ts.map +1 -0
  94. package/dist/types/plugins/index.d.ts +3 -0
  95. package/dist/types/plugins/index.d.ts.map +1 -0
  96. package/dist/types/plugins/types.d.ts +83 -0
  97. package/dist/types/plugins/types.d.ts.map +1 -0
  98. package/dist/types/store/index.d.ts +1 -1
  99. package/dist/types/store/index.d.ts.map +1 -1
  100. package/dist/types/store/types.d.ts +0 -8
  101. package/dist/types/store/types.d.ts.map +1 -1
  102. package/dist/types/template/render-html.d.ts +9 -0
  103. package/dist/types/template/render-html.d.ts.map +1 -0
  104. package/dist/types/template/render.d.ts +15 -0
  105. package/dist/types/template/render.d.ts.map +1 -0
  106. package/dist/types/tools/index.d.ts +39 -27
  107. package/dist/types/tools/index.d.ts.map +1 -1
  108. package/dist/types/ui/generate-page-html.d.ts +4 -6
  109. package/dist/types/ui/generate-page-html.d.ts.map +1 -1
  110. package/dist/types/ui/{generate-ui.d.ts → generate-page.d.ts} +6 -6
  111. package/dist/types/ui/generate-page.d.ts.map +1 -0
  112. package/dist/types/ui/parse-form-data.d.ts +1 -5
  113. package/dist/types/ui/parse-form-data.d.ts.map +1 -1
  114. package/dist/types/ui/types.d.ts +0 -49
  115. package/dist/types/ui/types.d.ts.map +1 -1
  116. package/dist/types/yaml/data-validator.d.ts +0 -5
  117. package/dist/types/yaml/data-validator.d.ts.map +1 -1
  118. package/dist/types/yaml/type-inference.d.ts +4 -2
  119. package/dist/types/yaml/type-inference.d.ts.map +1 -1
  120. package/dist/types/yaml/types.d.ts +0 -1
  121. package/dist/types/yaml/types.d.ts.map +1 -1
  122. package/package.json +5 -1
  123. package/dist/src/dsl/agent-messages.js +0 -5
  124. package/dist/src/ui/validate-form.js +0 -428
  125. package/dist/types/dsl/agent-messages.d.ts +0 -12
  126. package/dist/types/dsl/agent-messages.d.ts.map +0 -1
  127. package/dist/types/memory/scoped-memory.d.ts.map +0 -1
  128. package/dist/types/ui/generate-ui.d.ts.map +0 -1
  129. package/dist/types/ui/validate-form.d.ts +0 -45
  130. package/dist/types/ui/validate-form.d.ts.map +0 -1
@@ -0,0 +1,35 @@
1
+ import type { JSX as ReactJSX } from 'react';
2
+ export declare const Fragment: unique symbol;
3
+ export declare const File: unique symbol;
4
+ export declare const Resource: unique symbol;
5
+ interface FormComponent {
6
+ (props: Record<string, unknown>): TemplateNode;
7
+ }
8
+ export declare const Form: FormComponent;
9
+ type BuiltinComponent = typeof Fragment | typeof File | typeof Resource;
10
+ export type FunctionComponent = (props: Record<string, unknown>) => TemplateChild | Promise<TemplateChild>;
11
+ export type ElementType = BuiltinComponent | FunctionComponent | string;
12
+ export interface TemplateNode {
13
+ type: ElementType;
14
+ props: Record<string, unknown>;
15
+ children: TemplateChild[];
16
+ }
17
+ export type TemplateChild = string | number | boolean | null | undefined | TemplateNode | TemplateChild[];
18
+ export declare function jsx(type: ElementType, props: Record<string, unknown>): TemplateNode;
19
+ export declare const jsxs: typeof jsx;
20
+ type WithTemplateChildren<T> = Omit<T, 'children'> & {
21
+ children?: TemplateChild;
22
+ };
23
+ type PositronicIntrinsicElements = {
24
+ [K in keyof ReactJSX.IntrinsicElements]: WithTemplateChildren<ReactJSX.IntrinsicElements[K]>;
25
+ };
26
+ export declare namespace JSX {
27
+ type Element = TemplateNode;
28
+ interface IntrinsicElements extends PositronicIntrinsicElements {
29
+ }
30
+ interface ElementChildrenAttribute {
31
+ children: {};
32
+ }
33
+ }
34
+ export {};
35
+ //# sourceMappingURL=jsx-runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsx-runtime.d.ts","sourceRoot":"","sources":["../../src/jsx-runtime.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,GAAG,IAAI,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE7C,eAAO,MAAM,QAAQ,eAAoC,CAAC;AAC1D,eAAO,MAAM,IAAI,eAAgC,CAAC;AAClD,eAAO,MAAM,QAAQ,eAAoC,CAAC;AAK1D,UAAU,aAAa;IACrB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,YAAY,CAAC;CAChD;AACD,eAAO,MAAM,IAAI,EAAE,aAAoD,CAAC;AAExE,KAAK,gBAAgB,GAAG,OAAO,QAAQ,GAAG,OAAO,IAAI,GAAG,OAAO,QAAQ,CAAC;AAExE,MAAM,MAAM,iBAAiB,GAAG,CAC9B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC3B,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AAE5C,MAAM,MAAM,WAAW,GAAG,gBAAgB,GAAG,iBAAiB,GAAG,MAAM,CAAC;AAExE,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,WAAW,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,QAAQ,EAAE,aAAa,EAAE,CAAC;CAC3B;AAED,MAAM,MAAM,aAAa,GACrB,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,SAAS,GACT,YAAY,GACZ,aAAa,EAAE,CAAC;AAGpB,wBAAgB,GAAG,CACjB,IAAI,EAAE,WAAW,EACjB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,YAAY,CAOd;AAGD,eAAO,MAAM,IAAI,YAAM,CAAC;AAGxB,KAAK,oBAAoB,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,UAAU,CAAC,GAAG;IACnD,QAAQ,CAAC,EAAE,aAAa,CAAC;CAC1B,CAAC;AAEF,KAAK,2BAA2B,GAAG;KAChC,CAAC,IAAI,MAAM,QAAQ,CAAC,iBAAiB,GAAG,oBAAoB,CAC3D,QAAQ,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAC9B;CACF,CAAC;AAEF,yBAAiB,GAAG,CAAC;IACnB,KAAY,OAAO,GAAG,YAAY,CAAC;IAEnC,UAAiB,iBAAkB,SAAQ,2BAA2B;KAAG;IAEzE,UAAiB,wBAAwB;QACvC,QAAQ,EAAE,EAAE,CAAC;KACd;CACF"}
@@ -1,6 +1,6 @@
1
- import type { MemoryProvider, ScopedMemory } from './types.js';
1
+ import type { MemoryProvider, Memory } from './types.js';
2
2
  /**
3
- * Creates a scoped memory instance with agentId and userId pre-bound.
3
+ * Creates a Memory instance with agentId and userId pre-bound.
4
4
  *
5
5
  * This wraps a MemoryProvider and automatically includes the agentId
6
6
  * and userId in all calls, so brain steps don't need to pass them explicitly.
@@ -8,16 +8,16 @@ import type { MemoryProvider, ScopedMemory } from './types.js';
8
8
  * @param provider - The underlying memory provider
9
9
  * @param agentId - The agent/brain ID to scope memories to
10
10
  * @param userId - The user name to scope memories to (from currentUser.name)
11
- * @returns A ScopedMemory instance
11
+ * @returns A Memory instance
12
12
  *
13
13
  * @example
14
14
  * ```typescript
15
15
  * const provider = createMem0Provider({ apiKey: '...' });
16
- * const scopedMemory = createScopedMemory(provider, 'my-brain', 'user-123');
16
+ * const memory = createMemory(provider, 'my-brain', 'user-123');
17
17
  *
18
18
  * // Now search without passing agentId or userId
19
- * const memories = await scopedMemory.search('user preferences');
19
+ * const memories = await memory.search('user preferences');
20
20
  * ```
21
21
  */
22
- export declare function createScopedMemory(provider: MemoryProvider, agentId: string, userId: string): ScopedMemory;
23
- //# sourceMappingURL=scoped-memory.d.ts.map
22
+ export declare function createMemory(provider: MemoryProvider, agentId: string, userId: string): Memory;
23
+ //# sourceMappingURL=create-memory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-memory.d.ts","sourceRoot":"","sources":["../../../src/memory/create-memory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,MAAM,EAKP,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,cAAc,EACxB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,GACb,MAAM,CAkBR"}
@@ -8,7 +8,7 @@
8
8
  /**
9
9
  * A single memory entry returned from search operations.
10
10
  */
11
- export interface Memory {
11
+ export interface MemoryEntry {
12
12
  /** Unique identifier for this memory */
13
13
  id: string;
14
14
  /** The memory content */
@@ -66,7 +66,7 @@ export interface MemoryProvider {
66
66
  */
67
67
  search(query: string, scope: MemoryScope, options?: {
68
68
  limit?: number;
69
- }): Promise<Memory[]>;
69
+ }): Promise<MemoryEntry[]>;
70
70
  /**
71
71
  * Add memories from a conversation.
72
72
  *
@@ -82,7 +82,7 @@ export interface MemoryProvider {
82
82
  * Scoped memory interface with agentId and userId pre-bound.
83
83
  * This is what brain steps receive - they don't need to pass agentId or userId.
84
84
  */
85
- export interface ScopedMemory {
85
+ export interface Memory {
86
86
  /**
87
87
  * Search for relevant memories.
88
88
  *
@@ -90,7 +90,7 @@ export interface ScopedMemory {
90
90
  * @param options - Optional search options (limit)
91
91
  * @returns Array of matching memories
92
92
  */
93
- search(query: string, options?: MemorySearchOptions): Promise<Memory[]>;
93
+ search(query: string, options?: MemorySearchOptions): Promise<MemoryEntry[]>;
94
94
  /**
95
95
  * Add memories from messages.
96
96
  *
@@ -1 +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,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,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,E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AAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,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,WAAW,EAAE,CAAC,CAAC;IAE1B;;;;;;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,MAAM;IACrB;;;;;;OAMG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;IAE7E;;;;;OAKG;IACH,GAAG,CAAC,QAAQ,EAAE,aAAa,EAAE,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3E"}
@@ -0,0 +1,8 @@
1
+ import type { ConfiguredPlugin } from './types.js';
2
+ import type { WebhookFunction } from '../dsl/webhook.js';
3
+ /**
4
+ * Collect webhook declarations from all plugins.
5
+ * Returns a manifest-compatible record mapping slug -> WebhookFunction.
6
+ */
7
+ export declare function collectPluginWebhooks(plugins: readonly ConfiguredPlugin[]): Record<string, WebhookFunction<any>>;
8
+ //# sourceMappingURL=collect-webhooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collect-webhooks.d.ts","sourceRoot":"","sources":["../../../src/plugins/collect-webhooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,SAAS,gBAAgB,EAAE,GACnC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,GAAG,CAAC,CAAC,CAWtC"}
@@ -0,0 +1,25 @@
1
+ import type { PluginDefinition, PluginCreateReturn, ConfiguredPlugin, ConfiguredPluginWithSetup } from './types.js';
2
+ /**
3
+ * Define a plugin with a setup function for typed configuration.
4
+ * Returns a ConfiguredPlugin with a .setup() method.
5
+ *
6
+ * Usage:
7
+ * const mem0 = definePlugin({ name: 'mem0', setup: (c: Config) => c, create: ... })
8
+ * brain('x').withPlugin(mem0) // default config
9
+ * brain('x').withPlugin(mem0.setup({ scope: 'user' })) // custom config
10
+ */
11
+ export declare function definePlugin<TName extends string, TConfig, TCreate extends PluginCreateReturn>(definition: PluginDefinition<TName, TConfig, TCreate> & {
12
+ setup: (config: TConfig) => TConfig;
13
+ }): ConfiguredPluginWithSetup<TName, TConfig, TCreate>;
14
+ /**
15
+ * Define a plugin without a setup function (no configuration needed).
16
+ * Returns a ConfiguredPlugin that can be passed directly to withPlugin().
17
+ *
18
+ * Usage:
19
+ * const logger = definePlugin({ name: 'logger', create: ... })
20
+ * brain('x').withPlugin(logger)
21
+ */
22
+ export declare function definePlugin<TName extends string, TCreate extends PluginCreateReturn>(definition: PluginDefinition<TName, undefined, TCreate> & {
23
+ setup?: never;
24
+ }): ConfiguredPlugin<TName, undefined, TCreate>;
25
+ //# sourceMappingURL=define-plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"define-plugin.d.ts","sourceRoot":"","sources":["../../../src/plugins/define-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,yBAAyB,EAC1B,MAAM,YAAY,CAAC;AAEpB;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC1B,KAAK,SAAS,MAAM,EACpB,OAAO,EACP,OAAO,SAAS,kBAAkB,EAElC,UAAU,EAAE,gBAAgB,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,GAAG;IACtD,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC;CACrC,GACA,yBAAyB,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AAEtD;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAC1B,KAAK,SAAS,MAAM,EACpB,OAAO,SAAS,kBAAkB,EAElC,UAAU,EAAE,gBAAgB,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,GAAG;IAAE,KAAK,CAAC,EAAE,KAAK,CAAA;CAAE,GAC1E,gBAAgB,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { definePlugin } from './define-plugin.js';
2
+ export type { CreateContext, PluginAdapter, PluginCreateReturn, PluginDefinition, PluginInjection, PluginsFrom, PluginsFromArray, ConfiguredPlugin, ConfiguredPluginWithSetup, } from './types.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,YAAY,EACV,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,yBAAyB,GAC1B,MAAM,YAAY,CAAC"}
@@ -0,0 +1,83 @@
1
+ import type { CurrentUser } from '../dsl/types.js';
2
+ import type { WebhookFunction } from '../dsl/webhook.js';
3
+ /**
4
+ * Context passed to a plugin's `create` function.
5
+ * Contains per-run information needed to scope the plugin instance.
6
+ */
7
+ export interface CreateContext<TConfig = undefined> {
8
+ config: TConfig;
9
+ brainTitle: string;
10
+ currentUser: CurrentUser;
11
+ brainRunId: string;
12
+ }
13
+ /**
14
+ * A plugin adapter that receives brain events.
15
+ * Optional `resume` method receives historical events on brain resume
16
+ * for rebuilding internal state without side effects.
17
+ */
18
+ export interface PluginAdapter {
19
+ dispatch(event: any): void | Promise<void>;
20
+ resume?(events: any[]): void;
21
+ }
22
+ /**
23
+ * The return value of a plugin's `create` function.
24
+ * Special keys `tools` and `adapter` are intercepted by the framework.
25
+ * Everything else goes on StepContext under the plugin name.
26
+ */
27
+ export type PluginCreateReturn = {
28
+ tools?: Record<string, any>;
29
+ adapter?: PluginAdapter;
30
+ webhooks?: Record<string, WebhookFunction<any>>;
31
+ [key: string]: any;
32
+ };
33
+ /**
34
+ * The full plugin definition as passed to definePlugin().
35
+ */
36
+ export interface PluginDefinition<TName extends string, TConfig, TCreate extends PluginCreateReturn> {
37
+ name: TName;
38
+ setup?: (config: TConfig) => TConfig;
39
+ create: (ctx: CreateContext<TConfig>) => TCreate;
40
+ /** Static webhook declarations — discovered at startup for manifest registration */
41
+ webhooks?: Record<string, WebhookFunction<any>>;
42
+ }
43
+ /**
44
+ * What goes on StepContext under the plugin name:
45
+ * everything from create() except `adapter`.
46
+ */
47
+ export type PluginInjection<TCreate extends PluginCreateReturn> = Omit<TCreate, 'adapter'>;
48
+ /**
49
+ * A configured plugin instance. Returned by definePlugin() and by .setup().
50
+ * Can be passed directly to brain.withPlugin().
51
+ *
52
+ * The __plugin and __config fields are internal — used by the framework
53
+ * to resolve plugins at brain.run() time.
54
+ */
55
+ export interface ConfiguredPlugin<TName extends string = string, TConfig = any, TCreate extends PluginCreateReturn = PluginCreateReturn> {
56
+ readonly __plugin: PluginDefinition<TName, TConfig, TCreate>;
57
+ readonly __config: TConfig;
58
+ }
59
+ /**
60
+ * Extract plugin injections from a plugins object literal.
61
+ * Maps { slack: ConfiguredPlugin<'slack', C, R> } → { slack: PluginInjection<R> }.
62
+ * The injection name comes from the object key, not the plugin's internal name.
63
+ */
64
+ export type PluginsFrom<T extends Record<string, ConfiguredPlugin>> = {
65
+ [K in keyof T]: T[K] extends ConfiguredPlugin<any, any, infer C> ? PluginInjection<C> : never;
66
+ };
67
+ /**
68
+ * Extract plugin injections from an array of ConfiguredPlugin instances.
69
+ * Reuses PluginsFrom by mapping the array's union to a record keyed by plugin name.
70
+ *
71
+ * Used by createBrain() to propagate project-level plugin types to all brains.
72
+ */
73
+ export type PluginsFromArray<T extends readonly ConfiguredPlugin[]> = PluginsFrom<{
74
+ [K in T[number] as K['__plugin']['name']]: K;
75
+ }>;
76
+ /**
77
+ * A configured plugin that also has a .setup() method for per-brain configuration.
78
+ * Returned by definePlugin() when a setup function is provided.
79
+ */
80
+ export interface ConfiguredPluginWithSetup<TName extends string, TConfig, TCreate extends PluginCreateReturn> extends ConfiguredPlugin<TName, TConfig, TCreate> {
81
+ setup(config: TConfig): ConfiguredPlugin<TName, TConfig, TCreate>;
82
+ }
83
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/plugins/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD;;;GAGG;AACH,MAAM,WAAW,aAAa,CAAC,OAAO,GAAG,SAAS;IAChD,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,WAAW,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,MA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OAAO,CAAC;CAC5B;AAED;;;;GAIG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,IAAI;KACnE,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC,GAC5D,eAAe,CAAC,CAAC,CAAC,GAClB,KAAK;CACV,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,SAAS,gBAAgB,EAAE,IAChE,WAAW,CAAC;KACT,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;CAC7C,CAAC,CAAC;AAEL;;;GAGG;AACH,MAAM,WAAW,yBAAyB,CACxC,KAAK,SAAS,MAAM,EACpB,OAAO,EACP,OAAO,SAAS,kBAAkB,CAClC,SAAQ,gBAAgB,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC;IACjD,KAAK,CAAC,MAAM,EAAE,OAAO,GAAG,gBAAgB,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;CACnE"}
@@ -1,2 +1,2 @@
1
- export type { Store, StoreProvider, PerUserField, InferStoreTypes, StoreContext, } from './types.js';
1
+ export type { Store, StoreProvider, PerUserField, InferStoreTypes, } from './types.js';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/store/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,KAAK,EACL,aAAa,EACb,YAAY,EACZ,eAAe,EACf,YAAY,GACb,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/store/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,KAAK,EACL,aAAa,EACb,YAAY,EACZ,eAAe,GAChB,MAAM,YAAY,CAAC"}
@@ -40,12 +40,4 @@ export type StoreProvider = (config: {
40
40
  brainTitle: string;
41
41
  currentUser?: CurrentUser;
42
42
  }) => Store<any>;
43
- /**
44
- * Conditional type that adds `store` to step params only when withStore() is used.
45
- * When TStore is `never` (default), this resolves to `{}` — no store in params.
46
- * When TStore is a record type, this adds `{ store: Store<TStore> }`.
47
- */
48
- export type StoreContext<TStore> = [TStore] extends [never] ? {} : TStore extends Record<string, JsonValue | undefined> ? {
49
- store: Store<TStore>;
50
- } : {};
51
43
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/store/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9D;;;GAGG;AACH,MAAM,WAAW,YAAY,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,OAAO;IAC3D,IAAI,EAAE,CAAC,CAAC;IACR,OAAO,EAAE,IAAI,CAAC;CACf;AAED;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;AAExE;;;GAGG;AACH,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,WAAW,IAAI;KAClD,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,YAAY,CAAC,MAAM,CAAC,CAAC,GAC9C,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GACV,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,GACtB,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GACb,KAAK;CACV,CAAC;AAEF;;;;GAIG;AACH,MAAM,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M,EAAE,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC3D;AAED;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE;IACnC,MAAM,EAAE,WAAW,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B,KAAK,KAAK,CAAC,GAAG,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { type TemplateChild } from '../jsx-runtime.js';
2
+ export interface RenderHtmlContext {
3
+ formAction?: string;
4
+ }
5
+ export declare function renderHtml(node: TemplateChild, context?: RenderHtmlContext): string;
6
+ export declare function wrapHtmlDocument(body: string, options?: {
7
+ title?: string;
8
+ }): string;
9
+ //# sourceMappingURL=render-html.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render-html.d.ts","sourceRoot":"","sources":["../../../src/template/render-html.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,aAAa,EAEnB,MAAM,mBAAmB,CAAC;AAE3B,MAAM,WAAW,iBAAiB;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AA8JD,wBAAgB,UAAU,CACxB,IAAI,EAAE,aAAa,EACnB,OAAO,GAAE,iBAAsB,GAC9B,MAAM,CAER;AAED,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAC3B,MAAM,CAcR"}
@@ -0,0 +1,15 @@
1
+ import { type TemplateNode, type TemplateChild } from '../jsx-runtime.js';
2
+ import type { TemplateReturn } from '../dsl/definitions/blocks.js';
3
+ export interface TemplateContext {
4
+ readFile?: (name: string) => Promise<string>;
5
+ readResource?: (name: string) => Promise<string>;
6
+ }
7
+ export declare function buildTemplateContext(files?: {
8
+ open(name: string): {
9
+ read(): Promise<string>;
10
+ };
11
+ }, resources?: unknown): TemplateContext;
12
+ export declare function isTemplateNode(value: unknown): value is TemplateNode;
13
+ export declare function resolveTemplate(raw: TemplateReturn, context?: TemplateContext): Promise<string>;
14
+ export declare function renderTemplate(node: TemplateChild, context?: TemplateContext): Promise<string>;
15
+ //# sourceMappingURL=render.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../../src/template/render.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,YAAY,EACjB,KAAK,aAAa,EAEnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAEnE,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7C,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CAClD;AAED,wBAAgB,oBAAoB,CAClC,KAAK,CAAC,EAAE;IAAE,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG;QAAE,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CAAA;KAAE,CAAA;CAAE,EAC3D,SAAS,CAAC,EAAE,OAAO,GAClB,eAAe,CAOjB;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAQpE;AAED,wBAAsB,eAAe,CACnC,GAAG,EAAE,cAAc,EACnB,OAAO,GAAE,eAAoB,GAC5B,OAAO,CAAC,MAAM,CAAC,CAIjB;AAED,wBAAsB,cAAc,CAClC,IAAI,EAAE,aAAa,EACnB,OAAO,GAAE,eAAoB,GAC5B,OAAO,CAAC,MAAM,CAAC,CAGjB"}
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import type { AgentTool, AgentToolWaitFor, StepContext } from '../dsl/types.js';
2
+ import type { Tool, ToolWaitFor, StepContext } from '../dsl/types.js';
3
3
  /**
4
4
  * Helper function to create tools with proper type inference.
5
5
  *
@@ -24,10 +24,10 @@ import type { AgentTool, AgentToolWaitFor, StepContext } 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>, context: StepContext) => unknown | Promise<unknown> | AgentToolWaitFor | Promise<AgentToolWaitFor>;
27
+ execute?: (input: z.infer<T>, context: StepContext) => unknown | Promise<unknown> | ToolWaitFor | Promise<ToolWaitFor>;
28
28
  terminal?: boolean;
29
- }): AgentTool<T>;
30
- declare const generateUIInputSchema: z.ZodObject<{
29
+ }): Tool<T>;
30
+ declare const generatePageInputSchema: z.ZodObject<{
31
31
  prompt: z.ZodString;
32
32
  hasForm: z.ZodOptional<z.ZodBoolean>;
33
33
  persist: z.ZodOptional<z.ZodBoolean>;
@@ -59,7 +59,7 @@ declare const generateUIInputSchema: z.ZodObject<{
59
59
  *
60
60
  * The description is enriched at runtime with available component information.
61
61
  */
62
- export declare const generateUI: AgentTool<typeof generateUIInputSchema>;
62
+ export declare const generatePage: Tool<typeof generatePageInputSchema>;
63
63
  declare const waitForWebhookInputSchema: z.ZodObject<{
64
64
  slug: z.ZodString;
65
65
  identifier: z.ZodString;
@@ -68,29 +68,29 @@ declare const waitForWebhookInputSchema: z.ZodObject<{
68
68
  }, "strip", z.ZodTypeAny, {
69
69
  slug: string;
70
70
  identifier: string;
71
- token?: string | undefined;
72
71
  timeout?: string | undefined;
72
+ token?: string | undefined;
73
73
  }, {
74
74
  slug: string;
75
75
  identifier: string;
76
- token?: string | undefined;
77
76
  timeout?: string | undefined;
77
+ token?: string | undefined;
78
78
  }>;
79
79
  /**
80
80
  * Wait for webhook tool - pauses execution until a webhook receives a response.
81
81
  *
82
- * Use this after generating a UI page with a form to wait for the user's submission.
82
+ * Use this after generating a page with a form to wait for the user's submission.
83
83
  * The form data will be returned as the tool result when the webhook fires.
84
84
  *
85
85
  * IMPORTANT: Before calling this tool, ensure the user knows the page URL
86
86
  * so they can access and submit the form.
87
87
  */
88
- export declare const waitForWebhook: AgentTool<typeof waitForWebhookInputSchema>;
88
+ export declare const waitForWebhook: Tool<typeof waitForWebhookInputSchema>;
89
89
  /**
90
90
  * Print tool - the simplest way for agents to communicate with users.
91
91
  * Like PRINT in BASIC - outputs a message that users can see.
92
92
  */
93
- export declare const print: AgentTool<z.ZodObject<{
93
+ export declare const print: Tool<z.ZodObject<{
94
94
  message: z.ZodString;
95
95
  }, "strip", z.ZodTypeAny, {
96
96
  message: string;
@@ -101,7 +101,7 @@ export declare const print: AgentTool<z.ZodObject<{
101
101
  * Console log tool - for internal server-side debugging and logging.
102
102
  * NOT for user communication - use print for that.
103
103
  */
104
- export declare const consoleLog: AgentTool<z.ZodObject<{
104
+ export declare const consoleLog: Tool<z.ZodObject<{
105
105
  message: z.ZodString;
106
106
  level: z.ZodOptional<z.ZodEnum<["info", "warn", "error"]>>;
107
107
  }, "strip", z.ZodTypeAny, {
@@ -112,16 +112,29 @@ export declare const consoleLog: AgentTool<z.ZodObject<{
112
112
  level?: "error" | "info" | "warn" | undefined;
113
113
  }>>;
114
114
  /**
115
- * Default schema for the auto-generated 'done' tool when no outputSchema is provided.
116
- * Used internally by the framework.
115
+ * Read a file by name. The agent decides which files to read.
116
+ * Returns the file content as text.
117
117
  */
118
- export declare const defaultDoneSchema: z.ZodObject<{
119
- result: z.ZodString;
118
+ export declare const readFile: Tool<z.ZodObject<{
119
+ name: z.ZodString;
120
120
  }, "strip", z.ZodTypeAny, {
121
- result: string;
121
+ name: string;
122
122
  }, {
123
- result: string;
124
- }>;
123
+ name: string;
124
+ }>>;
125
+ /**
126
+ * Write text content to a file. The agent decides what to write and where.
127
+ */
128
+ export declare const writeFile: Tool<z.ZodObject<{
129
+ name: z.ZodString;
130
+ content: z.ZodString;
131
+ }, "strip", z.ZodTypeAny, {
132
+ name: string;
133
+ content: string;
134
+ }, {
135
+ name: string;
136
+ content: string;
137
+ }>>;
125
138
  /**
126
139
  * Default tools bundle.
127
140
  *
@@ -129,9 +142,8 @@ export declare const defaultDoneSchema: z.ZodObject<{
129
142
  * standard tools in your brain. Tools can be extended or overridden in
130
143
  * individual agent steps.
131
144
  *
132
- * Note: A 'done' terminal tool is automatically generated for every agent.
133
- * If you provide an outputSchema, 'done' will use that schema. Otherwise,
134
- * it uses a default schema expecting { result: string }.
145
+ * Note: A 'done' terminal tool is automatically generated for every agent
146
+ * using the required outputSchema.
135
147
  *
136
148
  * @example
137
149
  * ```typescript
@@ -153,7 +165,7 @@ export declare const defaultDoneSchema: z.ZodObject<{
153
165
  * ```
154
166
  */
155
167
  export declare const defaultTools: {
156
- generateUI: AgentTool<z.ZodObject<{
168
+ generatePage: Tool<z.ZodObject<{
157
169
  prompt: z.ZodString;
158
170
  hasForm: z.ZodOptional<z.ZodBoolean>;
159
171
  persist: z.ZodOptional<z.ZodBoolean>;
@@ -169,7 +181,7 @@ export declare const defaultTools: {
169
181
  hasForm?: boolean | undefined;
170
182
  persist?: boolean | undefined;
171
183
  }>>;
172
- waitForWebhook: AgentTool<z.ZodObject<{
184
+ waitForWebhook: Tool<z.ZodObject<{
173
185
  slug: z.ZodString;
174
186
  identifier: z.ZodString;
175
187
  token: z.ZodOptional<z.ZodString>;
@@ -177,22 +189,22 @@ export declare const defaultTools: {
177
189
  }, "strip", z.ZodTypeAny, {
178
190
  slug: string;
179
191
  identifier: string;
180
- token?: string | undefined;
181
192
  timeout?: string | undefined;
193
+ token?: string | undefined;
182
194
  }, {
183
195
  slug: string;
184
196
  identifier: string;
185
- token?: string | undefined;
186
197
  timeout?: string | undefined;
198
+ token?: string | undefined;
187
199
  }>>;
188
- print: AgentTool<z.ZodObject<{
200
+ print: Tool<z.ZodObject<{
189
201
  message: z.ZodString;
190
202
  }, "strip", z.ZodTypeAny, {
191
203
  message: string;
192
204
  }, {
193
205
  message: string;
194
206
  }>>;
195
- consoleLog: AgentTool<z.ZodObject<{
207
+ consoleLog: Tool<z.ZodObject<{
196
208
  message: z.ZodString;
197
209
  level: z.ZodOptional<z.ZodEnum<["info", "warn", "error"]>>;
198
210
  }, "strip", z.ZodTypeAny, {
@@ -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;AAMhF;;;;;;;;;;;;;;;;;;;;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,KAElB,OAAO,GACP,OAAO,CAAC,OAAO,CAAC,GAChB,gBAAgB,GAChB,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,GAAG,SAAS,CAAC,CAAC,CAAC,CAEf;AAED,QAAA,MAAM,qBAAqB;;;;;;;;;;;;;;;EAmCzB,CAAC;AAEH;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,UAAU,EAAE,SAAS,CAAC,OAAO,qBAAqB,CAiG9D,CAAC;AAEF,QAAA,MAAM,yBAAyB;;;;;;;;;;;;;;;EA+B7B,CAAC;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,EAAE,SAAS,CAAC,OAAO,yBAAyB,CA4CtE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,KAAK;;;;;;GAWhB,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,UAAU;;;;;;;;;GAmBrB,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;;;;EAQ5B,CAAC;AAEH;;;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Q;;;;;;GAcnB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,SAAS;;;;;;;;;GAepB,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAKxB,CAAC"}
@@ -3,9 +3,9 @@ import type { Placement } from './types.js';
3
3
  * Generate a CSRF token for form submissions.
4
4
  * Use this when building custom HTML pages with forms that submit to webhook endpoints.
5
5
  *
6
- * Include the returned token as a hidden input field:
7
- * ```html
8
- * <input type="hidden" name="__positronic_token" value="${token}">
6
+ * Include the returned token as a query parameter in the form action URL:
7
+ * ```
8
+ * /webhooks/system/ui-form?identifier=...&token=${token}
9
9
  * ```
10
10
  * And include it in the WebhookRegistration's `token` field.
11
11
  */
@@ -22,10 +22,8 @@ export interface GeneratePageHtmlOptions {
22
22
  data: Record<string, unknown>;
23
23
  /** Page title */
24
24
  title?: string;
25
- /** Form action URL for form submission */
25
+ /** Form action URL for form submission (include token as query param if needed) */
26
26
  formAction?: string;
27
- /** CSRF token for form submission validation */
28
- formToken?: string;
29
27
  }
30
28
  /**
31
29
  * Generate a complete HTML page from placements.
@@ -1 +1 @@
1
- {"version":3,"file":"generate-page-html.d.ts","sourceRoot":"","sources":["../../../src/ui/generate-page-html.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,2DAA2D;IAC3D,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB,mCAAmC;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,kEAAkE;IAClE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,iBAAiB;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0CAA0C;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gDAAgD;IAChD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAsID;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,GAAG,MAAM,CA4DzE"}
1
+ {"version":3,"file":"generate-page-html.d.ts","sourceRoot":"","sources":["../../../src/ui/generate-page-html.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,2DAA2D;IAC3D,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB,mCAAmC;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,kEAAkE;IAClE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,iBAAiB;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mFAAmF;IACnF,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AA8HD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,GAAG,MAAM,CAwDzE"}
@@ -1,9 +1,9 @@
1
1
  import type { ObjectGenerator } from '../clients/types.js';
2
2
  import type { UIComponent, Placement, FormSchema } from './types.js';
3
3
  /**
4
- * Result of generateUI - contains all component placements from the agent loop.
4
+ * Result of generatePage - contains all component placements from the agent loop.
5
5
  */
6
- export interface GenerateUIResult {
6
+ export interface GeneratePageResult {
7
7
  placements: Placement[];
8
8
  rootId: string | undefined;
9
9
  yaml?: string;
@@ -22,7 +22,7 @@ export interface GenerateUIResult {
22
22
  * ```typescript
23
23
  * import { components } from '@positronic/gen-ui-components';
24
24
  *
25
- * const result = await generateUI({
25
+ * const result = await generatePage({
26
26
  * client,
27
27
  * prompt: 'Create a form to collect user name and email',
28
28
  * components,
@@ -35,7 +35,7 @@ export interface GenerateUIResult {
35
35
  * // result.yaml is the generated YAML template
36
36
  * ```
37
37
  */
38
- export declare function generateUI(params: {
38
+ export declare function generatePage(params: {
39
39
  client: ObjectGenerator;
40
40
  prompt: string;
41
41
  components: Record<string, UIComponent<any>>;
@@ -43,5 +43,5 @@ export declare function generateUI(params: {
43
43
  data?: Record<string, unknown>;
44
44
  system?: string;
45
45
  maxSteps?: number;
46
- }): Promise<GenerateUIResult>;
47
- //# sourceMappingURL=generate-ui.d.ts.map
46
+ }): Promise<GeneratePageResult>;
47
+ //# sourceMappingURL=generate-page.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-page.d.ts","sourceRoot":"","sources":["../../../src/ui/generate-page.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAkErE;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,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;AA8UD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,YAAY,CAAC,MAAM,EAAE;IACzC,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,kBAAkB,CAAC,CAoE9B"}
@@ -1,12 +1,8 @@
1
1
  /**
2
2
  * Parse form data into a plain object, handling array fields.
3
- * Extracts and strips the __positronic_token CSRF field.
4
3
  * Supports:
5
4
  * - name[] syntax for explicit arrays
6
5
  * - Multiple values with same key (converted to array)
7
6
  */
8
- export declare function parseFormData(formData: FormData): {
9
- data: Record<string, unknown>;
10
- token: string | null;
11
- };
7
+ export declare function parseFormData(formData: FormData): Record<string, unknown>;
12
8
  //# sourceMappingURL=parse-form-data.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"parse-form-data.d.ts","sourceRoot":"","sources":["../../../src/ui/parse-form-data.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,QAAQ,GAAG;IACjD,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB,CA8BA"}
1
+ {"version":3,"file":"parse-form-data.d.ts","sourceRoot":"","sources":["../../../src/ui/parse-form-data.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAuBzE"}