@neutrome/lilsdk 0.4.6 → 0.5.1

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
@@ -4,24 +4,31 @@ High-level TypeScript SDK for transport-neutral model authoring on top of `@neut
4
4
 
5
5
  ```ts
6
6
  import type { Executor } from "@neutrome/lilsdk";
7
- import { retry } from "@neutrome/lilsdk/loops";
8
- import {
9
- observeExecutionStream,
10
- writeReasoning,
11
- } from "@neutrome/lilsdk/stream";
12
- import { connectTools } from "@neutrome/lilsdk/tools";
7
+ import { fallback, retry } from "@neutrome/lilsdk/loops";
8
+ import { createToolsExecutor } from "@neutrome/lilsdk/tools";
9
+ import { observeExecutionStream, writeThinking } from "@neutrome/lilsdk/stream";
10
+ import { prependSystemPrompt } from "@neutrome/lil-engine";
13
11
  ```
14
12
 
15
- This package owns:
13
+ Every symbol has exactly one import path. The root export is intentionally
14
+ small — SDK contracts only — and each subpath owns one concern:
16
15
 
17
- - executor and tool contracts
18
- - `@neutrome/lilsdk/primitives`: structural program helpers such as `walk`, `map`, `reduce`, `has`, `find`, `indexOf`, `all`, and `any`
19
- - `@neutrome/lilsdk/synthetic`: request/message synthesis helpers such as `createModelProgram`, `makeMessage`, `makeToolCall`, `makeToolResponse`, and `appendToolInteraction`
20
- - `@neutrome/lilsdk/tools`: `connectTools` tool-call loop
21
- - `@neutrome/lilsdk/stream`: stream observation and output helpers
22
- - `@neutrome/lilsdk/loops`: `retry`, `fallback`, and `createGoalExecutor` control-flow helpers
23
- The root export is intentionally small: SDK contracts.
16
+ - root: `Executor`, `ExecutorContext`, `ExecutorInput`, `Tool`,
17
+ `ProgramTransform`, `RuntimeContext`, `Cache`, `ExecutionEvent`,
18
+ `OutputSink`, and `createExecutionEvent`
19
+ - `@neutrome/lilsdk/loops`: `retry`, `fallback`, and `createGoalExecutor`
20
+ - `@neutrome/lilsdk/tools`: `createToolsExecutor` tool-call loop
21
+ - `@neutrome/lilsdk/managed`: `createCapabilitiesExecutor` and
22
+ `createAttachmentToTextExecutor`
23
+ - `@neutrome/lilsdk/stream`: `observeExecutionStream`, `streamStage`, and
24
+ `writeThinking`
25
+ - `@neutrome/lilsdk/primitives`: structural program helpers — `walk`, `map`,
26
+ `filter`, `reduce`, `has`, `find`, `indexOf`, `all`, and `any`
24
27
 
25
- It intentionally does not own HTTP routing, provider credentials, target
26
- resolution, or provider JSON conversion. Those live in `@neutrome/open-ai-router`
27
- and `@neutrome/lil-engine`.
28
+ Executor factories are named `create*Executor`, except `retry` and `fallback`,
29
+ which read better as bare verbs.
30
+
31
+ Building programs — messages, tool calls, attachments, streaming chunks — is
32
+ `@neutrome/lil-engine`'s job, so `prependSystemPrompt` and friends are imported
33
+ from there. HTTP routing, provider credentials, target resolution and provider
34
+ JSON conversion live in `@neutrome/open-ai-router` and `@neutrome/lil-engine`.
@@ -1,103 +1,96 @@
1
- ## API Report File for "neutrome"
2
-
3
- > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
-
5
- ```ts
6
-
7
- import type { Program } from '@neutrome/lil-engine';
8
-
9
- // @public (undocumented)
10
- type Cache_2 = {
11
- get(key: string): Promise<string | null>;
12
- put(key: string, value: string, options?: CachePutOptions): Promise<void>;
13
- delete(key: string): Promise<void>;
14
- };
15
- export { Cache_2 as Cache }
16
-
17
- // @public (undocumented)
18
- export type CachePutOptions = {
19
- expiration?: number;
20
- expirationTtl?: number;
21
- };
22
-
23
- // @public (undocumented)
24
- export function createExecutionEvent(input: ExecutionEventInput): ExecutionEvent;
25
-
26
- // @public (undocumented)
27
- export type ExecutionEvent = {
28
- kind: string;
29
- requestId: string;
30
- executionId: string;
31
- timestamp: string;
32
- parentExecutionId?: string;
33
- target?: {
34
- kind: "provider" | "executor";
35
- id: string;
36
- };
37
- errorKind?: string;
38
- data?: Record<string, unknown>;
39
- };
40
-
41
- // @public (undocumented)
42
- export type ExecutionEventInput = Omit<ExecutionEvent, "timestamp"> & {
43
- timestamp?: string;
44
- };
45
-
46
- // @public (undocumented)
47
- export type Executor = {
48
- execute(request: Program, ctx: ExecutorContext): Promise<Program>;
49
- stream(request: Program, ctx: ExecutorContext): AsyncIterable<Program>;
50
- };
51
-
52
- // Warning: (ae-forgotten-export) The symbol "RuntimeContext" needs to be exported by the entry point index.d.ts
53
- //
54
- // @public (undocumented)
55
- export type ExecutorContext = RuntimeContext & {
56
- requestId: string;
57
- executionId: string;
58
- parentExecutionId?: string;
59
- };
60
-
61
- // @public (undocumented)
62
- export type ExecutorInput = string | Executor;
63
-
64
- // @public (undocumented)
65
- export type OutputSink = {
66
- write(chunk: Program): void | Promise<void>;
67
- close(): void | Promise<void>;
68
- };
69
-
70
- // @public (undocumented)
71
- export type ProgramTransform = {
72
- name: string;
73
- capabilities: TransformCapability[];
74
- apply(program: Program, ctx: TransformContext): Program | Promise<Program>;
75
- };
76
-
77
- // @public (undocumented)
78
- type RuntimeContext = {
79
- cache: Cache_2;
80
- invoke(executor: ExecutorInput, request: Program): Promise<Program>;
81
- invokeStream(executor: ExecutorInput, request: Program): AsyncIterable<Program>;
82
- observe(event: ExecutionEvent): void;
83
- signal: AbortSignal;
84
- };
85
-
86
- // @public (undocumented)
87
- export type Tool = {
88
- name: string;
89
- description: string;
90
- schema: Record<string, unknown>;
91
- systemPromptFragment?: string;
92
- execute(args: Record<string, unknown>, ctx: ExecutorContext): Promise<string>;
93
- };
94
-
95
- // @public (undocumented)
96
- export type TransformCapability = "read_messages" | "write_messages" | "write_config" | "write_tools" | "drop_content" | "provider_extension";
97
-
98
- // @public (undocumented)
99
- export type TransformContext = RuntimeContext;
100
-
101
- // (No @packageDocumentation comment for this package)
102
-
103
- ```
1
+ ## API Report File for "neutrome"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+
7
+ import type { Program } from '@neutrome/lil-engine';
8
+
9
+ // @public
10
+ type Cache_2 = {
11
+ get(key: string): Promise<string | null>;
12
+ put(key: string, value: string, options?: CachePutOptions): Promise<void>;
13
+ delete(key: string): Promise<void>;
14
+ };
15
+ export { Cache_2 as Cache }
16
+
17
+ // @public
18
+ export type CachePutOptions = {
19
+ expiration?: number;
20
+ expirationTtl?: number;
21
+ };
22
+
23
+ // @public
24
+ export function createExecutionEvent(input: ExecutionEventInput): ExecutionEvent;
25
+
26
+ // @public
27
+ export type ExecutionEvent = {
28
+ kind: string;
29
+ requestId: string;
30
+ executionId: string;
31
+ timestamp: string;
32
+ parentExecutionId?: string;
33
+ target?: {
34
+ kind: "provider" | "executor";
35
+ id: string;
36
+ };
37
+ errorKind?: string;
38
+ data?: Record<string, unknown>;
39
+ };
40
+
41
+ // @public
42
+ export type ExecutionEventInput = Omit<ExecutionEvent, "timestamp"> & {
43
+ timestamp?: string;
44
+ };
45
+
46
+ // @public
47
+ export type Executor = {
48
+ execute(request: Program, ctx: ExecutorContext): Promise<Program>;
49
+ stream(request: Program, ctx: ExecutorContext): AsyncIterable<Program>;
50
+ };
51
+
52
+ // @public
53
+ export type ExecutorContext = RuntimeContext & {
54
+ requestId: string;
55
+ executionId: string;
56
+ parentExecutionId?: string;
57
+ };
58
+
59
+ // @public
60
+ export type ExecutorInput = string | Executor;
61
+
62
+ // @public
63
+ export type OutputSink = {
64
+ write(chunk: Program): void | Promise<void>;
65
+ close(): void | Promise<void>;
66
+ };
67
+
68
+ // @public
69
+ export type ProgramTransform = {
70
+ name: string;
71
+ capabilities: TransformCapability[];
72
+ apply(program: Program, ctx: RuntimeContext): Program | Promise<Program>;
73
+ };
74
+
75
+ // @public
76
+ export type RuntimeContext = {
77
+ cache: Cache_2;
78
+ invoke(executor: ExecutorInput, request: Program): Promise<Program>;
79
+ invokeStream(executor: ExecutorInput, request: Program): AsyncIterable<Program>;
80
+ observe(event: ExecutionEvent): void;
81
+ signal: AbortSignal;
82
+ };
83
+
84
+ // @public
85
+ export type Tool = {
86
+ name: string;
87
+ description: string;
88
+ schema: Record<string, unknown>;
89
+ systemPromptFragment?: string;
90
+ execute(args: Record<string, unknown>, ctx: ExecutorContext): Promise<string>;
91
+ };
92
+
93
+ // @public
94
+ export type TransformCapability = "read_messages" | "write_messages" | "write_config" | "write_tools" | "drop_content" | "provider_extension";
95
+
96
+ ```
@@ -1,108 +1,108 @@
1
- ## API Report File for "neutrome"
2
-
3
- > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
-
5
- ```ts
6
-
7
- import { Program } from '@neutrome/lil-engine';
8
-
9
- // @public (undocumented)
10
- type Cache_2 = {
11
- get(key: string): Promise<string | null>;
12
- put(key: string, value: string, options?: CachePutOptions): Promise<void>;
13
- delete(key: string): Promise<void>;
14
- };
15
-
16
- // @public (undocumented)
17
- type CachePutOptions = {
18
- expiration?: number;
19
- expirationTtl?: number;
20
- };
21
-
22
- // Warning: (ae-forgotten-export) The symbol "Executor" needs to be exported by the entry point index.d.ts
23
- //
24
- // @public (undocumented)
25
- export function createGoalExecutor(options: GoalExecutorOptions): Executor;
26
-
27
- // @public (undocumented)
28
- type ExecutionEvent = {
29
- kind: string;
30
- requestId: string;
31
- executionId: string;
32
- timestamp: string;
33
- parentExecutionId?: string;
34
- target?: {
35
- kind: "provider" | "executor";
36
- id: string;
37
- };
38
- errorKind?: string;
39
- data?: Record<string, unknown>;
40
- };
41
-
42
- // @public (undocumented)
43
- type Executor = {
44
- execute(request: Program, ctx: ExecutorContext): Promise<Program>;
45
- stream(request: Program, ctx: ExecutorContext): AsyncIterable<Program>;
46
- };
47
-
48
- // Warning: (ae-forgotten-export) The symbol "RuntimeContext" needs to be exported by the entry point index.d.ts
49
- //
50
- // @public (undocumented)
51
- type ExecutorContext = RuntimeContext & {
52
- requestId: string;
53
- executionId: string;
54
- parentExecutionId?: string;
55
- };
56
-
57
- // @public (undocumented)
58
- type ExecutorInput = string | Executor;
59
-
60
- // Warning: (ae-forgotten-export) The symbol "ExecutorInput" needs to be exported by the entry point index.d.ts
61
- //
62
- // @public (undocumented)
63
- export function fallback(executors: readonly ExecutorInput[], options?: FallbackOptions): Executor;
64
-
65
- // @public (undocumented)
66
- export type FallbackOptions = {
67
- shouldFallback?: (error: unknown, executorIndex: number) => boolean | Promise<boolean>;
68
- onFallback?: (error: unknown, executorIndex: number) => void | Promise<void>;
69
- };
70
-
71
- // @public (undocumented)
72
- export type GoalExecutorOptions = {
73
- draft: ExecutorInput;
74
- review: ExecutorInput;
75
- refine: (request: Program, answer: Program, review: Program, attempt: number) => Program | Promise<Program>;
76
- satisfied: (review: Program, attempt: number) => boolean | Promise<boolean>;
77
- maxIterations?: number;
78
- };
79
-
80
- // @public (undocumented)
81
- export function retry(executor: ExecutorInput, options?: RetryOptions): Executor;
82
-
83
- // @public (undocumented)
84
- export type RetryOptions = {
85
- attempts?: number;
86
- shouldRetry?: (error: unknown, attempt: number) => boolean | Promise<boolean>;
87
- onRetry?: (error: unknown, attempt: number) => void | Promise<void>;
88
- };
89
-
90
- // @public (undocumented)
91
- type RuntimeContext = {
92
- cache: Cache_2;
93
- invoke(executor: ExecutorInput, request: Program): Promise<Program>;
94
- invokeStream(executor: ExecutorInput, request: Program): AsyncIterable<Program>;
95
- observe(event: ExecutionEvent): void;
96
- signal: AbortSignal;
97
- };
98
-
99
- // Warnings were encountered during analysis:
100
- //
101
- // .reference-build/types/neutrome-lilsdk/src/types.d.ts:25:5 - (ae-forgotten-export) The symbol "CachePutOptions" needs to be exported by the entry point index.d.ts
102
- // .reference-build/types/neutrome-lilsdk/src/types.d.ts:29:5 - (ae-forgotten-export) The symbol "Cache_2" needs to be exported by the entry point index.d.ts
103
- // .reference-build/types/neutrome-lilsdk/src/types.d.ts:32:5 - (ae-forgotten-export) The symbol "ExecutionEvent" needs to be exported by the entry point index.d.ts
104
- // .reference-build/types/neutrome-lilsdk/src/types.d.ts:47:5 - (ae-forgotten-export) The symbol "ExecutorContext" needs to be exported by the entry point index.d.ts
105
-
106
- // (No @packageDocumentation comment for this package)
107
-
108
- ```
1
+ ## API Report File for "neutrome"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+
7
+ import { Program } from '@neutrome/lil-engine';
8
+
9
+ // @public
10
+ type Cache_2 = {
11
+ get(key: string): Promise<string | null>;
12
+ put(key: string, value: string, options?: CachePutOptions): Promise<void>;
13
+ delete(key: string): Promise<void>;
14
+ };
15
+
16
+ // @public
17
+ type CachePutOptions = {
18
+ expiration?: number;
19
+ expirationTtl?: number;
20
+ };
21
+
22
+ // Warning: (ae-forgotten-export) The symbol "Executor" needs to be exported by the entry point index.d.ts
23
+ //
24
+ // @public
25
+ export function createGoalExecutor(options: GoalExecutorOptions): Executor;
26
+
27
+ // @public
28
+ type ExecutionEvent = {
29
+ kind: string;
30
+ requestId: string;
31
+ executionId: string;
32
+ timestamp: string;
33
+ parentExecutionId?: string;
34
+ target?: {
35
+ kind: "provider" | "executor";
36
+ id: string;
37
+ };
38
+ errorKind?: string;
39
+ data?: Record<string, unknown>;
40
+ };
41
+
42
+ // @public
43
+ type Executor = {
44
+ execute(request: Program, ctx: ExecutorContext): Promise<Program>;
45
+ stream(request: Program, ctx: ExecutorContext): AsyncIterable<Program>;
46
+ };
47
+
48
+ // Warning: (ae-forgotten-export) The symbol "RuntimeContext" needs to be exported by the entry point index.d.ts
49
+ //
50
+ // @public
51
+ type ExecutorContext = RuntimeContext & {
52
+ requestId: string;
53
+ executionId: string;
54
+ parentExecutionId?: string;
55
+ };
56
+
57
+ // @public
58
+ type ExecutorInput = string | Executor;
59
+
60
+ // Warning: (ae-forgotten-export) The symbol "ExecutorInput" needs to be exported by the entry point index.d.ts
61
+ //
62
+ // @public
63
+ export function fallback(executors: readonly ExecutorInput[], options?: FallbackOptions): Executor;
64
+
65
+ // @public
66
+ export type FallbackOptions = {
67
+ shouldFallback?: (error: unknown, executorIndex: number) => boolean | Promise<boolean>;
68
+ onFallback?: (error: unknown, executorIndex: number) => void | Promise<void>;
69
+ };
70
+
71
+ // @public
72
+ export type GoalExecutorOptions = {
73
+ draft: ExecutorInput;
74
+ review: ExecutorInput;
75
+ refine: (request: Program, answer: Program, review: Program, attempt: number) => Program | Promise<Program>;
76
+ satisfied: (review: Program, attempt: number) => boolean | Promise<boolean>;
77
+ maxIterations?: number;
78
+ };
79
+
80
+ // @public
81
+ export function retry(executor: ExecutorInput, options?: RetryOptions): Executor;
82
+
83
+ // @public
84
+ export type RetryOptions = {
85
+ attempts?: number;
86
+ shouldRetry?: (error: unknown, attempt: number) => boolean | Promise<boolean>;
87
+ onRetry?: (error: unknown, attempt: number) => void | Promise<void>;
88
+ };
89
+
90
+ // @public
91
+ type RuntimeContext = {
92
+ cache: Cache_2;
93
+ invoke(executor: ExecutorInput, request: Program): Promise<Program>;
94
+ invokeStream(executor: ExecutorInput, request: Program): AsyncIterable<Program>;
95
+ observe(event: ExecutionEvent): void;
96
+ signal: AbortSignal;
97
+ };
98
+
99
+ // Warnings were encountered during analysis:
100
+ //
101
+ // .reference-build/types/neutrome-lilsdk/src/types.d.ts:42:5 - (ae-forgotten-export) The symbol "CachePutOptions" needs to be exported by the entry point index.d.ts
102
+ // .reference-build/types/neutrome-lilsdk/src/types.d.ts:55:5 - (ae-forgotten-export) The symbol "Cache_2" needs to be exported by the entry point index.d.ts
103
+ // .reference-build/types/neutrome-lilsdk/src/types.d.ts:77:5 - (ae-forgotten-export) The symbol "ExecutionEvent" needs to be exported by the entry point index.d.ts
104
+ // .reference-build/types/neutrome-lilsdk/src/types.d.ts:131:5 - (ae-forgotten-export) The symbol "ExecutorContext" needs to be exported by the entry point index.d.ts
105
+
106
+ // (No @packageDocumentation comment for this package)
107
+
108
+ ```