@genesislcap/ai-assistant 15.111.0 → 15.111.1-GENC-2045.1

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.
@@ -4161,6 +4161,16 @@ export declare class ChatDriver extends EventTarget implements AiDriver {
4161
4161
  * turn content and the model must keep seeing them.
4162
4162
  */
4163
4163
  private appendDriverNotice;
4164
+ /**
4165
+ * Flags everything from the latest user message onward `excludeFromProvider`, so the next request
4166
+ * no longer carries a turn the provider refused (GENC-2045). The user message and any tool
4167
+ * traffic of the turn go together, so no tool call is left without its result. Nothing is
4168
+ * removed from the history: the UI and the debug log still show the turn.
4169
+ *
4170
+ * Only the top-level driver does this. A sub-agent's history is its own and is rebuilt per
4171
+ * delegation.
4172
+ */
4173
+ private withdrawCurrentTurnFromProvider;
4164
4174
  private appendToHistory;
4165
4175
  /** Announce the current history to the host. */
4166
4176
  private notifyHistoryUpdated;
@@ -8060,7 +8060,7 @@ var TURN_FAILURE_EXITS = {
8060
8060
  refusal: {
8061
8061
  subReason: "refusal",
8062
8062
  resultReason: "refusal",
8063
- copy: "This request was declined. Try rephrasing it, or breaking it into smaller steps."
8063
+ copy: "The AI provider declined to act on that request, so I've left it out of the conversation and you can carry on with something else. Rewording the same request is unlikely to help."
8064
8064
  },
8065
8065
  emptyResponse: {
8066
8066
  subReason: "empty_response",
@@ -10953,6 +10953,7 @@ ${tailBody}
10953
10953
  isSubAgent: this.isSubAgent,
10954
10954
  ...response.responseMeta
10955
10955
  });
10956
+ if (isRefusal) this.withdrawCurrentTurnFromProvider();
10956
10957
  return this.endTurnWithFailure(exit);
10957
10958
  } else {
10958
10959
  const { reasoning, ...rest } = response;
@@ -11388,6 +11389,30 @@ RECOVERY: this tool failed once \u2014 you may retry it, or take a different val
11388
11389
  appendDriverNotice(content) {
11389
11390
  this.appendToHistory({ role: "assistant", content, excludeFromProvider: true });
11390
11391
  }
11392
+ /**
11393
+ * Flags everything from the latest user message onward `excludeFromProvider`, so the next request
11394
+ * no longer carries a turn the provider refused (GENC-2045). The user message and any tool
11395
+ * traffic of the turn go together, so no tool call is left without its result. Nothing is
11396
+ * removed from the history: the UI and the debug log still show the turn.
11397
+ *
11398
+ * Only the top-level driver does this. A sub-agent's history is its own and is rebuilt per
11399
+ * delegation.
11400
+ */
11401
+ withdrawCurrentTurnFromProvider() {
11402
+ if (this.isSubAgent) return;
11403
+ let start = -1;
11404
+ for (let i = this.history.length - 1; i >= 0; i -= 1) {
11405
+ if (this.history[i].role === "user") {
11406
+ start = i;
11407
+ break;
11408
+ }
11409
+ }
11410
+ if (start < 0) return;
11411
+ this.history = this.history.map(
11412
+ (m, i) => i >= start && !m.excludeFromProvider ? { ...m, excludeFromProvider: true } : m
11413
+ );
11414
+ this.notifyHistoryUpdated();
11415
+ }
11391
11416
  appendToHistory(message) {
11392
11417
  const tagged = {
11393
11418
  ...message,