@positronic/core 0.0.67 → 0.0.69
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/brain-runner.js +34 -9
- package/dist/src/dsl/builder/brain.js +60 -16
- package/dist/src/dsl/create-brain.js +4 -1
- package/dist/src/dsl/execution/event-stream.js +40 -16
- package/dist/src/memory/scoped-memory.js +8 -7
- package/dist/src/memory/types.js +2 -2
- package/dist/src/store/index.js +1 -0
- package/dist/src/store/types.js +5 -0
- package/dist/types/clients/types.d.ts +17 -1
- package/dist/types/clients/types.d.ts.map +1 -1
- package/dist/types/dsl/brain-runner.d.ts +9 -2
- package/dist/types/dsl/brain-runner.d.ts.map +1 -1
- package/dist/types/dsl/builder/brain.d.ts +46 -21
- package/dist/types/dsl/builder/brain.d.ts.map +1 -1
- package/dist/types/dsl/create-brain.d.ts +7 -4
- package/dist/types/dsl/create-brain.d.ts.map +1 -1
- package/dist/types/dsl/definitions/blocks.d.ts +2 -0
- package/dist/types/dsl/definitions/blocks.d.ts.map +1 -1
- package/dist/types/dsl/definitions/events.d.ts +2 -1
- package/dist/types/dsl/definitions/events.d.ts.map +1 -1
- package/dist/types/dsl/definitions/run-params.d.ts +5 -1
- package/dist/types/dsl/definitions/run-params.d.ts.map +1 -1
- package/dist/types/dsl/example-webhook.d.ts +1 -1
- package/dist/types/dsl/example-webhook.d.ts.map +1 -1
- package/dist/types/dsl/execution/event-stream.d.ts +5 -0
- package/dist/types/dsl/execution/event-stream.d.ts.map +1 -1
- package/dist/types/dsl/types.d.ts +7 -0
- package/dist/types/dsl/types.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/memory/scoped-memory.d.ts +6 -5
- package/dist/types/memory/scoped-memory.d.ts.map +1 -1
- package/dist/types/memory/types.d.ts +4 -8
- package/dist/types/memory/types.d.ts.map +1 -1
- package/dist/types/store/index.d.ts +2 -0
- package/dist/types/store/index.d.ts.map +1 -0
- package/dist/types/store/types.d.ts +51 -0
- package/dist/types/store/types.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -40,8 +40,6 @@ export interface MemoryScope {
|
|
|
40
40
|
* Search options for memory retrieval.
|
|
41
41
|
*/
|
|
42
42
|
export interface MemorySearchOptions {
|
|
43
|
-
/** Optional user ID to scope the search */
|
|
44
|
-
userId?: string;
|
|
45
43
|
/** Maximum number of memories to return */
|
|
46
44
|
limit?: number;
|
|
47
45
|
}
|
|
@@ -49,8 +47,6 @@ export interface MemorySearchOptions {
|
|
|
49
47
|
* Options for adding memories.
|
|
50
48
|
*/
|
|
51
49
|
export interface MemoryAddOptions {
|
|
52
|
-
/** Optional user ID to scope the memory */
|
|
53
|
-
userId?: string;
|
|
54
50
|
/** Additional metadata to store with the memory */
|
|
55
51
|
metadata?: Record<string, unknown>;
|
|
56
52
|
}
|
|
@@ -83,15 +79,15 @@ export interface MemoryProvider {
|
|
|
83
79
|
}): Promise<void>;
|
|
84
80
|
}
|
|
85
81
|
/**
|
|
86
|
-
* Scoped memory interface with agentId pre-bound.
|
|
87
|
-
* This is what brain steps receive - they don't need to pass agentId.
|
|
82
|
+
* Scoped memory interface with agentId and userId pre-bound.
|
|
83
|
+
* This is what brain steps receive - they don't need to pass agentId or userId.
|
|
88
84
|
*/
|
|
89
85
|
export interface ScopedMemory {
|
|
90
86
|
/**
|
|
91
87
|
* Search for relevant memories.
|
|
92
88
|
*
|
|
93
89
|
* @param query - The search query
|
|
94
|
-
* @param options - Optional search options (
|
|
90
|
+
* @param options - Optional search options (limit)
|
|
95
91
|
* @returns Array of matching memories
|
|
96
92
|
*/
|
|
97
93
|
search(query: string, options?: MemorySearchOptions): Promise<Memory[]>;
|
|
@@ -99,7 +95,7 @@ export interface ScopedMemory {
|
|
|
99
95
|
* Add memories from messages.
|
|
100
96
|
*
|
|
101
97
|
* @param messages - Array of messages to extract memories from
|
|
102
|
-
* @param options - Optional options (
|
|
98
|
+
* @param options - Optional options (metadata)
|
|
103
99
|
*/
|
|
104
100
|
add(messages: MemoryMessage[], options?: MemoryAddOptions): Promise<void>;
|
|
105
101
|
}
|
|
@@ -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,
|
|
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,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Root":"","sources":["../../../src/store/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { JsonValue, CurrentUser } from '../dsl/types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Per-user field marker for store field definitions.
|
|
5
|
+
* Wraps a Zod type and marks the field as per-user scoped.
|
|
6
|
+
*/
|
|
7
|
+
export interface PerUserField<T extends z.ZodType = z.ZodType> {
|
|
8
|
+
type: T;
|
|
9
|
+
perUser: true;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Store field definitions — the shape declaration for withStore().
|
|
13
|
+
* Values are either Zod types (shared) or { type: ZodType, perUser: true } (per-user).
|
|
14
|
+
*/
|
|
15
|
+
export type StoreSchema = Record<string, z.ZodType | PerUserField<any>>;
|
|
16
|
+
/**
|
|
17
|
+
* Extract the value types from store field definitions.
|
|
18
|
+
* PerUserField<T> extracts z.infer<T>, plain ZodType extracts z.infer.
|
|
19
|
+
*/
|
|
20
|
+
export type InferStoreTypes<T extends StoreSchema> = {
|
|
21
|
+
[K in keyof T]: T[K] extends PerUserField<infer V> ? z.infer<V> : T[K] extends z.ZodType ? z.infer<T[K]> : never;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Unified store interface — used for both raw backends AND typed stores.
|
|
25
|
+
* Raw backend: Store<any> (string keys, any values)
|
|
26
|
+
* Typed store: Store<{counter: number, pref: string}> (constrained keys, typed values)
|
|
27
|
+
*/
|
|
28
|
+
export interface Store<T extends Record<string, JsonValue>> {
|
|
29
|
+
get<K extends keyof T & string>(key: K): Promise<T[K] | undefined>;
|
|
30
|
+
set<K extends keyof T & string>(key: K, value: T[K]): Promise<void>;
|
|
31
|
+
delete<K extends keyof T & string>(key: K): Promise<void>;
|
|
32
|
+
has<K extends keyof T & string>(key: K): Promise<boolean>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Factory function that creates a typed Store from a schema and runtime context.
|
|
36
|
+
* Backends implement this to handle persistence and key resolution.
|
|
37
|
+
*/
|
|
38
|
+
export type StoreProvider = (config: {
|
|
39
|
+
schema: StoreSchema;
|
|
40
|
+
brainTitle: string;
|
|
41
|
+
currentUser?: CurrentUser;
|
|
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> ? {
|
|
49
|
+
store: Store<TStore>;
|
|
50
|
+
} : {};
|
|
51
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +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,SAA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