liminal 0.5.1 → 0.5.2
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/Agent.ts +10 -0
- package/CHANGELOG.md +6 -0
- package/Exec.ts +19 -31
- package/L.ts +4 -7
- package/LiminalConfig.ts +1 -1
- package/Model.ts +8 -2
- package/PathLike.ts +8 -10
- package/Scope.ts +33 -14
- package/Tool.ts +3 -3
- package/actions/actions_derived/clear.ts +2 -2
- package/actions/actions_derived/declareModel.test.ts +10 -7
- package/actions/actions_derived/declareModel.ts +3 -3
- package/actions/actions_derived/messages.ts +0 -1
- package/actions/actions_derived/readers_derived.ts +15 -0
- package/actions/appendMessage.ts +27 -3
- package/actions/branch.ts +31 -33
- package/actions/catch.ts +3 -3
- package/actions/embed.ts +2 -1
- package/actions/enableTool.ts +2 -2
- package/actions/enableTool.type-test.ts +7 -7
- package/actions/infer.ts +15 -3
- package/actions/messages.ts +62 -0
- package/actions/pushModel.ts +22 -2
- package/actions/scope.ts +13 -0
- package/actions/section.ts +105 -0
- package/cli/cli_common.ts +1 -0
- package/cli/main.ts +6 -1
- package/cli/runExec.ts +20 -16
- package/dist/Agent.d.ts +7 -0
- package/dist/Agent.js +2 -0
- package/dist/Agent.js.map +1 -0
- package/dist/Exec.d.ts +5 -7
- package/dist/Exec.js +14 -17
- package/dist/Exec.js.map +1 -1
- package/dist/L.d.ts +4 -7
- package/dist/L.js +4 -7
- package/dist/L.js.map +1 -1
- package/dist/LiminalConfig.d.ts +1 -1
- package/dist/Model.d.ts +7 -2
- package/dist/PathLike.d.ts +4 -7
- package/dist/Scope.d.ts +11 -5
- package/dist/Scope.js +8 -5
- package/dist/Scope.js.map +1 -1
- package/dist/Tool.d.ts +2 -2
- package/dist/actions/actions_derived/clear.js +2 -2
- package/dist/actions/actions_derived/clear.js.map +1 -1
- package/dist/actions/actions_derived/declareModel.d.ts +2 -2
- package/dist/actions/actions_derived/declareModel.js +1 -1
- package/dist/actions/actions_derived/declareModel.js.map +1 -1
- package/dist/actions/actions_derived/declareModel.test.js +10 -7
- package/dist/actions/actions_derived/declareModel.test.js.map +1 -1
- package/dist/actions/actions_derived/messages.d.ts +3 -3
- package/dist/actions/actions_derived/messages.js.map +1 -1
- package/dist/actions/actions_derived/readers_derived.d.ts +6 -0
- package/dist/actions/actions_derived/readers_derived.js +14 -0
- package/dist/actions/actions_derived/readers_derived.js.map +1 -0
- package/dist/actions/appendMessage.d.ts +6 -2
- package/dist/actions/appendMessage.js +23 -2
- package/dist/actions/appendMessage.js.map +1 -1
- package/dist/actions/branch.d.ts +18 -14
- package/dist/actions/branch.js +10 -10
- package/dist/actions/branch.js.map +1 -1
- package/dist/actions/catch.d.ts +2 -2
- package/dist/actions/catch.js +2 -2
- package/dist/actions/embed.js +2 -1
- package/dist/actions/embed.js.map +1 -1
- package/dist/actions/enableTool.d.ts +2 -2
- package/dist/actions/enableTool.type-test.js +5 -5
- package/dist/actions/infer.d.ts +3 -1
- package/dist/actions/infer.js +11 -3
- package/dist/actions/infer.js.map +1 -1
- package/dist/actions/messages.d.ts +24 -0
- package/dist/actions/{setMessages.js → messages.js} +14 -10
- package/dist/actions/messages.js.map +1 -0
- package/dist/actions/pushModel.d.ts +5 -1
- package/dist/actions/pushModel.js +17 -2
- package/dist/actions/pushModel.js.map +1 -1
- package/dist/actions/{getScope.d.ts → scope.d.ts} +3 -1
- package/dist/actions/scope.js +10 -0
- package/dist/actions/scope.js.map +1 -0
- package/dist/actions/section.d.ts +23 -0
- package/dist/actions/section.js +64 -0
- package/dist/actions/section.js.map +1 -0
- package/dist/cli/cli_common.d.ts +1 -0
- package/dist/cli/main.js +6 -1
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/runExec.js +21 -16
- package/dist/cli/runExec.js.map +1 -1
- package/dist/events/LEvent.d.ts +3 -1
- package/dist/events/SectionCleared.d.ts +5 -0
- package/dist/events/SectionCleared.js +2 -0
- package/dist/events/SectionCleared.js.map +1 -0
- package/dist/events/Sectioned.d.ts +5 -0
- package/dist/events/Sectioned.js +2 -0
- package/dist/events/Sectioned.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/testing/{ActorAssertions.d.ts → AgentAssertions.d.ts} +3 -3
- package/dist/testing/AgentAssertions.js +6 -0
- package/dist/testing/AgentAssertions.js.map +1 -0
- package/dist/testing/TestEmbeddingModel.js +1 -0
- package/dist/testing/TestEmbeddingModel.js.map +1 -1
- package/dist/testing/TestLanguageModel.js +1 -0
- package/dist/testing/TestLanguageModel.js.map +1 -1
- package/dist/testing/index.d.ts +1 -1
- package/dist/testing/index.js +1 -1
- package/dist/testing/takeFirstAction.d.ts +2 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/Type.d.ts +1 -0
- package/dist/types/Type.js.map +1 -1
- package/dist/types/array.js +2 -2
- package/dist/types/array.js.map +1 -1
- package/dist/types/boolean.js +2 -2
- package/dist/types/boolean.js.map +1 -1
- package/dist/types/const.js +2 -2
- package/dist/types/const.js.map +1 -1
- package/dist/types/enum.js +2 -2
- package/dist/types/enum.js.map +1 -1
- package/dist/types/integer.js +2 -2
- package/dist/types/integer.js.map +1 -1
- package/dist/types/makeType.d.ts +2 -0
- package/dist/types/{declareType.js → makeType.js} +4 -3
- package/dist/types/makeType.js.map +1 -0
- package/dist/types/null.js +2 -2
- package/dist/types/null.js.map +1 -1
- package/dist/types/number.js +2 -2
- package/dist/types/number.js.map +1 -1
- package/dist/types/object.js +2 -2
- package/dist/types/object.js.map +1 -1
- package/dist/types/ref.js +2 -2
- package/dist/types/ref.js.map +1 -1
- package/dist/types/string.js +2 -2
- package/dist/types/string.js.map +1 -1
- package/dist/types/union.js +2 -2
- package/dist/types/union.js.map +1 -1
- package/dist/util/peekLast.d.ts +1 -0
- package/dist/util/peekLast.js +4 -0
- package/dist/util/peekLast.js.map +1 -0
- package/events/LEvent.ts +4 -0
- package/events/SectionCleared.ts +6 -0
- package/events/Sectioned.ts +6 -0
- package/index.ts +1 -1
- package/package.json +1 -1
- package/testing/{ActorAssertions.ts → AgentAssertions.ts} +3 -5
- package/testing/TestEmbeddingModel.ts +1 -0
- package/testing/TestLanguageModel.ts +1 -0
- package/testing/index.ts +1 -1
- package/testing/takeFirstAction.ts +2 -2
- package/types/Type.ts +1 -0
- package/types/array.ts +2 -2
- package/types/boolean.ts +2 -2
- package/types/const.ts +2 -2
- package/types/enum.ts +2 -2
- package/types/integer.ts +2 -2
- package/types/{declareType.ts → makeType.ts} +3 -2
- package/types/null.ts +2 -2
- package/types/number.ts +2 -2
- package/types/object.ts +2 -2
- package/types/ref.ts +2 -2
- package/types/string.ts +2 -2
- package/types/union.ts +2 -2
- package/util/peekLast.ts +3 -0
- package/Actor.ts +0 -20
- package/actions/actions_derived/getMessages.ts +0 -9
- package/actions/getScope.ts +0 -11
- package/actions/getSignal.ts +0 -10
- package/actions/getTools.ts +0 -11
- package/actions/removeMessage.ts +0 -22
- package/actions/removeModel.ts +0 -31
- package/actions/setMessages.ts +0 -66
- package/dist/Actor.d.ts +0 -14
- package/dist/Actor.js +0 -2
- package/dist/Actor.js.map +0 -1
- package/dist/actions/actions_derived/getMessages.d.ts +0 -3
- package/dist/actions/actions_derived/getMessages.js +0 -8
- package/dist/actions/actions_derived/getMessages.js.map +0 -1
- package/dist/actions/getScope.js +0 -8
- package/dist/actions/getScope.js.map +0 -1
- package/dist/actions/getSignal.d.ts +0 -4
- package/dist/actions/getSignal.js +0 -8
- package/dist/actions/getSignal.js.map +0 -1
- package/dist/actions/getTools.d.ts +0 -5
- package/dist/actions/getTools.js +0 -8
- package/dist/actions/getTools.js.map +0 -1
- package/dist/actions/removeMessage.d.ts +0 -9
- package/dist/actions/removeMessage.js +0 -17
- package/dist/actions/removeMessage.js.map +0 -1
- package/dist/actions/removeModel.d.ts +0 -10
- package/dist/actions/removeModel.js +0 -20
- package/dist/actions/removeModel.js.map +0 -1
- package/dist/actions/setMessages.d.ts +0 -16
- package/dist/actions/setMessages.js.map +0 -1
- package/dist/testing/ActorAssertions.js +0 -6
- package/dist/testing/ActorAssertions.js.map +0 -1
- package/dist/types/declareType.d.ts +0 -2
- package/dist/types/declareType.js.map +0 -1
|
@@ -1,26 +1,29 @@
|
|
|
1
1
|
import { Action } from "../Action.js";
|
|
2
2
|
import { isPropertyKey } from "../util/isPropertyKey.js";
|
|
3
|
-
|
|
3
|
+
import { scope } from "./scope.js";
|
|
4
|
+
export const messages = Object.assign(messages_, {
|
|
5
|
+
*[Symbol.iterator]() {
|
|
6
|
+
const scope_ = yield* scope;
|
|
7
|
+
return scope_.messages;
|
|
8
|
+
},
|
|
9
|
+
});
|
|
10
|
+
function* messages_(setterOrKey, maybeSetter) {
|
|
4
11
|
return yield Action("set_messages", async (scope) => {
|
|
5
12
|
if (isPropertyKey(setterOrKey)) {
|
|
6
13
|
const setterScope = scope.fork("set_messages", [setterOrKey]);
|
|
7
14
|
const reduced = await setterScope.reduce(maybeSetter([...scope.messages]));
|
|
8
|
-
const {
|
|
9
|
-
setterScope.event({
|
|
10
|
-
type: "returned",
|
|
11
|
-
value,
|
|
12
|
-
});
|
|
15
|
+
const { messages } = reduced;
|
|
13
16
|
setterScope.event({
|
|
14
17
|
type: "messages_set",
|
|
15
|
-
messages:
|
|
18
|
+
messages: [...messages],
|
|
16
19
|
});
|
|
17
20
|
return {
|
|
18
21
|
...scope,
|
|
19
|
-
messages
|
|
22
|
+
messages,
|
|
20
23
|
nextArg: scope.messages,
|
|
21
24
|
};
|
|
22
25
|
}
|
|
23
|
-
const messages = await setterOrKey([...scope.messages]);
|
|
26
|
+
const messages = new Set(Array.isArray(setterOrKey) ? setterOrKey : await setterOrKey([...scope.messages]));
|
|
24
27
|
return {
|
|
25
28
|
...scope,
|
|
26
29
|
messages,
|
|
@@ -28,4 +31,5 @@ export function* setMessages(setterOrKey, maybeSetter) {
|
|
|
28
31
|
};
|
|
29
32
|
});
|
|
30
33
|
}
|
|
31
|
-
|
|
34
|
+
Object.defineProperty(messages_, "name", { value: "messages" });
|
|
35
|
+
//# sourceMappingURL=messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../actions/messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAKrC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAGxD,OAAO,EAAiB,KAAK,EAAE,MAAM,YAAY,CAAA;AAmBjD,MAAM,CAAC,MAAM,QAAQ,GAAa,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE;IACzD,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC;QAChB,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,KAAK,CAAA;QAC3B,OAAO,MAAM,CAAC,QAAQ,CAAA;IACxB,CAAC;CACF,CAAU,CAAA;AAEX,QAAQ,CAAC,CAAC,SAAS,CACjB,WAAgF,EAChF,WAA+D;IAE/D,OAAO,MAAM,MAAM,CAAC,cAAc,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;QAClD,IAAI,aAAa,CAAC,WAAW,CAAC,EAAE,CAAC;YAC/B,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,WAAW,CAAC,CAAC,CAAA;YAC7D,MAAM,OAAO,GAAG,MAAM,WAAW,CAAC,MAAM,CAAC,WAAY,CAAC,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;YAC3E,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAA;YAC5B,WAAW,CAAC,KAAK,CAAC;gBAChB,IAAI,EAAE,cAAc;gBACpB,QAAQ,EAAE,CAAC,GAAG,QAAQ,CAAC;aACxB,CAAC,CAAA;YACF,OAAO;gBACL,GAAG,KAAK;gBACR,QAAQ;gBACR,OAAO,EAAE,KAAK,CAAC,QAAQ;aACxB,CAAA;QACH,CAAC;QACD,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,WAAW,CAAC,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;QAC3G,OAAO;YACL,GAAG,KAAK;YACR,QAAQ;YACR,OAAO,EAAE,KAAK,CAAC,QAAQ;SACxB,CAAA;IACH,CAAC,CAAC,CAAA;AACJ,CAAC;AACD,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAA"}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { Action } from "../Action.ts";
|
|
2
2
|
import type { ModelPushed } from "../events/ModelPushed.ts";
|
|
3
|
+
import type { ModelRemoved } from "../events/ModelRemoved.ts";
|
|
3
4
|
import type { Model, ModelType } from "../Model.ts";
|
|
4
5
|
import type { Spec } from "../Spec.ts";
|
|
5
6
|
import type { JSONKey } from "../util/JSONKey.ts";
|
|
6
|
-
import { removeModel } from "./removeModel.ts";
|
|
7
7
|
export interface pushModel<K extends JSONKey, M extends ModelType> extends Action<"remove_model", Spec.Make<{
|
|
8
8
|
Event: ModelPushed<K, M>;
|
|
9
9
|
}>> {
|
|
10
10
|
}
|
|
11
|
+
export interface removeModel<K extends JSONKey, M extends ModelType> extends Action<"remove_model", Spec.Make<{
|
|
12
|
+
Event: ModelRemoved<K, M>;
|
|
13
|
+
}>> {
|
|
14
|
+
}
|
|
11
15
|
export declare function pushModel<K extends JSONKey, M extends Model>(modelKey: K, model: M): Generator<pushModel<K, M["type"]>, Generator<removeModel<K, M["type"]>, void>>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Action } from "../Action.js";
|
|
2
2
|
import { applyToModels } from "./actions_common/updateModels.js";
|
|
3
|
-
import { removeModel } from "./removeModel.js";
|
|
4
3
|
export function* pushModel(modelKey, model) {
|
|
5
4
|
return yield Action("remove_model", (scope) => {
|
|
6
5
|
scope.event({
|
|
@@ -14,7 +13,23 @@ export function* pushModel(modelKey, model) {
|
|
|
14
13
|
models.add(model);
|
|
15
14
|
return models;
|
|
16
15
|
}),
|
|
17
|
-
nextArg:
|
|
16
|
+
nextArg: (function* () {
|
|
17
|
+
yield Action("remove_model", (scope) => {
|
|
18
|
+
scope.event({
|
|
19
|
+
type: "model_removed",
|
|
20
|
+
modelKey,
|
|
21
|
+
modelType: model.type,
|
|
22
|
+
});
|
|
23
|
+
return {
|
|
24
|
+
...scope,
|
|
25
|
+
...applyToModels(scope, model, (models) => {
|
|
26
|
+
models.delete(model);
|
|
27
|
+
return models;
|
|
28
|
+
}),
|
|
29
|
+
nextArg: undefined,
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
})(),
|
|
18
33
|
};
|
|
19
34
|
});
|
|
20
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pushModel.js","sourceRoot":"","sources":["../../actions/pushModel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"pushModel.js","sourceRoot":"","sources":["../../actions/pushModel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAMrC,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAA;AAUhE,MAAM,SAAS,CAAC,CAAC,SAAS,CACxB,QAAW,EACX,KAAQ;IAER,OAAO,MAAM,MAAM,CAAC,cAAc,EAAE,CAAC,KAAK,EAAE,EAAE;QAC5C,KAAK,CAAC,KAAK,CAAC;YACV,IAAI,EAAE,cAAc;YACpB,QAAQ;YACR,SAAS,EAAE,KAAK,CAAC,IAAI;SACtB,CAAC,CAAA;QACF,OAAO;YACL,GAAG,KAAK;YACR,GAAG,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,EAAE;gBACxC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;gBACjB,OAAO,MAAM,CAAA;YACf,CAAC,CAAC;YACF,OAAO,EAAE,CAAC,QAAQ,CAAC;gBACjB,MAAM,MAAM,CAAC,cAAc,EAAE,CAAC,KAAK,EAAE,EAAE;oBACrC,KAAK,CAAC,KAAK,CAAC;wBACV,IAAI,EAAE,eAAe;wBACrB,QAAQ;wBACR,SAAS,EAAE,KAAK,CAAC,IAAI;qBACtB,CAAC,CAAA;oBACF,OAAO;wBACL,GAAG,KAAK;wBACR,GAAG,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,EAAE;4BACxC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;4BACpB,OAAO,MAAM,CAAA;wBACf,CAAC,CAAC;wBACF,OAAO,EAAE,SAAS;qBACnB,CAAA;gBACH,CAAC,CAAC,CAAA;YACJ,CAAC,CAAC,EAAE;SACL,CAAA;IACH,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -2,4 +2,6 @@ import { Action } from "../Action.ts";
|
|
|
2
2
|
import type { Scope } from "../Scope.ts";
|
|
3
3
|
export interface getScope extends Action<"get_scope", never> {
|
|
4
4
|
}
|
|
5
|
-
export declare
|
|
5
|
+
export declare const scope: {
|
|
6
|
+
[Symbol.iterator](): Iterator<getScope, Scope>;
|
|
7
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope.js","sourceRoot":"","sources":["../../actions/scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAKrC,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC;QAChB,OAAO,MAAM,MAAM,CAAC,WAAW,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YAC3C,GAAG,KAAK;YACR,OAAO,EAAE,KAAK;SACf,CAAC,CAAC,CAAA;IACL,CAAC;CACF,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Action } from "../Action.ts";
|
|
2
|
+
import type { AgentLike } from "../Agent.ts";
|
|
3
|
+
import type { SectionCleared } from "../events/SectionCleared.ts";
|
|
4
|
+
import type { Sectioned } from "../events/Sectioned.ts";
|
|
5
|
+
import type { Message } from "../Message.ts";
|
|
6
|
+
import type { Spec } from "../Spec.ts";
|
|
7
|
+
import type { JSONKey } from "../util/JSONKey.ts";
|
|
8
|
+
export interface section<K extends JSONKey> extends Action<"section", Spec.Make<{
|
|
9
|
+
Event: Sectioned<K>;
|
|
10
|
+
}>> {
|
|
11
|
+
}
|
|
12
|
+
export interface SectionHandle<K extends JSONKey> {
|
|
13
|
+
clear: Generator<Action<"clear_section", Spec.Make<{
|
|
14
|
+
Event: SectionCleared<K>;
|
|
15
|
+
}>>, void>;
|
|
16
|
+
getMessages: () => Generator<Action<"get_section_messages", never>, Set<Message>>;
|
|
17
|
+
<L extends JSONKey, Y extends Action, T>(key: L, agentLike: AgentLike<Y, T>): Generator<Action<"run_section", Spec.Make<{
|
|
18
|
+
Child: [L, Y[""]];
|
|
19
|
+
Entry: Y[""]["Entry"];
|
|
20
|
+
Value: T;
|
|
21
|
+
}>>, T>;
|
|
22
|
+
}
|
|
23
|
+
export declare function section<K extends JSONKey>(sectionKey: K): Generator<section<K>, SectionHandle<K>>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Action } from "../Action.js";
|
|
2
|
+
import { unwrapDeferred } from "../util/unwrapDeferred.js";
|
|
3
|
+
export function* section(sectionKey) {
|
|
4
|
+
return yield Action("section", (scope) => {
|
|
5
|
+
scope.event({
|
|
6
|
+
type: "sectioned",
|
|
7
|
+
sectionKey,
|
|
8
|
+
});
|
|
9
|
+
const section = {
|
|
10
|
+
sectionKey,
|
|
11
|
+
messages: new Set(),
|
|
12
|
+
};
|
|
13
|
+
scope.sections.add(section);
|
|
14
|
+
return {
|
|
15
|
+
...scope,
|
|
16
|
+
nextArg: Object.assign(function* (key, agentLike) {
|
|
17
|
+
return yield Action("run_section", async (scope) => {
|
|
18
|
+
const sectionScope = scope.fork("run_section", [key], {
|
|
19
|
+
messages: new Set(section.messages),
|
|
20
|
+
});
|
|
21
|
+
const reduced = await sectionScope.reduce(unwrapDeferred(agentLike));
|
|
22
|
+
const { value } = reduced;
|
|
23
|
+
sectionScope.event({
|
|
24
|
+
type: "returned",
|
|
25
|
+
value,
|
|
26
|
+
});
|
|
27
|
+
return {
|
|
28
|
+
...scope,
|
|
29
|
+
nextArg: value,
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
}, {
|
|
33
|
+
getMessages: (function* () {
|
|
34
|
+
return yield Action("get_section_messages", (scope) => ({
|
|
35
|
+
...scope,
|
|
36
|
+
nextArg: new Set(section.messages),
|
|
37
|
+
}));
|
|
38
|
+
})(),
|
|
39
|
+
}, {
|
|
40
|
+
clear: (function* () {
|
|
41
|
+
return yield Action("clear_section", (scope) => {
|
|
42
|
+
const sections = new Set(scope.sections);
|
|
43
|
+
sections.delete(section);
|
|
44
|
+
const messages = new Set(scope.messages);
|
|
45
|
+
section.messages.forEach((message) => {
|
|
46
|
+
messages.delete(message);
|
|
47
|
+
});
|
|
48
|
+
scope.event({
|
|
49
|
+
type: "section_cleared",
|
|
50
|
+
sectionKey,
|
|
51
|
+
});
|
|
52
|
+
return {
|
|
53
|
+
...scope,
|
|
54
|
+
nextArg: messages,
|
|
55
|
+
sections,
|
|
56
|
+
messages,
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
})(),
|
|
60
|
+
}),
|
|
61
|
+
};
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=section.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"section.js","sourceRoot":"","sources":["../../actions/section.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAQrC,OAAO,EAAE,cAA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C,OAAO,CAAC,QAAQ,CAAC;qBACnC,CAAC,CAAC,CAAA;gBACL,CAAC,CAAC,EAAE;aACL,EACD;gBACE,KAAK,EACH,CAAC,QAAQ,CAAC;oBACR,OAAO,MAAM,MAAM,CAAC,eAAe,EAAE,CAAC,KAAK,EAAE,EAAE;wBAC7C,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;wBACxC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;wBACxB,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;wBACxC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;4BACnC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;wBAC1B,CAAC,CAAC,CAAA;wBACF,KAAK,CAAC,KAAK,CAAC;4BACV,IAAI,EAAE,iBAAiB;4BACvB,UAAU;yBACX,CAAC,CAAA;wBACF,OAAO;4BACL,GAAG,KAAK;4BACR,OAAO,EAAE,QAAQ;4BACjB,QAAQ;4BACR,QAAQ;yBACT,CAAA;oBACH,CAAC,CAAC,CAAA;gBACJ,CAAC,CAAC,EAAE;aACP,CACF;SACF,CAAA;IACH,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
package/dist/cli/cli_common.d.ts
CHANGED
package/dist/cli/main.js
CHANGED
|
@@ -5,7 +5,12 @@ import { runExec } from "./runExec.js";
|
|
|
5
5
|
const args = process.argv.slice(2);
|
|
6
6
|
const command = L.enum("exec").assert(args.shift());
|
|
7
7
|
const ctl = new AbortController();
|
|
8
|
-
const cliCtx = {
|
|
8
|
+
const cliCtx = {
|
|
9
|
+
ctl,
|
|
10
|
+
error(message) {
|
|
11
|
+
throw new Error(message);
|
|
12
|
+
},
|
|
13
|
+
};
|
|
9
14
|
switch (command) {
|
|
10
15
|
case "exec": {
|
|
11
16
|
await runExec(cliCtx, args);
|
package/dist/cli/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../cli/main.ts"],"names":[],"mappings":";AAEA,OAAO,OAAO,MAAM,cAAc,CAAA;AAClC,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAA;AAE/B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;AAClC,MAAM,OAAO,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAA;AACnD,MAAM,GAAG,GAAG,IAAI,eAAe,EAAE,CAAA;AAEjC,MAAM,MAAM,GAAW,
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../cli/main.ts"],"names":[],"mappings":";AAEA,OAAO,OAAO,MAAM,cAAc,CAAA;AAClC,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAA;AAE/B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;AAClC,MAAM,OAAO,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAA;AACnD,MAAM,GAAG,GAAG,IAAI,eAAe,EAAE,CAAA;AAEjC,MAAM,MAAM,GAAW;IACrB,GAAG;IACH,KAAK,CAAC,OAAO;QACX,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAA;IAC1B,CAAC;CACF,CAAA;AAED,QAAQ,OAAO,EAAE,CAAC;IAChB,KAAK,MAAM,CAAC,CAAC,CAAC;QACZ,MAAM,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;QAC3B,MAAK;IACP,CAAC;AACH,CAAC"}
|
package/dist/cli/runExec.js
CHANGED
|
@@ -8,7 +8,7 @@ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExte
|
|
|
8
8
|
};
|
|
9
9
|
import { dirname, isAbsolute, parse, resolve } from "node:path";
|
|
10
10
|
import { parseArgs } from "node:util";
|
|
11
|
-
import {
|
|
11
|
+
import { exec, L } from "../index.js";
|
|
12
12
|
import { WriteHandler } from "./WriteHandler.js";
|
|
13
13
|
const options = {
|
|
14
14
|
config: {
|
|
@@ -31,19 +31,25 @@ export async function runExec(ctx, args) {
|
|
|
31
31
|
const configPathResolved = resolve(configPath);
|
|
32
32
|
const configDir = dirname(configPathResolved);
|
|
33
33
|
const config = await import(__rewriteRelativeImportExtension(configPathResolved)).then(({ default: default_ }) => default_);
|
|
34
|
-
const
|
|
35
|
-
let
|
|
36
|
-
if (isAbsolute(
|
|
37
|
-
|
|
34
|
+
const agentPathInitial = L.string.assert(positionals[0]);
|
|
35
|
+
let agentPathResolved;
|
|
36
|
+
if (isAbsolute(agentPathInitial)) {
|
|
37
|
+
agentPathResolved = agentPathInitial;
|
|
38
38
|
}
|
|
39
39
|
else {
|
|
40
|
-
|
|
40
|
+
agentPathResolved = resolve(configDir, ...config.agents ? [config.agents] : [], agentPathInitial);
|
|
41
41
|
}
|
|
42
|
-
if (!
|
|
43
|
-
|
|
42
|
+
if (!agentPathResolved.endsWith(".ts")) {
|
|
43
|
+
agentPathResolved = `${agentPathResolved}.ts`;
|
|
44
|
+
}
|
|
45
|
+
const parsedPath = parse(agentPathResolved);
|
|
46
|
+
let agentLike;
|
|
47
|
+
try {
|
|
48
|
+
agentLike = await import(__rewriteRelativeImportExtension(agentPathResolved)).then(({ default: default_ }) => default_);
|
|
49
|
+
}
|
|
50
|
+
catch (_e) {
|
|
51
|
+
ctx.error(`Could not fine agent file at "${agentPathResolved}".`);
|
|
44
52
|
}
|
|
45
|
-
const parsedPath = parse(actorPathResolved);
|
|
46
|
-
const actorLike = await import(__rewriteRelativeImportExtension(actorPathResolved)).then(({ default: default_ }) => default_);
|
|
47
53
|
const startTime = Date.now();
|
|
48
54
|
const writeHandlerOrNoop = config.write
|
|
49
55
|
? await WriteHandler({
|
|
@@ -55,14 +61,13 @@ export async function runExec(ctx, args) {
|
|
|
55
61
|
})
|
|
56
62
|
: undefined;
|
|
57
63
|
const printHandlerOrNoop = config.silent ? undefined : (event) => console.log(event);
|
|
58
|
-
|
|
64
|
+
await exec(agentLike, {
|
|
59
65
|
default: config.default,
|
|
60
66
|
args: config.args,
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}, {
|
|
67
|
+
handler(event) {
|
|
68
|
+
printHandlerOrNoop?.(event);
|
|
69
|
+
writeHandlerOrNoop?.(event);
|
|
70
|
+
},
|
|
66
71
|
signal: ctx.ctl.signal,
|
|
67
72
|
});
|
|
68
73
|
}
|
package/dist/cli/runExec.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runExec.js","sourceRoot":"","sources":["../../cli/runExec.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAC/D,OAAO,EAAE,SAAS,EAAwB,MAAM,WAAW,CAAA;AAC3D,OAAO,EAAkC,IAAI,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"runExec.js","sourceRoot":"","sources":["../../cli/runExec.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAC/D,OAAO,EAAE,SAAS,EAAwB,MAAM,WAAW,CAAA;AAC3D,OAAO,EAAkC,IAAI,EAAE,CAAC,EAAsB,MAAM,aAAa,CAAA;AAEzF,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEhD,MAAM,OAAO,GAAG;IACd,MAAM,E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from "./MessagesSet.ts";
|
|
|
11
11
|
import type { ModelPushed } from "./ModelPushed.ts";
|
|
12
12
|
import type { ModelRemoved } from "./ModelRemoved.ts";
|
|
13
13
|
import type { Returned } from "./Returned.ts";
|
|
14
|
+
import type { SectionCleared } from "./SectionCleared.ts";
|
|
15
|
+
import type { Sectioned } from "./Sectioned.ts";
|
|
14
16
|
import type { Threw } from "./Threw.ts";
|
|
15
17
|
import type { ToolCalled } from "./ToolCalled.ts";
|
|
16
18
|
import type { ToolDisabled } from "./ToolDisabled.ts";
|
|
17
19
|
import type { ToolEnabled } from "./ToolEnabled.ts";
|
|
18
|
-
export type LEvent = Embedded | EmbeddingRequested | Emitted | Inferred | InferenceRequested | MessageAppended | MessagesSet | Returned | Threw | ToolCalled | ToolDisabled | ToolEnabled | Aborted | MessageRemoved | Forked | ModelPushed | ModelRemoved;
|
|
20
|
+
export type LEvent = Embedded | EmbeddingRequested | Emitted | Inferred | InferenceRequested | MessageAppended | MessagesSet | Returned | Threw | ToolCalled | ToolDisabled | ToolEnabled | Aborted | MessageRemoved | Forked | ModelPushed | ModelRemoved | Sectioned | SectionCleared;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SectionCleared.js","sourceRoot":"","sources":["../../events/SectionCleared.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Sectioned.js","sourceRoot":"","sources":["../../events/Sectioned.ts"],"names":[],"mappings":""}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { IsExact } from "conditional-type-checks";
|
|
2
2
|
import type { Action } from "../Action.ts";
|
|
3
|
-
import type {
|
|
3
|
+
import type { AgentLike } from "../Agent.ts";
|
|
4
4
|
import type { Spec } from "../Spec.ts";
|
|
5
5
|
import type { Expand } from "../util/Expand.ts";
|
|
6
|
-
export interface
|
|
6
|
+
export interface AgentAssertions<S extends Spec> {
|
|
7
7
|
assertSpec<A extends Spec>(...[passes]: IsExact<S, Expand<A>> extends true ? [passes?: true] : [passes: false]): void;
|
|
8
8
|
}
|
|
9
|
-
export declare function
|
|
9
|
+
export declare function AgentAssertions<Y extends Action, R>(_agentLike: AgentLike<Y, R>): AgentAssertions<Y[""]>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentAssertions.js","sourceRoot":"","sources":["../../testing/AgentAssertions.ts"],"names":[],"mappings":"AAYA,MAAM,UAAU,eAAe,CAAsB,UAA2B;IAC9E,OAAO;QACL,UAAU,EAAE,GAAG,EAAE,GAAE,CAAC;KACrB,CAAA;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TestEmbeddingModel.js","sourceRoot":"","sources":["../../testing/TestEmbeddingModel.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,MAAM,kCAAkC,GAA6B;IAC1E,YAAY,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;CACxC,CAAA;AAED,MAAM,UAAU,kBAAkB,CAAC,EACjC,YAAY,MACgB,kCAAkC;IAC9D,OAAO;QACL,IAAI,EAAE,WAAW;QACjB,KAAK,EAAE,YAAY;KACpB,CAAA;AACH,CAAC"}
|
|
1
|
+
{"version":3,"file":"TestEmbeddingModel.js","sourceRoot":"","sources":["../../testing/TestEmbeddingModel.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,MAAM,kCAAkC,GAA6B;IAC1E,YAAY,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;CACxC,CAAA;AAED,MAAM,UAAU,kBAAkB,CAAC,EACjC,YAAY,MACgB,kCAAkC;IAC9D,OAAO;QACL,IAAI,EAAE,WAAW;QACjB,MAAM,EAAE,iBAAiB;QACzB,KAAK,EAAE,YAAY;KACpB,CAAA;AACH,CAAC"}
|
|
@@ -6,6 +6,7 @@ export const defaultTestLanguageModelConfig = {
|
|
|
6
6
|
export function TestLanguageModel({ getObject, getText, } = defaultTestLanguageModelConfig) {
|
|
7
7
|
return {
|
|
8
8
|
type: "language",
|
|
9
|
+
vendor: "liminal_testing",
|
|
9
10
|
async *infer(type) {
|
|
10
11
|
if (type) {
|
|
11
12
|
const object = getObject();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TestLanguageModel.js","sourceRoot":"","sources":["../../testing/TestLanguageModel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAA;AASlE,MAAM,CAAC,MAAM,8BAA8B,GAA4B;IACrE,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;IACrB,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE;CAClB,CAAA;AAED,MAAM,UAAU,iBAAiB,CAAC,EAChC,SAAS,EACT,OAAO,MACoB,8BAA8B;IACzD,OAAO;QACL,IAAI,EAAE,UAAU;QAChB,KAAK,CAAC,CAAC,KAAK,CAAC,IAAI;YACf,IAAI,IAAI,EAAE,CAAC;gBACT,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;gBAC1B,KAAK,CAAC,CAAC,SAAS,CAAA,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAA;gBAC3C,OAAO,MAAM,CAAA;YACf,CAAC;YACD,MAAM,IAAI,GAAG,OAAO,EAAE,CAAA;YACtB,KAAK,CAAC,CAAC,SAAS,CAAA,GAAG,IAAI,EAAE,CAAA;YACzB,OAAO,IAAI,CAAA;QACb,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
1
|
+
{"version":3,"file":"TestLanguageModel.js","sourceRoot":"","sources":["../../testing/TestLanguageModel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAA;AASlE,MAAM,CAAC,MAAM,8BAA8B,GAA4B;IACrE,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;IACrB,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE;CAClB,CAAA;AAED,MAAM,UAAU,iBAAiB,CAAC,EAChC,SAAS,EACT,OAAO,MACoB,8BAA8B;IACzD,OAAO;QACL,IAAI,EAAE,UAAU;QAChB,MAAM,EAAE,iBAAiB;QACzB,KAAK,CAAC,CAAC,KAAK,CAAC,IAAI;YACf,IAAI,IAAI,EAAE,CAAC;gBACT,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;gBAC1B,KAAK,CAAC,CAAC,SAAS,CAAA,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAA;gBAC3C,OAAO,MAAM,CAAA;YACf,CAAC;YACD,MAAM,IAAI,GAAG,OAAO,EAAE,CAAA;YACtB,KAAK,CAAC,CAAC,SAAS,CAAA,GAAG,IAAI,EAAE,CAAA;YACzB,OAAO,IAAI,CAAA;QACb,CAAC;KACF,CAAA;AACH,CAAC"}
|
package/dist/testing/index.d.ts
CHANGED
package/dist/testing/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Action } from "../Action.ts";
|
|
2
|
-
import type {
|
|
3
|
-
export declare function takeFirstAction<Y extends Action>(f:
|
|
2
|
+
import type { AgentLike } from "../Agent.ts";
|
|
3
|
+
export declare function takeFirstAction<Y extends Action>(f: AgentLike<Y>): Promise<Y | undefined>;
|