@theoremjs/web 0.3.4-next.425.gd676bc4 → 0.3.4-next.429.g04f32ef

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
@@ -189,6 +189,7 @@ await chat.submit();
189
189
  | `enqueue('queue')` | Keeps the draft to send after the reply. When the reply ends without a failure and no gate waits, the first queued message is sent. |
190
190
  | `enqueue('stash')` | Keeps the draft without sending it. `queuePending(id)` moves it to the queue. |
191
191
  | `sendNow(message?)` | Sends a pending message, or the draft, at once. A streaming reply is stopped first, as `stop()` stops it. A reply that waits on gates is left. |
192
+ | `movePending(id, direction)` | Moves a pending message one place `'up'` or `'down'` among the messages of its kind. `composerPendingMoves(messages, id)` from `@theoremjs/agents/interface` says which ways it can go, so a control that can do nothing is not drawn. |
192
193
  | `restorePending(id)` | Puts a pending message back in the composer. The draft that was there is stashed first, so the user loses nothing. |
193
194
  | `stop()` | Stops the streaming reply with `transport.stop`. What the reply said before the stop stays in the transcript and the history, closed as cancelled. A queued message stays queued. When the host refuses the stop, the controller drops the stream instead, and a host that keeps the conversation keeps the stopped reply where the page can't read it. |
194
195
  | `decide(action)`, `authenticate(secret?)` | Answer the gate that the reply waits on. |
package/client/chat.d.ts CHANGED
@@ -133,6 +133,8 @@ export type ChatController = {
133
133
  restorePending(id: string): Promise<void>;
134
134
  /** Moves a stashed message into the queue. At idle, the queue starts sending. */
135
135
  queuePending(id: string): void;
136
+ /** Moves a pending message one place up or down among those of its kind; `composerPendingMoves` says which ways it can go. */
137
+ movePending(id: string, direction: 'up' | 'down'): void;
136
138
  /** Answers the gate the reply waits on. */
137
139
  decide(action: ToolDecisionAction): Promise<void>;
138
140
  /** The visitor signed in for the gated call, or gave its secret. */
package/client/chat.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { TheoremError } from '@theoremjs/agents';
2
- import { branchInterfaceTurnSession, consumeNextComposerQueue, convertSteersToFrontQueued, createComposerPendingMessage, defaultInterfaceEffort, emptyInterfaceTurnSession, orderComposerPendingMessages, promoteComposerPendingKind, removeComposerPendingMessage, removeLandedSteers, userDraftHasPayload, userDraftToSteerInject, } from '@theoremjs/agents/interface';
2
+ import { branchInterfaceTurnSession, consumeNextComposerQueue, convertSteersToFrontQueued, createComposerPendingMessage, defaultInterfaceEffort, emptyInterfaceTurnSession, moveComposerPendingWithinKind, orderComposerPendingMessages, promoteComposerPendingKind, removeComposerPendingMessage, removeLandedSteers, userDraftHasPayload, userDraftToSteerInject, } from '@theoremjs/agents/interface';
3
3
  import { composerHasPayload } from "./composer-primary.js";
4
4
  import { composerFieldsFromDraft } from "./decode-composer-draft.js";
5
5
  import { encodeComposerDraft } from "./encode-composer-draft.js";
@@ -276,6 +276,11 @@ class Chat {
276
276
  pendingMessages: promoteComposerPendingKind(this.#state.pendingMessages, id, 'queue'),
277
277
  });
278
278
  };
279
+ movePending = (id, direction) => {
280
+ this.#set({
281
+ pendingMessages: moveComposerPendingWithinKind(this.#state.pendingMessages, id, direction),
282
+ });
283
+ };
279
284
  decide = (action) => this.#answerGate({ action });
280
285
  authenticate = (secret) => this.#answerGate({ action: 'auth', ...(secret === undefined ? {} : { secret }) });
281
286
  branch = async (index) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theoremjs/web",
3
- "version": "0.3.4-next.425.gd676bc4",
3
+ "version": "0.3.4-next.429.g04f32ef",
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.4-next.425.gd676bc4"
28
+ "@theoremjs/agents": "^0.3.4-next.429.g04f32ef"
29
29
  }
30
30
  }