liminal 0.5.11 → 0.5.13
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/CHANGELOG.md +14 -0
- package/Config.ts +13 -0
- package/Context.ts +24 -32
- package/Definition.ts +32 -0
- package/EventBase.ts +1 -1
- package/Handler.ts +3 -5
- package/L/L.ts +5 -2
- package/L/all.ts +35 -0
- package/L/assistant.ts +5 -6
- package/L/catch.ts +16 -18
- package/L/context.ts +12 -0
- package/L/continuation.ts +13 -0
- package/L/emit.ts +10 -8
- package/L/infer.ts +22 -27
- package/L/message.ts +5 -9
- package/L/model.ts +6 -8
- package/L/reflect.ts +12 -0
- package/L/run.ts +29 -0
- package/L/strand.ts +14 -95
- package/L/stream.ts +11 -24
- package/L/system.ts +13 -8
- package/L/user.ts +13 -8
- package/LEvent.ts +9 -17
- package/LiminalAssertionError.ts +19 -0
- package/Model.ts +5 -3
- package/ModelRegistry.ts +1 -7
- package/Rune.test.ts +5 -0
- package/Rune.ts +24 -12
- package/Schema.ts +185 -0
- package/Strand.ts +253 -0
- package/Tool.ts +8 -16
- package/TypeAdapter.ts +3 -0
- package/dist/Config.d.ts +12 -0
- package/dist/Config.js +2 -0
- package/dist/Config.js.map +1 -0
- package/dist/Context.d.ts +11 -10
- package/dist/Context.js +15 -26
- package/dist/Context.js.map +1 -1
- package/dist/Definition.d.ts +10 -0
- package/dist/Definition.js +18 -0
- package/dist/Definition.js.map +1 -0
- package/dist/EventBase.js +1 -1
- package/dist/EventBase.js.map +1 -1
- package/dist/Handler.d.ts +3 -4
- package/dist/Handler.js +1 -2
- package/dist/Handler.js.map +1 -1
- package/dist/L/L.d.ts +5 -2
- package/dist/L/L.js +5 -2
- package/dist/L/L.js.map +1 -1
- package/dist/L/all.d.ts +10 -0
- package/dist/L/all.js +20 -0
- package/dist/L/all.js.map +1 -0
- package/dist/L/assistant.d.ts +2 -2
- package/dist/L/assistant.js +4 -5
- package/dist/L/assistant.js.map +1 -1
- package/dist/L/catch.d.ts +3 -2
- package/dist/L/catch.js +12 -15
- package/dist/L/catch.js.map +1 -1
- package/dist/L/context.d.ts +2 -0
- package/dist/L/context.js +12 -0
- package/dist/L/context.js.map +1 -0
- package/dist/L/continuation.d.ts +3 -0
- package/dist/L/continuation.js +12 -0
- package/dist/L/continuation.js.map +1 -0
- package/dist/L/emit.d.ts +3 -5
- package/dist/L/emit.js +8 -3
- package/dist/L/emit.js.map +1 -1
- package/dist/L/infer.d.ts +2 -5
- package/dist/L/infer.js +21 -22
- package/dist/L/infer.js.map +1 -1
- package/dist/L/message.d.ts +2 -4
- package/dist/L/message.js +4 -6
- package/dist/L/message.js.map +1 -1
- package/dist/L/model.d.ts +2 -4
- package/dist/L/model.js +4 -5
- package/dist/L/model.js.map +1 -1
- package/dist/L/reflect.d.ts +4 -0
- package/dist/L/reflect.js +10 -0
- package/dist/L/reflect.js.map +1 -0
- package/dist/L/run.d.ts +15 -0
- package/dist/L/run.js +16 -0
- package/dist/L/run.js.map +1 -0
- package/dist/L/strand.d.ts +4 -25
- package/dist/L/strand.js +8 -65
- package/dist/L/strand.js.map +1 -1
- package/dist/L/stream.d.ts +2 -4
- package/dist/L/stream.js +8 -19
- package/dist/L/stream.js.map +1 -1
- package/dist/L/system.d.ts +2 -4
- package/dist/L/system.js +4 -3
- package/dist/L/system.js.map +1 -1
- package/dist/L/user.d.ts +2 -4
- package/dist/L/user.js +4 -3
- package/dist/L/user.js.map +1 -1
- package/dist/LEvent.d.ts +13 -41
- package/dist/LEvent.js +4 -15
- package/dist/LEvent.js.map +1 -1
- package/dist/LiminalAssertionError.d.ts +8 -0
- package/dist/LiminalAssertionError.js +20 -0
- package/dist/LiminalAssertionError.js.map +1 -0
- package/dist/Model.d.ts +4 -2
- package/dist/Model.js +1 -1
- package/dist/Model.js.map +1 -1
- package/dist/ModelRegistry.d.ts +0 -2
- package/dist/ModelRegistry.js +0 -2
- package/dist/ModelRegistry.js.map +1 -1
- package/dist/Rune.d.ts +19 -7
- package/dist/Rune.js +8 -4
- package/dist/Rune.js.map +1 -1
- package/dist/Rune.test.d.ts +1 -0
- package/dist/Rune.test.js +5 -0
- package/dist/Rune.test.js.map +1 -0
- package/dist/Schema.d.ts +46 -0
- package/dist/Schema.js +130 -0
- package/dist/Schema.js.map +1 -0
- package/dist/Strand.d.ts +57 -0
- package/dist/Strand.js +177 -0
- package/dist/Strand.js.map +1 -0
- package/dist/Tool.d.ts +6 -5
- package/dist/Tool.js +3 -4
- package/dist/Tool.js.map +1 -1
- package/dist/TypeAdapter.d.ts +1 -0
- package/dist/TypeAdapter.js +3 -0
- package/dist/TypeAdapter.js.map +1 -0
- package/dist/errors.d.ts +9 -0
- package/dist/errors.js +11 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +6 -4
- package/dist/index.js +6 -4
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/util/EnsureNarrow.d.ts +1 -0
- package/dist/util/EnsureNarrow.js +2 -0
- package/dist/util/EnsureNarrow.js.map +1 -0
- package/dist/util/JSONValue.d.ts +8 -0
- package/dist/util/JSONValue.js +20 -0
- package/dist/util/JSONValue.js.map +1 -0
- package/dist/util/attachCustomInspect.d.ts +1 -0
- package/dist/util/attachCustomInspect.js +11 -0
- package/dist/util/attachCustomInspect.js.map +1 -0
- package/dist/util/isTemplateStringsArray.d.ts +1 -0
- package/dist/util/isTemplateStringsArray.js +4 -0
- package/dist/util/isTemplateStringsArray.js.map +1 -0
- package/errors.ts +12 -0
- package/index.ts +6 -4
- package/package.json +3 -13
- package/tsconfig.json +1 -5
- package/util/EnsureNarrow.ts +1 -0
- package/util/JSONValue.ts +20 -0
- package/util/attachCustomInspect.ts +14 -0
- package/util/isTemplateStringsArray.ts +3 -0
- package/Fiber.ts +0 -126
- package/L/_common.ts +0 -6
- package/L/rune.ts +0 -12
- package/MessageRegistry.ts +0 -22
- package/Runic.ts +0 -30
- package/ToolRegistry.ts +0 -10
- package/dist/Fiber.d.ts +0 -36
- package/dist/Fiber.js +0 -97
- package/dist/Fiber.js.map +0 -1
- package/dist/L/_common.d.ts +0 -4
- package/dist/L/_common.js +0 -7
- package/dist/L/_common.js.map +0 -1
- package/dist/L/rune.d.ts +0 -3
- package/dist/L/rune.js +0 -9
- package/dist/L/rune.js.map +0 -1
- package/dist/MessageRegistry.d.ts +0 -9
- package/dist/MessageRegistry.js +0 -15
- package/dist/MessageRegistry.js.map +0 -1
- package/dist/Runic.d.ts +0 -9
- package/dist/Runic.js +0 -18
- package/dist/Runic.js.map +0 -1
- package/dist/ToolRegistry.d.ts +0 -6
- package/dist/ToolRegistry.js +0 -8
- package/dist/ToolRegistry.js.map +0 -1
package/Tool.ts
CHANGED
|
@@ -1,26 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
Schema,
|
|
4
|
-
type SchemaObject,
|
|
5
|
-
toJSONSchema,
|
|
6
|
-
validate,
|
|
7
|
-
type Value,
|
|
8
|
-
type ValueObject,
|
|
9
|
-
} from "liminal-schema"
|
|
1
|
+
import { Schema } from "./Schema.ts"
|
|
2
|
+
import type { JSONValue } from "./util/JSONValue.ts"
|
|
10
3
|
|
|
11
4
|
export class Tool {
|
|
12
|
-
static async make<T extends
|
|
5
|
+
static async make<T extends JSONValue>(
|
|
13
6
|
description: string,
|
|
14
|
-
|
|
15
|
-
f: (arg: T) =>
|
|
7
|
+
schema: Schema<T>,
|
|
8
|
+
f: (arg: T) => JSONValue | Promise<JSONValue>,
|
|
16
9
|
) {
|
|
17
|
-
const schema = toJSONSchema(type)
|
|
18
10
|
return new Tool(
|
|
19
11
|
await Schema.id(schema, description),
|
|
20
12
|
description,
|
|
21
13
|
schema,
|
|
22
14
|
async (arg) => {
|
|
23
|
-
return await f(await
|
|
15
|
+
return await f(await Schema.validateValue(schema, arg))
|
|
24
16
|
},
|
|
25
17
|
)
|
|
26
18
|
}
|
|
@@ -28,7 +20,7 @@ export class Tool {
|
|
|
28
20
|
constructor(
|
|
29
21
|
readonly name: string,
|
|
30
22
|
readonly description: string,
|
|
31
|
-
readonly parameterSchema:
|
|
32
|
-
readonly f: (arg: any) =>
|
|
23
|
+
readonly parameterSchema: Schema,
|
|
24
|
+
readonly f: (arg: any) => JSONValue | Promise<JSONValue>,
|
|
33
25
|
) {}
|
|
34
26
|
}
|
package/TypeAdapter.ts
ADDED
package/dist/Config.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Message } from "./Message.ts";
|
|
2
|
+
import { ModelRegistry } from "./ModelRegistry.ts";
|
|
3
|
+
import type { Rune } from "./Rune.ts";
|
|
4
|
+
import type { Strand } from "./Strand.ts";
|
|
5
|
+
import type { Tool } from "./Tool.ts";
|
|
6
|
+
export interface Config<Y extends Rune<any> = Rune<any>, T = any> {
|
|
7
|
+
handler?: ((this: Strand<Y, T>, event: Rune.E<Y>) => void) | undefined;
|
|
8
|
+
models?: ModelRegistry | undefined;
|
|
9
|
+
messages?: Array<Message>;
|
|
10
|
+
tools?: Set<Tool> | undefined;
|
|
11
|
+
signal?: AbortSignal | undefined;
|
|
12
|
+
}
|
package/dist/Config.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Config.js","sourceRoot":"","sources":["../Config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA"}
|
package/dist/Context.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import type { Handler } from "./Handler.ts";
|
|
2
|
+
import type { Message } from "./Message.ts";
|
|
3
|
+
import { ModelRegistry } from "./ModelRegistry.ts";
|
|
4
|
+
import type { Tool } from "./Tool.ts";
|
|
5
|
+
export interface Context {
|
|
6
|
+
readonly handler: Handler | undefined;
|
|
7
|
+
readonly models: ModelRegistry;
|
|
8
|
+
readonly messages: Array<Message>;
|
|
9
|
+
readonly tools: Set<Tool>;
|
|
10
|
+
clone(): Context;
|
|
5
11
|
}
|
|
6
|
-
export
|
|
7
|
-
fork(parent?: V): V;
|
|
8
|
-
get(): V | undefined;
|
|
9
|
-
debug?: string;
|
|
10
|
-
}
|
|
11
|
-
export declare function ContextPart<V>(fork: (parent?: V) => V, debug?: string): ContextPart<V>;
|
|
12
|
+
export declare function Context(context?: Omit<Context, "clone">): Context;
|
package/dist/Context.js
CHANGED
|
@@ -1,30 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
return context;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
export function ContextPart(fork, debug) {
|
|
21
|
-
const self = {
|
|
22
|
-
fork,
|
|
23
|
-
get() {
|
|
24
|
-
return Context.get()?.get(self);
|
|
1
|
+
import { ModelRegistry } from "./ModelRegistry.js";
|
|
2
|
+
export function Context(context) {
|
|
3
|
+
return {
|
|
4
|
+
handler: context?.handler,
|
|
5
|
+
models: context?.models.clone() ?? new ModelRegistry(),
|
|
6
|
+
messages: [],
|
|
7
|
+
tools: new Set(context?.tools),
|
|
8
|
+
clone() {
|
|
9
|
+
return {
|
|
10
|
+
handler: this.handler,
|
|
11
|
+
models: this.models.clone(),
|
|
12
|
+
messages: [...this.messages],
|
|
13
|
+
tools: new Set(this.tools),
|
|
14
|
+
clone: this.clone,
|
|
15
|
+
};
|
|
25
16
|
},
|
|
26
|
-
...debug && { debug },
|
|
27
17
|
};
|
|
28
|
-
return self;
|
|
29
18
|
}
|
|
30
19
|
//# sourceMappingURL=Context.js.map
|
package/dist/Context.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Context.js","sourceRoot":"","sources":["../Context.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Context.js","sourceRoot":"","sources":["../Context.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAYlD,MAAM,UAAU,OAAO,CAAC,OAAgC;IACtD,OAAO;QACL,OAAO,EAAE,OAAO,EAAE,OAAO;QACzB,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,KAAK,EAAE,IAAI,IAAI,aAAa,EAAE;QACtD,QAAQ,EAAE,EAAE;QACZ,KAAK,EAAE,IAAI,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC;QAE9B,KAAK;YACH,OAAO;gBACL,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE;gBAC3B,QAAQ,EAAE,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC;gBAC5B,KAAK,EAAE,IAAI,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC;gBAC1B,KAAK,EAAE,IAAI,CAAC,KAAK;aAClB,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Rune } from "./Rune.ts";
|
|
2
|
+
export type RuneIterator<Y extends Rune<any> = Rune<any>, T = any> = Iterator<Y, T> | AsyncIterator<Y, T>;
|
|
3
|
+
export type RuneIterable<Y extends Rune<any> = Rune<any>, T = any> = Iterable<Y, T> | AsyncIterable<Y, T>;
|
|
4
|
+
export type Definition<Y extends Rune<any> = Rune<any>, T = any> = RuneIterable<Y, T> | (() => RuneIterable<Y, T>);
|
|
5
|
+
export declare namespace Definition {
|
|
6
|
+
type Y<X extends Definition> = X extends RuneIterable<infer Y> ? Y : X extends () => RuneIterable<infer Y> ? Y : X extends RuneIterator<infer Y> ? Y : never;
|
|
7
|
+
type T<X extends Definition> = X extends RuneIterable<Rune<any>, infer T> ? T : X extends () => RuneIterable<Rune<any>, infer T> ? T : X extends RuneIterator<Rune<any>, infer T> ? T : never;
|
|
8
|
+
type E<X extends Definition> = Rune.E<Y<X>>;
|
|
9
|
+
function unwrap<Y extends Rune<any>, T>(definition: Definition<Y, T>): RuneIterator<Y, T>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export var Definition;
|
|
2
|
+
(function (Definition) {
|
|
3
|
+
function unwrap(definition) {
|
|
4
|
+
if (Symbol.iterator in definition) {
|
|
5
|
+
return definition[Symbol.iterator]();
|
|
6
|
+
}
|
|
7
|
+
else if (Symbol.asyncIterator in definition) {
|
|
8
|
+
return definition[Symbol.asyncIterator]();
|
|
9
|
+
}
|
|
10
|
+
const iterable = definition();
|
|
11
|
+
if (Symbol.iterator in iterable) {
|
|
12
|
+
return iterable[Symbol.iterator]();
|
|
13
|
+
}
|
|
14
|
+
return iterable[Symbol.asyncIterator]();
|
|
15
|
+
}
|
|
16
|
+
Definition.unwrap = unwrap;
|
|
17
|
+
})(Definition || (Definition = {}));
|
|
18
|
+
//# sourceMappingURL=Definition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Definition.js","sourceRoot":"","sources":["../Definition.ts"],"names":[],"mappings":"AAMA,MAAM,KAAW,UAAU,CAyB1B;AAzBD,WAAiB,UAAU;IAazB,SAAgB,MAAM,CAAyB,UAA4B;QACzE,IAAI,MAAM,CAAC,QAAQ,IAAI,UAAU,EAAE,CAAC;YAClC,OAAO,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAA;QACtC,CAAC;aAAM,IAAI,MAAM,CAAC,aAAa,IAAI,UAAU,EAAE,CAAC;YAC9C,OAAO,UAAU,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAA;QAC3C,CAAC;QACD,MAAM,QAAQ,GAAG,UAAU,EAAE,CAAA;QAC7B,IAAI,MAAM,CAAC,QAAQ,IAAI,QAAQ,EAAE,CAAC;YAChC,OAAO,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAA;QACpC,CAAC;QACD,OAAO,QAAQ,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAA;IACzC,CAAC;IAXe,iBAAM,SAWrB,CAAA;AACH,CAAC,EAzBgB,UAAU,KAAV,UAAU,QAyB1B"}
|
package/dist/EventBase.js
CHANGED
package/dist/EventBase.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventBase.js","sourceRoot":"","sources":["../EventBase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"EventBase.js","sourceRoot":"","sources":["../EventBase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAA;AAOnE,MAAM,UAAU,SAAS,CAAqC,KAAQ,EAAE,IAAO;IAC7E,OAAO;QACL,MAAM,CAAC,EAAE,CAAkC,KAAc;YACvD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;mBAC7C,OAAO,IAAI,KAAK,IAAI,KAAK,CAAC,KAAK,KAAK,KAAK;mBACzC,MAAM,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,CAAA;QAC7C,CAAC;QAEQ,KAAK,GAAG,KAAK,CAAA;QACb,IAAI,GAAG,IAAI,CAAA;QAEpB;YACE,mBAAmB,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,CAAA;QACvE,CAAC;KACF,CAAA;AACH,CAAC"}
|
package/dist/Handler.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
3
|
-
export type Handler<
|
|
4
|
-
export declare const HandlerContext: ContextPart<Handler | undefined>;
|
|
1
|
+
import type { Rune } from "./Rune.ts";
|
|
2
|
+
import type { Strand } from "./Strand.ts";
|
|
3
|
+
export type Handler<Y extends Rune<any> = Rune<any>> = (this: Strand, event: Rune.E<Y>) => void;
|
package/dist/Handler.js
CHANGED
package/dist/Handler.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Handler.js","sourceRoot":"","sources":["../Handler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Handler.js","sourceRoot":"","sources":["../Handler.ts"],"names":[],"mappings":""}
|
package/dist/L/L.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
export * from "
|
|
1
|
+
export * from "./all.ts";
|
|
2
2
|
export * from "./assistant.ts";
|
|
3
3
|
export * from "./catch.ts";
|
|
4
|
+
export * from "./context.ts";
|
|
5
|
+
export * from "./continuation.ts";
|
|
4
6
|
export * from "./emit.ts";
|
|
5
7
|
export * from "./infer.ts";
|
|
6
8
|
export * from "./message.ts";
|
|
7
9
|
export * from "./model.ts";
|
|
8
|
-
export * from "./
|
|
10
|
+
export * from "./reflect.ts";
|
|
11
|
+
export * from "./run.ts";
|
|
9
12
|
export * from "./strand.ts";
|
|
10
13
|
export * from "./stream.ts";
|
|
11
14
|
export * from "./system.ts";
|
package/dist/L/L.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
export * from "
|
|
1
|
+
export * from "./all.js";
|
|
2
2
|
export * from "./assistant.js";
|
|
3
3
|
export * from "./catch.js";
|
|
4
|
+
export * from "./context.js";
|
|
5
|
+
export * from "./continuation.js";
|
|
4
6
|
export * from "./emit.js";
|
|
5
7
|
export * from "./infer.js";
|
|
6
8
|
export * from "./message.js";
|
|
7
9
|
export * from "./model.js";
|
|
8
|
-
export * from "./
|
|
10
|
+
export * from "./reflect.js";
|
|
11
|
+
export * from "./run.js";
|
|
9
12
|
export * from "./strand.js";
|
|
10
13
|
export * from "./stream.js";
|
|
11
14
|
export * from "./system.js";
|
package/dist/L/L.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"L.js","sourceRoot":"","sources":["../../L/L.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"L.js","sourceRoot":"","sources":["../../L/L.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,mBAAmB,CAAA;AACjC,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,WAAW,CAAA"}
|
package/dist/L/all.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Context } from "../Context.ts";
|
|
2
|
+
import { Definition } from "../Definition.ts";
|
|
3
|
+
import type { LEvent } from "../LEvent.ts";
|
|
4
|
+
import type { Rune } from "../Rune.ts";
|
|
5
|
+
export declare function all<A extends Array<Definition>>(definitions: A, context?: Context): Generator<Rune<LEvent> | Definition.Y<A[number]>, {
|
|
6
|
+
[I in keyof A]: Definition.T<A[I]>;
|
|
7
|
+
}>;
|
|
8
|
+
export declare function all<A extends Record<keyof any, Definition>>(definitions: A, context?: Context): Generator<Rune<LEvent> | Definition.Y<A[keyof A]>, {
|
|
9
|
+
[K in keyof A]: Definition.T<A[K]>;
|
|
10
|
+
}>;
|
package/dist/L/all.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Definition } from "../Definition.js";
|
|
2
|
+
import { Strand } from "../Strand.js";
|
|
3
|
+
import { continuation } from "./continuation.js";
|
|
4
|
+
import { reflect } from "./reflect.js";
|
|
5
|
+
export function* all(definitions, context) {
|
|
6
|
+
const parent = yield* reflect;
|
|
7
|
+
const strands = [];
|
|
8
|
+
for (const definition of Array.isArray(definitions) ? definitions : Object.values(definitions)) {
|
|
9
|
+
strands.push(new Strand(definition, {
|
|
10
|
+
parent,
|
|
11
|
+
context: context?.clone() ?? parent.context.clone(),
|
|
12
|
+
}));
|
|
13
|
+
}
|
|
14
|
+
const results = yield* continuation("all", () => Promise.all(strands));
|
|
15
|
+
if (Array.isArray(strands))
|
|
16
|
+
return results;
|
|
17
|
+
const keys = Object.keys(strands);
|
|
18
|
+
return Object.fromEntries(results.map((result, i) => [keys[i], result]));
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=all.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"all.js","sourceRoot":"","sources":["../../L/all.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAG7C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAUtC,MAAM,SAAS,CAAC,CAAC,GAAG,CAClB,WAAc,EACd,OAAiB;IAEjB,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,OAAO,CAAA;IAC7B,MAAM,OAAO,GAAkB,EAAE,CAAA;IACjC,KAAK,MAAM,UAAU,IAAI,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC;QAC/F,OAAO,CAAC,IAAI,CACV,IAAI,MAAM,CAAC,UAAU,EAAE;YACrB,MAAM;YACN,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE;SACpD,CAAC,CACH,CAAA;IACH,CAAC;IACD,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAA;IACtE,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;QAAE,OAAO,OAAO,CAAA;IAC1C,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IACjC,OAAO,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAA;AAC1E,CAAC"}
|
package/dist/L/assistant.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type LType } from "liminal-schema";
|
|
2
1
|
import type { LEvent } from "../LEvent.ts";
|
|
3
2
|
import type { Rune } from "../Rune.ts";
|
|
3
|
+
import { Schema } from "../Schema.ts";
|
|
4
4
|
export interface assistant extends Iterable<Rune<LEvent>, string> {
|
|
5
|
-
<T>(
|
|
5
|
+
<T>(schema: Schema<T>): Generator<Rune<LEvent>, T>;
|
|
6
6
|
}
|
|
7
7
|
export declare const assistant: assistant;
|
package/dist/L/assistant.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Schema } from "../Schema.js";
|
|
2
|
+
import { continuation } from "./continuation.js";
|
|
2
3
|
import { infer } from "./infer.js";
|
|
3
4
|
import { message } from "./message.js";
|
|
4
|
-
|
|
5
|
-
export const assistant = Object.assign(function* (type) {
|
|
6
|
-
const schema = toJSONSchema(type);
|
|
5
|
+
export const assistant = Object.assign(function* assistant(schema) {
|
|
7
6
|
const inference = yield* infer(schema);
|
|
8
7
|
yield* message("assistant", [{ part: inference }]);
|
|
9
8
|
const input = JSON.parse(inference);
|
|
10
|
-
return yield*
|
|
9
|
+
return yield* continuation("validate_assistant_message", () => Schema.validateValue(schema, input));
|
|
11
10
|
}, {
|
|
12
11
|
*[Symbol.iterator]() {
|
|
13
12
|
const inference = yield* infer();
|
package/dist/L/assistant.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assistant.js","sourceRoot":"","sources":["../../L/assistant.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"assistant.js","sourceRoot":"","sources":["../../L/assistant.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAMtC,MAAM,CAAC,MAAM,SAAS,GAAc,MAAM,CAAC,MAAM,CAC/C,QAAQ,CAAC,CAAC,SAAS,CAAI,MAAiB;IACtC,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IACtC,KAAK,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,CAAA;IAClD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;IACnC,OAAO,KAAK,CAAC,CAAC,YAAY,CAAC,4BAA4B,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAA;AACrG,CAAC,EACD;IACE,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC;QAChB,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,KAAK,EAAE,CAAA;QAChC,KAAK,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,CAAA;QAClD,OAAO,SAAS,CAAA;IAClB,CAAC;CACF,CACF,CAAA"}
|
package/dist/L/catch.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { Definition } from "../Definition.ts";
|
|
2
|
+
import type { LEvent } from "../LEvent.ts";
|
|
1
3
|
import type { Rune } from "../Rune.ts";
|
|
2
|
-
import type { Runic } from "../Runic.ts";
|
|
3
4
|
export { catch_ as catch };
|
|
4
|
-
declare function catch_<Y extends Rune
|
|
5
|
+
declare function catch_<Y extends Rune<any>, T>(definition: Definition<Y, T>): Generator<Rune<LEvent> | Rune<Y>, CatchResult<T>>;
|
|
5
6
|
export type CatchResult<T> = {
|
|
6
7
|
resolved: T;
|
|
7
8
|
rejected?: never;
|
package/dist/L/catch.js
CHANGED
|
@@ -1,24 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { rune } from "./rune.js";
|
|
1
|
+
import { Strand } from "../Strand.js";
|
|
2
|
+
import { continuation } from "./continuation.js";
|
|
3
|
+
import { reflect } from "./reflect.js";
|
|
5
4
|
export { catch_ as catch };
|
|
6
|
-
function* catch_(
|
|
7
|
-
|
|
5
|
+
function* catch_(definition) {
|
|
6
|
+
const parent = yield* reflect;
|
|
7
|
+
return yield* continuation("catch", async () => {
|
|
8
8
|
try {
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
parent,
|
|
15
|
-
}).resolution()),
|
|
16
|
-
};
|
|
9
|
+
const resolved = await new Strand(definition, {
|
|
10
|
+
parent,
|
|
11
|
+
context: parent.context.clone(),
|
|
12
|
+
}).then();
|
|
13
|
+
return { resolved };
|
|
17
14
|
}
|
|
18
15
|
catch (exception) {
|
|
19
16
|
return { rejected: exception };
|
|
20
17
|
}
|
|
21
|
-
}
|
|
18
|
+
});
|
|
22
19
|
}
|
|
23
20
|
Object.defineProperty(catch_, "name", { value: "catch" });
|
|
24
21
|
//# sourceMappingURL=catch.js.map
|
package/dist/L/catch.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catch.js","sourceRoot":"","sources":["../../L/catch.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"catch.js","sourceRoot":"","sources":["../../L/catch.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,OAAO,EAAE,MAAM,IAAI,KAAK,EAAE,CAAA;AAE1B,QAAQ,CAAC,CAAC,MAAM,CACd,UAA4B;IAE5B,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,OAAO,CAAA;IAC7B,OAAO,KAAK,CAAC,CAAC,YAAY,CAAC,OAAO,EAAE,KAAK,IAAI,EAAE;QAC7C,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAI,MAAM,CAAC,UAAU,EAAE;gBAC5C,MAAM;gBACN,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE;aAChC,CAAC,CAAC,IAAI,EAAE,CAAA;YACT,OAAO,EAAE,QAAQ,EAAE,CAAA;QACrB,CAAC;QAAC,OAAO,SAAkB,EAAE,CAAC;YAC5B,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAA;QAChC,CAAC;IACH,CAAC,CAAC,CAAA;AACJ,CAAC;AACD,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Context } from "../Context.js";
|
|
2
|
+
import { reflect } from "./reflect.js";
|
|
3
|
+
export function* context(partial) {
|
|
4
|
+
const { context } = yield* reflect;
|
|
5
|
+
return Context({
|
|
6
|
+
handler: partial.handler ?? context.handler,
|
|
7
|
+
messages: partial.messages ?? context.messages,
|
|
8
|
+
models: partial.models ?? context.models,
|
|
9
|
+
tools: partial.tools ?? context.tools,
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../L/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,MAAM,SAAS,CAAC,CAAC,OAAO,CAAC,OAAwC;IAC/D,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC,CAAC,OAAO,CAAA;IAClC,OAAO,OAAO,CAAC;QACb,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO;QAC3C,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ;QAC9C,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM;QACxC,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK;KACtC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"continuation.js","sourceRoot":"","sources":["../../L/continuation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAE1C,MAAM,SAAS,CAAC,CAAC,YAAY,CAAI,KAAa,EAAE,CAAU;IACxD,OAAO,MAAM;QACX,CAAC,OAAO,CAAC,EAAE,IAAI;QACf,KAAK,EAAE;YACL,IAAI,EAAE,cAAc;YACpB,KAAK;YACL,CAAC;SACF;KACF,CAAA;AACH,CAAC"}
|
package/dist/L/emit.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type {
|
|
3
|
-
export
|
|
4
|
-
}
|
|
5
|
-
export declare function emit<const E>(event: EnsureNarrow<E>): emit<E>;
|
|
1
|
+
import { Rune } from "../Rune.ts";
|
|
2
|
+
import type { EnsureNarrow } from "../util/EnsureNarrow.ts";
|
|
3
|
+
export declare function emit<E>(event: EnsureNarrow<E>): Generator<Rune<E>, void>;
|
package/dist/L/emit.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Rune, RuneKey } from "../Rune.js";
|
|
2
2
|
export function* emit(event) {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
return yield {
|
|
4
|
+
[RuneKey]: true,
|
|
5
|
+
value: {
|
|
6
|
+
kind: "event",
|
|
7
|
+
event,
|
|
8
|
+
},
|
|
9
|
+
};
|
|
5
10
|
}
|
|
6
11
|
//# sourceMappingURL=emit.js.map
|
package/dist/L/emit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emit.js","sourceRoot":"","sources":["../../L/emit.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"emit.js","sourceRoot":"","sources":["../../L/emit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAG1C,MAAM,SAAS,CAAC,CAAC,IAAI,CAAI,KAAsB;IAC7C,OAAO,MAAM;QACX,CAAC,OAAO,CAAC,EAAE,IAAI;QACf,KAAK,EAAE;YACL,IAAI,EAAE,OAAO;YACb,KAAK;SACN;KACF,CAAA;AACH,CAAC"}
|
package/dist/L/infer.d.ts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import type { SchemaObject } from "liminal-schema";
|
|
2
1
|
import { type LEvent } from "../LEvent.ts";
|
|
3
2
|
import type { Rune } from "../Rune.ts";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
declare function infer_(schema?: SchemaObject): infer_;
|
|
3
|
+
import { Schema } from "../Schema.ts";
|
|
4
|
+
export declare function infer(schema?: Schema): Generator<Rune<LEvent>, string>;
|
package/dist/L/infer.js
CHANGED
|
@@ -1,29 +1,28 @@
|
|
|
1
|
-
import { assert } from "liminal-util";
|
|
2
1
|
import { InferenceRequested, Inferred } from "../LEvent.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { LiminalAssertionError } from "../LiminalAssertionError.js";
|
|
3
|
+
import { Schema } from "../Schema.js";
|
|
4
|
+
import { continuation } from "./continuation.js";
|
|
6
5
|
import { emit } from "./emit.js";
|
|
7
|
-
import {
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
assert(
|
|
12
|
-
const
|
|
13
|
-
assert(model);
|
|
14
|
-
const requestId = RequestCounter.next();
|
|
6
|
+
import { reflect } from "./reflect.js";
|
|
7
|
+
export function* infer(schema) {
|
|
8
|
+
const { context: { models, messages }, signal } = yield* reflect;
|
|
9
|
+
const model = models.peek();
|
|
10
|
+
LiminalAssertionError.assert(model);
|
|
11
|
+
const requestId = crypto.randomUUID();
|
|
15
12
|
yield* emit(new InferenceRequested(requestId, schema));
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
13
|
+
let inference = yield* continuation("infer", () => model.seal({
|
|
14
|
+
messages,
|
|
15
|
+
schema: schema
|
|
16
|
+
? schema.type === "object"
|
|
17
|
+
? schema
|
|
18
|
+
: Schema.wrap(schema)
|
|
19
|
+
: undefined,
|
|
20
|
+
signal,
|
|
21
|
+
}).resolve());
|
|
22
|
+
if (schema?.type && schema.type !== "object") {
|
|
23
|
+
inference = JSON.stringify(JSON.parse(inference).value);
|
|
24
|
+
}
|
|
25
25
|
yield* emit(new Inferred(requestId, inference));
|
|
26
26
|
return inference;
|
|
27
27
|
}
|
|
28
|
-
Object.defineProperty(infer_, "name", { value: "infer" });
|
|
29
28
|
//# sourceMappingURL=infer.js.map
|
package/dist/L/infer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"infer.js","sourceRoot":"","sources":["../../L/infer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"infer.js","sourceRoot":"","sources":["../../L/infer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAe,MAAM,cAAc,CAAA;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAA;AAEnE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,MAAM,SAAS,CAAC,CAAC,KAAK,CAAC,MAAe;IACpC,MAAM,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,OAAO,CAAA;IAChE,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,EAAE,CAAA;IAC3B,qBAAqB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IACnC,MAAM,SAAS,GAAG,MAAM,CAAC,UAAU,EAAE,CAAA;IACrC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,kBAAkB,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAA;IACtD,IAAI,SAAS,GAAG,KAAK,CAAC,CAAC,YAAY,CAAC,OAAO,EAAE,GAAG,EAAE,CAChD,KAAK,CAAC,IAAI,CAAC;QACT,QAAQ;QACR,MAAM,EAAE,MAAM;YACZ,CAAC,CAAC,MAAM,CAAC,IAAI,KAAK,QAAQ;gBACxB,CAAC,CAAC,MAAM;gBACR,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;YACvB,CAAC,CAAC,SAAS;QACb,MAAM;KACP,CAAC,CAAC,OAAO,EAAE,CAAC,CAAA;IACf,IAAI,MAAM,EAAE,IAAI,IAAI,MAAM,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC7C,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,CAAA;IACzD,CAAC;IACD,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,CAAA;IAC/C,OAAO,SAAS,CAAA;AAClB,CAAC"}
|
package/dist/L/message.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LEvent } from "../LEvent.ts";
|
|
2
2
|
import type { ContentPart, MessageRole } from "../Message.ts";
|
|
3
3
|
import type { Rune } from "../Rune.ts";
|
|
4
|
-
export
|
|
5
|
-
}
|
|
6
|
-
export declare function message(role: MessageRole, content: Array<ContentPart>): message;
|
|
4
|
+
export declare function message(role: MessageRole, content: Array<ContentPart>): Generator<Rune<LEvent>, void>;
|
package/dist/L/message.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { MessageAppended } from "../LEvent.js";
|
|
3
|
-
import { MessageRegistryContext } from "../MessageRegistry.js";
|
|
1
|
+
import { LEvent, MessageAppended } from "../LEvent.js";
|
|
4
2
|
import { emit } from "./emit.js";
|
|
3
|
+
import { reflect } from "./reflect.js";
|
|
5
4
|
export function* message(role, content) {
|
|
6
|
-
const
|
|
7
|
-
assert(messageRegistry);
|
|
5
|
+
const { context: { messages } } = yield* reflect;
|
|
8
6
|
const message = { role, content };
|
|
9
7
|
yield* emit(new MessageAppended(message));
|
|
10
|
-
|
|
8
|
+
messages.push(message);
|
|
11
9
|
}
|
|
12
10
|
//# sourceMappingURL=message.js.map
|
package/dist/L/message.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../L/message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../L/message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAGtD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,MAAM,SAAS,CAAC,CAAC,OAAO,CAAC,IAAiB,EAAE,OAA2B;IACrE,MAAM,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,EAAE,GAAG,KAAK,CAAC,CAAC,OAAO,CAAA;IAChD,MAAM,OAAO,GAAY,EAAE,IAAI,EAAE,OAAO,EAAE,CAAA;IAC1C,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC,CAAA;IACzC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;AACxB,CAAC"}
|
package/dist/L/model.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { LEvent } from "../LEvent.ts";
|
|
2
2
|
import type { Model } from "../Model.ts";
|
|
3
3
|
import type { Rune } from "../Rune.ts";
|
|
4
|
-
export
|
|
5
|
-
}
|
|
6
|
-
export declare function model(model: Model): model;
|
|
4
|
+
export declare function model(model: Model): Generator<Rune<LEvent>, Model>;
|
package/dist/L/model.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { assert } from "liminal-util";
|
|
2
1
|
import { ModelRegistered } from "../LEvent.js";
|
|
3
|
-
import { ModelRegistryContext } from "../ModelRegistry.js";
|
|
4
2
|
import { emit } from "./emit.js";
|
|
3
|
+
import { reflect } from "./reflect.js";
|
|
5
4
|
export function* model(model) {
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
registry.register(model);
|
|
5
|
+
const { context: { models } } = yield* reflect;
|
|
6
|
+
models.register(model);
|
|
9
7
|
yield* emit(new ModelRegistered(model));
|
|
8
|
+
return model;
|
|
10
9
|
}
|
|
11
10
|
//# sourceMappingURL=model.js.map
|