@runtypelabs/persona 4.6.0 → 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/index.d.cts CHANGED
@@ -812,6 +812,7 @@ type RuntypeExecutionStreamEvent = ({
812
812
  };
813
813
  type: "execution_complete";
814
814
  }) | ({
815
+ blockReason?: string;
815
816
  code?: string;
816
817
  completedAt?: string;
817
818
  error: string | {
@@ -1066,6 +1067,7 @@ type RuntypeExecutionStreamEvent = ({
1066
1067
  startedAt?: string;
1067
1068
  subagent?: {
1068
1069
  agentName?: string;
1070
+ parentToolCallId?: string;
1069
1071
  toolName: string;
1070
1072
  };
1071
1073
  timeout?: number;
@@ -1159,6 +1161,7 @@ type RuntypeFlowSSEEvent = {
1159
1161
  totalTokensUsed?: number;
1160
1162
  type: "flow_complete";
1161
1163
  } | ({
1164
+ blockReason?: string;
1162
1165
  code?: string;
1163
1166
  error: string | {
1164
1167
  code: string;
@@ -1179,6 +1182,7 @@ type RuntypeFlowSSEEvent = {
1179
1182
  type: "flow_error";
1180
1183
  upgradeUrl?: string;
1181
1184
  }) | ({
1185
+ approvalId?: string;
1182
1186
  awaitReason?: string;
1183
1187
  awaitedAt: string;
1184
1188
  crawlId?: string;
@@ -1189,6 +1193,7 @@ type RuntypeFlowSSEEvent = {
1189
1193
  parameters?: Record<string, unknown>;
1190
1194
  seq?: number;
1191
1195
  stepId?: string;
1196
+ timeout?: number;
1192
1197
  toolCallId?: string;
1193
1198
  toolId?: string;
1194
1199
  toolName?: string;
@@ -1431,7 +1436,7 @@ type RuntypeClientInitResponse = {
1431
1436
  welcomeMessage?: string | null;
1432
1437
  };
1433
1438
  expiresAt: string;
1434
- flow: {
1439
+ flow?: {
1435
1440
  description?: string | null;
1436
1441
  id: string;
1437
1442
  name?: string | null;
@@ -1452,6 +1457,10 @@ type RuntypeClientChatRequest = {
1452
1457
  untrustedContentHint?: boolean;
1453
1458
  }>;
1454
1459
  clientToolsFingerprint?: string;
1460
+ identityProof?: {
1461
+ provider: string;
1462
+ token: string;
1463
+ };
1455
1464
  inputs?: Record<string, unknown>;
1456
1465
  messages: Array<{
1457
1466
  content: string | (Array<{
@@ -6191,6 +6200,7 @@ declare class AgentWidgetClient {
6191
6200
  private sessionInitPromise;
6192
6201
  private lastSentClientToolsFingerprint;
6193
6202
  private clientToolsFingerprintSessionId;
6203
+ private sentNonEmptyClientToolsSessionId;
6194
6204
  private readonly webMcpBridge;
6195
6205
  constructor(config?: AgentWidgetConfig);
6196
6206
  /**
@@ -6386,8 +6396,13 @@ declare class AgentWidgetClient {
6386
6396
  * - **client-token mode**: POST `${apiBase}/v1/client/resume` (the
6387
6397
  * session-authenticated sibling of `/v1/client/chat`; runtypelabs/core#3889),
6388
6398
  * with the active `sessionId` in the body and no Bearer key: a browser
6389
- * client-token page holds no secret. `clientTools` are already persisted
6390
- * server-side from the dispatch turn, so only `toolOutputs` is re-sent.
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.
6391
6406
  * - **dispatch / proxy mode**: POST `${apiUrl}/resume`: Runtype mounts
6392
6407
  * resume as a child of `/v1/dispatch`, so the URL is `${apiUrl}/resume`,
6393
6408
  * and proxies follow the same shape (`/api/chat/dispatch/resume`).
@@ -6399,6 +6414,39 @@ declare class AgentWidgetClient {
6399
6414
  * @param toolOutputs - Map keyed by per-call `toolCallId` (core#3878),
6400
6415
  * falling back to tool name for legacy servers → the tool's result value.
6401
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;
6402
6450
  resumeFlow(executionId: string, toolOutputs: Record<string, unknown>, options?: {
6403
6451
  streamResponse?: boolean;
6404
6452
  signal?: AbortSignal;
package/dist/index.d.ts CHANGED
@@ -812,6 +812,7 @@ type RuntypeExecutionStreamEvent = ({
812
812
  };
813
813
  type: "execution_complete";
814
814
  }) | ({
815
+ blockReason?: string;
815
816
  code?: string;
816
817
  completedAt?: string;
817
818
  error: string | {
@@ -1066,6 +1067,7 @@ type RuntypeExecutionStreamEvent = ({
1066
1067
  startedAt?: string;
1067
1068
  subagent?: {
1068
1069
  agentName?: string;
1070
+ parentToolCallId?: string;
1069
1071
  toolName: string;
1070
1072
  };
1071
1073
  timeout?: number;
@@ -1159,6 +1161,7 @@ type RuntypeFlowSSEEvent = {
1159
1161
  totalTokensUsed?: number;
1160
1162
  type: "flow_complete";
1161
1163
  } | ({
1164
+ blockReason?: string;
1162
1165
  code?: string;
1163
1166
  error: string | {
1164
1167
  code: string;
@@ -1179,6 +1182,7 @@ type RuntypeFlowSSEEvent = {
1179
1182
  type: "flow_error";
1180
1183
  upgradeUrl?: string;
1181
1184
  }) | ({
1185
+ approvalId?: string;
1182
1186
  awaitReason?: string;
1183
1187
  awaitedAt: string;
1184
1188
  crawlId?: string;
@@ -1189,6 +1193,7 @@ type RuntypeFlowSSEEvent = {
1189
1193
  parameters?: Record<string, unknown>;
1190
1194
  seq?: number;
1191
1195
  stepId?: string;
1196
+ timeout?: number;
1192
1197
  toolCallId?: string;
1193
1198
  toolId?: string;
1194
1199
  toolName?: string;
@@ -1431,7 +1436,7 @@ type RuntypeClientInitResponse = {
1431
1436
  welcomeMessage?: string | null;
1432
1437
  };
1433
1438
  expiresAt: string;
1434
- flow: {
1439
+ flow?: {
1435
1440
  description?: string | null;
1436
1441
  id: string;
1437
1442
  name?: string | null;
@@ -1452,6 +1457,10 @@ type RuntypeClientChatRequest = {
1452
1457
  untrustedContentHint?: boolean;
1453
1458
  }>;
1454
1459
  clientToolsFingerprint?: string;
1460
+ identityProof?: {
1461
+ provider: string;
1462
+ token: string;
1463
+ };
1455
1464
  inputs?: Record<string, unknown>;
1456
1465
  messages: Array<{
1457
1466
  content: string | (Array<{
@@ -6191,6 +6200,7 @@ declare class AgentWidgetClient {
6191
6200
  private sessionInitPromise;
6192
6201
  private lastSentClientToolsFingerprint;
6193
6202
  private clientToolsFingerprintSessionId;
6203
+ private sentNonEmptyClientToolsSessionId;
6194
6204
  private readonly webMcpBridge;
6195
6205
  constructor(config?: AgentWidgetConfig);
6196
6206
  /**
@@ -6386,8 +6396,13 @@ declare class AgentWidgetClient {
6386
6396
  * - **client-token mode**: POST `${apiBase}/v1/client/resume` (the
6387
6397
  * session-authenticated sibling of `/v1/client/chat`; runtypelabs/core#3889),
6388
6398
  * with the active `sessionId` in the body and no Bearer key: a browser
6389
- * client-token page holds no secret. `clientTools` are already persisted
6390
- * server-side from the dispatch turn, so only `toolOutputs` is re-sent.
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.
6391
6406
  * - **dispatch / proxy mode**: POST `${apiUrl}/resume`: Runtype mounts
6392
6407
  * resume as a child of `/v1/dispatch`, so the URL is `${apiUrl}/resume`,
6393
6408
  * and proxies follow the same shape (`/api/chat/dispatch/resume`).
@@ -6399,6 +6414,39 @@ declare class AgentWidgetClient {
6399
6414
  * @param toolOutputs - Map keyed by per-call `toolCallId` (core#3878),
6400
6415
  * falling back to tool name for legacy servers → the tool's result value.
6401
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;
6402
6450
  resumeFlow(executionId: string, toolOutputs: Record<string, unknown>, options?: {
6403
6451
  streamResponse?: boolean;
6404
6452
  signal?: AbortSignal;