@genesislcap/ai-assistant 15.78.1 → 15.78.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"orchestrating-driver.d.ts","sourceRoot":"","sources":["../../../../src/components/orchestrating-driver/orchestrating-driver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,WAAW,EAEZ,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,KAAK,EACV,WAAW,EAMZ,MAAM,qBAAqB,CAAC;AAI7B,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,+BAA+B,CAAC;AAKvC,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAClG,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EACL,UAAU,EACV,KAAK,0BAA0B,EAEhC,MAAM,4BAA4B,CAAC;AAkBpC;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,eAAe;AACzB,kDAAkD;AAChD,YAAY;AACd,6EAA6E;GAC3E,UAAU;AACZ;;;;;GAKG;GACD,kBAAkB;AACpB,+DAA+D;GAC7D,kBAAkB;AACpB,kDAAkD;GAChD,gBAAgB;AAClB,kFAAkF;GAChF,sBAAsB;AACxB,oEAAoE;GAClE,mBAAmB;AACrB,0EAA0E;GACxE,QAAQ,CAAC;AAwEb;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,mBAAmB,CAAC;AAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,sBAAsB,ijBAIyH,CAAC;AAuB7J;;;;;;;;;;;;GAYG;AACH,qBAAa,mBAAoB,SAAQ,mBAAmB,CAAC,UAAU,C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SAAS,CAKjF"}
1
+ {"version":3,"file":"orchestrating-driver.d.ts","sourceRoot":"","sources":["../../../../src/components/orchestrating-driver/orchestrating-driver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,WAAW,EAEZ,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,KAAK,EACV,WAAW,EAMZ,MAAM,qBAAqB,CAAC;AAI7B,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,+BAA+B,CAAC;AAKvC,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAClG,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EACL,UAAU,EACV,KAAK,0BAA0B,EAEhC,MAAM,4BAA4B,CAAC;AAkBpC;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,eAAe;AACzB,kDAAkD;AAChD,YAAY;AACd,6EAA6E;GAC3E,UAAU;AACZ;;;;;GAKG;GACD,kBAAkB;AACpB,+DAA+D;GAC7D,kBAAkB;AACpB,kDAAkD;GAChD,gBAAgB;AAClB,kFAAkF;GAChF,sBAAsB;AACxB,oEAAoE;GAClE,mBAAmB;AACrB,0EAA0E;GACxE,QAAQ,CAAC;AAwEb;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,mBAAmB,CAAC;AAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,sBAAsB,ijBAIyH,CAAC;AA0C7J;;;;;;;;;;;;GAYG;AACH,qBAAa,mBAAoB,SAAQ,mBAAmB,CAAC,UAAU,CAAC;IAoDpE,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,QAAQ,CAAC,MAAM;IApDzB,uDAAuD;IACvD,OAAO,KA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Ae,EAAE,GAC/B,OAAO,CAAC,MAAM,EAAE,CAAC;IAgBL,WAAW,CACxB,KAAK,EAAE,MAAM,EACb,WAAW,CAAC,EAAE,cAAc,EAAE,EAC9B,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,gBAAgB,CAAC;YAyCd,mBAAmB;IAqMjC,iDAAiD;IACxC,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAIxD,mDAAmD;IAC1C,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAK1D;;;;;;;;;;;OAWG;IACY,kBAAkB,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC;IAc7F;;;;OAIG;IACY,mBAAmB,CAChC,eAAe,CAAC,EAAE,WAAW,EAAE,EAC/B,OAAO,CAAC,EAAE,0BAA0B,GACnC,OAAO,CAAC,gBAAgB,CAAC;IAM5B,sGAAsG;YACxF,kBAAkB;IAMhC;;;;OAIG;IACM,iBAAiB,IAAI,wBAAwB,GAAG,SAAS;YAiDpD,YAAY;IAiD1B;;;;;;;;;;OAUG;YACW,kBAAkB;IAIhC;;;;OAIG;IACM,MAAM,IAAI,IAAI;IAKvB;;;;OAIG;IACY,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAUvC;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,aAAa;IAoCrB;;;OAGG;IACH,OAAO,CAAC,oBAAoB;YAoCd,QAAQ;IAsMtB;;;;;;;OAOG;IACH,OAAO,CAAC,kBAAkB;IAa1B;;;;;OAKG;IACH,OAAO,CAAC,mBAAmB;CAe5B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAAC,MAAM,CAAC,EAAE,QAAQ,GAAG,mBAAmB,GAAG,SAAS,CAKjF"}
@@ -143,6 +143,24 @@ function buildFallbackSystemPrompt(fallback, specialists) {
143
143
  }
144
144
  return `You are a helpful assistant. You cannot directly help with the user's request, but the following specialists are available:\n\n${agentList}\n\nPolitely let the user know what you can help with and invite them to rephrase their request.\n\n${UNROUTABLE_INSTRUCTION}`;
145
145
  }
