assistme 0.8.9 → 0.8.10
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/dist/index.js +16 -4
- package/package.json +1 -1
- package/src/orchestrator.ts +21 -5
package/dist/index.js
CHANGED
|
@@ -1361,12 +1361,12 @@ var Orchestrator = class {
|
|
|
1361
1361
|
workerManager = null;
|
|
1362
1362
|
userId = null;
|
|
1363
1363
|
conversationId = null;
|
|
1364
|
-
|
|
1364
|
+
titledConversations = /* @__PURE__ */ new Set();
|
|
1365
1365
|
// ── Lifecycle ───────────────────────────────────────────────────
|
|
1366
1366
|
async start(userId) {
|
|
1367
1367
|
const config = getConfig();
|
|
1368
1368
|
this.userId = userId;
|
|
1369
|
-
this.
|
|
1369
|
+
this.titledConversations.clear();
|
|
1370
1370
|
this.session = await createSession(config.sessionName, config.workspacePath, "0.1.0");
|
|
1371
1371
|
this.conversationId = await getOrCreateCliConversation();
|
|
1372
1372
|
this.workerManager = new WorkerManager(userId, this.session.id);
|
|
@@ -1379,6 +1379,12 @@ var Orchestrator = class {
|
|
|
1379
1379
|
this.heartbeat.start(this.session.id);
|
|
1380
1380
|
this.taskPoller = new TaskPoller(this.session.id, {
|
|
1381
1381
|
onTask: (task) => {
|
|
1382
|
+
if (task.conversation_id && !this.titledConversations.has(task.conversation_id)) {
|
|
1383
|
+
this.titledConversations.add(task.conversation_id);
|
|
1384
|
+
generateAndSaveTitle(task.conversation_id, task.prompt).catch(
|
|
1385
|
+
(err) => log.debug(`Title generation failed: ${err}`)
|
|
1386
|
+
);
|
|
1387
|
+
}
|
|
1382
1388
|
this.workerManager.dispatchTask(task).catch((err) => {
|
|
1383
1389
|
log.error(`Task dispatch error: ${err}`);
|
|
1384
1390
|
});
|
|
@@ -1437,8 +1443,8 @@ var Orchestrator = class {
|
|
|
1437
1443
|
}
|
|
1438
1444
|
const task = await createTask(this.conversationId, this.session.id, prompt);
|
|
1439
1445
|
await claimTask(task.id);
|
|
1440
|
-
if (!this.
|
|
1441
|
-
this.
|
|
1446
|
+
if (!this.titledConversations.has(this.conversationId)) {
|
|
1447
|
+
this.titledConversations.add(this.conversationId);
|
|
1442
1448
|
generateAndSaveTitle(this.conversationId, prompt).catch(
|
|
1443
1449
|
(err) => log.debug(`Title generation failed: ${err}`)
|
|
1444
1450
|
);
|
|
@@ -1451,6 +1457,12 @@ var Orchestrator = class {
|
|
|
1451
1457
|
}
|
|
1452
1458
|
const task = await createTask(this.conversationId, this.session.id, prompt);
|
|
1453
1459
|
await claimTask(task.id);
|
|
1460
|
+
if (!this.titledConversations.has(this.conversationId)) {
|
|
1461
|
+
this.titledConversations.add(this.conversationId);
|
|
1462
|
+
generateAndSaveTitle(this.conversationId, prompt).catch(
|
|
1463
|
+
(err) => log.debug(`Title generation failed: ${err}`)
|
|
1464
|
+
);
|
|
1465
|
+
}
|
|
1454
1466
|
await this.workerManager.dispatchAndWait(task);
|
|
1455
1467
|
}
|
|
1456
1468
|
/** Alias for interactive CLI. */
|
package/package.json
CHANGED
package/src/orchestrator.ts
CHANGED
|
@@ -48,14 +48,14 @@ export class Orchestrator {
|
|
|
48
48
|
|
|
49
49
|
private userId: string | null = null;
|
|
50
50
|
private conversationId: string | null = null;
|
|
51
|
-
private
|
|
51
|
+
private titledConversations = new Set<string>();
|
|
52
52
|
|
|
53
53
|
// ── Lifecycle ───────────────────────────────────────────────────
|
|
54
54
|
|
|
55
55
|
async start(userId: string): Promise<AgentSession> {
|
|
56
56
|
const config = getConfig();
|
|
57
57
|
this.userId = userId;
|
|
58
|
-
this.
|
|
58
|
+
this.titledConversations.clear();
|
|
59
59
|
|
|
60
60
|
this.session = await createSession(config.sessionName, config.workspacePath, "0.1.0");
|
|
61
61
|
this.conversationId = await getOrCreateCliConversation();
|
|
@@ -74,6 +74,13 @@ export class Orchestrator {
|
|
|
74
74
|
|
|
75
75
|
this.taskPoller = new TaskPoller(this.session.id, {
|
|
76
76
|
onTask: (task) => {
|
|
77
|
+
// Generate title on first task per conversation (fire-and-forget)
|
|
78
|
+
if (task.conversation_id && !this.titledConversations.has(task.conversation_id)) {
|
|
79
|
+
this.titledConversations.add(task.conversation_id);
|
|
80
|
+
generateAndSaveTitle(task.conversation_id, task.prompt).catch((err) =>
|
|
81
|
+
log.debug(`Title generation failed: ${err}`)
|
|
82
|
+
);
|
|
83
|
+
}
|
|
77
84
|
this.workerManager!.dispatchTask(task).catch((err) => {
|
|
78
85
|
log.error(`Task dispatch error: ${err}`);
|
|
79
86
|
});
|
|
@@ -145,9 +152,9 @@ export class Orchestrator {
|
|
|
145
152
|
const task = await createTask(this.conversationId, this.session.id, prompt);
|
|
146
153
|
await claimTask(task.id);
|
|
147
154
|
|
|
148
|
-
// Generate title on first task (fire-and-forget
|
|
149
|
-
if (!this.
|
|
150
|
-
this.
|
|
155
|
+
// Generate title on first task per conversation (fire-and-forget)
|
|
156
|
+
if (!this.titledConversations.has(this.conversationId)) {
|
|
157
|
+
this.titledConversations.add(this.conversationId);
|
|
151
158
|
generateAndSaveTitle(this.conversationId, prompt).catch((err) =>
|
|
152
159
|
log.debug(`Title generation failed: ${err}`)
|
|
153
160
|
);
|
|
@@ -163,6 +170,15 @@ export class Orchestrator {
|
|
|
163
170
|
|
|
164
171
|
const task = await createTask(this.conversationId, this.session.id, prompt);
|
|
165
172
|
await claimTask(task.id);
|
|
173
|
+
|
|
174
|
+
// Generate title on first task per conversation (fire-and-forget)
|
|
175
|
+
if (!this.titledConversations.has(this.conversationId)) {
|
|
176
|
+
this.titledConversations.add(this.conversationId);
|
|
177
|
+
generateAndSaveTitle(this.conversationId, prompt).catch((err) =>
|
|
178
|
+
log.debug(`Title generation failed: ${err}`)
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
|
|
166
182
|
await this.workerManager!.dispatchAndWait(task);
|
|
167
183
|
}
|
|
168
184
|
|