@celljs/ai-agent 0.0.0-stage → 4.1.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/README.md +68 -2
- package/cell.yml +5 -0
- package/esm/node/agent/agent-factory.d.ts +10 -0
- package/esm/node/agent/agent-factory.js +76 -0
- package/esm/node/agent/agent-factory.js.map +1 -0
- package/esm/node/agent/index.d.ts +1 -0
- package/esm/node/agent/index.js +2 -0
- package/esm/node/agent/index.js.map +1 -0
- package/esm/node/agent-protocol.d.ts +32 -0
- package/esm/node/agent-protocol.js +5 -0
- package/esm/node/agent-protocol.js.map +1 -0
- package/esm/node/error/errors.d.ts +11 -0
- package/esm/node/error/errors.js +16 -0
- package/esm/node/error/errors.js.map +1 -0
- package/esm/node/error/index.d.ts +1 -0
- package/esm/node/error/index.js +2 -0
- package/esm/node/error/index.js.map +1 -0
- package/esm/node/event/agent-event-util.d.ts +37 -0
- package/esm/node/event/agent-event-util.js +60 -0
- package/esm/node/event/agent-event-util.js.map +1 -0
- package/esm/node/event/index.d.ts +1 -0
- package/esm/node/event/index.js +2 -0
- package/esm/node/event/index.js.map +1 -0
- package/esm/node/index.d.ts +5 -0
- package/esm/node/index.js +6 -0
- package/esm/node/index.js.map +1 -0
- package/esm/node/module.d.ts +3 -0
- package/esm/node/module.js +4 -0
- package/esm/node/module.js.map +1 -0
- package/esm/node/pi/index.d.ts +2 -0
- package/esm/node/pi/index.js +3 -0
- package/esm/node/pi/index.js.map +1 -0
- package/esm/node/pi/pi-agent-core-util.d.ts +6 -0
- package/esm/node/pi/pi-agent-core-util.js +17 -0
- package/esm/node/pi/pi-agent-core-util.js.map +1 -0
- package/esm/node/pi/pi-types.d.ts +6 -0
- package/esm/node/pi/pi-types.js +2 -0
- package/esm/node/pi/pi-types.js.map +1 -0
- package/esm/node/test/index.d.ts +2 -0
- package/esm/node/test/index.js +3 -0
- package/esm/node/test/index.js.map +1 -0
- package/esm/node/test/test-container.d.ts +7 -0
- package/esm/node/test/test-container.js +11 -0
- package/esm/node/test/test-container.js.map +1 -0
- package/esm/package.json +3 -0
- package/lib/node/agent/agent-factory.d.ts +11 -0
- package/lib/node/agent/agent-factory.d.ts.map +1 -0
- package/lib/node/agent/agent-factory.js +79 -0
- package/lib/node/agent/agent-factory.js.map +1 -0
- package/lib/node/agent/agent-factory.spec.d.ts +47 -0
- package/lib/node/agent/agent-factory.spec.d.ts.map +1 -0
- package/lib/node/agent/agent-factory.spec.js +109 -0
- package/lib/node/agent/agent-factory.spec.js.map +1 -0
- package/lib/node/agent/index.d.ts +2 -0
- package/lib/node/agent/index.d.ts.map +1 -0
- package/lib/node/agent/index.js +18 -0
- package/lib/node/agent/index.js.map +1 -0
- package/lib/node/agent-protocol.d.ts +33 -0
- package/lib/node/agent-protocol.d.ts.map +1 -0
- package/lib/node/agent-protocol.js +8 -0
- package/lib/node/agent-protocol.js.map +1 -0
- package/lib/node/error/errors.d.ts +12 -0
- package/lib/node/error/errors.d.ts.map +1 -0
- package/lib/node/error/errors.js +22 -0
- package/lib/node/error/errors.js.map +1 -0
- package/lib/node/error/index.d.ts +2 -0
- package/lib/node/error/index.d.ts.map +1 -0
- package/lib/node/error/index.js +18 -0
- package/lib/node/error/index.js.map +1 -0
- package/lib/node/event/agent-event-util.d.ts +38 -0
- package/lib/node/event/agent-event-util.d.ts.map +1 -0
- package/lib/node/event/agent-event-util.js +63 -0
- package/lib/node/event/agent-event-util.js.map +1 -0
- package/lib/node/event/agent-event-util.spec.d.ts +2 -0
- package/lib/node/event/agent-event-util.spec.d.ts.map +1 -0
- package/lib/node/event/agent-event-util.spec.js +81 -0
- package/lib/node/event/agent-event-util.spec.js.map +1 -0
- package/lib/node/event/index.d.ts +2 -0
- package/lib/node/event/index.d.ts.map +1 -0
- package/lib/node/event/index.js +18 -0
- package/lib/node/event/index.js.map +1 -0
- package/lib/node/index.d.ts +6 -0
- package/lib/node/index.d.ts.map +1 -0
- package/lib/node/index.js +22 -0
- package/lib/node/index.js.map +1 -0
- package/lib/node/module.d.ts +4 -0
- package/lib/node/module.d.ts.map +1 -0
- package/lib/node/module.js +6 -0
- package/lib/node/module.js.map +1 -0
- package/lib/node/pi/index.d.ts +3 -0
- package/lib/node/pi/index.d.ts.map +1 -0
- package/lib/node/pi/index.js +19 -0
- package/lib/node/pi/index.js.map +1 -0
- package/lib/node/pi/pi-agent-core-util.d.ts +7 -0
- package/lib/node/pi/pi-agent-core-util.d.ts.map +1 -0
- package/lib/node/pi/pi-agent-core-util.js +20 -0
- package/lib/node/pi/pi-agent-core-util.js.map +1 -0
- package/lib/node/pi/pi-types.d.ts +7 -0
- package/lib/node/pi/pi-types.d.ts.map +1 -0
- package/lib/node/pi/pi-types.js +3 -0
- package/lib/node/pi/pi-types.js.map +1 -0
- package/lib/node/test/index.d.ts +3 -0
- package/lib/node/test/index.d.ts.map +1 -0
- package/lib/node/test/index.js +21 -0
- package/lib/node/test/index.js.map +1 -0
- package/lib/node/test/test-container.d.ts +8 -0
- package/lib/node/test/test-container.d.ts.map +1 -0
- package/lib/node/test/test-container.js +14 -0
- package/lib/node/test/test-container.js.map +1 -0
- package/package.json +93 -4
- package/src/node/agent/agent-factory.spec.ts +97 -0
- package/src/node/agent/agent-factory.ts +60 -0
- package/src/node/agent/index.ts +1 -0
- package/src/node/agent-protocol.ts +39 -0
- package/src/node/error/errors.ts +20 -0
- package/src/node/error/index.ts +1 -0
- package/src/node/event/agent-event-util.spec.ts +87 -0
- package/src/node/event/agent-event-util.ts +79 -0
- package/src/node/event/index.ts +1 -0
- package/src/node/index.ts +5 -0
- package/src/node/module.ts +4 -0
- package/src/node/pi/index.ts +2 -0
- package/src/node/pi/pi-agent-core-util.ts +19 -0
- package/src/node/pi/pi-types.ts +8 -0
- package/src/node/test/index.ts +2 -0
- package/src/node/test/test-container.ts +15 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-factory.js","sourceRoot":"","sources":["../../../src/node/agent/agent-factory.ts"],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CAAC,OAAO,CAAC,KAAK,CAAC;gBACtC,QAAQ,QAAE,aAAa,CAAC,QAAQ,mCAAI,EAAE;aACzC;YACD,QAAQ,EAAE,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC;YAC1C,aAAa,EAAE,OAAO,CAAC,aAAa;SACvC,CAAC,CAAC;IACP,CAAC;IAES,WAAW,CAAC,KAAgB;;QAClC,MAAM,KAAK,SAAG,IAAI,CAAC,KAAK,mCAAI,EAAE,CAAC;QAC/B,IAAI,CAAC,KAAK,EAAE,CAAC;YACT,OAAO,KAAK,CAAC;QACjB,CAAC;QACD,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YACpB,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;YAC9C,IAAI,CAAC,IAAI,EAAE,CAAC;gBACR,MAAM,IAAI,8BAAsB,CAC5B,IAAI,EACJ,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CACzB,CAAC;YACN,CAAC;YACD,OAAO,IAAI,CAAC;QAChB,CAAC,CAAC,CAAC;IACP,CAAC;CACJ,CAAA;;AAlDsB;IADlB,IAAA,YAAK,EAAC,8BAAa,CAAC;;oDACqB;AAGvB;IADlB,IAAA,gBAAS,EAAC,wBAAgB,CAAC;;2DACwB;AAIjC;IAFlB,IAAA,gBAAS,EAAC,0BAAS,CAAC;IACpB,IAAA,eAAQ,GAAE;;kDACgC;8BATlC,mBAAmB;IAD/B,IAAA,gBAAS,EAAC,6BAAY,CAAC;GACX,mBAAmB,CAoD/B"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { AgentTool } from '../agent-protocol';
|
|
2
|
+
export declare class Inventory {
|
|
3
|
+
count(item: string): number;
|
|
4
|
+
}
|
|
5
|
+
export declare class CountTool implements AgentTool<{
|
|
6
|
+
type: 'object';
|
|
7
|
+
}> {
|
|
8
|
+
readonly name = "count";
|
|
9
|
+
readonly label = "Count";
|
|
10
|
+
readonly description = "Counts the items in stock";
|
|
11
|
+
readonly parameters: {
|
|
12
|
+
type: 'object';
|
|
13
|
+
properties: {
|
|
14
|
+
item: {
|
|
15
|
+
type: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
required: string[];
|
|
19
|
+
};
|
|
20
|
+
protected readonly inventory: Inventory;
|
|
21
|
+
execute(_toolCallId: string, params: any): Promise<{
|
|
22
|
+
content: {
|
|
23
|
+
type: 'text';
|
|
24
|
+
text: string;
|
|
25
|
+
}[];
|
|
26
|
+
details: {};
|
|
27
|
+
}>;
|
|
28
|
+
}
|
|
29
|
+
export declare class ClockTool implements AgentTool<{
|
|
30
|
+
type: 'object';
|
|
31
|
+
}> {
|
|
32
|
+
readonly name = "clock";
|
|
33
|
+
readonly label = "Clock";
|
|
34
|
+
readonly description = "Tells the time";
|
|
35
|
+
readonly parameters: {
|
|
36
|
+
type: 'object';
|
|
37
|
+
properties: {};
|
|
38
|
+
};
|
|
39
|
+
execute(): Promise<{
|
|
40
|
+
content: {
|
|
41
|
+
type: 'text';
|
|
42
|
+
text: string;
|
|
43
|
+
}[];
|
|
44
|
+
details: {};
|
|
45
|
+
}>;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=agent-factory.spec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-factory.spec.d.ts","sourceRoot":"","sources":["../../../src/node/agent/agent-factory.spec.ts"],"names":[],"mappings":"AAGA,OAAO,EAAgB,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAI5D,qBACa,SAAS;IAClB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE1B;CACJ;AAED,qBACa,SAAU,YAAW,SAAS,CAAC;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC;IAC3D,QAAQ,CAAC,IAAI,WAAW;IACxB,QAAQ,CAAC,KAAK,WAAW;IACzB,QAAQ,CAAC,WAAW,+BAA+B;IACnD,QAAQ,CAAC,UAAU;QAAK,IAAI,EAAE,QAAQ;QAAW,UAAU;YAAI,IAAI;gBAAI,IAAI;;;QAAgB,QAAQ;MAAa;IAGhH,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAElC,OAAO,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG;;kBACf,MAAM;;;;OACpC;CACJ;AAED,qBACa,SAAU,YAAW,SAAS,CAAC;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC;IAC3D,QAAQ,CAAC,IAAI,WAAW;IACxB,QAAQ,CAAC,KAAK,WAAW;IACzB,QAAQ,CAAC,WAAW,oBAAoB;IACxC,QAAQ,CAAC,UAAU;QAAK,IAAI,EAAE,QAAQ;QAAW,UAAU;MAAO;IAE5D,OAAO;;kBACkB,MAAM;;;;OACpC;CACJ"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ClockTool = exports.CountTool = exports.Inventory = void 0;
|
|
13
|
+
const bun_test_1 = require("bun:test");
|
|
14
|
+
const core_1 = require("@celljs/core");
|
|
15
|
+
const chai_1 = require("chai");
|
|
16
|
+
const agent_protocol_1 = require("../agent-protocol");
|
|
17
|
+
const error_1 = require("../error");
|
|
18
|
+
const test_1 = require("../test");
|
|
19
|
+
let Inventory = class Inventory {
|
|
20
|
+
count(item) {
|
|
21
|
+
return item === 'apple' ? 3 : 0;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
exports.Inventory = Inventory;
|
|
25
|
+
exports.Inventory = Inventory = __decorate([
|
|
26
|
+
(0, core_1.Component)()
|
|
27
|
+
], Inventory);
|
|
28
|
+
let CountTool = class CountTool {
|
|
29
|
+
constructor() {
|
|
30
|
+
this.name = 'count';
|
|
31
|
+
this.label = 'Count';
|
|
32
|
+
this.description = 'Counts the items in stock';
|
|
33
|
+
this.parameters = { type: 'object', properties: { item: { type: 'string' } }, required: ['item'] };
|
|
34
|
+
}
|
|
35
|
+
async execute(_toolCallId, params) {
|
|
36
|
+
return { content: [{ type: 'text', text: String(this.inventory.count(params.item)) }], details: {} };
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
exports.CountTool = CountTool;
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, core_1.Autowired)(Inventory),
|
|
42
|
+
__metadata("design:type", Inventory)
|
|
43
|
+
], CountTool.prototype, "inventory", void 0);
|
|
44
|
+
exports.CountTool = CountTool = __decorate([
|
|
45
|
+
(0, core_1.Component)(agent_protocol_1.AgentTool)
|
|
46
|
+
], CountTool);
|
|
47
|
+
let ClockTool = class ClockTool {
|
|
48
|
+
constructor() {
|
|
49
|
+
this.name = 'clock';
|
|
50
|
+
this.label = 'Clock';
|
|
51
|
+
this.description = 'Tells the time';
|
|
52
|
+
this.parameters = { type: 'object', properties: {} };
|
|
53
|
+
}
|
|
54
|
+
async execute() {
|
|
55
|
+
return { content: [{ type: 'text', text: 'noon' }], details: {} };
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
exports.ClockTool = ClockTool;
|
|
59
|
+
exports.ClockTool = ClockTool = __decorate([
|
|
60
|
+
(0, core_1.Component)(agent_protocol_1.AgentTool)
|
|
61
|
+
], ClockTool);
|
|
62
|
+
const toolsModule = (0, core_1.autoBind)();
|
|
63
|
+
const lastText = (messages) => { var _a; return (_a = messages
|
|
64
|
+
.filter(m => m.role === 'assistant')
|
|
65
|
+
.at(-1)) === null || _a === void 0 ? void 0 : _a.content.filter((c) => c.type === 'text').map((c) => c.text).join(''); };
|
|
66
|
+
(0, bun_test_1.describe)('AgentFactory', () => {
|
|
67
|
+
(0, bun_test_1.it)('creates agents that answer with the configured model', async () => {
|
|
68
|
+
const { container, faux } = await (0, test_1.createAgentTestContainer)({ systemPrompt: 'Be brief.' });
|
|
69
|
+
faux.reply('Hello!');
|
|
70
|
+
const agent = await container.get(agent_protocol_1.AgentFactory).create();
|
|
71
|
+
await agent.prompt('Hi');
|
|
72
|
+
(0, chai_1.expect)(lastText(agent.state.messages)).to.equal('Hello!');
|
|
73
|
+
(0, chai_1.expect)(JSON.stringify(faux.contexts[0])).to.include('Be brief.');
|
|
74
|
+
});
|
|
75
|
+
(0, bun_test_1.it)('gives agents the AgentTool components, with their injected services', async () => {
|
|
76
|
+
const { container, faux } = await (0, test_1.createAgentTestContainer)({}, toolsModule);
|
|
77
|
+
faux.reply({ tool: 'count', args: { item: 'apple' } }, 'There are 3 apples.');
|
|
78
|
+
const agent = await container.get(agent_protocol_1.AgentFactory).create();
|
|
79
|
+
(0, chai_1.expect)(agent.state.tools.map(t => t.name).sort()).to.deep.equal(['clock', 'count']);
|
|
80
|
+
await agent.prompt('How many apples?');
|
|
81
|
+
const result = agent.state.messages.find(m => m.role === 'toolResult');
|
|
82
|
+
(0, chai_1.expect)(result.content[0].text).to.equal('3');
|
|
83
|
+
(0, chai_1.expect)(lastText(agent.state.messages)).to.equal('There are 3 apples.');
|
|
84
|
+
});
|
|
85
|
+
(0, bun_test_1.it)('selects tools by name, per agent or in the configuration', async () => {
|
|
86
|
+
const { container } = await (0, test_1.createAgentTestContainer)({ tools: ['clock'] }, toolsModule);
|
|
87
|
+
const factory = container.get(agent_protocol_1.AgentFactory);
|
|
88
|
+
(0, chai_1.expect)((await factory.create()).state.tools.map(t => t.name)).to.deep.equal(['clock']);
|
|
89
|
+
(0, chai_1.expect)((await factory.create({ tools: ['count'] })).state.tools.map(t => t.name)).to.deep.equal(['count']);
|
|
90
|
+
let error;
|
|
91
|
+
await factory.create({ tools: ['missing'] }).catch(e => (error = e));
|
|
92
|
+
(0, chai_1.expect)(error).to.be.instanceOf(error_1.AgentToolNotFoundError);
|
|
93
|
+
(0, chai_1.expect)(error.message)
|
|
94
|
+
.to.include('clock')
|
|
95
|
+
.and.include('count');
|
|
96
|
+
});
|
|
97
|
+
(0, bun_test_1.it)('continues a saved conversation', async () => {
|
|
98
|
+
const { container, faux } = await (0, test_1.createAgentTestContainer)();
|
|
99
|
+
const factory = container.get(agent_protocol_1.AgentFactory);
|
|
100
|
+
faux.reply('First answer');
|
|
101
|
+
const first = await factory.create();
|
|
102
|
+
await first.prompt('First question');
|
|
103
|
+
faux.reply('Second answer');
|
|
104
|
+
const second = await factory.create({ messages: first.state.messages });
|
|
105
|
+
await second.prompt('Second question');
|
|
106
|
+
(0, chai_1.expect)(JSON.stringify(faux.contexts[1])).to.include('First question').and.include('First answer');
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
//# sourceMappingURL=agent-factory.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-factory.spec.js","sourceRoot":"","sources":["../../../src/node/agent/agent-factory.spec.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAAwC;AACxC,uCAA8D;AAC9D,+BAA8B;AAC9B,sDAA4D;AAC5D,oCAAkD;AAClD,kCAAmD;AAG5C,IAAM,SAAS,GAAf,MAAM,SAAS;IAClB,KAAK,CAAC,IAAY;QACd,OAAO,I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IAAI,EAAE,GAAG,MAAM,IAAA,+BAAwB,GAAE,CAAC;QAC7D,MAAM,OAAO,GAAG,SAAS,CAAC,GAAG,CAAe,6BAAY,CAAC,CAAC;QAC1D,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QAC3B,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,MAAM,EAAE,CAAC;QACrC,MAAM,KAAK,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;QACrC,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;QAC5B,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;QACxE,MAAM,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;QACvC,IAAA,aAAM,EAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IACtG,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/node/agent/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./agent-factory"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/node/agent/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Agent, AgentMessage, ThinkingLevel } from './pi';
|
|
2
|
+
export declare const AgentTool: unique symbol;
|
|
3
|
+
export declare const AgentFactory: unique symbol;
|
|
4
|
+
/** Configuration key of {@link AgentOptions}. */
|
|
5
|
+
export declare const AGENT_OPTIONS = "cell.ai.agent";
|
|
6
|
+
/**
|
|
7
|
+
* A tool as a Cell component: pi-agent-core's `AgentTool` (`name`, `label`, `description`, JSON Schema
|
|
8
|
+
* `parameters`, `execute`). `execute` throws on failure. The same components are tools of coding agent
|
|
9
|
+
* sessions (@celljs/ai-coding-agent).
|
|
10
|
+
*/
|
|
11
|
+
export type AgentTool<TParameters extends object = object, TDetails = any> = import('@earendil-works/pi-agent-core', { with: { 'resolution-mode': 'import'
|
|
12
|
+
} }).AgentTool<TParameters, TDetails>;
|
|
13
|
+
/** `cell.ai.agent`. */
|
|
14
|
+
export interface AgentOptions {
|
|
15
|
+
/** `<provider>/<model id>` of pi-ai (@celljs/ai-pi). Default: the first model with credentials. */
|
|
16
|
+
model?: string;
|
|
17
|
+
systemPrompt?: string;
|
|
18
|
+
thinkingLevel?: ThinkingLevel;
|
|
19
|
+
/** Names of the AgentTool components the agent gets. Default: all of them. */
|
|
20
|
+
tools?: string[];
|
|
21
|
+
/** How the tool calls of one model response run. Default: parallel. */
|
|
22
|
+
toolExecution?: 'parallel' | 'sequential';
|
|
23
|
+
}
|
|
24
|
+
/** Options of one agent; they override `cell.ai.agent`. */
|
|
25
|
+
export interface AgentCreateOptions extends Omit<AgentOptions, 'toolExecution'> {
|
|
26
|
+
/** Conversation to continue, e.g. `agent.state.messages` saved earlier. */
|
|
27
|
+
messages?: AgentMessage[];
|
|
28
|
+
}
|
|
29
|
+
/** Creates pi-agent-core `Agent`s with the models of @celljs/ai-pi and the {@link AgentTool} components. */
|
|
30
|
+
export interface AgentFactory {
|
|
31
|
+
create(options?: AgentCreateOptions): Promise<Agent>;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=agent-protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-protocol.d.ts","sourceRoot":"","sources":["../../src/node/agent-protocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AAE/D,eAAO,MAAM,SAAS,eAAsB,CAAC;AAC7C,eAAO,MAAM,YAAY,eAAyB,CAAC;AAEnD,iDAAiD;AACjD,eAAO,MAAM,aAAa,kBAAkB,CAAC;AAE7C;;;;GAIG;AACH,MAAM,MAAM,SAAS,CAAC,WAAW,SAAS,MAAM,GAAG,MAAM,EAAE,QAAQ,GAAG,GAAG,IAAI,OAAO,+BAA+B,EAAU,UACzH,iBAAiB,EAAE,QAAQ;GAC9B,EAAG,SAAS,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;AAErC,uBAAuB;AACvB,MAAM,WAAW,YAAY;IACzB,mGAAmG;IACnG,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,8EAA8E;IAC9E,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,uEAAuE;IACvE,aAAa,CAAC,EAAE,UAAU,GAAG,YAAY,CAAC;CAC7C;AAED,2DAA2D;AAC3D,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,YAAY,EAAE,eAAe,CAAC;IAC3E,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC;CAC7B;AAED,4GAA4G;AAC5G,MAAM,WAAW,YAAY;IACzB,MAAM,CAAC,OAAO,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;CACxD"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AGENT_OPTIONS = exports.AgentFactory = exports.AgentTool = void 0;
|
|
4
|
+
exports.AgentTool = Symbol('AgentTool');
|
|
5
|
+
exports.AgentFactory = Symbol('AgentFactory');
|
|
6
|
+
/** Configuration key of {@link AgentOptions}. */
|
|
7
|
+
exports.AGENT_OPTIONS = 'cell.ai.agent';
|
|
8
|
+
//# sourceMappingURL=agent-protocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-protocol.js","sourceRoot":"","sources":["../../src/node/agent-protocol.ts"],"names":[],"mappings":";;;AAEa,QAAA,SAAS,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;AAChC,QAAA,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AAEnD,iDAAiD;AACpC,QAAA,aAAa,GAAG,eAAe,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CustomError } from '@celljs/core';
|
|
2
|
+
export declare class AgentError extends CustomError {
|
|
3
|
+
}
|
|
4
|
+
export declare class AgentToolNotFoundError extends AgentError {
|
|
5
|
+
readonly tool: string;
|
|
6
|
+
readonly available: string[];
|
|
7
|
+
constructor(tool: string, available: string[]);
|
|
8
|
+
}
|
|
9
|
+
export declare class AgentModelMissingError extends AgentError {
|
|
10
|
+
constructor();
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/node/error/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,qBAAa,UAAW,SAAQ,WAAW;CAAG;AAE9C,qBAAa,sBAAuB,SAAQ,UAAU;IAE9C,QAAQ,CAAC,IAAI,EAAE,MAAM;IACrB,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE;IAFhC,YACa,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EAAE,EAG/B;CACJ;AAED,qBAAa,sBAAuB,SAAQ,UAAU;IAClD,cAIC;CACJ"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AgentModelMissingError = exports.AgentToolNotFoundError = exports.AgentError = void 0;
|
|
4
|
+
const core_1 = require("@celljs/core");
|
|
5
|
+
class AgentError extends core_1.CustomError {
|
|
6
|
+
}
|
|
7
|
+
exports.AgentError = AgentError;
|
|
8
|
+
class AgentToolNotFoundError extends AgentError {
|
|
9
|
+
constructor(tool, available) {
|
|
10
|
+
super(`No AgentTool component is named ${tool}. Known tools: ${available.length ? available.join(', ') : 'none; add one with @Component(AgentTool)'}.`);
|
|
11
|
+
this.tool = tool;
|
|
12
|
+
this.available = available;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.AgentToolNotFoundError = AgentToolNotFoundError;
|
|
16
|
+
class AgentModelMissingError extends AgentError {
|
|
17
|
+
constructor() {
|
|
18
|
+
super('No model is available for the agent: set cell.ai.agent.model ("<provider>/<model id>") and the API key of its provider (e.g. ANTHROPIC_API_KEY or cell.ai.pi.apiKeys).');
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.AgentModelMissingError = AgentModelMissingError;
|
|
22
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/node/error/errors.ts"],"names":[],"mappings":";;;AAAA,uCAA2C;AAE3C,gBAAwB,SAAQ,kBAAW;CAAG;;AAE9C,4BAAoC,SAAQ,UAAU;IAClD,YACa,IAAY,EACZ,SAAmB;QAE5B,KAAK,CAAC,mCAAmC,IAAI,kBAAkB,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,0CAA0C,GAAG,CAAC,CAAC;oBAH/I,IAAI;yBACJ,SAAS;IAGtB,CAAC;CACJ;;AAED,4BAAoC,SAAQ,UAAU;IAClD;QACI,KAAK,CACD,wKAAwK,CAC3K,CAAC;IACN,CAAC;CACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/node/error/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./errors"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/node/error/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/** The part of a Node.js `ServerResponse` that {@link AgentEventUtil.stream} writes to. */
|
|
2
|
+
export interface EventStreamResponse {
|
|
3
|
+
setHeader(name: string, value: string): unknown;
|
|
4
|
+
write(chunk: string): unknown;
|
|
5
|
+
end(): unknown;
|
|
6
|
+
flushHeaders?(): void;
|
|
7
|
+
readonly writableEnded?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/** What emits agent events: a pi-agent-core `Agent` or a pi coding agent `AgentSession`. */
|
|
10
|
+
export interface AgentEventSource {
|
|
11
|
+
subscribe(listener: (event: any) => unknown): () => void;
|
|
12
|
+
}
|
|
13
|
+
/** An agent event: pi-agent-core's `AgentEvent` or pi coding agent's `AgentSessionEvent`. */
|
|
14
|
+
export interface AgentWireEvent {
|
|
15
|
+
type: string;
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
}
|
|
18
|
+
/** Sent by {@link AgentEventUtil.stream} when the run fails; pi's own events never use this type. */
|
|
19
|
+
export interface AgentErrorEvent {
|
|
20
|
+
type: 'error';
|
|
21
|
+
message: string;
|
|
22
|
+
}
|
|
23
|
+
export declare namespace AgentEventUtil {
|
|
24
|
+
/**
|
|
25
|
+
* The event as pi's JSON and RPC modes write it (see pi coding agent's docs/json.md):
|
|
26
|
+
* `message_update` keeps only the delta and the usage, so a stream grows linearly. Other events are unchanged.
|
|
27
|
+
*/
|
|
28
|
+
function toWire<T extends AgentWireEvent>(event: T): AgentWireEvent;
|
|
29
|
+
/** One Server-Sent Events frame: the event type as `event`, the wire event as JSON `data`. */
|
|
30
|
+
function toSse(event: AgentWireEvent | AgentErrorEvent): string;
|
|
31
|
+
/**
|
|
32
|
+
* Streams the events of `source` to `response` as Server-Sent Events while `run` (usually
|
|
33
|
+
* `() => agent.prompt(text)`) is pending, then ends the response. A failure of `run` becomes an
|
|
34
|
+
* `error` event. The agent keeps running if the client goes away; abort it explicitly.
|
|
35
|
+
*/
|
|
36
|
+
function stream(source: AgentEventSource, response: EventStreamResponse, run: () => Promise<unknown>): Promise<void>;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=agent-event-util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-event-util.d.ts","sourceRoot":"","sources":["../../../src/node/event/agent-event-util.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,MAAM,WAAW,mBAAmB;IAChC,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;IAChD,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;IAC9B,GAAG,IAAI,OAAO,CAAC;IACf,YAAY,CAAC,IAAI,IAAI,CAAC;IACtB,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;CACpC;AAED,4FAA4F;AAC5F,MAAM,WAAW,gBAAgB;IAC7B,SAAS,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,OAAO,GAAG,MAAM,IAAI,CAAC;CAC5D;AAED,6FAA6F;AAC7F,MAAM,WAAW,cAAc;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB;AAED,qGAAqG;AACrG,MAAM,WAAW,eAAe;IAC5B,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,yBAAiB,cAAc,CAAC;IAC5B;;;OAGG;IACH,SAAgB,MAAM,CAAC,CAAC,SAAS,cAAc,EAAE,KAAK,EAAE,CAAC,GAAG,cAAc,CAYzE;IAED,8FAA8F;IAC9F,SAAgB,KAAK,CAAC,KAAK,EAAE,cAAc,GAAG,eAAe,GAAG,MAAM,CAErE;IAED;;;;OAIG;IACH,SAAsB,MAAM,CAAC,MAAM,EAAE,gBAAgB,EAAE,QAAQ,EAAE,mBAAmB,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAsBhI;CACJ"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AgentEventUtil = void 0;
|
|
4
|
+
var AgentEventUtil;
|
|
5
|
+
(function (AgentEventUtil) {
|
|
6
|
+
/**
|
|
7
|
+
* The event as pi's JSON and RPC modes write it (see pi coding agent's docs/json.md):
|
|
8
|
+
* `message_update` keeps only the delta and the usage, so a stream grows linearly. Other events are unchanged.
|
|
9
|
+
*/
|
|
10
|
+
function toWire(event) {
|
|
11
|
+
var _a;
|
|
12
|
+
if (event.type !== 'message_update') {
|
|
13
|
+
return event;
|
|
14
|
+
}
|
|
15
|
+
const { partial, ...delta } = event.assistantMessageEvent;
|
|
16
|
+
const wire = delta;
|
|
17
|
+
if (delta.type === 'toolcall_start' && partial) {
|
|
18
|
+
const toolCall = partial.content[delta.contentIndex];
|
|
19
|
+
wire.id = toolCall === null || toolCall === void 0 ? void 0 : toolCall.id;
|
|
20
|
+
wire.toolName = toolCall === null || toolCall === void 0 ? void 0 : toolCall.name;
|
|
21
|
+
}
|
|
22
|
+
return { type: 'message_update', usage: (_a = event.message) === null || _a === void 0 ? void 0 : _a.usage, assistantMessageEvent: wire };
|
|
23
|
+
}
|
|
24
|
+
AgentEventUtil.toWire = toWire;
|
|
25
|
+
/** One Server-Sent Events frame: the event type as `event`, the wire event as JSON `data`. */
|
|
26
|
+
function toSse(event) {
|
|
27
|
+
return `event: ${event.type}\ndata: ${JSON.stringify(event)}\n\n`;
|
|
28
|
+
}
|
|
29
|
+
AgentEventUtil.toSse = toSse;
|
|
30
|
+
/**
|
|
31
|
+
* Streams the events of `source` to `response` as Server-Sent Events while `run` (usually
|
|
32
|
+
* `() => agent.prompt(text)`) is pending, then ends the response. A failure of `run` becomes an
|
|
33
|
+
* `error` event. The agent keeps running if the client goes away; abort it explicitly.
|
|
34
|
+
*/
|
|
35
|
+
async function stream(source, response, run) {
|
|
36
|
+
var _a;
|
|
37
|
+
response.setHeader('Content-Type', 'text/event-stream; charset=utf-8');
|
|
38
|
+
response.setHeader('Cache-Control', 'no-cache, no-transform');
|
|
39
|
+
response.setHeader('Connection', 'keep-alive');
|
|
40
|
+
response.setHeader('X-Accel-Buffering', 'no');
|
|
41
|
+
(_a = response.flushHeaders) === null || _a === void 0 ? void 0 : _a.call(response);
|
|
42
|
+
const write = (chunk) => {
|
|
43
|
+
if (!response.writableEnded) {
|
|
44
|
+
response.write(chunk);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
const unsubscribe = source.subscribe(event => write(toSse(toWire(event))));
|
|
48
|
+
try {
|
|
49
|
+
await run();
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
write(toSse({ type: 'error', message: error instanceof Error ? error.message : String(error) }));
|
|
53
|
+
}
|
|
54
|
+
finally {
|
|
55
|
+
unsubscribe();
|
|
56
|
+
if (!response.writableEnded) {
|
|
57
|
+
response.end();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
AgentEventUtil.stream = stream;
|
|
62
|
+
})(AgentEventUtil || (exports.AgentEventUtil = AgentEventUtil = {}));
|
|
63
|
+
//# sourceMappingURL=agent-event-util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-event-util.js","sourceRoot":"","sources":["../../../src/node/event/agent-event-util.ts"],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C,SAAS,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;QAC/C,QAAQ,CAAC,SAAS,CAAC,mBAAmB,EAAE,IAAI,CAAC,CAAC;QAC9C,MAAA,QAAQ,CAAC,YAAY,+CAArB,QAAQ,CAAiB,CAAC;QAC1B,MAAM,KAAK,GAAG,CAAC,KAAa,EAAE,EAAE;YAC5B,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE,CAAC;gBAC1B,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YAC1B,CAAC;QACL,CAAC,CAAC;QACF,MAAM,WAAW,GAAG,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3E,IAAI,CAAC;YACD,MAAM,GAAG,EAAE,CAAC;QAChB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,KAAK,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;QACrG,CAAC;gBAAS,CAAC;YACP,WAAW,EAAE,CAAC;YACd,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE,CAAC;gBAC1B,QAAQ,CAAC,GAAG,EAAE,CAAC;YACnB,CAAC;QACL,CAAC;IACL,CAAC;IAtBqB,eAAA,MAAM,SAsB3B,CAAA;AACL,CAAC,EApDgB,cAAc,aAAd,cAAc,GAAd,cAAc,QAoD9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-event-util.spec.d.ts","sourceRoot":"","sources":["../../../src/node/event/agent-event-util.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const bun_test_1 = require("bun:test");
|
|
4
|
+
const chai_1 = require("chai");
|
|
5
|
+
const agent_protocol_1 = require("../agent-protocol");
|
|
6
|
+
const test_1 = require("../test");
|
|
7
|
+
const agent_event_util_1 = require("./agent-event-util");
|
|
8
|
+
class RecordingResponse {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.headers = {};
|
|
11
|
+
this.chunks = '';
|
|
12
|
+
this.writableEnded = false;
|
|
13
|
+
}
|
|
14
|
+
setHeader(name, value) {
|
|
15
|
+
this.headers[name.toLowerCase()] = value;
|
|
16
|
+
}
|
|
17
|
+
write(chunk) {
|
|
18
|
+
(0, chai_1.expect)(this.writableEnded).to.equal(false);
|
|
19
|
+
this.chunks += chunk;
|
|
20
|
+
}
|
|
21
|
+
end() {
|
|
22
|
+
this.writableEnded = true;
|
|
23
|
+
}
|
|
24
|
+
get frames() {
|
|
25
|
+
return this.chunks
|
|
26
|
+
.split('\n\n')
|
|
27
|
+
.filter(Boolean)
|
|
28
|
+
.map(frame => {
|
|
29
|
+
const [event, data] = frame.split('\n');
|
|
30
|
+
return { event: event.slice('event: '.length), data: JSON.parse(data.slice('data: '.length)) };
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
(0, bun_test_1.describe)('AgentEventUtil', () => {
|
|
35
|
+
(0, bun_test_1.describe)('toWire', () => {
|
|
36
|
+
const usage = { input: 1, output: 2 };
|
|
37
|
+
const update = (assistantMessageEvent) => ({ type: 'message_update', message: { role: 'assistant', usage, content: [] }, assistantMessageEvent });
|
|
38
|
+
(0, bun_test_1.it)('keeps the delta and the usage of message_update', () => {
|
|
39
|
+
const wire = agent_event_util_1.AgentEventUtil.toWire(update({ type: 'text_delta', contentIndex: 0, delta: 'Hi', partial: { content: [] } }));
|
|
40
|
+
(0, chai_1.expect)(wire).to.deep.equal({ type: 'message_update', usage, assistantMessageEvent: { type: 'text_delta', contentIndex: 0, delta: 'Hi' } });
|
|
41
|
+
});
|
|
42
|
+
(0, bun_test_1.it)('names the tool of toolcall_start', () => {
|
|
43
|
+
const partial = {
|
|
44
|
+
content: [
|
|
45
|
+
{ type: 'text', text: '' },
|
|
46
|
+
{ type: 'toolCall', id: 'call-1', name: 'greet', arguments: {} },
|
|
47
|
+
],
|
|
48
|
+
};
|
|
49
|
+
const wire = agent_event_util_1.AgentEventUtil.toWire(update({ type: 'toolcall_start', contentIndex: 1, partial }));
|
|
50
|
+
(0, chai_1.expect)(wire.assistantMessageEvent).to.deep.equal({ type: 'toolcall_start', contentIndex: 1, id: 'call-1', toolName: 'greet' });
|
|
51
|
+
});
|
|
52
|
+
(0, bun_test_1.it)('leaves other events unchanged', () => {
|
|
53
|
+
const event = { type: 'agent_end', messages: [] };
|
|
54
|
+
(0, chai_1.expect)(agent_event_util_1.AgentEventUtil.toWire(event)).to.equal(event);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
(0, bun_test_1.describe)('stream', () => {
|
|
58
|
+
(0, bun_test_1.it)('writes the events of an agent run as Server-Sent Events and ends the response', async () => {
|
|
59
|
+
const { container, faux } = await (0, test_1.createAgentTestContainer)();
|
|
60
|
+
faux.reply('Hello from pi');
|
|
61
|
+
const agent = await container.get(agent_protocol_1.AgentFactory).create();
|
|
62
|
+
const response = new RecordingResponse();
|
|
63
|
+
await agent_event_util_1.AgentEventUtil.stream(agent, response, () => agent.prompt('hi'));
|
|
64
|
+
(0, chai_1.expect)(response.headers['content-type']).to.equal('text/event-stream; charset=utf-8');
|
|
65
|
+
(0, chai_1.expect)(response.writableEnded).to.equal(true);
|
|
66
|
+
const frames = response.frames;
|
|
67
|
+
(0, chai_1.expect)(frames[0].event).to.equal('agent_start');
|
|
68
|
+
(0, chai_1.expect)(frames.at(-1).event).to.equal('agent_end');
|
|
69
|
+
const deltas = frames.filter(f => { var _a; return ((_a = f.data.assistantMessageEvent) === null || _a === void 0 ? void 0 : _a.type) === 'text_delta'; });
|
|
70
|
+
(0, chai_1.expect)(deltas.map(f => f.data.assistantMessageEvent.delta).join('')).to.equal('Hello from pi');
|
|
71
|
+
(0, chai_1.expect)(frames.every(f => { var _a; return f.event === f.data.type && !((_a = f.data.assistantMessageEvent) === null || _a === void 0 ? void 0 : _a.partial); })).to.equal(true);
|
|
72
|
+
});
|
|
73
|
+
(0, bun_test_1.it)('sends an error event when the run fails', async () => {
|
|
74
|
+
const response = new RecordingResponse();
|
|
75
|
+
await agent_event_util_1.AgentEventUtil.stream({ subscribe: () => () => undefined }, response, () => Promise.reject(new Error('no credits')));
|
|
76
|
+
(0, chai_1.expect)(response.frames).to.deep.equal([{ event: 'error', data: { type: 'error', message: 'no credits' } }]);
|
|
77
|
+
(0, chai_1.expect)(response.writableEnded).to.equal(true);
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
//# sourceMappingURL=agent-event-util.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-event-util.spec.js","sourceRoot":"","sources":["../../../src/node/event/agent-event-util.spec.ts"],"names":[],"mappings":";;AAAA,uCAAwC;AACxC,+BAA8B;AAC9B,sDAAiD;AACjD,kCAAmD;AACnD,yDAA8E;AAE9E,MAAM,iBAAiB;IAAvB;QACa,YAAO,GAA2B,EAAE,CAAC;QAC9C,WAAM,GAAG,EAAE,CAAC;QACZ,kBAAa,GAAG,KAAK,CAAC;IAwB1B,CAAC;IAtBG,SAAS,CAAC,IAAY,EAAE,KAAa;QACjC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,GAAG,KAAK,CAAC;IAC7C,CAAC;IAED,KAAK,CAAC,KAAa;QACf,IAAA,aAAM,EAAC,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC3C,IAAI,CAAC,MAAM,IAAI,KAAK,CAAC;IACzB,CAAC;IAED,GAAG;QACC,IAAI,CAAC,aAAa,GAAG,IA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";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./agent-event-util"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/node/event/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,MAAM,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./agent"), exports);
|
|
18
|
+
__exportStar(require("./agent-protocol"), exports);
|
|
19
|
+
__exportStar(require("./error"), exports);
|
|
20
|
+
__exportStar(require("./event"), exports);
|
|
21
|
+
__exportStar(require("./pi"), exports);
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,mDAAiC;AACjC,0CAAwB;AACxB,0CAAwB;AACxB,uCAAqB"}
|