@agentorg/cli 0.0.7 → 0.0.8
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 +2 -2
- package/dist/node_modules/@agentorg/looper/dist/src/loop.d.ts +26 -12
- package/dist/node_modules/@agentorg/looper/dist/src/loop.js +72 -38
- package/dist/node_modules/@agentorg/looper/dist/src/looper.d.ts +27 -17
- package/dist/node_modules/@agentorg/looper/dist/src/looper.js +405 -113
- package/dist/node_modules/@agentorg/looper/dist/src/main.d.ts +34 -0
- package/dist/node_modules/@agentorg/looper/dist/src/main.js +116 -0
- package/dist/node_modules/@agentorg/looper/dist/src/record.d.ts +97 -15
- package/dist/node_modules/@agentorg/looper/dist/src/record.js +211 -56
- package/dist/node_modules/@agentorg/manager/dist/src/control.d.ts +1 -1
- package/dist/node_modules/@agentorg/manager/dist/src/control.js +1 -1
- package/dist/node_modules/@agentorg/shell/dist/app.css +47 -111
- package/dist/node_modules/@agentorg/shell/dist/app.js +139 -139
- package/dist/node_modules/assistant/dist/src/chats.d.ts +8 -6
- package/dist/node_modules/assistant/dist/src/chats.js +23 -25
- package/dist/node_modules/assistant/dist/src/engine.js +1 -1
- package/package.json +1 -1
|
@@ -31,8 +31,10 @@ export declare function createChats(options: {
|
|
|
31
31
|
log: Log;
|
|
32
32
|
}): {
|
|
33
33
|
/**
|
|
34
|
-
* Say a message in a chat, or in a new chat it starts.
|
|
35
|
-
*
|
|
34
|
+
* Say a message in a chat, or in a new chat it starts. A new chat's first message is put to
|
|
35
|
+
* the agent's main loop, which gives it to new work or to work in a turn; from then on the
|
|
36
|
+
* chat's messages are that work's: with no turn of it running one starts a turn, and a turn
|
|
37
|
+
* running takes it at its next model request.
|
|
36
38
|
*/
|
|
37
39
|
send({ chat, text }: Input<"send">): Promise<{
|
|
38
40
|
chat: string;
|
|
@@ -77,14 +79,14 @@ export declare function createChats(options: {
|
|
|
77
79
|
*/
|
|
78
80
|
stop: () => Promise<void>;
|
|
79
81
|
start: () => void;
|
|
80
|
-
/** Go on with
|
|
82
|
+
/** Go on with what was cut off when the agent last ran, each once: turns, and messages waiting. */
|
|
81
83
|
resume(): Promise<void>;
|
|
82
84
|
/**
|
|
83
|
-
* Close for good: its turns are cut, and none starts after. They stay marked,
|
|
84
|
-
* that opens this store next goes on with them.
|
|
85
|
+
* Close for good: its turns are cut, and none starts after. They stay marked, as do messages
|
|
86
|
+
* no work has taken, so the engine that opens this store next goes on with them.
|
|
85
87
|
*/
|
|
86
88
|
close: () => Promise<void>;
|
|
87
|
-
/** Settles when every
|
|
89
|
+
/** Settles when every piece of work's latest turn has written all it will. */
|
|
88
90
|
settled(): Promise<void>;
|
|
89
91
|
/** Streamed text of the model request running now. */
|
|
90
92
|
delta(requestId: string, text: string): void;
|
|
@@ -106,10 +106,10 @@ export function createChats(options) {
|
|
|
106
106
|
/** The chats, by id, once their entries are read. */
|
|
107
107
|
const chats = new Map();
|
|
108
108
|
let loaded;
|
|
109
|
-
/**
|
|
110
|
-
|
|
111
|
-
const stateNow = () => ({ state:
|
|
112
|
-
/** The
|
|
109
|
+
/** Whether the agent is working, as its looper last said. */
|
|
110
|
+
let working = false;
|
|
111
|
+
const stateNow = () => ({ state: working ? "working" : "idle" });
|
|
112
|
+
/** The agent's loops: a chat is the looper's thread of the same name. */
|
|
113
113
|
const looper = forChats(createLooper({
|
|
114
114
|
store: forLooper(store),
|
|
115
115
|
model: options.model,
|
|
@@ -122,22 +122,18 @@ export function createChats(options) {
|
|
|
122
122
|
emit.message({ ...message, chat: thread });
|
|
123
123
|
},
|
|
124
124
|
delta: (thread, id, text) => emit.delta({ chat: thread, id, text }),
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
// before the agent is said to be idle.
|
|
125
|
+
working(on) {
|
|
126
|
+
working = on;
|
|
127
|
+
emit.status(stateNow());
|
|
128
|
+
},
|
|
129
|
+
// A message in the chat got no answer: the chat is told why. The looper says this before
|
|
130
|
+
// it says the agent is idle.
|
|
131
|
+
failed(thread, { code, message }) {
|
|
133
132
|
const held = chats.get(thread);
|
|
134
|
-
if (
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
if (atWork.size > 0 !== was)
|
|
140
|
-
emit.status(stateNow());
|
|
133
|
+
if (!held)
|
|
134
|
+
return;
|
|
135
|
+
held.stored.problem = { code: head(code, 128), message: head(message, 2000) };
|
|
136
|
+
told(held);
|
|
141
137
|
},
|
|
142
138
|
},
|
|
143
139
|
stopped: options.stopped,
|
|
@@ -267,8 +263,10 @@ export function createChats(options) {
|
|
|
267
263
|
};
|
|
268
264
|
return {
|
|
269
265
|
/**
|
|
270
|
-
* Say a message in a chat, or in a new chat it starts.
|
|
271
|
-
*
|
|
266
|
+
* Say a message in a chat, or in a new chat it starts. A new chat's first message is put to
|
|
267
|
+
* the agent's main loop, which gives it to new work or to work in a turn; from then on the
|
|
268
|
+
* chat's messages are that work's: with no turn of it running one starts a turn, and a turn
|
|
269
|
+
* running takes it at its next model request.
|
|
272
270
|
*/
|
|
273
271
|
async send({ chat, text }) {
|
|
274
272
|
if (chat !== undefined) {
|
|
@@ -332,18 +330,18 @@ export function createChats(options) {
|
|
|
332
330
|
*/
|
|
333
331
|
stop: () => looper.stop(),
|
|
334
332
|
start: () => looper.start(),
|
|
335
|
-
/** Go on with
|
|
333
|
+
/** Go on with what was cut off when the agent last ran, each once: turns, and messages waiting. */
|
|
336
334
|
async resume() {
|
|
337
335
|
// The chats first: what a turn says moves its chat in the list.
|
|
338
336
|
await load();
|
|
339
337
|
await looper.resume();
|
|
340
338
|
},
|
|
341
339
|
/**
|
|
342
|
-
* Close for good: its turns are cut, and none starts after. They stay marked,
|
|
343
|
-
* that opens this store next goes on with them.
|
|
340
|
+
* Close for good: its turns are cut, and none starts after. They stay marked, as do messages
|
|
341
|
+
* no work has taken, so the engine that opens this store next goes on with them.
|
|
344
342
|
*/
|
|
345
343
|
close: () => looper.close(),
|
|
346
|
-
/** Settles when every
|
|
344
|
+
/** Settles when every piece of work's latest turn has written all it will. */
|
|
347
345
|
async settled() {
|
|
348
346
|
await loaded?.catch(() => undefined);
|
|
349
347
|
await looper.settled();
|
|
@@ -68,7 +68,7 @@ export function startEngine(ctx, options) {
|
|
|
68
68
|
* settings answer, and no tools slot is away. As the agent starts, what it is bound to may not
|
|
69
69
|
* be running yet, so this is looked at again whenever that may have changed: a slot's provider
|
|
70
70
|
* is back, a tools slot is made or gone, or one says its tools changed. A tools slot that stays
|
|
71
|
-
* away holds them back; a message in a chat starts
|
|
71
|
+
* away holds them back; a message in a chat starts a turn anyway.
|
|
72
72
|
*/
|
|
73
73
|
let wentOn = false;
|
|
74
74
|
/** Each tools slot heard for its tools changing, with how to stop hearing it. */
|