@neutrome/lilsdk 0.6.2 → 0.6.3
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/README.md
CHANGED
|
@@ -20,7 +20,8 @@ small — SDK contracts only — and each subpath owns one concern:
|
|
|
20
20
|
- `@neutrome/lilsdk/tools`: `createToolsExecutor` tool-call loop
|
|
21
21
|
- `@neutrome/lilsdk/managed`: `createCapabilitiesExecutor`,
|
|
22
22
|
`createAttachmentToTextExecutor`, and
|
|
23
|
-
`
|
|
23
|
+
`createCollapsedReasoner(reasoner, summarizer, options)` for safe reasoning
|
|
24
|
+
updates
|
|
24
25
|
- `@neutrome/lilsdk/stream`: `observeExecutionStream`, `streamStage`, and
|
|
25
26
|
`writeThinking`
|
|
26
27
|
- `@neutrome/lilsdk/primitives`: structural program helpers — `walk`, `map`,
|
package/etc/api/managed.api.md
CHANGED
|
@@ -39,11 +39,6 @@ export type CapabilitiesExecutorOptions = {
|
|
|
39
39
|
skipPrefixes?: readonly string[];
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
-
// Warning: (ae-forgotten-export) The symbol "Executor" needs to be exported by the entry point index.d.ts
|
|
43
|
-
//
|
|
44
|
-
// @public
|
|
45
|
-
export function collapsedReasoner(reasoner: ExecutorInput, summarizer: ExecutorInput, options?: CollapsedReasonerOptions): Executor;
|
|
46
|
-
|
|
47
42
|
// @public
|
|
48
43
|
export type CollapsedReasonerOptions = {
|
|
49
44
|
prompt?: string;
|
|
@@ -52,12 +47,17 @@ export type CollapsedReasonerOptions = {
|
|
|
52
47
|
forcedInterval?: number;
|
|
53
48
|
};
|
|
54
49
|
|
|
50
|
+
// Warning: (ae-forgotten-export) The symbol "Executor" needs to be exported by the entry point index.d.ts
|
|
51
|
+
//
|
|
55
52
|
// @public
|
|
56
53
|
export function createAttachmentToTextExecutor(inner: ExecutorInput, rules: readonly AttachmentReaderRule[], options?: AttachmentToTextOptions): Executor;
|
|
57
54
|
|
|
58
55
|
// @public
|
|
59
56
|
export function createCapabilitiesExecutor(inner: ExecutorInput, options?: CapabilitiesExecutorOptions): Executor;
|
|
60
57
|
|
|
58
|
+
// @public
|
|
59
|
+
export function createCollapsedReasoner(reasoner: ExecutorInput, summarizer: ExecutorInput, options?: CollapsedReasonerOptions): Executor;
|
|
60
|
+
|
|
61
61
|
// @public
|
|
62
62
|
type ExecutionEvent = {
|
|
63
63
|
kind: string;
|
package/package.json
CHANGED
|
@@ -20,7 +20,7 @@ const DEFAULT_PROMPT =
|
|
|
20
20
|
const DEFAULT_FORCED_PROMPT =
|
|
21
21
|
"Give a concise user-facing progress update based only on the reasoning below. Return an empty response when no update is useful.";
|
|
22
22
|
|
|
23
|
-
/** Options accepted by {@link
|
|
23
|
+
/** Options accepted by {@link createCollapsedReasoner}. */
|
|
24
24
|
export type CollapsedReasonerOptions = {
|
|
25
25
|
/** Prompt used for periodic progress updates. */
|
|
26
26
|
prompt?: string;
|
|
@@ -40,7 +40,7 @@ export type CollapsedReasonerOptions = {
|
|
|
40
40
|
* @param summarizer - Executor or model id that summarizes unexposed reasoning.
|
|
41
41
|
* @param options - Prompts and wall-clock update cadence.
|
|
42
42
|
*/
|
|
43
|
-
export function
|
|
43
|
+
export function createCollapsedReasoner(
|
|
44
44
|
reasoner: ExecutorInput,
|
|
45
45
|
summarizer: ExecutorInput,
|
|
46
46
|
options: CollapsedReasonerOptions = {},
|
package/src/managed/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { createCapabilitiesExecutor } from "./capabilities.ts";
|
|
2
2
|
export type { CapabilitiesExecutorOptions } from "./capabilities.ts";
|
|
3
|
-
export {
|
|
3
|
+
export { createCollapsedReasoner } from "./collapsed-reasoner.ts";
|
|
4
4
|
export type { CollapsedReasonerOptions } from "./collapsed-reasoner.ts";
|
|
5
5
|
export { createAttachmentToTextExecutor } from "./attachment-to-text.ts";
|
|
6
6
|
export type {
|
|
@@ -11,13 +11,13 @@ import {
|
|
|
11
11
|
type Program,
|
|
12
12
|
} from "@neutrome/lil-engine";
|
|
13
13
|
import { describe, expect, it, vi } from "vitest";
|
|
14
|
-
import {
|
|
14
|
+
import { createCollapsedReasoner } from "../src/managed/collapsed-reasoner.ts";
|
|
15
15
|
import type { Executor, ExecutorContext } from "../src/types.ts";
|
|
16
16
|
|
|
17
|
-
describe("
|
|
17
|
+
describe("createCollapsedReasoner", () => {
|
|
18
18
|
it("replaces completed raw reasoning with a forced summary", async () => {
|
|
19
19
|
let summaryRequest: Program | undefined;
|
|
20
|
-
const executor =
|
|
20
|
+
const executor = createCollapsedReasoner(
|
|
21
21
|
fromExecute(async () => withThinking("answer", "private reasoning")),
|
|
22
22
|
fromExecute(async (request) => {
|
|
23
23
|
summaryRequest = request;
|
|
@@ -33,7 +33,7 @@ describe("collapsedReasoner", () => {
|
|
|
33
33
|
});
|
|
34
34
|
|
|
35
35
|
it("suppresses raw stream deltas, preserves visible chunks, and flushes before the end", async () => {
|
|
36
|
-
const executor =
|
|
36
|
+
const executor = createCollapsedReasoner(
|
|
37
37
|
streaming(async function* () {
|
|
38
38
|
yield delta.start();
|
|
39
39
|
yield delta.thinking("private reasoning");
|
|
@@ -57,7 +57,7 @@ describe("collapsedReasoner", () => {
|
|
|
57
57
|
it("uses elapsed time for periodic summaries and gives a forced tick priority", async () => {
|
|
58
58
|
vi.useFakeTimers();
|
|
59
59
|
let release: (() => void) | undefined;
|
|
60
|
-
const executor =
|
|
60
|
+
const executor = createCollapsedReasoner(
|
|
61
61
|
streaming(async function* () {
|
|
62
62
|
yield delta.thinking("first");
|
|
63
63
|
await new Promise<void>((resolve) => {
|
|
@@ -84,12 +84,12 @@ describe("collapsedReasoner", () => {
|
|
|
84
84
|
});
|
|
85
85
|
|
|
86
86
|
it("validates its timing options and never emits blank summaries", async () => {
|
|
87
|
-
expect(() =>
|
|
87
|
+
expect(() => createCollapsedReasoner("reasoner", "summarizer", { interval: 0 })).toThrow(RangeError);
|
|
88
88
|
expect(() =>
|
|
89
|
-
|
|
89
|
+
createCollapsedReasoner("reasoner", "summarizer", { interval: 10, forcedInterval: 9 }),
|
|
90
90
|
).toThrow(RangeError);
|
|
91
91
|
|
|
92
|
-
const executor =
|
|
92
|
+
const executor = createCollapsedReasoner(
|
|
93
93
|
streaming(async function* () {
|
|
94
94
|
yield delta.thinking("private");
|
|
95
95
|
yield delta.end();
|
|
@@ -103,7 +103,7 @@ describe("collapsedReasoner", () => {
|
|
|
103
103
|
|
|
104
104
|
it("propagates source and summarizer failures without exposing reasoning", async () => {
|
|
105
105
|
const sourceFailure = new Error("source failed");
|
|
106
|
-
const brokenSource =
|
|
106
|
+
const brokenSource = createCollapsedReasoner(
|
|
107
107
|
streaming(async function* () {
|
|
108
108
|
throw sourceFailure;
|
|
109
109
|
}),
|
|
@@ -112,7 +112,7 @@ describe("collapsedReasoner", () => {
|
|
|
112
112
|
await expect(collect(brokenSource.stream(createProgram(), context()))).rejects.toBe(sourceFailure);
|
|
113
113
|
|
|
114
114
|
const summaryFailure = new Error("summary failed");
|
|
115
|
-
const brokenSummary =
|
|
115
|
+
const brokenSummary = createCollapsedReasoner(
|
|
116
116
|
streaming(async function* () {
|
|
117
117
|
yield delta.thinking("private");
|
|
118
118
|
yield delta.end();
|