@dirgha/code 1.6.0 → 1.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 +5 -15
- package/LICENSE +21 -101
- package/README.md +9 -15
- package/dist_v2/cli/config.d.ts +0 -1
- package/dist_v2/cli/config.js.map +1 -1
- package/dist_v2/cli/main.js +4 -8
- package/dist_v2/cli/main.js.map +1 -1
- package/dist_v2/kernel/agent-loop.d.ts +38 -8
- package/dist_v2/kernel/agent-loop.js +57 -18
- package/dist_v2/kernel/agent-loop.js.map +1 -1
- package/dist_v2/kernel/index.d.ts +1 -0
- package/dist_v2/kernel/index.js +1 -0
- package/dist_v2/kernel/index.js.map +1 -1
- package/dist_v2/kernel/message.d.ts +17 -1
- package/dist_v2/kernel/message.js +26 -0
- package/dist_v2/kernel/message.js.map +1 -1
- package/dist_v2/kernel/queues.d.ts +82 -0
- package/dist_v2/kernel/queues.js +105 -0
- package/dist_v2/kernel/queues.js.map +1 -0
- package/dist_v2/kernel/types.d.ts +29 -0
- package/dist_v2/providers/faux.d.ts +99 -0
- package/dist_v2/providers/faux.js +153 -0
- package/dist_v2/providers/faux.js.map +1 -0
- package/package.json +6 -16
- package/CREDITS.md +0 -46
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-loop.js","sourceRoot":"","sources":["../../src_v2/kernel/agent-loop.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"agent-loop.js","sourceRoot":"","sources":["../../src_v2/kernel/agent-loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAmBH,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC9F,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAyD3D,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,GAAoB;IACrD,MAAM,MAAM,GAAG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AAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC;AACzD,CAAC;AAED,SAAS,aAAa;IACpB,OAAO,IAAI,eAAe,EAAE,CAAC,MAAM,CAAC;AACtC,CAAC"}
|
package/dist_v2/kernel/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src_v2/kernel/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src_v2/kernel/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC"}
|
|
@@ -1,7 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Message manipulation helpers. Pure functions over Message[].
|
|
3
3
|
*/
|
|
4
|
-
import type { Message, ContentPart, ToolUsePart, AgentEvent } from './types.js';
|
|
4
|
+
import type { AgentMessage, Message, ContentPart, ToolUsePart, AgentEvent } from './types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Projection boundary: convert kernel-internal `AgentMessage[]` (which may
|
|
7
|
+
* carry UI-only metadata) into the clean `Message[]` shape that providers
|
|
8
|
+
* actually send to the LLM.
|
|
9
|
+
*
|
|
10
|
+
* Behaviour:
|
|
11
|
+
* - Filters out any entry with `hidden === true`.
|
|
12
|
+
* - Strips the `ui` field from the remaining entries.
|
|
13
|
+
* - Preserves order.
|
|
14
|
+
* - Pure: does not mutate the input array or its elements.
|
|
15
|
+
*
|
|
16
|
+
* This is the ONLY seam the agent loop should use when handing messages
|
|
17
|
+
* off to a `Provider.stream` call. Keeping it a single function makes the
|
|
18
|
+
* UI/LLM boundary auditable.
|
|
19
|
+
*/
|
|
20
|
+
export declare function convertToLlm(messages: AgentMessage[]): Message[];
|
|
5
21
|
export declare function normaliseContent(msg: Message): ContentPart[];
|
|
6
22
|
export declare function extractText(msg: Message): string;
|
|
7
23
|
export declare function extractToolUses(msg: Message): ToolUsePart[];
|
|
@@ -1,6 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Message manipulation helpers. Pure functions over Message[].
|
|
3
3
|
*/
|
|
4
|
+
/**
|
|
5
|
+
* Projection boundary: convert kernel-internal `AgentMessage[]` (which may
|
|
6
|
+
* carry UI-only metadata) into the clean `Message[]` shape that providers
|
|
7
|
+
* actually send to the LLM.
|
|
8
|
+
*
|
|
9
|
+
* Behaviour:
|
|
10
|
+
* - Filters out any entry with `hidden === true`.
|
|
11
|
+
* - Strips the `ui` field from the remaining entries.
|
|
12
|
+
* - Preserves order.
|
|
13
|
+
* - Pure: does not mutate the input array or its elements.
|
|
14
|
+
*
|
|
15
|
+
* This is the ONLY seam the agent loop should use when handing messages
|
|
16
|
+
* off to a `Provider.stream` call. Keeping it a single function makes the
|
|
17
|
+
* UI/LLM boundary auditable.
|
|
18
|
+
*/
|
|
19
|
+
export function convertToLlm(messages) {
|
|
20
|
+
const out = [];
|
|
21
|
+
for (const m of messages) {
|
|
22
|
+
if (m.hidden === true)
|
|
23
|
+
continue;
|
|
24
|
+
// Destructure to strip ui/hidden without mutating the original.
|
|
25
|
+
const { ui: _ui, hidden: _hidden, ...rest } = m;
|
|
26
|
+
out.push(rest);
|
|
27
|
+
}
|
|
28
|
+
return out;
|
|
29
|
+
}
|
|
4
30
|
export function normaliseContent(msg) {
|
|
5
31
|
if (typeof msg.content === 'string') {
|
|
6
32
|
return msg.content.length > 0 ? [{ type: 'text', text: msg.content }] : [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../src_v2/kernel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ACR,CAAC;YACD,KAAK,OAAO;gBACV,WAAW,IAAI,EAAE,CAAC,WAAW,CAAC;gBAC9B,YAAY,IAAI,EAAE,CAAC,YAAY,CAAC;gBAChC,YAAY,IAAI,EAAE,CAAC,YAAY,IAAI,CAAC,CAAC;gBACrC,MAAM;QACV,CAAC;IACH,CAAC;IACD,SAAS,EAAE,CAAC;IACZ,aAAa,EAAE,CAAC;IAEhB,OAAO;QACL,OAAO,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE;QAC9C,WAAW;QACX,YAAY;QACZ,YAAY;KACb,CAAC;AACJ,CAAC;AAED,SAAS,SAAS,CAAC,IAAY;IAC7B,IAAI,CAAC,IAAI;QAAE,OAAO,EAAE,CAAC;IACrB,IAAI,CAAC;QAAC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAAC,CAAC;IAAC,MAAM,CAAC;QAAC,OAAO,EAAE,CAAC;IAAC,CAAC;AACvD,CAAC;AAED,uDAAuD;AACvD,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,IAAI,CAAC,IAAI;QAAE,OAAO,CAAC,CAAC;IACpB,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Steering and follow-up queues for mid-flight agent control.
|
|
3
|
+
*
|
|
4
|
+
* Two queue types with different drain semantics:
|
|
5
|
+
*
|
|
6
|
+
* - SteeringQueue: drain mode 'all'. Every queued message replaces the
|
|
7
|
+
* current turn's prompt mid-flight. Used for "stop and do this instead".
|
|
8
|
+
* When drained, all queued messages are returned and the queue is cleared.
|
|
9
|
+
*
|
|
10
|
+
* - FollowUpQueue: drain mode 'one-at-a-time'. Each queued message becomes
|
|
11
|
+
* the next turn after the current one completes. When drained, only one
|
|
12
|
+
* message is returned (if any), leaving the rest for subsequent drains.
|
|
13
|
+
*
|
|
14
|
+
* Both queues accept `AgentMessage` (user messages to inject into the
|
|
15
|
+
* conversation) and expose the standard queue operations: enqueue, drain,
|
|
16
|
+
* peek, and clear.
|
|
17
|
+
*/
|
|
18
|
+
import type { AgentMessage } from './types.js';
|
|
19
|
+
/**
|
|
20
|
+
* Drain mode determines how many messages are removed on drain.
|
|
21
|
+
* - 'all': drain removes every queued message.
|
|
22
|
+
* - 'one': drain removes at most one message.
|
|
23
|
+
*/
|
|
24
|
+
type DrainMode = 'all' | 'one';
|
|
25
|
+
/**
|
|
26
|
+
* Base queue implementation with configurable drain behaviour.
|
|
27
|
+
*/
|
|
28
|
+
declare class MessageQueue {
|
|
29
|
+
protected readonly messages: AgentMessage[];
|
|
30
|
+
protected readonly mode: DrainMode;
|
|
31
|
+
constructor(mode: DrainMode);
|
|
32
|
+
/**
|
|
33
|
+
* Append a message to the end of the queue.
|
|
34
|
+
*/
|
|
35
|
+
enqueue(msg: AgentMessage): void;
|
|
36
|
+
/**
|
|
37
|
+
* Remove and return messages according to the drain mode.
|
|
38
|
+
*
|
|
39
|
+
* - 'all': returns all messages (or null if empty), clears the queue.
|
|
40
|
+
* - 'one': returns the oldest message as a single-element array (or null
|
|
41
|
+
* if empty), removes only that message.
|
|
42
|
+
*/
|
|
43
|
+
drain(): AgentMessage[] | null;
|
|
44
|
+
/**
|
|
45
|
+
* Peek at queued messages without removing them.
|
|
46
|
+
*
|
|
47
|
+
* - 'all': returns all messages (or null if empty).
|
|
48
|
+
* - 'one': returns the oldest message as a single-element array (or null
|
|
49
|
+
* if empty).
|
|
50
|
+
*/
|
|
51
|
+
peek(): AgentMessage[] | null;
|
|
52
|
+
/**
|
|
53
|
+
* Remove all messages from the queue.
|
|
54
|
+
*/
|
|
55
|
+
clear(): void;
|
|
56
|
+
/**
|
|
57
|
+
* Number of messages currently in the queue.
|
|
58
|
+
*/
|
|
59
|
+
get length(): number;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* SteeringQueue: drain mode 'all'.
|
|
63
|
+
*
|
|
64
|
+
* Used for mid-flight steering — "stop and do this instead". When drained,
|
|
65
|
+
* all queued messages are returned and the queue is cleared. The agent loop
|
|
66
|
+
* should push these messages into history and continue looping (i.e. not
|
|
67
|
+
* break on end_turn).
|
|
68
|
+
*/
|
|
69
|
+
export declare class SteeringQueue extends MessageQueue {
|
|
70
|
+
constructor();
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* FollowUpQueue: drain mode 'one-at-a-time'.
|
|
74
|
+
*
|
|
75
|
+
* Used for scheduling follow-up turns. Each queued message becomes the next
|
|
76
|
+
* turn after the current one completes. When drained, only one message is
|
|
77
|
+
* returned (if any), leaving the rest for subsequent drains.
|
|
78
|
+
*/
|
|
79
|
+
export declare class FollowUpQueue extends MessageQueue {
|
|
80
|
+
constructor();
|
|
81
|
+
}
|
|
82
|
+
export {};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Steering and follow-up queues for mid-flight agent control.
|
|
3
|
+
*
|
|
4
|
+
* Two queue types with different drain semantics:
|
|
5
|
+
*
|
|
6
|
+
* - SteeringQueue: drain mode 'all'. Every queued message replaces the
|
|
7
|
+
* current turn's prompt mid-flight. Used for "stop and do this instead".
|
|
8
|
+
* When drained, all queued messages are returned and the queue is cleared.
|
|
9
|
+
*
|
|
10
|
+
* - FollowUpQueue: drain mode 'one-at-a-time'. Each queued message becomes
|
|
11
|
+
* the next turn after the current one completes. When drained, only one
|
|
12
|
+
* message is returned (if any), leaving the rest for subsequent drains.
|
|
13
|
+
*
|
|
14
|
+
* Both queues accept `AgentMessage` (user messages to inject into the
|
|
15
|
+
* conversation) and expose the standard queue operations: enqueue, drain,
|
|
16
|
+
* peek, and clear.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Base queue implementation with configurable drain behaviour.
|
|
20
|
+
*/
|
|
21
|
+
class MessageQueue {
|
|
22
|
+
messages = [];
|
|
23
|
+
mode;
|
|
24
|
+
constructor(mode) {
|
|
25
|
+
this.mode = mode;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Append a message to the end of the queue.
|
|
29
|
+
*/
|
|
30
|
+
enqueue(msg) {
|
|
31
|
+
this.messages.push(msg);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Remove and return messages according to the drain mode.
|
|
35
|
+
*
|
|
36
|
+
* - 'all': returns all messages (or null if empty), clears the queue.
|
|
37
|
+
* - 'one': returns the oldest message as a single-element array (or null
|
|
38
|
+
* if empty), removes only that message.
|
|
39
|
+
*/
|
|
40
|
+
drain() {
|
|
41
|
+
if (this.messages.length === 0)
|
|
42
|
+
return null;
|
|
43
|
+
if (this.mode === 'all') {
|
|
44
|
+
const drained = [...this.messages];
|
|
45
|
+
this.messages.length = 0;
|
|
46
|
+
return drained;
|
|
47
|
+
}
|
|
48
|
+
// mode === 'one'
|
|
49
|
+
return [this.messages.shift()];
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Peek at queued messages without removing them.
|
|
53
|
+
*
|
|
54
|
+
* - 'all': returns all messages (or null if empty).
|
|
55
|
+
* - 'one': returns the oldest message as a single-element array (or null
|
|
56
|
+
* if empty).
|
|
57
|
+
*/
|
|
58
|
+
peek() {
|
|
59
|
+
if (this.messages.length === 0)
|
|
60
|
+
return null;
|
|
61
|
+
if (this.mode === 'all') {
|
|
62
|
+
return [...this.messages];
|
|
63
|
+
}
|
|
64
|
+
// mode === 'one'
|
|
65
|
+
return [this.messages[0]];
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Remove all messages from the queue.
|
|
69
|
+
*/
|
|
70
|
+
clear() {
|
|
71
|
+
this.messages.length = 0;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Number of messages currently in the queue.
|
|
75
|
+
*/
|
|
76
|
+
get length() {
|
|
77
|
+
return this.messages.length;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* SteeringQueue: drain mode 'all'.
|
|
82
|
+
*
|
|
83
|
+
* Used for mid-flight steering — "stop and do this instead". When drained,
|
|
84
|
+
* all queued messages are returned and the queue is cleared. The agent loop
|
|
85
|
+
* should push these messages into history and continue looping (i.e. not
|
|
86
|
+
* break on end_turn).
|
|
87
|
+
*/
|
|
88
|
+
export class SteeringQueue extends MessageQueue {
|
|
89
|
+
constructor() {
|
|
90
|
+
super('all');
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* FollowUpQueue: drain mode 'one-at-a-time'.
|
|
95
|
+
*
|
|
96
|
+
* Used for scheduling follow-up turns. Each queued message becomes the next
|
|
97
|
+
* turn after the current one completes. When drained, only one message is
|
|
98
|
+
* returned (if any), leaving the rest for subsequent drains.
|
|
99
|
+
*/
|
|
100
|
+
export class FollowUpQueue extends MessageQueue {
|
|
101
|
+
constructor() {
|
|
102
|
+
super('one');
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=queues.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queues.js","sourceRoot":"","sources":["../../src_v2/kernel/queues.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAWH;;GAEG;AACH,MAAM,YAAY;IACG,QAAQ,GAAmB,EAAE,CAAC;IAC9B,IAAI,CAAY;IAEnC,YAAY,IAAe;QACzB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED;;OAEG;IACH,OAAO,CAAC,GAAiB;QACvB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC1B,CAAC;IAED;;;;;;OAMG;IACH,KAAK;QACH,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;QAC5C,IAAI,IAAI,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;YACxB,MAAM,OAAO,GAAG,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC;YACnC,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;YACzB,OAAO,OAAO,CAAC;QACjB,CAAC;QACD,iBAAiB;QACjB,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAG,CAAC,CAAC;IAClC,CAAC;IAED;;;;;;OAMG;IACH,IAAI;QACF,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;QAC5C,IAAI,IAAI,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;YACxB,OAAO,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC5B,CAAC;QACD,iBAAiB;QACjB,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,KAAK;QACH,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;IAC9B,CAAC;CACF;AAED;;;;;;;GAOG;AACH,MAAM,OAAO,aAAc,SAAQ,YAAY;IAC7C;QACE,KAAK,CAAC,KAAK,CAAC,CAAC;IACf,CAAC;CACF;AAED;;;;;;GAMG;AACH,MAAM,OAAO,aAAc,SAAQ,YAAY;IAC7C;QACE,KAAK,CAAC,KAAK,CAAC,CAAC;IACf,CAAC;CACF"}
|
|
@@ -33,6 +33,35 @@ export interface Message {
|
|
|
33
33
|
content: string | ContentPart[];
|
|
34
34
|
name?: string;
|
|
35
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* UI-only metadata that may be attached to a message in agent state but
|
|
38
|
+
* MUST NOT be sent to the LLM. Use `convertToLlm` (see `./message.ts`) at
|
|
39
|
+
* the provider boundary to strip these fields.
|
|
40
|
+
*
|
|
41
|
+
* `kind` is the high-level provenance / role of the entry:
|
|
42
|
+
* - 'notification' : transient UI banner (rate-limit, model-switch, etc.)
|
|
43
|
+
* - 'skill-injection' : marker for a skill-prompt injection event
|
|
44
|
+
* - 'fleet-supervisor': supervisor commentary in fleet/multi-agent runs
|
|
45
|
+
* - 'internal' : free-form internal annotation
|
|
46
|
+
*
|
|
47
|
+
* `data` is opaque to the kernel; consumers (TUI, daemon, fleet) may shape
|
|
48
|
+
* it as they wish.
|
|
49
|
+
*/
|
|
50
|
+
export interface AgentMessageUi {
|
|
51
|
+
kind: 'notification' | 'skill-injection' | 'fleet-supervisor' | 'internal';
|
|
52
|
+
data?: unknown;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* `AgentMessage` is the in-kernel transcript entry. It is a `Message` plus
|
|
56
|
+
* optional UI-only metadata. The agent loop stores `AgentMessage[]`; only
|
|
57
|
+
* the projected `Message[]` (via `convertToLlm`) is sent to providers.
|
|
58
|
+
*
|
|
59
|
+
* `hidden: true` excludes the message from the LLM context entirely.
|
|
60
|
+
*/
|
|
61
|
+
export interface AgentMessage extends Message {
|
|
62
|
+
ui?: AgentMessageUi;
|
|
63
|
+
hidden?: boolean;
|
|
64
|
+
}
|
|
36
65
|
export type StopReason = 'end_turn' | 'tool_use' | 'max_tokens' | 'stop_sequence' | 'error' | 'aborted';
|
|
37
66
|
export interface UsageTotal {
|
|
38
67
|
inputTokens: number;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FauxProvider — deterministic, in-process Provider for testing the agent loop.
|
|
3
|
+
*
|
|
4
|
+
* Implements the same `Provider` contract as real providers (anthropic.ts,
|
|
5
|
+
* openai.ts, etc.) but consumes a pre-baked script of step descriptors
|
|
6
|
+
* instead of talking to a network. Each call to `stream()` consumes the
|
|
7
|
+
* NEXT step from the script and emits the corresponding `AgentEvent`s.
|
|
8
|
+
*
|
|
9
|
+
* Use it to drive `runAgentLoop` end-to-end without any I/O.
|
|
10
|
+
*
|
|
11
|
+
* const provider = new FauxProvider([
|
|
12
|
+
* { kind: 'tool-call', id: 'c1', name: 'shell', input: { cmd: 'ls' } },
|
|
13
|
+
* { kind: 'text', chunks: ['done'] },
|
|
14
|
+
* ]);
|
|
15
|
+
*
|
|
16
|
+
* The provider also records `callCount` and `lastMessages` so tests can
|
|
17
|
+
* assert what the loop sent to the LLM (post-projection from AgentMessage[]).
|
|
18
|
+
*/
|
|
19
|
+
import type { AgentEvent, Message } from '../kernel/types.js';
|
|
20
|
+
import type { Provider, StreamRequest } from './iface.js';
|
|
21
|
+
export type FauxScriptStep = {
|
|
22
|
+
kind: 'text';
|
|
23
|
+
chunks: string[];
|
|
24
|
+
usage?: {
|
|
25
|
+
inputTokens: number;
|
|
26
|
+
outputTokens: number;
|
|
27
|
+
cachedTokens?: number;
|
|
28
|
+
};
|
|
29
|
+
} | {
|
|
30
|
+
kind: 'tool-call';
|
|
31
|
+
id: string;
|
|
32
|
+
name: string;
|
|
33
|
+
input: unknown;
|
|
34
|
+
usage?: {
|
|
35
|
+
inputTokens: number;
|
|
36
|
+
outputTokens: number;
|
|
37
|
+
cachedTokens?: number;
|
|
38
|
+
};
|
|
39
|
+
} | {
|
|
40
|
+
kind: 'mixed';
|
|
41
|
+
text?: string;
|
|
42
|
+
toolCalls: {
|
|
43
|
+
id: string;
|
|
44
|
+
name: string;
|
|
45
|
+
input: unknown;
|
|
46
|
+
}[];
|
|
47
|
+
usage?: {
|
|
48
|
+
inputTokens: number;
|
|
49
|
+
outputTokens: number;
|
|
50
|
+
cachedTokens?: number;
|
|
51
|
+
};
|
|
52
|
+
} | {
|
|
53
|
+
kind: 'error';
|
|
54
|
+
error: Error;
|
|
55
|
+
} | {
|
|
56
|
+
kind: 'abort';
|
|
57
|
+
afterMs?: number;
|
|
58
|
+
} | {
|
|
59
|
+
kind: 'wait';
|
|
60
|
+
ms: number;
|
|
61
|
+
};
|
|
62
|
+
export interface FauxProviderOptions {
|
|
63
|
+
/** Provider id reported via `provider.id`. Defaults to `'faux'`. */
|
|
64
|
+
id?: string;
|
|
65
|
+
/** Whether `supportsTools` returns true (default: true). */
|
|
66
|
+
supportsTools?: boolean;
|
|
67
|
+
/** Whether `supportsThinking` returns true (default: false). */
|
|
68
|
+
supportsThinking?: boolean;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Synchronous-throwing AbortError. Mirrors the shape Node/undici fetch
|
|
72
|
+
* rejects with when an AbortSignal fires mid-request — `.name === 'AbortError'`
|
|
73
|
+
* is the discriminator real providers and the loop's error path see.
|
|
74
|
+
*/
|
|
75
|
+
export declare class FauxAbortError extends Error {
|
|
76
|
+
readonly name = "AbortError";
|
|
77
|
+
constructor(message?: string);
|
|
78
|
+
}
|
|
79
|
+
export declare class FauxProvider implements Provider {
|
|
80
|
+
readonly id: string;
|
|
81
|
+
private readonly script;
|
|
82
|
+
private cursor;
|
|
83
|
+
private readonly _toolsSupported;
|
|
84
|
+
private readonly _thinkingSupported;
|
|
85
|
+
/** Total number of times `stream()` has been called. */
|
|
86
|
+
callCount: number;
|
|
87
|
+
/** The `messages` argument from the most recent `stream()` call. */
|
|
88
|
+
lastMessages: Message[];
|
|
89
|
+
/** All `messages` arguments captured across every `stream()` call, in order. */
|
|
90
|
+
callHistory: Message[][];
|
|
91
|
+
constructor(script: FauxScriptStep[], opts?: FauxProviderOptions);
|
|
92
|
+
supportsTools(_modelId: string): boolean;
|
|
93
|
+
supportsThinking(_modelId: string): boolean;
|
|
94
|
+
/** Number of script steps not yet consumed. */
|
|
95
|
+
get remaining(): number;
|
|
96
|
+
/** Reset call counters and cursor. Useful between assertions in one test. */
|
|
97
|
+
reset(): void;
|
|
98
|
+
stream(req: StreamRequest): AsyncIterable<AgentEvent>;
|
|
99
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FauxProvider — deterministic, in-process Provider for testing the agent loop.
|
|
3
|
+
*
|
|
4
|
+
* Implements the same `Provider` contract as real providers (anthropic.ts,
|
|
5
|
+
* openai.ts, etc.) but consumes a pre-baked script of step descriptors
|
|
6
|
+
* instead of talking to a network. Each call to `stream()` consumes the
|
|
7
|
+
* NEXT step from the script and emits the corresponding `AgentEvent`s.
|
|
8
|
+
*
|
|
9
|
+
* Use it to drive `runAgentLoop` end-to-end without any I/O.
|
|
10
|
+
*
|
|
11
|
+
* const provider = new FauxProvider([
|
|
12
|
+
* { kind: 'tool-call', id: 'c1', name: 'shell', input: { cmd: 'ls' } },
|
|
13
|
+
* { kind: 'text', chunks: ['done'] },
|
|
14
|
+
* ]);
|
|
15
|
+
*
|
|
16
|
+
* The provider also records `callCount` and `lastMessages` so tests can
|
|
17
|
+
* assert what the loop sent to the LLM (post-projection from AgentMessage[]).
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Synchronous-throwing AbortError. Mirrors the shape Node/undici fetch
|
|
21
|
+
* rejects with when an AbortSignal fires mid-request — `.name === 'AbortError'`
|
|
22
|
+
* is the discriminator real providers and the loop's error path see.
|
|
23
|
+
*/
|
|
24
|
+
export class FauxAbortError extends Error {
|
|
25
|
+
name = 'AbortError';
|
|
26
|
+
constructor(message = 'The operation was aborted') {
|
|
27
|
+
super(message);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export class FauxProvider {
|
|
31
|
+
id;
|
|
32
|
+
script;
|
|
33
|
+
cursor = 0;
|
|
34
|
+
_toolsSupported;
|
|
35
|
+
_thinkingSupported;
|
|
36
|
+
/** Total number of times `stream()` has been called. */
|
|
37
|
+
callCount = 0;
|
|
38
|
+
/** The `messages` argument from the most recent `stream()` call. */
|
|
39
|
+
lastMessages = [];
|
|
40
|
+
/** All `messages` arguments captured across every `stream()` call, in order. */
|
|
41
|
+
callHistory = [];
|
|
42
|
+
constructor(script, opts = {}) {
|
|
43
|
+
this.script = script;
|
|
44
|
+
this.id = opts.id ?? 'faux';
|
|
45
|
+
this._toolsSupported = opts.supportsTools ?? true;
|
|
46
|
+
this._thinkingSupported = opts.supportsThinking ?? false;
|
|
47
|
+
}
|
|
48
|
+
supportsTools(_modelId) {
|
|
49
|
+
return this._toolsSupported;
|
|
50
|
+
}
|
|
51
|
+
supportsThinking(_modelId) {
|
|
52
|
+
return this._thinkingSupported;
|
|
53
|
+
}
|
|
54
|
+
/** Number of script steps not yet consumed. */
|
|
55
|
+
get remaining() {
|
|
56
|
+
return this.script.length - this.cursor;
|
|
57
|
+
}
|
|
58
|
+
/** Reset call counters and cursor. Useful between assertions in one test. */
|
|
59
|
+
reset() {
|
|
60
|
+
this.cursor = 0;
|
|
61
|
+
this.callCount = 0;
|
|
62
|
+
this.lastMessages = [];
|
|
63
|
+
this.callHistory = [];
|
|
64
|
+
}
|
|
65
|
+
async *stream(req) {
|
|
66
|
+
// Capture the request BEFORE consuming the script so an exhausted-script
|
|
67
|
+
// throw still records the call (helps debugging in tests).
|
|
68
|
+
this.callCount += 1;
|
|
69
|
+
this.lastMessages = req.messages;
|
|
70
|
+
this.callHistory.push(req.messages);
|
|
71
|
+
if (this.cursor >= this.script.length) {
|
|
72
|
+
throw new Error('FauxProvider: script exhausted');
|
|
73
|
+
}
|
|
74
|
+
const step = this.script[this.cursor++];
|
|
75
|
+
switch (step.kind) {
|
|
76
|
+
case 'error':
|
|
77
|
+
// Real providers throw mid-fetch; FauxProvider throws on first
|
|
78
|
+
// iteration. The loop catches inside the `for await` either way.
|
|
79
|
+
throw step.error;
|
|
80
|
+
case 'abort': {
|
|
81
|
+
const ms = step.afterMs ?? 10;
|
|
82
|
+
await delay(ms);
|
|
83
|
+
if (req.signal?.aborted) {
|
|
84
|
+
// If the caller aborted us during the delay, surface that signal's
|
|
85
|
+
// reason instead of a synthetic one.
|
|
86
|
+
throw new FauxAbortError('Aborted by caller signal');
|
|
87
|
+
}
|
|
88
|
+
throw new FauxAbortError();
|
|
89
|
+
}
|
|
90
|
+
case 'wait':
|
|
91
|
+
await delay(step.ms);
|
|
92
|
+
return;
|
|
93
|
+
case 'text': {
|
|
94
|
+
yield { type: 'text_start' };
|
|
95
|
+
for (const chunk of step.chunks) {
|
|
96
|
+
if (req.signal?.aborted)
|
|
97
|
+
throw new FauxAbortError();
|
|
98
|
+
yield { type: 'text_delta', delta: chunk };
|
|
99
|
+
}
|
|
100
|
+
yield { type: 'text_end' };
|
|
101
|
+
if (step.usage) {
|
|
102
|
+
yield {
|
|
103
|
+
type: 'usage',
|
|
104
|
+
inputTokens: step.usage.inputTokens,
|
|
105
|
+
outputTokens: step.usage.outputTokens,
|
|
106
|
+
cachedTokens: step.usage.cachedTokens ?? 0,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
case 'tool-call': {
|
|
112
|
+
yield { type: 'toolcall_start', id: step.id, name: step.name };
|
|
113
|
+
const json = JSON.stringify(step.input ?? {});
|
|
114
|
+
yield { type: 'toolcall_delta', id: step.id, deltaJson: json };
|
|
115
|
+
yield { type: 'toolcall_end', id: step.id, input: step.input };
|
|
116
|
+
if (step.usage) {
|
|
117
|
+
yield {
|
|
118
|
+
type: 'usage',
|
|
119
|
+
inputTokens: step.usage.inputTokens,
|
|
120
|
+
outputTokens: step.usage.outputTokens,
|
|
121
|
+
cachedTokens: step.usage.cachedTokens ?? 0,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
case 'mixed': {
|
|
127
|
+
if (step.text && step.text.length > 0) {
|
|
128
|
+
yield { type: 'text_start' };
|
|
129
|
+
yield { type: 'text_delta', delta: step.text };
|
|
130
|
+
yield { type: 'text_end' };
|
|
131
|
+
}
|
|
132
|
+
for (const tc of step.toolCalls) {
|
|
133
|
+
yield { type: 'toolcall_start', id: tc.id, name: tc.name };
|
|
134
|
+
yield { type: 'toolcall_delta', id: tc.id, deltaJson: JSON.stringify(tc.input ?? {}) };
|
|
135
|
+
yield { type: 'toolcall_end', id: tc.id, input: tc.input };
|
|
136
|
+
}
|
|
137
|
+
if (step.usage) {
|
|
138
|
+
yield {
|
|
139
|
+
type: 'usage',
|
|
140
|
+
inputTokens: step.usage.inputTokens,
|
|
141
|
+
outputTokens: step.usage.outputTokens,
|
|
142
|
+
cachedTokens: step.usage.cachedTokens ?? 0,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
function delay(ms) {
|
|
151
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=faux.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"faux.js","sourceRoot":"","sources":["../../src_v2/providers/faux.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AA2BH;;;;GAIG;AACH,MAAM,OAAO,cAAe,SAAQ,KAAK;IAC9B,IAAI,GAAG,YAAY,CAAC;IAC7B,YAAY,OAAO,GAAG,2BAA2B;QAC/C,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;CACF;AAED,MAAM,OAAO,YAAY;IACd,EAAE,CAAS;IACH,MAAM,CAAmB;IAClC,MAAM,GAAG,CAAC,CAAC;IACF,eAAe,CAAU;IACzB,kBAAkB,CAAU;IAE7C,wDAAwD;IACxD,SAAS,GAAG,CAAC,CAAC;IACd,oEAAoE;IACpE,YAAY,GAAc,EAAE,CAAC;IAC7B,gFAAgF;IAChF,WAAW,GAAgB,EAAE,CAAC;IAE9B,YAAY,MAAwB,EAAE,OAA4B,EAAE;QAClE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC;QAC5B,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC;QAClD,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC,gBAAgB,IAAI,KAAK,CAAC;IAC3D,CAA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