@runtypelabs/persona 4.6.1 → 4.7.0
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/dist/codegen.cjs +1 -1
- package/dist/codegen.js +1 -1
- package/dist/index.cjs +39 -39
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +41 -2
- package/dist/index.d.ts +41 -2
- package/dist/index.global.js +29 -29
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +39 -39
- package/dist/index.js.map +1 -1
- package/dist/theme-editor-preview.cjs +30 -30
- package/dist/theme-editor-preview.js +30 -30
- package/package.json +1 -1
- package/src/client.test.ts +314 -0
- package/src/client.ts +193 -84
- package/src/runtime/persist-state.test.ts +118 -0
- package/src/ui.scroll-additive.test.ts +1 -1
- package/src/ui.streaming-coalescing.test.ts +312 -0
- package/src/ui.ts +235 -105
package/dist/index.d.cts
CHANGED
|
@@ -6200,6 +6200,7 @@ declare class AgentWidgetClient {
|
|
|
6200
6200
|
private sessionInitPromise;
|
|
6201
6201
|
private lastSentClientToolsFingerprint;
|
|
6202
6202
|
private clientToolsFingerprintSessionId;
|
|
6203
|
+
private sentNonEmptyClientToolsSessionId;
|
|
6203
6204
|
private readonly webMcpBridge;
|
|
6204
6205
|
constructor(config?: AgentWidgetConfig);
|
|
6205
6206
|
/**
|
|
@@ -6395,8 +6396,13 @@ declare class AgentWidgetClient {
|
|
|
6395
6396
|
* - **client-token mode**: POST `${apiBase}/v1/client/resume` (the
|
|
6396
6397
|
* session-authenticated sibling of `/v1/client/chat`; runtypelabs/core#3889),
|
|
6397
6398
|
* with the active `sessionId` in the body and no Bearer key: a browser
|
|
6398
|
-
* client-token page holds no secret.
|
|
6399
|
-
*
|
|
6399
|
+
* client-token page holds no secret. The page's tool registry is
|
|
6400
|
+
* re-snapshotted and sent alongside `toolOutputs` via the same diff-only
|
|
6401
|
+
* `clientTools` / `clientToolsFingerprint` protocol as `/v1/client/chat`
|
|
6402
|
+
* (runtypelabs/core#5361), so tools registered by a mid-run page
|
|
6403
|
+
* navigation replace the run's dispatch-time set and become callable on
|
|
6404
|
+
* the next model turn. Old servers strip the unknown fields and keep the
|
|
6405
|
+
* frozen-at-dispatch behavior.
|
|
6400
6406
|
* - **dispatch / proxy mode**: POST `${apiUrl}/resume`: Runtype mounts
|
|
6401
6407
|
* resume as a child of `/v1/dispatch`, so the URL is `${apiUrl}/resume`,
|
|
6402
6408
|
* and proxies follow the same shape (`/api/chat/dispatch/resume`).
|
|
@@ -6408,6 +6414,39 @@ declare class AgentWidgetClient {
|
|
|
6408
6414
|
* @param toolOutputs - Map keyed by per-call `toolCallId` (core#3878),
|
|
6409
6415
|
* falling back to tool name for legacy servers → the tool's result value.
|
|
6410
6416
|
*/
|
|
6417
|
+
/**
|
|
6418
|
+
* Diff-only / send-once WebMCP clientTools transport, shared by the
|
|
6419
|
+
* client-token chat (`/v1/client/chat`) and resume (`/v1/client/resume`)
|
|
6420
|
+
* paths — both routes speak the same protocol (runtypelabs/core#5361).
|
|
6421
|
+
*
|
|
6422
|
+
* Decides, against the shared fingerprint cache, whether this request ships
|
|
6423
|
+
* the full `clientTools[]` + fingerprint (first send under this session, or
|
|
6424
|
+
* a changed set) or the fingerprint alone (unchanged set; the server reuses
|
|
6425
|
+
* its stored copy). Runs `doFetch` with the chosen fields and retries
|
|
6426
|
+
* EXACTLY once with the full array on a
|
|
6427
|
+
* `409 { error: 'client_tools_resend_required' }` registry miss — the retry
|
|
6428
|
+
* is 409-*triggered*, never 409-*expected*, so servers predating the
|
|
6429
|
+
* protocol (which strip the unknown fields and never 409) work unchanged.
|
|
6430
|
+
* The 409 body is probed on a `clone()` so the original response body stays
|
|
6431
|
+
* readable by the caller's error handling.
|
|
6432
|
+
*
|
|
6433
|
+
* The cache is NOT committed here: callers invoke the returned `commit()`
|
|
6434
|
+
* only after the server has accepted the request (response OK / stream
|
|
6435
|
+
* started), so a failed request can never record a fingerprint the server
|
|
6436
|
+
* never stored. A resend-required miss invalidates the cached fingerprint
|
|
6437
|
+
* immediately so later turns keep resending in full until a clean success
|
|
6438
|
+
* commits a fresh one.
|
|
6439
|
+
*
|
|
6440
|
+
* `emptyMeansReplace` (resume only): when the live snapshot is empty but a
|
|
6441
|
+
* non-empty set was committed under this session and never explicitly
|
|
6442
|
+
* cleared (the paused tool navigated to a page with no tool registry), ship
|
|
6443
|
+
* an explicit `clientTools: []` so the server REPLACES the persisted
|
|
6444
|
+
* dispatch-time set with nothing and clears its stored registry. Chat keeps
|
|
6445
|
+
* its omit-when-empty behavior: on `/chat`, absent fields already mean "no
|
|
6446
|
+
* tools this turn", whereas on `/resume` absence means "keep the frozen
|
|
6447
|
+
* dispatch-time set".
|
|
6448
|
+
*/
|
|
6449
|
+
private sendWithClientToolsDiff;
|
|
6411
6450
|
resumeFlow(executionId: string, toolOutputs: Record<string, unknown>, options?: {
|
|
6412
6451
|
streamResponse?: boolean;
|
|
6413
6452
|
signal?: AbortSignal;
|
package/dist/index.d.ts
CHANGED
|
@@ -6200,6 +6200,7 @@ declare class AgentWidgetClient {
|
|
|
6200
6200
|
private sessionInitPromise;
|
|
6201
6201
|
private lastSentClientToolsFingerprint;
|
|
6202
6202
|
private clientToolsFingerprintSessionId;
|
|
6203
|
+
private sentNonEmptyClientToolsSessionId;
|
|
6203
6204
|
private readonly webMcpBridge;
|
|
6204
6205
|
constructor(config?: AgentWidgetConfig);
|
|
6205
6206
|
/**
|
|
@@ -6395,8 +6396,13 @@ declare class AgentWidgetClient {
|
|
|
6395
6396
|
* - **client-token mode**: POST `${apiBase}/v1/client/resume` (the
|
|
6396
6397
|
* session-authenticated sibling of `/v1/client/chat`; runtypelabs/core#3889),
|
|
6397
6398
|
* with the active `sessionId` in the body and no Bearer key: a browser
|
|
6398
|
-
* client-token page holds no secret.
|
|
6399
|
-
*
|
|
6399
|
+
* client-token page holds no secret. The page's tool registry is
|
|
6400
|
+
* re-snapshotted and sent alongside `toolOutputs` via the same diff-only
|
|
6401
|
+
* `clientTools` / `clientToolsFingerprint` protocol as `/v1/client/chat`
|
|
6402
|
+
* (runtypelabs/core#5361), so tools registered by a mid-run page
|
|
6403
|
+
* navigation replace the run's dispatch-time set and become callable on
|
|
6404
|
+
* the next model turn. Old servers strip the unknown fields and keep the
|
|
6405
|
+
* frozen-at-dispatch behavior.
|
|
6400
6406
|
* - **dispatch / proxy mode**: POST `${apiUrl}/resume`: Runtype mounts
|
|
6401
6407
|
* resume as a child of `/v1/dispatch`, so the URL is `${apiUrl}/resume`,
|
|
6402
6408
|
* and proxies follow the same shape (`/api/chat/dispatch/resume`).
|
|
@@ -6408,6 +6414,39 @@ declare class AgentWidgetClient {
|
|
|
6408
6414
|
* @param toolOutputs - Map keyed by per-call `toolCallId` (core#3878),
|
|
6409
6415
|
* falling back to tool name for legacy servers → the tool's result value.
|
|
6410
6416
|
*/
|
|
6417
|
+
/**
|
|
6418
|
+
* Diff-only / send-once WebMCP clientTools transport, shared by the
|
|
6419
|
+
* client-token chat (`/v1/client/chat`) and resume (`/v1/client/resume`)
|
|
6420
|
+
* paths — both routes speak the same protocol (runtypelabs/core#5361).
|
|
6421
|
+
*
|
|
6422
|
+
* Decides, against the shared fingerprint cache, whether this request ships
|
|
6423
|
+
* the full `clientTools[]` + fingerprint (first send under this session, or
|
|
6424
|
+
* a changed set) or the fingerprint alone (unchanged set; the server reuses
|
|
6425
|
+
* its stored copy). Runs `doFetch` with the chosen fields and retries
|
|
6426
|
+
* EXACTLY once with the full array on a
|
|
6427
|
+
* `409 { error: 'client_tools_resend_required' }` registry miss — the retry
|
|
6428
|
+
* is 409-*triggered*, never 409-*expected*, so servers predating the
|
|
6429
|
+
* protocol (which strip the unknown fields and never 409) work unchanged.
|
|
6430
|
+
* The 409 body is probed on a `clone()` so the original response body stays
|
|
6431
|
+
* readable by the caller's error handling.
|
|
6432
|
+
*
|
|
6433
|
+
* The cache is NOT committed here: callers invoke the returned `commit()`
|
|
6434
|
+
* only after the server has accepted the request (response OK / stream
|
|
6435
|
+
* started), so a failed request can never record a fingerprint the server
|
|
6436
|
+
* never stored. A resend-required miss invalidates the cached fingerprint
|
|
6437
|
+
* immediately so later turns keep resending in full until a clean success
|
|
6438
|
+
* commits a fresh one.
|
|
6439
|
+
*
|
|
6440
|
+
* `emptyMeansReplace` (resume only): when the live snapshot is empty but a
|
|
6441
|
+
* non-empty set was committed under this session and never explicitly
|
|
6442
|
+
* cleared (the paused tool navigated to a page with no tool registry), ship
|
|
6443
|
+
* an explicit `clientTools: []` so the server REPLACES the persisted
|
|
6444
|
+
* dispatch-time set with nothing and clears its stored registry. Chat keeps
|
|
6445
|
+
* its omit-when-empty behavior: on `/chat`, absent fields already mean "no
|
|
6446
|
+
* tools this turn", whereas on `/resume` absence means "keep the frozen
|
|
6447
|
+
* dispatch-time set".
|
|
6448
|
+
*/
|
|
6449
|
+
private sendWithClientToolsDiff;
|
|
6411
6450
|
resumeFlow(executionId: string, toolOutputs: Record<string, unknown>, options?: {
|
|
6412
6451
|
streamResponse?: boolean;
|
|
6413
6452
|
signal?: AbortSignal;
|