@theoremjs/web 0.3.4-next.401.gec4c582 → 0.3.4-next.405.g57fd3a0
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 +1 -0
- package/client/index.d.ts +1 -1
- package/client/index.js +1 -1
- package/client/transport.d.ts +11 -1
- package/client/transport.js +16 -3
- package/package.json +2 -2
- package/server/mod.d.ts +1 -1
- package/server/mod.js +1 -1
package/README.md
CHANGED
|
@@ -483,6 +483,7 @@ On the browser side, `@theoremjs/web/client` reads what your server sends:
|
|
|
483
483
|
| `ChatLine`, `ChatLineSink` | A checked line, and the callback that receives each one. |
|
|
484
484
|
| `fetchConversation(url, body, options?)` | POSTs a conversation read, and checks the view your server answers. |
|
|
485
485
|
| `fetchRewound(url, body, options?)` | POSTs a rewind, and checks the rewound conversation. |
|
|
486
|
+
| `fetchStarted(url, body, options?)` | POSTs blocks to start a conversation on, and checks the started conversation. |
|
|
486
487
|
| `failedDecisionTraces(err)` | The trace records that a failed decision left, for the trace inspector. |
|
|
487
488
|
|
|
488
489
|
## More documentation
|
package/client/index.d.ts
CHANGED
|
@@ -33,5 +33,5 @@ export { hasLead, layoutResult, type ResultChart, type ResultFigure, type Result
|
|
|
33
33
|
export type { AnsweringGate, ToolDecisionAction, ToolGateResolution, } from './tool-resume.ts';
|
|
34
34
|
export { continueGatedToolInvocation, type PersonGateResolution } from './tool-resume.ts';
|
|
35
35
|
export { createTraceFeed, type TraceFeed } from './trace-feed.ts';
|
|
36
|
-
export { CHAT_LINES, type ChatLine, type ChatLineSink, type ClientTurnEvent, type ConversationLine, type ConversationView, createHttpTransport, fetchConversation, fetchRewound, type HostErrorBody, type HttpOptions, type HttpTransportOptions, hostError, isTheoremStreamError, type MalformedEvent, postJson, postNdjson, readNdjsonStream, type TheoremConversationRequest, type TheoremInvokeRequest, type TheoremReplay, type TheoremRewindRequest, type TheoremRewound, type TheoremSteerRequest, TheoremStreamError, type TheoremTransport, type TheoremTurnInput, type TheoremTurnRequest, type TurnEventSink, type UnsupportedEvent, type WireLines, } from './transport.ts';
|
|
36
|
+
export { CHAT_LINES, type ChatLine, type ChatLineSink, type ClientTurnEvent, type ConversationLine, type ConversationView, createHttpTransport, fetchConversation, fetchRewound, fetchStarted, type HostErrorBody, type HttpOptions, type HttpTransportOptions, hostError, isTheoremStreamError, type MalformedEvent, postJson, postNdjson, readNdjsonStream, type TheoremConversationRequest, type TheoremInvokeRequest, type TheoremReplay, type TheoremRewindRequest, type TheoremRewound, type TheoremStartRequest, type TheoremSteerRequest, TheoremStreamError, type TheoremTransport, type TheoremTurnInput, type TheoremTurnRequest, type TurnEventSink, type UnsupportedEvent, type WireLines, } from './transport.ts';
|
|
37
37
|
export { buildInvokeRequest, buildTurnRequest, foldAssistantTurn, issuedOperationId, type RunScope, type WalkAway, } from './turn-client.ts';
|
package/client/index.js
CHANGED
|
@@ -27,5 +27,5 @@ export { DOT_FLOATS, FRAME_SLOT, queryGeometry, SEGMENT_FLOATS, spaceGeometry, }
|
|
|
27
27
|
export { hasLead, layoutResult, returnedMedia, timeFormats, } from "./tool-result.js";
|
|
28
28
|
export { continueGatedToolInvocation } from "./tool-resume.js";
|
|
29
29
|
export { createTraceFeed } from "./trace-feed.js";
|
|
30
|
-
export { CHAT_LINES, createHttpTransport, fetchConversation, fetchRewound, hostError, isTheoremStreamError, postJson, postNdjson, readNdjsonStream, TheoremStreamError, } from "./transport.js";
|
|
30
|
+
export { CHAT_LINES, createHttpTransport, fetchConversation, fetchRewound, fetchStarted, hostError, isTheoremStreamError, postJson, postNdjson, readNdjsonStream, TheoremStreamError, } from "./transport.js";
|
|
31
31
|
export { buildInvokeRequest, buildTurnRequest, foldAssistantTurn, issuedOperationId, } from "./turn-client.js";
|
package/client/transport.d.ts
CHANGED
|
@@ -158,7 +158,13 @@ export type TheoremRewindRequest = {
|
|
|
158
158
|
};
|
|
159
159
|
/** A `/rewind` body as `createTheoremHandler` reads it. */
|
|
160
160
|
export declare const theoremRewindRequestSchema: z.ZodType<TheoremRewindRequest>;
|
|
161
|
-
/**
|
|
161
|
+
/** Start a conversation on blocks the host wrote, not ran: a `/conversation/start` body. */
|
|
162
|
+
export type TheoremStartRequest = {
|
|
163
|
+
blocks: TranscriptBlock[];
|
|
164
|
+
};
|
|
165
|
+
/** A `/conversation/start` body as a host reads it. */
|
|
166
|
+
export declare const theoremStartRequestSchema: z.ZodType<TheoremStartRequest>;
|
|
167
|
+
/** A rewound or started conversation: its new ref, and what the browser draws. */
|
|
162
168
|
export type TheoremRewound = {
|
|
163
169
|
conversation: string;
|
|
164
170
|
view: ConversationView;
|
|
@@ -256,6 +262,10 @@ export declare function fetchConversation(url: string, body: unknown, options?:
|
|
|
256
262
|
export declare function fetchRewound(url: string, body: unknown, options?: HttpOptions & {
|
|
257
263
|
signal?: AbortSignal;
|
|
258
264
|
}): Promise<TheoremRewound>;
|
|
265
|
+
/** POST blocks to start a conversation on to `url`, and check the conversation the host answers. */
|
|
266
|
+
export declare function fetchStarted(url: string, body: unknown, options?: HttpOptions & {
|
|
267
|
+
signal?: AbortSignal;
|
|
268
|
+
}): Promise<TheoremRewound>;
|
|
259
269
|
export type HttpTransportOptions = HttpOptions & {
|
|
260
270
|
/** Base URL where `createTheoremHandler` is mounted. Default `/api/theorem`. */
|
|
261
271
|
endpoint?: string;
|
package/client/transport.js
CHANGED
|
@@ -112,6 +112,10 @@ const theoremRewindRequest = z.object({
|
|
|
112
112
|
true;
|
|
113
113
|
/** A `/rewind` body as `createTheoremHandler` reads it. */
|
|
114
114
|
export const theoremRewindRequestSchema = theoremRewindRequest;
|
|
115
|
+
const theoremStartRequest = z.object({ blocks: z.array(transcriptBlockSchema) });
|
|
116
|
+
true;
|
|
117
|
+
/** A `/conversation/start` body as a host reads it. */
|
|
118
|
+
export const theoremStartRequestSchema = theoremStartRequest;
|
|
115
119
|
const theoremRewound = z.object({ conversation: z.string().min(1), view: conversationView });
|
|
116
120
|
true;
|
|
117
121
|
/**
|
|
@@ -295,10 +299,19 @@ export async function fetchConversation(url, body, options = {}) {
|
|
|
295
299
|
// labels-exempt: internal diagnostic; the user reads error.bad_response
|
|
296
300
|
return checkWire(conversationView, await fetchJson(url, { body, signal }, http), 'the conversation');
|
|
297
301
|
}
|
|
298
|
-
|
|
299
|
-
export async function fetchRewound(url, body, options = {}) {
|
|
302
|
+
async function fetchConversationRef(url, body, options, what) {
|
|
300
303
|
const { signal, ...http } = options;
|
|
301
|
-
return checkWire(theoremRewound, await fetchJson(url, { body, signal }, http),
|
|
304
|
+
return checkWire(theoremRewound, await fetchJson(url, { body, signal }, http), what);
|
|
305
|
+
}
|
|
306
|
+
/** POST a rewind to `url`, and check the rewound conversation the host answers. */
|
|
307
|
+
export function fetchRewound(url, body, options = {}) {
|
|
308
|
+
// labels-exempt: internal diagnostic; the user reads error.bad_response
|
|
309
|
+
return fetchConversationRef(url, body, options, 'the rewound conversation');
|
|
310
|
+
}
|
|
311
|
+
/** POST blocks to start a conversation on to `url`, and check the conversation the host answers. */
|
|
312
|
+
export function fetchStarted(url, body, options = {}) {
|
|
313
|
+
// labels-exempt: internal diagnostic; the user reads error.bad_response
|
|
314
|
+
return fetchConversationRef(url, body, options, 'the started conversation');
|
|
302
315
|
}
|
|
303
316
|
/** Drops trailing '/'s by scanning back, not with a regex (a `/\/+$/` scan is quadratic on long runs of '/'). */
|
|
304
317
|
function withoutTrailingSlashes(url) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theoremjs/web",
|
|
3
|
-
"version": "0.3.4-next.
|
|
3
|
+
"version": "0.3.4-next.405.g57fd3a0",
|
|
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.
|
|
28
|
+
"@theoremjs/agents": "^0.3.4-next.405.g57fd3a0"
|
|
29
29
|
}
|
|
30
30
|
}
|
package/server/mod.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export { theoremHostCallRequestSchema } from '../client/host-transport.ts';
|
|
9
9
|
export type { LiveClientMessage, LiveOpenMessage } from '../client/live-messages.ts';
|
|
10
|
-
export { theoremConversationRequestSchema, theoremInvokeRequestSchema, theoremReplaySchema, theoremRewindRequestSchema, theoremSteerRequestSchema, theoremTurnRequestSchema, } from '../client/transport.ts';
|
|
10
|
+
export { theoremConversationRequestSchema, theoremInvokeRequestSchema, theoremReplaySchema, theoremRewindRequestSchema, theoremStartRequestSchema, theoremSteerRequestSchema, theoremTurnRequestSchema, } from '../client/transport.ts';
|
|
11
11
|
export { answerReply, type ConversationHost, type ConversationUse, conversationView, type IssuedWalkAway, messageReply, type OpenedConversation, openConversation, type PostedMessage, postedMessage, type ReplyLine, type ReplyRunner, type ReplyTurn, readerConversationHost, rewindConversation, startConversation, statelessRefusal, type WalkedAwayCall, waitingCalls, } from './conversation.ts';
|
|
12
12
|
export { type ConversationSnapshot, type ConversationWriteResult, createMemoryConversationStore, createSealedConversationStore, emptyConversation, type PausedReply, type SealedConversationStoreOptions, type StoredConversation, storedConversationSchema, type TheoremConversationStore, unknownConversation, } from './conversation-store.ts';
|
|
13
13
|
export { createMemoryCredentialStore, type TheoremCredentialStore, type TheoremCredentials, } from './credential-store.ts';
|
package/server/mod.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @module
|
|
7
7
|
*/
|
|
8
8
|
export { theoremHostCallRequestSchema } from "../client/host-transport.js";
|
|
9
|
-
export { theoremConversationRequestSchema, theoremInvokeRequestSchema, theoremReplaySchema, theoremRewindRequestSchema, theoremSteerRequestSchema, theoremTurnRequestSchema, } from "../client/transport.js";
|
|
9
|
+
export { theoremConversationRequestSchema, theoremInvokeRequestSchema, theoremReplaySchema, theoremRewindRequestSchema, theoremStartRequestSchema, theoremSteerRequestSchema, theoremTurnRequestSchema, } from "../client/transport.js";
|
|
10
10
|
export { answerReply, conversationView, messageReply, openConversation, postedMessage, readerConversationHost, rewindConversation, startConversation, statelessRefusal, waitingCalls, } from "./conversation.js";
|
|
11
11
|
export { createMemoryConversationStore, createSealedConversationStore, emptyConversation, storedConversationSchema, unknownConversation, } from "./conversation-store.js";
|
|
12
12
|
export { createMemoryCredentialStore, } from "./credential-store.js";
|