146
+ /**
147
+ * The note a handoff's continuation ends on, so the request closes on a user turn (see the call in
148
+ * `runOrchestratedTurn`).
149
+ *
150
+ * The fallback's note names no work, because its routing note already says the work is nobody's
151
+ * here, and the same work restated last would read as a work order — the shape that drew blank
152
+ * turns from it (GENC-1573). A specialist gets what remains or, when the agent handing off did not
153
+ * say, the user's request, which is also what the re-classify routed on.
154
+ */
155
+ function handoffTailNote(agent, remainingTask) {
156
+ if (isFallback(agent)) {
157
+ return '[Hand-off]: no specialist here can take on what remains. Reply to the user now, as the routing note says.';
158
+ }
159
+ const work = remainingTask === null || remainingTask === void 0 ? void 0 : remainingTask.trim();
160
+ return work
161
+ ? `[Hand-off]: the previous agent passed the rest of this request to you. What remains: ${work}`
162
+ : "[Hand-off]: the previous agent passed the rest of this request to you without saying what remains. Carry on with the user's request above.";
163
+ }
146
164
  /**
147
165
  * Orchestrates multiple specialist agents. Sits between `FoundationAiAssistant`
148
166
  * and `ChatDriver`, classifying each user message and routing it to the right
@@ -308,6 +326,10 @@ export class OrchestratingDriver extends BaseDriverDecorator {
308
326
  this.dispatchEvent(new CustomEvent('history-updated', {
309
327
  detail: [...history, Object.assign({ role: 'user', content: input, attachments }, delegated)],
310
328
  }));
329
+ // What the turn is routed on — and routed on again after a handoff that names no remaining task.
330
+ const routingInput = delegated.delegate
331
+ ? frameDelegatedContent(input, delegated.delegateFraming)
332
+ : input;
311
333
  const pinned = this.resolvePinnedAgent();
312
334
  if (!pinned)
313
335
  this.dispatchEvent(new CustomEvent('orchestrating-start'));
@@ -320,7 +342,7 @@ export class OrchestratingDriver extends BaseDriverDecorator {
320
342
  routed = { agent: pinned, decision: 'pinned' };
321
343
  }
322
344
  else {
323
- routed = yield this.classify(delegated.delegate ? frameDelegatedContent(input, delegated.delegateFraming) : input, history, this.activeAgent);
345
+ routed = yield this.classify(routingInput, history, this.activeAgent);
324
346
  }
325
347
  let currentAgent = routed.agent;
326
348
  let isHandoff = false;
@@ -381,8 +403,18 @@ export class OrchestratingDriver extends BaseDriverDecorator {
381
403
  'yourself, and do not return an empty response.',
382
404
  });
383
405
  }
406
+ // The primer LEADS the request, and the history after it closes on the previous agent's
407
+ // turn: its `request_continuation` call, flattened to assistant prose for an agent that did
408
+ // not make it (`transformHistoryForAgent`). A request ending on an assistant turn is a
409
+ // prefill, which Anthropic refuses outright: a handoff on Claude ended in "Sorry, something
410
+ // went wrong" unless the agent reached had a tail context of its own, and Gemini, which
411
+ // tolerates it, never showed it. The tail note lands after the history as a user turn. It
412
+ // rides the first model call only, so the primer stays where it is: it has to outlast that
413
+ // call, for the whole tool loop.
384
414
  // oxlint-disable-next-line no-await-in-loop
385
- result = yield this.chatDriver.continueFromHistory(contextPrimer);
415
+ result = yield this.chatDriver.continueFromHistory(contextPrimer, {
416
+ tailNote: handoffTailNote(currentAgent, remainingTask),
417
+ });
386
418
  }
387
419
  else {
388
420
  // From here the inner driver owns the user message — it appends it as
@@ -426,8 +458,13 @@ export class OrchestratingDriver extends BaseDriverDecorator {
426
458
  }
427
459
  const updatedHistory = this.chatDriver.getHistory();
428
460
  this.dispatchEvent(new CustomEvent('orchestrating-start'));
461
+ // The tool schema requires `remaining_task`, but nothing holds a model to `required`: Claude
462
+ // handed off with a `summary` alone, and an empty task is a classifier request with no
463
+ // message in it, which Anthropic refuses — on every attempt, so the turn fell to the fallback
464
+ // as `classifier-failed`. Route on the request the turn began with instead. The agent that
465
+ // just declined it is off the ballot, so the question put is the right one: who else.
429
466
  // oxlint-disable-next-line no-await-in-loop
430
- routed = yield this.classify(remainingTask, updatedHistory, undefined, attempted);
467
+ routed = yield this.classify((remainingTask === null || remainingTask === void 0 ? void 0 : remainingTask.trim()) || routingInput, updatedHistory, undefined, attempted);
431
468
  currentAgent = routed.agent;
432
469
  }
433
470
  // The orchestrated turn reports the outcome of the agent turn that ENDED it.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/ai-assistant",
3
3
  "description": "Genesis AI Assistant micro-frontend",
4
- "version": "15.78.1",
4
+ "version": "15.78.2",
5
5
  "license": "SEE LICENSE IN license.txt",
6
6
  "main": "dist/esm/index.js",
7
7
  "types": "dist/ai-assistant.d.ts",
@@ -92,31 +92,31 @@
92
92
  }
93
93
  },
94
94
  "devDependencies": {
95
- "@genesislcap/foundation-comms": "15.78.1",
96
- "@genesislcap/foundation-testing": "15.78.1",
97
- "@genesislcap/genx": "15.78.1",
98
- "@genesislcap/ts-builder": "15.78.1",
99
- "@genesislcap/uvu-playwright-builder": "15.78.1",
100
- "@genesislcap/vite-builder": "15.78.1",
101
- "@genesislcap/webpack-builder": "15.78.1",
95
+ "@genesislcap/foundation-comms": "15.78.2",
96
+ "@genesislcap/foundation-testing": "15.78.2",
97
+ "@genesislcap/genx": "15.78.2",
98
+ "@genesislcap/ts-builder": "15.78.2",
99
+ "@genesislcap/uvu-playwright-builder": "15.78.2",
100
+ "@genesislcap/vite-builder": "15.78.2",
101
+ "@genesislcap/webpack-builder": "15.78.2",
102
102
  "@types/dompurify": "^3.0.5",
103
103
  "@types/marked": "^5.0.2",
104
104
  "esbuild": "0.25.12"
105
105
  },
106
106
  "dependencies": {
107
- "@genesislcap/foundation-ai": "15.78.1",
108
- "@genesislcap/foundation-logger": "15.78.1",
109
- "@genesislcap/foundation-notifications": "15.78.1",
110
- "@genesislcap/foundation-redux": "15.78.1",
111
- "@genesislcap/foundation-ui": "15.78.1",
112
- "@genesislcap/foundation-utils": "15.78.1",
113
- "@genesislcap/rapid-design-system": "15.78.1",
114
- "@genesislcap/web-core": "15.78.1",
107
+ "@genesislcap/foundation-ai": "15.78.2",
108
+ "@genesislcap/foundation-logger": "15.78.2",
109
+ "@genesislcap/foundation-notifications": "15.78.2",
110
+ "@genesislcap/foundation-redux": "15.78.2",
111
+ "@genesislcap/foundation-ui": "15.78.2",
112
+ "@genesislcap/foundation-utils": "15.78.2",
113
+ "@genesislcap/rapid-design-system": "15.78.2",
114
+ "@genesislcap/web-core": "15.78.2",
115
115
  "dompurify": "^3.3.1",
116
116
  "marked": "^17.0.3"
117
117
  },
118
118
  "peerDependencies": {
119
- "@genesislcap/foundation-comms": "^15.78.1"
119
+ "@genesislcap/foundation-comms": "^15.78.2"
120
120
  },
121
121
  "peerDependenciesMeta": {
122
122
  "@genesislcap/foundation-comms": {