@siftd/connect-agent 0.2.47 → 0.2.48
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/orchestrator.d.ts +1 -0
- package/dist/orchestrator.js +17 -1
- package/package.json +1 -1
package/dist/orchestrator.d.ts
CHANGED
|
@@ -194,6 +194,7 @@ export declare class MasterOrchestrator {
|
|
|
194
194
|
private stripTodoSnapshot;
|
|
195
195
|
private hasTodoMutation;
|
|
196
196
|
private hasCalendarMutation;
|
|
197
|
+
private hasFileMutation;
|
|
197
198
|
private getUserTagHint;
|
|
198
199
|
private getBreakdownTarget;
|
|
199
200
|
private ensureBreakdownOriginalDone;
|
package/dist/orchestrator.js
CHANGED
|
@@ -701,6 +701,13 @@ export class MasterOrchestrator {
|
|
|
701
701
|
const query = /\b(what|show|list|open|view|see)\b/.test(lower);
|
|
702
702
|
return target && action && !query;
|
|
703
703
|
}
|
|
704
|
+
hasFileMutation(message) {
|
|
705
|
+
const lower = this.stripTodoSnapshot(message).toLowerCase();
|
|
706
|
+
const target = /(^|\s)\/files\b|\bfiles?\b/.test(lower);
|
|
707
|
+
const action = /\b(create|make|write|save|generate|export|upload|attach|produce|edit|update|modify|delete|remove)\b/.test(lower);
|
|
708
|
+
const query = /\b(what|show|list|open|view|see|browse|find)\b/.test(lower);
|
|
709
|
+
return target && action && !query;
|
|
710
|
+
}
|
|
704
711
|
getUserTagHint(message) {
|
|
705
712
|
if (!message)
|
|
706
713
|
return null;
|
|
@@ -768,12 +775,16 @@ export class MasterOrchestrator {
|
|
|
768
775
|
return undefined;
|
|
769
776
|
const wantsTodo = this.hasTodoMutation(last.content);
|
|
770
777
|
const wantsCal = this.hasCalendarMutation(last.content);
|
|
778
|
+
const wantsFiles = this.hasFileMutation(last.content);
|
|
771
779
|
if (wantsTodo && !wantsCal) {
|
|
772
780
|
return { type: 'tool', name: 'todo_upsert_items' };
|
|
773
781
|
}
|
|
774
782
|
if (wantsCal && !wantsTodo) {
|
|
775
783
|
return { type: 'tool', name: 'calendar_upsert_events' };
|
|
776
784
|
}
|
|
785
|
+
if (wantsFiles) {
|
|
786
|
+
return { type: 'tool', name: 'delegate_to_worker' };
|
|
787
|
+
}
|
|
777
788
|
return undefined;
|
|
778
789
|
}
|
|
779
790
|
withAttachments(task, context) {
|
|
@@ -1368,12 +1379,17 @@ ${hubContextStr}
|
|
|
1368
1379
|
if (response.stop_reason === 'end_turn' || !this.hasToolUse(response.content)) {
|
|
1369
1380
|
if (forcedToolChoice && !retriedForcedTool) {
|
|
1370
1381
|
retriedForcedTool = true;
|
|
1382
|
+
const toolName = forcedToolChoice.name;
|
|
1383
|
+
const needsNoWorkers = toolName === 'todo_upsert_items' || toolName === 'calendar_upsert_events';
|
|
1384
|
+
const followup = needsNoWorkers
|
|
1385
|
+
? `You must call the ${toolName} tool now. Use the exact task/event titles and any bracketed tags exactly as provided. Do not spawn workers.`
|
|
1386
|
+
: `You must call the ${toolName} tool now. Use the user's request as the task details.`;
|
|
1371
1387
|
currentMessages = [
|
|
1372
1388
|
...currentMessages,
|
|
1373
1389
|
{ role: 'assistant', content: response.content },
|
|
1374
1390
|
{
|
|
1375
1391
|
role: 'user',
|
|
1376
|
-
content:
|
|
1392
|
+
content: followup
|
|
1377
1393
|
}
|
|
1378
1394
|
];
|
|
1379
1395
|
continue;
|