@theoremjs/web 0.3.5-next.978.g2ef222f → 0.3.5-next.980.g83e419d

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/README.md CHANGED
@@ -209,7 +209,9 @@ await chat.submit();
209
209
  - Each method is bound to the controller. Pass it as a callback as it is.
210
210
  - `state.delivery` says how far the latest message has got: `sending` while it posts, `sent` once the server has it, `delivered` once the model works on it, and `read` once the reply starts. The server's own events (`stage`, `guardrail`, `late_results`, `session`, `hook_failed`, `error`, `done`) leave it at `sent`, because they say nothing of the model. It is `null` before the first message and after its turn fails.
211
211
 
212
- `state.phase` is `'idle'`, `'streaming'`, or `'gated'`. The methods for the composer depend on it:
212
+ `state.phase` is `'idle'`, `'streaming'`, or `'gated'`. At `'gated'`, the reply waits on a tool gate. `state.waitingGate` is that gate when the person must answer it: a confirmation, a permission or a sign-in. It is `null` at other times, and for a page gate, which the page answers.
213
+
214
+ The methods for the composer depend on the phase:
213
215
 
214
216
  | Method | What it does |
215
217
  | --- | --- |
package/client/chat.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { type ProfileOptions } from '@theoremjs/agents';
2
- import { type AttachmentValidationIssue, type ComposerMenuAction, type ComposerPendingMessage, type ComposerProfileInterface, type ComposerRunPhase, type InterfaceTurnSession, type TranscriptBlock } from '@theoremjs/agents/interface';
2
+ import { type AttachmentValidationIssue, type ComposerMenuAction, type ComposerPendingMessage, type ComposerProfileInterface, type ComposerRunPhase, type GatedToolContext, type InterfaceTurnSession, type TranscriptBlock } from '@theoremjs/agents/interface';
3
3
  import { type ClientFailure } from './failure.ts';
4
4
  import { type PageTools } from './live/live-page-tool.ts';
5
5
  import type { AnsweringGate, ToolDecisionAction } from './tool-resume.ts';
@@ -86,6 +86,11 @@ export type ChatState = {
86
86
  /** The answer on its way to a gate, shown on it until the answer settles or fails. */
87
87
  answering: AnsweringGate | null;
88
88
  phase: ComposerRunPhase;
89
+ /**
90
+ * The gate that waits for the person: a confirmation, a permission or a sign-in; `null` when
91
+ * none waits. A page gate, which the page answers, is never one.
92
+ */
93
+ waitingGate: GatedToolContext | null;
89
94
  session: InterfaceTurnSession;
90
95
  /** The latest message's delivery; `null` before the first and once its turn failed. */
91
96
  delivery: MessageDelivery | null;
package/client/chat.js CHANGED
@@ -143,6 +143,7 @@ class Chat {
143
143
  failure: null,
144
144
  answering: null,
145
145
  phase: 'idle',
146
+ waitingGate: null,
146
147
  session: emptyInterfaceTurnSession(),
147
148
  delivery: null,
148
149
  streaming: false,
@@ -462,6 +463,8 @@ class Chat {
462
463
  #set(patch) {
463
464
  const next = { ...this.#state, ...patch };
464
465
  next.phase = this.#busy ? 'streaming' : next.session.gatedTool ? 'gated' : 'idle';
466
+ const gate = next.session.gatedTool;
467
+ next.waitingGate = next.phase === 'gated' && gate && gate.gateKind !== 'page' ? gate : null;
465
468
  this.#state = next;
466
469
  if (this.#flushQueued)
467
470
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theoremjs/web",
3
- "version": "0.3.5-next.978.g2ef222f",
3
+ "version": "0.3.5-next.980.g83e419d",
4
4
  "description": "Theorem on the web platform, with no UI framework: Web-standard server handlers that serve a profile, and the browser client that talks to them.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -25,6 +25,6 @@
25
25
  },
26
26
  "peerDependencies": {
27
27
  "zod": "^4.6.5",
28
- "@theoremjs/agents": "^0.3.5-next.978.g2ef222f"
28
+ "@theoremjs/agents": "^0.3.5-next.980.g83e419d"
29
29
  }
30
30
  }