@genesislcap/ai-assistant 15.96.2 → 15.96.3-GENC-1640.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.
@@ -5710,7 +5710,7 @@
5710
5710
  {
5711
5711
  "kind": "MethodSignature",
5712
5712
  "canonicalReference": "@genesislcap/ai-assistant!AiDriver#restoreHandOffData:member(1)",
5713
- "docComment": "/**\n * Restore what {@link AiDriver.getHandOffData} saved, before the hand-off stack. Nothing comes back from a frozen (`interrupted`) session, whose flow does not resume.\n *\n * @beta\n */\n",
5713
+ "docComment": "/**\n * Restore what {@link AiDriver.getHandOffData} saved, before the hand-off stack. With `interrupted` true nothing comes back. A frozen session saves only its waiting callers' data, which resume, so a host restoring one passes `false`.\n *\n * @beta\n */\n",
5714
5714
  "excerptTokens": [
5715
5715
  {
5716
5716
  "kind": "Content",
@@ -5771,7 +5771,7 @@
5771
5771
  {
5772
5772
  "kind": "MethodSignature",
5773
5773
  "canonicalReference": "@genesislcap/ai-assistant!AiDriver#restoreHandOffStack:member(1)",
5774
- "docComment": "/**\n * Restore saved hand-offs, before the condense policies, against the agents configured now and the saved agent states. A frame whose caller has gone, or whose stateful caller has no saved state (`interrupted` drops them all), is unwound with `handoff-unwound`. When the top frame's target had finished, or has gone, its caller is due to resume: `resume` names it and the note its resumed turn needs, and {@link AiDriver.resumeRestoredFlow} hands back. `droppedLocks` names plain targets of unwound hand-offs, whose saved lock was only that hand-off's.\n *\n * @beta\n */\n",
5774
+ "docComment": "/**\n * Restore saved hand-offs, before the condense policies, against the agents configured now and the saved agent states. A frame whose caller has gone, or whose stateful caller has no saved state, is unwound with `handoff-unwound`. `interrupted` says the save was frozen: the running target's state was dropped, but the waiting callers' were kept, so when the top frame's target had not finished its outcome is `target-interrupted`. When the top frame's target had finished, or has gone, or was interrupted, its caller is due to resume: `resume` names it and the note its resumed turn needs, and {@link AiDriver.resumeRestoredFlow} hands back. `droppedLocks` names plain targets of unwound hand-offs, whose saved lock was only that hand-off's.\n *\n * @beta\n */\n",
5775
5775
  "excerptTokens": [
5776
5776
  {
5777
5777
  "kind": "Content",
@@ -30533,7 +30533,7 @@
30533
30533
  {
30534
30534
  "kind": "TypeAlias",
30535
30535
  "canonicalReference": "@genesislcap/ai-assistant!HandOffOutcomeKind:type",
30536
- "docComment": "/**\n * How a hand-off ended (GENC-1737): - `completed`: the target called `completeHandOff`; - `released`: the target called `releaseAgent`, or, a plain one, ended its turn; - `cleared`: the user cleared the chat; - `agent-removed`: the caller or the target is no longer in the agent list, found on restore; - `state-lost`: the caller's saved state is gone, so it cannot resume: a session saved while its flow could not be resumed, or a change to the agents, which disposes them.\n *\n * @beta\n */\n",
30536
+ "docComment": "/**\n * How a hand-off ended (GENC-1737): - `completed`: the target called `completeHandOff`; - `released`: the target called `releaseAgent`, or, a plain one, ended its turn; - `cleared`: the user cleared the chat; - `agent-removed`: the caller or the target is no longer in the agent list, found on restore; - `target-interrupted`: a reload cut the target's work short and it cannot resume (its `resumable` was `false`), so its unsaved work is lost; the caller's own state was saved, so the caller resumes and is told, and decides what to do next, such as handing off again; - `state-lost`: the caller's saved state is gone, so it cannot resume: a stateful caller whose state was not saved, or a change to the agents, which disposes them.\n *\n * @beta\n */\n",
30537
30537
  "excerptTokens": [
30538
30538
  {
30539
30539
  "kind": "Content",
@@ -30541,7 +30541,7 @@
30541
30541
  },
30542
30542
  {
30543
30543
  "kind": "Content",
30544
- "text": "'completed' | 'released' | 'cleared' | 'agent-removed' | 'state-lost'"
30544
+ "text": "'completed' | 'released' | 'cleared' | 'agent-removed' | 'target-interrupted' | 'state-lost'"
30545
30545
  },
30546
30546
  {
30547
30547
  "kind": "Content",
@@ -37345,7 +37345,7 @@
37345
37345
  {
37346
37346
  "kind": "Method",
37347
37347
  "canonicalReference": "@genesislcap/ai-assistant!OrchestratingDriver#restoreHandOffData:member(1)",
37348
- "docComment": "/**\n * Restore what {@link AiDriver.getHandOffData} saved, before the hand-off stack. Nothing comes back from a frozen (`interrupted`) session, whose flow does not resume.\n */\n",
37348
+ "docComment": "/**\n * Restore what {@link AiDriver.getHandOffData} saved, before the hand-off stack. With `interrupted` true nothing comes back. A frozen session saves only its waiting callers' data, which resume, so a host restoring one passes `false`.\n */\n",
37349
37349
  "excerptTokens": [
37350
37350
  {
37351
37351
  "kind": "Content",
@@ -37409,7 +37409,7 @@
37409
37409
  {
37410
37410
  "kind": "Method",
37411
37411
  "canonicalReference": "@genesislcap/ai-assistant!OrchestratingDriver#restoreHandOffStack:member(1)",
37412
- "docComment": "/**\n * Restore saved hand-offs, before the condense policies, against the agents configured now and the saved agent states. A frame whose caller has gone, or whose stateful caller has no saved state (`interrupted` drops them all), is unwound with `handoff-unwound`. When the top frame's target had finished, or has gone, its caller is due to resume: `resume` names it and the note its resumed turn needs, and {@link AiDriver.resumeRestoredFlow} hands back. `droppedLocks` names plain targets of unwound hand-offs, whose saved lock was only that hand-off's.\n */\n",
37412
+ "docComment": "/**\n * Restore saved hand-offs, before the condense policies, against the agents configured now and the saved agent states. A frame whose caller has gone, or whose stateful caller has no saved state, is unwound with `handoff-unwound`. `interrupted` says the save was frozen: the running target's state was dropped, but the waiting callers' were kept, so when the top frame's target had not finished its outcome is `target-interrupted`. When the top frame's target had finished, or has gone, or was interrupted, its caller is due to resume: `resume` names it and the note its resumed turn needs, and {@link AiDriver.resumeRestoredFlow} hands back. `droppedLocks` names plain targets of unwound hand-offs, whose saved lock was only that hand-off's.\n */\n",
37413
37413
  "excerptTokens": [
37414
37414
  {
37415
37415
  "kind": "Content",
@@ -1102,8 +1102,10 @@ export declare interface AiDriver extends EventTarget {
1102
1102
  /**
1103
1103
  * Restore saved hand-offs, before the condense policies, against the agents configured now and
1104
1104
  * the saved agent states. A frame whose caller has gone, or whose stateful caller has no saved
1105
- * state (`interrupted` drops them all), is unwound with `handoff-unwound`. When the top frame's
1106
- * target had finished, or has gone, its caller is due to resume: `resume` names it and the note
1105
+ * state, is unwound with `handoff-unwound`. `interrupted` says the save was frozen: the running
1106
+ * target's state was dropped, but the waiting callers' were kept, so when the top frame's target
1107
+ * had not finished its outcome is `target-interrupted`. When the top frame's target had
1108
+ * finished, or has gone, or was interrupted, its caller is due to resume: `resume` names it and the note
1107
1109
  * its resumed turn needs, and {@link AiDriver.resumeRestoredFlow} hands back. `droppedLocks`
1108
1110
  * names plain targets of unwound hand-offs, whose saved lock was only that hand-off's.
1109
1111
  *
@@ -1138,8 +1140,9 @@ export declare interface AiDriver extends EventTarget {
1138
1140
  */
1139
1141
  getHandOffData?(): Record<string, unknown>;
1140
1142
  /**
1141
- * Restore what {@link AiDriver.getHandOffData} saved, before the hand-off stack. Nothing comes
1142
- * back from a frozen (`interrupted`) session, whose flow does not resume.
1143
+ * Restore what {@link AiDriver.getHandOffData} saved, before the hand-off stack. With
1144
+ * `interrupted` true nothing comes back. A frozen session saves only its waiting callers' data,
1145
+ * which resume, so a host restoring one passes `false`.
1143
1146
  *
1144
1147
  * @beta
1145
1148
  */
@@ -2573,7 +2576,7 @@ declare interface BaseAgentConfig {
2573
2576
  onHandOffStart?: (frame: HandOffFrame) => void | Promise<void>;
2574
2577
  /**
2575
2578
  * Fires on the caller when a hand-off it made ends, before its next model call, so its own state
2576
- * can move on. `outcome.kind` says how it ended. Not fired for `state-lost`, whose caller cannot
2579
+ * can move on. `outcome.kind` says how it ended. Fired for `target-interrupted`, whose caller resumes. Not fired for `state-lost`, whose caller cannot
2577
2580
  * resume. GENC-1737.
2578
2581
  *
2579
2582
  * @beta
@@ -7573,12 +7576,15 @@ export declare interface HandOffOutcome {
7573
7576
  * - `released`: the target called `releaseAgent`, or, a plain one, ended its turn;
7574
7577
  * - `cleared`: the user cleared the chat;
7575
7578
  * - `agent-removed`: the caller or the target is no longer in the agent list, found on restore;
7576
- * - `state-lost`: the caller's saved state is gone, so it cannot resume: a session saved while its
7577
- * flow could not be resumed, or a change to the agents, which disposes them.
7579
+ * - `target-interrupted`: a reload cut the target's work short and it cannot resume (its
7580
+ * `resumable` was `false`), so its unsaved work is lost; the caller's own state was saved, so
7581
+ * the caller resumes and is told, and decides what to do next, such as handing off again;
7582
+ * - `state-lost`: the caller's saved state is gone, so it cannot resume: a stateful caller whose
7583
+ * state was not saved, or a change to the agents, which disposes them.
7578
7584
  *
7579
7585
  * @beta
7580
7586
  */
7581
- export declare type HandOffOutcomeKind = 'completed' | 'released' | 'cleared' | 'agent-removed' | 'state-lost';
7587
+ export declare type HandOffOutcomeKind = 'completed' | 'released' | 'cleared' | 'agent-removed' | 'target-interrupted' | 'state-lost';
7582
7588
 
7583
7589
  /**
7584
7590
  * What `act` is given besides the action: the arguments a person would fill in.
@@ -11261,6 +11261,7 @@ var OUTCOME_KINDS = [
11261
11261
  "released",
11262
11262
  "cleared",
11263
11263
  "agent-removed",
11264
+ "target-interrupted",
11264
11265
  "state-lost"
11265
11266
  ];
11266
11267
  function handOffNote(caller) {
@@ -11272,6 +11273,7 @@ function handBackNote(frame, outcome) {
11272
11273
  released: `${frame.target} has finished the request you handed it, without a summary. Its last reply is above.`,
11273
11274
  cleared: "The hand-off was cleared.",
11274
11275
  "agent-removed": `${frame.target} is no longer available, so the request you handed it was not finished.`,
11276
+ "target-interrupted": `${frame.target} was cut short by a page reload and could not resume, so the request you handed it was not finished and its unsaved work is lost.`,
11275
11277
  "state-lost": `The hand-off to ${frame.target} could not be resumed.`
11276
11278
  };
11277
11279
  const summary = outcome.kind === "completed" && outcome.message ? " Its summary is the message above." : "";
@@ -11873,7 +11875,7 @@ var OrchestratingDriver = class _OrchestratingDriver extends BaseDriverDecorator
11873
11875
  const outcome = frame.outcome;
11874
11876
  if (!caller) {
11875
11877
  this.unwound(frame, "agent-removed");
11876
- } else if (interrupted || caller.serialize && savedStates?.[caller.name] === void 0) {
11878
+ } else if (caller.serialize && savedStates?.[caller.name] === void 0) {
11877
11879
  this.unwound(frame, "state-lost");
11878
11880
  } else {
11879
11881
  kept.push(frame);
@@ -11890,6 +11892,8 @@ var OrchestratingDriver = class _OrchestratingDriver extends BaseDriverDecorator
11890
11892
  const top = kept[kept.length - 1];
11891
11893
  if (top && !top.outcome && !this.agents.some((a) => a.name === top.target)) {
11892
11894
  top.outcome = { kind: "agent-removed" };
11895
+ } else if (top && !top.outcome && interrupted) {
11896
+ top.outcome = { kind: "target-interrupted" };
11893
11897
  }
11894
11898
  this.handOffStack = kept;
11895
11899
  this.chatDriver.suspendRestoredActivations(kept.map((f) => f.caller));