liminal 0.5.17 → 0.7.0
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 +12 -0
- package/Context.ts +8 -47
- package/L.ts +4 -0
- package/assistant.ts +52 -0
- package/dist/Context.d.ts +13 -30
- package/dist/Context.js +9 -22
- package/dist/Context.js.map +1 -1
- package/dist/L.d.ts +4 -0
- package/dist/L.js +5 -0
- package/dist/L.js.map +1 -0
- package/dist/assistant.d.ts +9 -0
- package/dist/assistant.js +44 -0
- package/dist/assistant.js.map +1 -0
- package/dist/index.d.ts +2 -14
- package/dist/index.js +2 -14
- package/dist/index.js.map +1 -1
- package/dist/messages.d.ts +4 -0
- package/dist/messages.js +5 -0
- package/dist/messages.js.map +1 -0
- package/dist/set.d.ts +3 -0
- package/dist/set.js +11 -0
- package/dist/set.js.map +1 -0
- package/dist/strand.d.ts +15 -0
- package/dist/strand.js +19 -0
- package/dist/strand.js.map +1 -0
- package/dist/todo.test.js +3 -0
- package/dist/todo.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/user.d.ts +6 -0
- package/dist/user.js +16 -0
- package/dist/user.js.map +1 -0
- package/dist/util/JSONValue.d.ts +0 -3
- package/dist/util/JSONValue.js +1 -31
- package/dist/util/JSONValue.js.map +1 -1
- package/index.ts +2 -14
- package/messages.ts +6 -0
- package/package.json +4 -3
- package/set.ts +11 -0
- package/strand.ts +38 -0
- package/todo.test.ts +3 -0
- package/user.ts +22 -0
- package/util/JSONValue.ts +0 -30
- package/Adapter.ts +0 -27
- package/AdapterRegistry.ts +0 -78
- package/Config.ts +0 -13
- package/Definition.ts +0 -48
- package/EventBase.ts +0 -23
- package/Handler.ts +0 -4
- package/L/L.ts +0 -24
- package/L/all.ts +0 -39
- package/L/assistant.ts +0 -28
- package/L/catch.ts +0 -38
- package/L/continuation.ts +0 -14
- package/L/emit.ts +0 -16
- package/L/focus.ts +0 -17
- package/L/infer.ts +0 -34
- package/L/message.ts +0 -16
- package/L/reflect.ts +0 -13
- package/L/run.ts +0 -29
- package/L/schema/_schema_common.ts +0 -30
- package/L/schema/anyOf.ts +0 -10
- package/L/schema/array.ts +0 -13
- package/L/schema/boolean.ts +0 -8
- package/L/schema/const.ts +0 -18
- package/L/schema/enum.ts +0 -18
- package/L/schema/integer.ts +0 -6
- package/L/schema/null.ts +0 -8
- package/L/schema/number.ts +0 -8
- package/L/schema/object.ts +0 -21
- package/L/schema/string.ts +0 -11
- package/L/strand.ts +0 -22
- package/L/stream.ts +0 -16
- package/L/system.ts +0 -19
- package/L/user.ts +0 -19
- package/LEvent.ts +0 -61
- package/LiminalAssertionError.ts +0 -19
- package/Message.ts +0 -16
- package/Rune.test.ts +0 -5
- package/Rune.ts +0 -60
- package/Schema.ts +0 -185
- package/Strand.ts +0 -284
- package/Tool.ts +0 -26
- package/TypeAdapter.ts +0 -3
- package/dist/Adapter.d.ts +0 -18
- package/dist/Adapter.js +0 -13
- package/dist/Adapter.js.map +0 -1
- package/dist/AdapterRegistry.d.ts +0 -27
- package/dist/AdapterRegistry.js +0 -62
- package/dist/AdapterRegistry.js.map +0 -1
- package/dist/Config.d.ts +0 -12
- package/dist/Config.js +0 -2
- package/dist/Config.js.map +0 -1
- package/dist/Definition.d.ts +0 -24
- package/dist/Definition.js +0 -29
- package/dist/Definition.js.map +0 -1
- package/dist/EventBase.d.ts +0 -11
- package/dist/EventBase.js +0 -16
- package/dist/EventBase.js.map +0 -1
- package/dist/Handler.d.ts +0 -3
- package/dist/Handler.js +0 -2
- package/dist/Handler.js.map +0 -1
- package/dist/L/L.d.ts +0 -24
- package/dist/L/L.js +0 -25
- package/dist/L/L.js.map +0 -1
- package/dist/L/all.d.ts +0 -14
- package/dist/L/all.js +0 -20
- package/dist/L/all.js.map +0 -1
- package/dist/L/assistant.d.ts +0 -11
- package/dist/L/assistant.js +0 -15
- package/dist/L/assistant.js.map +0 -1
- package/dist/L/catch.d.ts +0 -16
- package/dist/L/catch.js +0 -25
- package/dist/L/catch.js.map +0 -1
- package/dist/L/continuation.d.ts +0 -4
- package/dist/L/continuation.js +0 -13
- package/dist/L/continuation.js.map +0 -1
- package/dist/L/emit.d.ts +0 -7
- package/dist/L/emit.js +0 -15
- package/dist/L/emit.js.map +0 -1
- package/dist/L/focus.d.ts +0 -8
- package/dist/L/focus.js +0 -14
- package/dist/L/focus.js.map +0 -1
- package/dist/L/infer.d.ts +0 -8
- package/dist/L/infer.js +0 -30
- package/dist/L/infer.js.map +0 -1
- package/dist/L/message.d.ts +0 -8
- package/dist/L/message.js +0 -14
- package/dist/L/message.js.map +0 -1
- package/dist/L/reflect.d.ts +0 -5
- package/dist/L/reflect.js +0 -11
- package/dist/L/reflect.js.map +0 -1
- package/dist/L/run.d.ts +0 -14
- package/dist/L/run.js +0 -16
- package/dist/L/run.js.map +0 -1
- package/dist/L/schema/_schema_common.d.ts +0 -6
- package/dist/L/schema/_schema_common.js +0 -20
- package/dist/L/schema/_schema_common.js.map +0 -1
- package/dist/L/schema/anyOf.d.ts +0 -5
- package/dist/L/schema/anyOf.js +0 -5
- package/dist/L/schema/anyOf.js.map +0 -1
- package/dist/L/schema/array.d.ts +0 -5
- package/dist/L/schema/array.js +0 -8
- package/dist/L/schema/array.js.map +0 -1
- package/dist/L/schema/boolean.d.ts +0 -6
- package/dist/L/schema/boolean.js +0 -4
- package/dist/L/schema/boolean.js.map +0 -1
- package/dist/L/schema/const.d.ts +0 -8
- package/dist/L/schema/const.js +0 -10
- package/dist/L/schema/const.js.map +0 -1
- package/dist/L/schema/enum.d.ts +0 -8
- package/dist/L/schema/enum.js +0 -10
- package/dist/L/schema/enum.js.map +0 -1
- package/dist/L/schema/integer.d.ts +0 -5
- package/dist/L/schema/integer.js +0 -3
- package/dist/L/schema/integer.js.map +0 -1
- package/dist/L/schema/null.d.ts +0 -6
- package/dist/L/schema/null.js +0 -4
- package/dist/L/schema/null.js.map +0 -1
- package/dist/L/schema/number.d.ts +0 -6
- package/dist/L/schema/number.js +0 -4
- package/dist/L/schema/number.js.map +0 -1
- package/dist/L/schema/object.d.ts +0 -9
- package/dist/L/schema/object.js +0 -12
- package/dist/L/schema/object.js.map +0 -1
- package/dist/L/schema/string.d.ts +0 -8
- package/dist/L/schema/string.js +0 -4
- package/dist/L/schema/string.js.map +0 -1
- package/dist/L/strand.d.ts +0 -9
- package/dist/L/strand.js +0 -16
- package/dist/L/strand.js.map +0 -1
- package/dist/L/stream.d.ts +0 -4
- package/dist/L/stream.js +0 -15
- package/dist/L/stream.js.map +0 -1
- package/dist/L/system.d.ts +0 -4
- package/dist/L/system.js +0 -9
- package/dist/L/system.js.map +0 -1
- package/dist/L/user.d.ts +0 -4
- package/dist/L/user.js +0 -9
- package/dist/L/user.js.map +0 -1
- package/dist/LEvent.d.ts +0 -68
- package/dist/LEvent.js +0 -50
- package/dist/LEvent.js.map +0 -1
- package/dist/LiminalAssertionError.d.ts +0 -8
- package/dist/LiminalAssertionError.js +0 -20
- package/dist/LiminalAssertionError.js.map +0 -1
- package/dist/Message.d.ts +0 -14
- package/dist/Message.js +0 -2
- package/dist/Message.js.map +0 -1
- package/dist/Rune.d.ts +0 -46
- package/dist/Rune.js +0 -11
- package/dist/Rune.js.map +0 -1
- package/dist/Rune.test.js +0 -5
- package/dist/Rune.test.js.map +0 -1
- package/dist/Schema.d.ts +0 -46
- package/dist/Schema.js +0 -130
- package/dist/Schema.js.map +0 -1
- package/dist/Strand.d.ts +0 -81
- package/dist/Strand.js +0 -200
- package/dist/Strand.js.map +0 -1
- package/dist/Tool.d.ts +0 -10
- package/dist/Tool.js +0 -19
- package/dist/Tool.js.map +0 -1
- package/dist/TypeAdapter.d.ts +0 -1
- package/dist/TypeAdapter.js +0 -3
- package/dist/TypeAdapter.js.map +0 -1
- package/dist/errors.d.ts +0 -9
- package/dist/errors.js +0 -11
- package/dist/errors.js.map +0 -1
- package/dist/util/EnsureNarrow.d.ts +0 -1
- package/dist/util/EnsureNarrow.js +0 -2
- package/dist/util/EnsureNarrow.js.map +0 -1
- package/dist/util/attachCustomInspect.d.ts +0 -1
- package/dist/util/attachCustomInspect.js +0 -11
- package/dist/util/attachCustomInspect.js.map +0 -1
- package/errors.ts +0 -12
- package/util/EnsureNarrow.ts +0 -1
- package/util/attachCustomInspect.ts +0 -14
- /package/dist/{Rune.test.d.ts → todo.test.d.ts} +0 -0
package/dist/Strand.js
DELETED
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
import { Context } from "./Context.js";
|
|
2
|
-
import { Definition } from "./Definition.js";
|
|
3
|
-
import { StrandRejectedError } from "./errors.js";
|
|
4
|
-
import { continuation } from "./L/continuation.js";
|
|
5
|
-
import { StrandStatusChanged } from "./LEvent.js";
|
|
6
|
-
import { attachCustomInspect } from "./util/attachCustomInspect.js";
|
|
7
|
-
let nextIndex = 0;
|
|
8
|
-
/**
|
|
9
|
-
* A "Strand" is the core unit of execution in Liminal.
|
|
10
|
-
*
|
|
11
|
-
* It represents a suspendable computation that can yield Runes to control conversation state.
|
|
12
|
-
* Strands implement both the Iterable and PromiseLike interfaces to enable both
|
|
13
|
-
* running (via awaiting) and joining to parent strands (via yielding).
|
|
14
|
-
*
|
|
15
|
-
* Strands maintain their own state and can be hierarchically organized with parent-child
|
|
16
|
-
* relationships. Child strands are bound to their parents, ensuring consistent
|
|
17
|
-
* cancellation behavior.
|
|
18
|
-
*
|
|
19
|
-
* @template Y The type of Runes this Strand can yield.
|
|
20
|
-
* @template T The result type of the Strand.
|
|
21
|
-
*/
|
|
22
|
-
export class Strand {
|
|
23
|
-
/** Controls abort signal propagation. */
|
|
24
|
-
#controller = new AbortController();
|
|
25
|
-
/** Signal that can be used to detect when this strand is aborted. */
|
|
26
|
-
signal = this.#controller.signal;
|
|
27
|
-
/** Optional event handler function. */
|
|
28
|
-
#handle;
|
|
29
|
-
/** The definition (usually via generator function) that powers this strand. */
|
|
30
|
-
#definition;
|
|
31
|
-
/** Current status of the strand (untouched, pending, resolved, rejected) */
|
|
32
|
-
status = { type: "untouched" };
|
|
33
|
-
/** Unique identifier for this strand. */
|
|
34
|
-
index = nextIndex++;
|
|
35
|
-
/** Nesting depth in the strand hierarchy. */
|
|
36
|
-
depth;
|
|
37
|
-
/** The conversation state with which the strand operates. */
|
|
38
|
-
context;
|
|
39
|
-
constructor(definition, config) {
|
|
40
|
-
this.#definition = definition;
|
|
41
|
-
this.depth = (config?.parent?.depth ?? -1) + 1;
|
|
42
|
-
const { parent, context, signal: configSignal } = config ?? {};
|
|
43
|
-
if (parent) {
|
|
44
|
-
this.parent = parent;
|
|
45
|
-
this.#attachSignal(parent.signal, () => ({
|
|
46
|
-
type: "parent_aborted",
|
|
47
|
-
reason: parent.signal.reason,
|
|
48
|
-
}));
|
|
49
|
-
}
|
|
50
|
-
if (configSignal) {
|
|
51
|
-
this.#attachSignal(configSignal, () => ({
|
|
52
|
-
type: "config_signal_aborted",
|
|
53
|
-
reason: configSignal.reason,
|
|
54
|
-
}));
|
|
55
|
-
}
|
|
56
|
-
if (context) {
|
|
57
|
-
this.context = context;
|
|
58
|
-
const { handler } = context;
|
|
59
|
-
if (handler) {
|
|
60
|
-
this.#handle = (function (event) {
|
|
61
|
-
try {
|
|
62
|
-
handler.call(this, event);
|
|
63
|
-
}
|
|
64
|
-
catch (exception) {
|
|
65
|
-
this.#setTerminalStatus({
|
|
66
|
-
type: "handler_exception_thrown",
|
|
67
|
-
exception,
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
}).bind(this);
|
|
71
|
-
this.#handle(new StrandStatusChanged(this.status));
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
this.context = Context();
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
#setStatus(status) {
|
|
79
|
-
this.status = status;
|
|
80
|
-
this.#handle?.(new StrandStatusChanged(this.status));
|
|
81
|
-
}
|
|
82
|
-
#setTerminalStatus = (status) => {
|
|
83
|
-
this.#setStatus(status);
|
|
84
|
-
this.#controller.abort(this.status);
|
|
85
|
-
};
|
|
86
|
-
#attachSignal(signal, getStatus) {
|
|
87
|
-
const f = () => {
|
|
88
|
-
this.#setTerminalStatus(getStatus());
|
|
89
|
-
};
|
|
90
|
-
if (signal.aborted) {
|
|
91
|
-
return f();
|
|
92
|
-
}
|
|
93
|
-
signal.addEventListener("abort", f, { once: true });
|
|
94
|
-
this.#controller.signal.addEventListener("abort", () => {
|
|
95
|
-
signal.removeEventListener("abort", f);
|
|
96
|
-
}, { once: true });
|
|
97
|
-
}
|
|
98
|
-
then(onfulfilled, onrejected) {
|
|
99
|
-
if (this.status.type !== "untouched") {
|
|
100
|
-
return this.#replay(this.status).then(onfulfilled, onrejected);
|
|
101
|
-
}
|
|
102
|
-
let resolve = undefined;
|
|
103
|
-
let reject = undefined;
|
|
104
|
-
const promise = new Promise((resolve_, reject_) => {
|
|
105
|
-
resolve = resolve_;
|
|
106
|
-
reject = reject_;
|
|
107
|
-
});
|
|
108
|
-
this.status = {
|
|
109
|
-
type: "pending",
|
|
110
|
-
promise,
|
|
111
|
-
resolve,
|
|
112
|
-
reject,
|
|
113
|
-
};
|
|
114
|
-
this.#handle?.(new StrandStatusChanged(this.status));
|
|
115
|
-
const iterator = Definition.unwrap(this.#definition);
|
|
116
|
-
let nextArg;
|
|
117
|
-
queueMicrotask(async () => {
|
|
118
|
-
try {
|
|
119
|
-
let current = await iterator.next();
|
|
120
|
-
while (!current.done) {
|
|
121
|
-
const rune = current.value;
|
|
122
|
-
const { instruction: value } = rune;
|
|
123
|
-
switch (value.kind) {
|
|
124
|
-
case "reflect": {
|
|
125
|
-
nextArg = this;
|
|
126
|
-
break;
|
|
127
|
-
}
|
|
128
|
-
case "continue": {
|
|
129
|
-
nextArg = await value.f();
|
|
130
|
-
break;
|
|
131
|
-
}
|
|
132
|
-
case "emit": {
|
|
133
|
-
this.#handle?.(value.event);
|
|
134
|
-
nextArg = undefined;
|
|
135
|
-
break;
|
|
136
|
-
}
|
|
137
|
-
case "create_child": {
|
|
138
|
-
nextArg = await new Strand(value.definition, {
|
|
139
|
-
parent: this,
|
|
140
|
-
context: value.context ?? this.context.clone(),
|
|
141
|
-
}).then();
|
|
142
|
-
break;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
switch (this.status.type) {
|
|
146
|
-
case "config_signal_aborted":
|
|
147
|
-
case "parent_aborted":
|
|
148
|
-
case "continuation_exception_thrown":
|
|
149
|
-
case "handler_exception_thrown": {
|
|
150
|
-
try {
|
|
151
|
-
await iterator.return?.(undefined);
|
|
152
|
-
}
|
|
153
|
-
catch (exception) { }
|
|
154
|
-
return Promise.reject(new StrandRejectedError(this.status));
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
current = await iterator.next(nextArg);
|
|
158
|
-
}
|
|
159
|
-
const { value } = current;
|
|
160
|
-
this.#setTerminalStatus({
|
|
161
|
-
type: "resolved",
|
|
162
|
-
value,
|
|
163
|
-
});
|
|
164
|
-
resolve(value);
|
|
165
|
-
}
|
|
166
|
-
catch (exception) {
|
|
167
|
-
this.#setTerminalStatus({
|
|
168
|
-
type: "continuation_exception_thrown",
|
|
169
|
-
exception,
|
|
170
|
-
});
|
|
171
|
-
reject(exception);
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
return promise.then(onfulfilled, onrejected);
|
|
175
|
-
}
|
|
176
|
-
*[Symbol.iterator]() {
|
|
177
|
-
return yield* continuation("run_strand", () => this.then());
|
|
178
|
-
}
|
|
179
|
-
#replay(status) {
|
|
180
|
-
switch (status.type) {
|
|
181
|
-
case "config_signal_aborted":
|
|
182
|
-
case "parent_aborted":
|
|
183
|
-
case "continuation_exception_thrown":
|
|
184
|
-
// case "model_error":
|
|
185
|
-
case "handler_exception_thrown": {
|
|
186
|
-
return Promise.reject(new StrandRejectedError(status));
|
|
187
|
-
}
|
|
188
|
-
case "resolved": {
|
|
189
|
-
return Promise.resolve(status.value);
|
|
190
|
-
}
|
|
191
|
-
case "pending": {
|
|
192
|
-
return status.promise;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
static {
|
|
197
|
-
attachCustomInspect(this, ({ index, parent }) => ({ index, ...parent && { parent } }));
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
//# sourceMappingURL=Strand.js.map
|
package/dist/Strand.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Strand.js","sourceRoot":"","sources":["../Strand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAEjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAA;AAYnE,IAAI,SAAS,GAAW,CAAC,CAAA;AAEzB;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,MAAM;IAIjB,yCAAyC;IAChC,WAAW,GAAoB,IAAI,eAAe,EAAE,CAAA;IAC7D,qEAAqE;IAC5D,MAAM,GAAgB,IAAI,CAAC,WAAW,CAAC,MAAM,CAAA;IACtD,uCAAuC;IACvC,OAAO,CAAmD;IAC1D,+EAA+E;IAC/E,WAAW,CAAkB;IAC7B,4EAA4E;IAC5E,MAAM,GAAoB,EAAE,IAAI,EAAE,WAAW,EAAE,CAAA;IAC/C,yCAAyC;IAChC,KAAK,GAAW,SAAS,EAAE,CAAA;IACpC,6CAA6C;IACpC,KAAK,CAAQ;IAGtB,6DAA6D;IACpD,OAAO,CAAS;IAEzB,YAAY,UAA4B,EAAE,MAAoB;QAC5D,IAAI,CAAC,WAAW,GAAG,UAAU,CAAA;QAC7B,IAAI,CAAC,KAAK,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,IA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,KAAK,CAAC,CAAC,YAAY,CAAC,YAAY,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAQ,CAAA;IACpE,CAAC;IAED,OAAO,CAAC,MAAqD;QAC3D,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;YACpB,KAAK,uBAAuB,CAAC;YAC7B,KAAK,gBAAgB,CAAC;YACtB,KAAK,+BAA+B,CAAC;YACrC,sBAAsB;YACtB,KAAK,0BAA0B,CAAC,CAAC,CAAC;gBAChC,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAA;YACxD,CAAC;YACD,KAAK,UAAU,CAAC,CAAC,CAAC;gBAChB,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;YACtC,CAAC;YACD,KAAK,SAAS,CAAC,CAAC,CAAC;gBACf,OAAO,MAAM,CAAC,OAAO,CAAA;YACvB,CAAC;QACH,CAAC;IACH,CAAC;IAED;QACE,mBAAmB,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,CAAA;IACxF,CAAC;CACF"}
|
package/dist/Tool.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Schema } from "./Schema.ts";
|
|
2
|
-
import type { JSONValue } from "./util/JSONValue.ts";
|
|
3
|
-
export declare class Tool {
|
|
4
|
-
readonly name: string;
|
|
5
|
-
readonly description: string;
|
|
6
|
-
readonly parameterSchema: Schema;
|
|
7
|
-
readonly f: (arg: any) => JSONValue | Promise<JSONValue>;
|
|
8
|
-
static make<T extends JSONValue>(description: string, schema: Schema<T>, f: (arg: T) => JSONValue | Promise<JSONValue>): Promise<Tool>;
|
|
9
|
-
constructor(name: string, description: string, parameterSchema: Schema, f: (arg: any) => JSONValue | Promise<JSONValue>);
|
|
10
|
-
}
|
package/dist/Tool.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Schema } from "./Schema.js";
|
|
2
|
-
export class Tool {
|
|
3
|
-
name;
|
|
4
|
-
description;
|
|
5
|
-
parameterSchema;
|
|
6
|
-
f;
|
|
7
|
-
static async make(description, schema, f) {
|
|
8
|
-
return new Tool(await Schema.id(schema, description), description, schema, async (arg) => {
|
|
9
|
-
return await f(await Schema.validateValue(schema, arg));
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
constructor(name, description, parameterSchema, f) {
|
|
13
|
-
this.name = name;
|
|
14
|
-
this.description = description;
|
|
15
|
-
this.parameterSchema = parameterSchema;
|
|
16
|
-
this.f = f;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=Tool.js.map
|
package/dist/Tool.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Tool.js","sourceRoot":"","sources":["../Tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAGpC,MAAM,OAAO,IAAI;IAiBJ;IACA;IACA;IACA;IAnBX,MAAM,CAAC,KAAK,CAAC,IAAI,CACf,WAAmB,EACnB,MAAiB,EACjB,CAA6C;QAE7C,OAAO,IAAI,IAAI,CACb,MAAM,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC,EACpC,WAAW,EACX,MAAM,EACN,KAAK,EAAE,GAAG,EAAE,EAAE;YACZ,OAAO,MAAM,CAAC,CAAC,MAAM,MAAM,CAAC,aAAa,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAA;QACzD,CAAC,CACF,CAAA;IACH,CAAC;IAED,YACW,IAAY,EACZ,WAAmB,EACnB,eAAuB,EACvB,CAA+C;QAH/C,SAAI,GAAJ,IAAI,CAAQ;QACZ,gBAAW,GAAX,WAAW,CAAQ;QACnB,oBAAe,GAAf,eAAe,CAAQ;QACvB,MAAC,GAAD,CAAC,CAA8C;IACvD,CAAC;CACL"}
|
package/dist/TypeAdapter.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/TypeAdapter.js
DELETED
package/dist/TypeAdapter.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TypeAdapter.js","sourceRoot":"","sources":["../TypeAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA"}
|
package/dist/errors.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { StrandStatus } from "./Strand.ts";
|
|
2
|
-
export declare const LiminalErrorTag: unique symbol;
|
|
3
|
-
export type LiminalErrorTag = typeof LiminalErrorTag;
|
|
4
|
-
export declare class StrandRejectedError extends Error {
|
|
5
|
-
readonly status: StrandStatus.Rejected;
|
|
6
|
-
readonly brand: LiminalErrorTag;
|
|
7
|
-
readonly name: string;
|
|
8
|
-
constructor(status: StrandStatus.Rejected);
|
|
9
|
-
}
|
package/dist/errors.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export const LiminalErrorTag = Symbol.for("liminal/LiminalError");
|
|
2
|
-
export class StrandRejectedError extends Error {
|
|
3
|
-
status;
|
|
4
|
-
brand = LiminalErrorTag;
|
|
5
|
-
name = "StrandRejectedError";
|
|
6
|
-
constructor(status) {
|
|
7
|
-
super();
|
|
8
|
-
this.status = status;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=errors.js.map
|
package/dist/errors.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../errors.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAA;AAGjE,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAGvB;IAFZ,KAAK,GAAoB,eAAe,CAAA;IAC/B,IAAI,GAAW,qBAAqB,CAAA;IACtD,YAAqB,MAA6B;QAChD,KAAK,EAAE,CAAA;QADY,WAAM,GAAN,MAAM,CAAuB;IAElD,CAAC;CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type EnsureNarrow<T> = {} extends T ? never : keyof any extends T ? never : T;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EnsureNarrow.js","sourceRoot":"","sources":["../../util/EnsureNarrow.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function attachCustomInspect<T>(constructor: new (...args: any[]) => T, select: (instance: T) => Record<string, unknown>): void;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { inspect } from "node:util";
|
|
2
|
-
export function attachCustomInspect(constructor, select) {
|
|
3
|
-
Object.defineProperties(constructor.prototype, {
|
|
4
|
-
[inspect.custom]: {
|
|
5
|
-
value(depth, options) {
|
|
6
|
-
return `${this.constructor.name} ` + inspect(select(this), { ...options, depth });
|
|
7
|
-
},
|
|
8
|
-
},
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=attachCustomInspect.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"attachCustomInspect.js","sourceRoot":"","sources":["../../util/attachCustomInspect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAuB,MAAM,WAAW,CAAA;AAExD,MAAM,UAAU,mBAAmB,CACjC,WAAqC,EACrC,MAAgD;IAEhD,MAAM,CAAC,gBAAgB,CAAC,WAAW,CAAC,SAAS,EAAE;QAC7C,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;YAChB,KAAK,CAAC,KAAa,EAAE,OAAuB;gBAC1C,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,OAAO,EAAE,KAAK,EAAE,CAAC,CAAA;YACnF,CAAC;SACF;KACF,CAAC,CAAA;AACJ,CAAC"}
|
package/errors.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { StrandStatus } from "./Strand.ts"
|
|
2
|
-
|
|
3
|
-
export const LiminalErrorTag = Symbol.for("liminal/LiminalError")
|
|
4
|
-
export type LiminalErrorTag = typeof LiminalErrorTag
|
|
5
|
-
|
|
6
|
-
export class StrandRejectedError extends Error {
|
|
7
|
-
readonly brand: LiminalErrorTag = LiminalErrorTag
|
|
8
|
-
override readonly name: string = "StrandRejectedError"
|
|
9
|
-
constructor(readonly status: StrandStatus.Rejected) {
|
|
10
|
-
super()
|
|
11
|
-
}
|
|
12
|
-
}
|
package/util/EnsureNarrow.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type EnsureNarrow<T> = {} extends T ? never : keyof any extends T ? never : T
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { inspect, type InspectOptions } from "node:util"
|
|
2
|
-
|
|
3
|
-
export function attachCustomInspect<T>(
|
|
4
|
-
constructor: new(...args: any[]) => T,
|
|
5
|
-
select: (instance: T) => Record<string, unknown>,
|
|
6
|
-
) {
|
|
7
|
-
Object.defineProperties(constructor.prototype, {
|
|
8
|
-
[inspect.custom]: {
|
|
9
|
-
value(depth: number, options: InspectOptions) {
|
|
10
|
-
return `${this.constructor.name} ` + inspect(select(this), { ...options, depth })
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
})
|
|
14
|
-
}
|
|
File without changes
|