@runtypelabs/persona 4.2.0 → 4.3.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/README.md +22 -6
- package/dist/animations/glyph-cycle.d.cts +1 -1
- package/dist/animations/glyph-cycle.d.ts +1 -1
- package/dist/animations/{types-B_xbfvR0.d.cts → types-C6tFDxKy.d.cts} +1 -1
- package/dist/animations/{types-B_xbfvR0.d.ts → types-C6tFDxKy.d.ts} +1 -1
- package/dist/animations/wipe.d.cts +1 -1
- package/dist/animations/wipe.d.ts +1 -1
- package/dist/codegen.cjs +6 -6
- package/dist/codegen.js +9 -9
- package/dist/index.cjs +44 -44
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +101 -3
- package/dist/index.d.ts +101 -3
- package/dist/index.global.js +33 -33
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +44 -44
- package/dist/index.js.map +1 -1
- package/dist/install.global.js +1 -1
- package/dist/install.global.js.map +1 -1
- package/dist/launcher.global.js.map +1 -1
- package/dist/smart-dom-reader.d.cts +76 -1
- package/dist/smart-dom-reader.d.ts +76 -1
- package/dist/theme-editor-preview.cjs +35 -35
- package/dist/theme-editor-preview.d.cts +76 -1
- package/dist/theme-editor-preview.d.ts +76 -1
- package/dist/theme-editor-preview.js +37 -37
- package/dist/theme-editor.cjs +1 -1
- package/dist/theme-editor.d.cts +76 -1
- package/dist/theme-editor.d.ts +76 -1
- package/dist/theme-editor.js +1 -1
- package/package.json +1 -1
- package/src/client.test.ts +349 -29
- package/src/client.ts +96 -24
- package/src/defaults.ts +2 -0
- package/src/index-core.ts +2 -0
- package/src/install.ts +9 -1
- package/src/session.ts +6 -3
- package/src/session.voice.test.ts +65 -0
- package/src/types.ts +57 -2
- package/src/utils/__fixtures__/unified-translator.oracle.ts +3 -3
- package/src/utils/code-generators.ts +10 -0
- package/src/utils/target.test.ts +51 -0
- package/src/utils/target.ts +90 -0
|
@@ -1385,6 +1385,32 @@ type RuntypeTurnCompleteEvent = RuntypeStreamEventOf<RuntypeExecutionStreamEvent
|
|
|
1385
1385
|
type RuntypeStepCompleteEvent = RuntypeStreamEventOf<RuntypeFlowSSEEvent, "step_complete">;
|
|
1386
1386
|
type RuntypeStopReasonKind = NonNullable<RuntypeTurnCompleteEvent["stopReason"] | RuntypeStepCompleteEvent["stopReason"]>;
|
|
1387
1387
|
|
|
1388
|
+
/**
|
|
1389
|
+
* Target resolution for the normalized, backend-neutral `target` field.
|
|
1390
|
+
*
|
|
1391
|
+
* `target` is a single string that selects which backend resource a widget
|
|
1392
|
+
* talks to, optimized for a browser widget (always serializable, no live
|
|
1393
|
+
* objects). Three shapes are supported:
|
|
1394
|
+
*
|
|
1395
|
+
* - Runtype TypeID (no prefix): `"agent_…"` / `"flow_…"` route to the
|
|
1396
|
+
* Runtype agent/flow paths. The TypeID prefix is self-describing, so no
|
|
1397
|
+
* wrapper is needed for the common case.
|
|
1398
|
+
* - Provider-prefixed: `"<provider>:<id>"` is handed to the matching
|
|
1399
|
+
* `targetProviders[provider]` resolver, which returns the dispatch payload
|
|
1400
|
+
* fragment for that backend (e.g. `eve`, `langgraph`). `"runtype:…"` is a
|
|
1401
|
+
* built-in that re-detects a TypeID.
|
|
1402
|
+
* - Bare name: `"support"` requires a `targetProviders.default` resolver,
|
|
1403
|
+
* otherwise it throws (a bare name is ambiguous without one).
|
|
1404
|
+
*
|
|
1405
|
+
* Resolvers are registered, not passed as the value, which keeps `target`
|
|
1406
|
+
* itself a plain string that survives script-tag installs, `data-config`,
|
|
1407
|
+
* persisted state, and codegen.
|
|
1408
|
+
*/
|
|
1409
|
+
/** Resolver for a provider-prefixed (or default) target id. */
|
|
1410
|
+
type TargetResolver = (id: string) => {
|
|
1411
|
+
payload: Record<string, unknown>;
|
|
1412
|
+
};
|
|
1413
|
+
|
|
1388
1414
|
/**
|
|
1389
1415
|
* Text content part for multi-modal messages
|
|
1390
1416
|
*/
|
|
@@ -1451,6 +1477,9 @@ type AgentWidgetRequestPayloadMessage = {
|
|
|
1451
1477
|
type AgentWidgetRequestPayload = {
|
|
1452
1478
|
messages: AgentWidgetRequestPayloadMessage[];
|
|
1453
1479
|
flowId?: string;
|
|
1480
|
+
agent?: {
|
|
1481
|
+
agentId: string;
|
|
1482
|
+
};
|
|
1454
1483
|
context?: Record<string, unknown>;
|
|
1455
1484
|
metadata?: Record<string, unknown>;
|
|
1456
1485
|
/** Per-turn template variables for /v1/client/chat (merged as root-level {{var}} in Runtype). */
|
|
@@ -4565,6 +4594,52 @@ type AgentWidgetLoadingIndicatorConfig = {
|
|
|
4565
4594
|
type AgentWidgetConfig = {
|
|
4566
4595
|
apiUrl?: string;
|
|
4567
4596
|
flowId?: string;
|
|
4597
|
+
/**
|
|
4598
|
+
* Persisted Runtype agent ID to execute.
|
|
4599
|
+
*
|
|
4600
|
+
* This is the primary Runtype entry point for simple agent-backed widgets.
|
|
4601
|
+
* It is mutually exclusive with `flowId` and with inline `agent` configs.
|
|
4602
|
+
* Voice and Runtype TTS providers inherit this value unless they specify their
|
|
4603
|
+
* own feature-scoped agent ID.
|
|
4604
|
+
*/
|
|
4605
|
+
agentId?: string;
|
|
4606
|
+
/**
|
|
4607
|
+
* Normalized, backend-neutral routing target. A single string that selects
|
|
4608
|
+
* the backend resource to talk to, optimized for portability across
|
|
4609
|
+
* frameworks (it is always serializable: no live objects).
|
|
4610
|
+
*
|
|
4611
|
+
* Shapes:
|
|
4612
|
+
* - Runtype TypeID (no prefix): `"agent_…"` / `"flow_…"` route to the
|
|
4613
|
+
* Runtype agent/flow paths (the prefix is self-describing).
|
|
4614
|
+
* - Provider-prefixed: `"<provider>:<id>"` is resolved by
|
|
4615
|
+
* `targetProviders[provider]` (e.g. `"eve:support"`). `"runtype:…"` is a
|
|
4616
|
+
* built-in that re-detects a TypeID.
|
|
4617
|
+
* - Bare name: `"support"` requires a `targetProviders.default` resolver.
|
|
4618
|
+
*
|
|
4619
|
+
* Mutually exclusive with `agentId`, `flowId`, and inline `agent`. Prefer
|
|
4620
|
+
* `target` for backend-agnostic apps; use `agentId`/`flowId` for the explicit
|
|
4621
|
+
* Runtype path.
|
|
4622
|
+
*
|
|
4623
|
+
* @example
|
|
4624
|
+
* ```typescript
|
|
4625
|
+
* config: { target: "agent_01k..." } // Runtype agent
|
|
4626
|
+
* config: { target: "flow_01k..." } // Runtype flow
|
|
4627
|
+
* config: { // custom backend
|
|
4628
|
+
* apiUrl: "/api/chat",
|
|
4629
|
+
* target: "eve:support",
|
|
4630
|
+
* targetProviders: { eve: (id) => ({ payload: { assistant: id } }) },
|
|
4631
|
+
* }
|
|
4632
|
+
* ```
|
|
4633
|
+
*/
|
|
4634
|
+
target?: string;
|
|
4635
|
+
/**
|
|
4636
|
+
* Prefix-keyed resolvers for `target` strings of the form
|
|
4637
|
+
* `"<provider>:<id>"`. Each resolver maps the id to the dispatch-payload
|
|
4638
|
+
* fragment its backend expects. Register a `default` resolver to also accept
|
|
4639
|
+
* bare (unprefixed, non-TypeID) target names. The built-in `runtype` provider
|
|
4640
|
+
* is always available and does not need to be registered.
|
|
4641
|
+
*/
|
|
4642
|
+
targetProviders?: Record<string, TargetResolver>;
|
|
4568
4643
|
/**
|
|
4569
4644
|
* Override the assistant-bubble copy shown when a dispatch fails before any
|
|
4570
4645
|
* response streams back (connection refused, CORS, 4xx/5xx, malformed
|
|
@@ -5250,7 +5325,7 @@ type AgentWidgetReasoning = {
|
|
|
5250
5325
|
status: "pending" | "streaming" | "complete";
|
|
5251
5326
|
chunks: string[];
|
|
5252
5327
|
/**
|
|
5253
|
-
* Reasoning channel scope (
|
|
5328
|
+
* Reasoning channel scope (wire spec). `"turn"` is ordinary per-turn
|
|
5254
5329
|
* thinking; `"loop"` is a cross-iteration agent reflection (the fold that
|
|
5255
5330
|
* replaced the legacy `agent_reflection` event). Absent for legacy streams.
|
|
5256
5331
|
*/
|
|
@@ -1385,6 +1385,32 @@ type RuntypeTurnCompleteEvent = RuntypeStreamEventOf<RuntypeExecutionStreamEvent
|
|
|
1385
1385
|
type RuntypeStepCompleteEvent = RuntypeStreamEventOf<RuntypeFlowSSEEvent, "step_complete">;
|
|
1386
1386
|
type RuntypeStopReasonKind = NonNullable<RuntypeTurnCompleteEvent["stopReason"] | RuntypeStepCompleteEvent["stopReason"]>;
|
|
1387
1387
|
|
|
1388
|
+
/**
|
|
1389
|
+
* Target resolution for the normalized, backend-neutral `target` field.
|
|
1390
|
+
*
|
|
1391
|
+
* `target` is a single string that selects which backend resource a widget
|
|
1392
|
+
* talks to, optimized for a browser widget (always serializable, no live
|
|
1393
|
+
* objects). Three shapes are supported:
|
|
1394
|
+
*
|
|
1395
|
+
* - Runtype TypeID (no prefix): `"agent_…"` / `"flow_…"` route to the
|
|
1396
|
+
* Runtype agent/flow paths. The TypeID prefix is self-describing, so no
|
|
1397
|
+
* wrapper is needed for the common case.
|
|
1398
|
+
* - Provider-prefixed: `"<provider>:<id>"` is handed to the matching
|
|
1399
|
+
* `targetProviders[provider]` resolver, which returns the dispatch payload
|
|
1400
|
+
* fragment for that backend (e.g. `eve`, `langgraph`). `"runtype:…"` is a
|
|
1401
|
+
* built-in that re-detects a TypeID.
|
|
1402
|
+
* - Bare name: `"support"` requires a `targetProviders.default` resolver,
|
|
1403
|
+
* otherwise it throws (a bare name is ambiguous without one).
|
|
1404
|
+
*
|
|
1405
|
+
* Resolvers are registered, not passed as the value, which keeps `target`
|
|
1406
|
+
* itself a plain string that survives script-tag installs, `data-config`,
|
|
1407
|
+
* persisted state, and codegen.
|
|
1408
|
+
*/
|
|
1409
|
+
/** Resolver for a provider-prefixed (or default) target id. */
|
|
1410
|
+
type TargetResolver = (id: string) => {
|
|
1411
|
+
payload: Record<string, unknown>;
|
|
1412
|
+
};
|
|
1413
|
+
|
|
1388
1414
|
/**
|
|
1389
1415
|
* Text content part for multi-modal messages
|
|
1390
1416
|
*/
|
|
@@ -1451,6 +1477,9 @@ type AgentWidgetRequestPayloadMessage = {
|
|
|
1451
1477
|
type AgentWidgetRequestPayload = {
|
|
1452
1478
|
messages: AgentWidgetRequestPayloadMessage[];
|
|
1453
1479
|
flowId?: string;
|
|
1480
|
+
agent?: {
|
|
1481
|
+
agentId: string;
|
|
1482
|
+
};
|
|
1454
1483
|
context?: Record<string, unknown>;
|
|
1455
1484
|
metadata?: Record<string, unknown>;
|
|
1456
1485
|
/** Per-turn template variables for /v1/client/chat (merged as root-level {{var}} in Runtype). */
|
|
@@ -4565,6 +4594,52 @@ type AgentWidgetLoadingIndicatorConfig = {
|
|
|
4565
4594
|
type AgentWidgetConfig = {
|
|
4566
4595
|
apiUrl?: string;
|
|
4567
4596
|
flowId?: string;
|
|
4597
|
+
/**
|
|
4598
|
+
* Persisted Runtype agent ID to execute.
|
|
4599
|
+
*
|
|
4600
|
+
* This is the primary Runtype entry point for simple agent-backed widgets.
|
|
4601
|
+
* It is mutually exclusive with `flowId` and with inline `agent` configs.
|
|
4602
|
+
* Voice and Runtype TTS providers inherit this value unless they specify their
|
|
4603
|
+
* own feature-scoped agent ID.
|
|
4604
|
+
*/
|
|
4605
|
+
agentId?: string;
|
|
4606
|
+
/**
|
|
4607
|
+
* Normalized, backend-neutral routing target. A single string that selects
|
|
4608
|
+
* the backend resource to talk to, optimized for portability across
|
|
4609
|
+
* frameworks (it is always serializable: no live objects).
|
|
4610
|
+
*
|
|
4611
|
+
* Shapes:
|
|
4612
|
+
* - Runtype TypeID (no prefix): `"agent_…"` / `"flow_…"` route to the
|
|
4613
|
+
* Runtype agent/flow paths (the prefix is self-describing).
|
|
4614
|
+
* - Provider-prefixed: `"<provider>:<id>"` is resolved by
|
|
4615
|
+
* `targetProviders[provider]` (e.g. `"eve:support"`). `"runtype:…"` is a
|
|
4616
|
+
* built-in that re-detects a TypeID.
|
|
4617
|
+
* - Bare name: `"support"` requires a `targetProviders.default` resolver.
|
|
4618
|
+
*
|
|
4619
|
+
* Mutually exclusive with `agentId`, `flowId`, and inline `agent`. Prefer
|
|
4620
|
+
* `target` for backend-agnostic apps; use `agentId`/`flowId` for the explicit
|
|
4621
|
+
* Runtype path.
|
|
4622
|
+
*
|
|
4623
|
+
* @example
|
|
4624
|
+
* ```typescript
|
|
4625
|
+
* config: { target: "agent_01k..." } // Runtype agent
|
|
4626
|
+
* config: { target: "flow_01k..." } // Runtype flow
|
|
4627
|
+
* config: { // custom backend
|
|
4628
|
+
* apiUrl: "/api/chat",
|
|
4629
|
+
* target: "eve:support",
|
|
4630
|
+
* targetProviders: { eve: (id) => ({ payload: { assistant: id } }) },
|
|
4631
|
+
* }
|
|
4632
|
+
* ```
|
|
4633
|
+
*/
|
|
4634
|
+
target?: string;
|
|
4635
|
+
/**
|
|
4636
|
+
* Prefix-keyed resolvers for `target` strings of the form
|
|
4637
|
+
* `"<provider>:<id>"`. Each resolver maps the id to the dispatch-payload
|
|
4638
|
+
* fragment its backend expects. Register a `default` resolver to also accept
|
|
4639
|
+
* bare (unprefixed, non-TypeID) target names. The built-in `runtype` provider
|
|
4640
|
+
* is always available and does not need to be registered.
|
|
4641
|
+
*/
|
|
4642
|
+
targetProviders?: Record<string, TargetResolver>;
|
|
4568
4643
|
/**
|
|
4569
4644
|
* Override the assistant-bubble copy shown when a dispatch fails before any
|
|
4570
4645
|
* response streams back (connection refused, CORS, 4xx/5xx, malformed
|
|
@@ -5250,7 +5325,7 @@ type AgentWidgetReasoning = {
|
|
|
5250
5325
|
status: "pending" | "streaming" | "complete";
|
|
5251
5326
|
chunks: string[];
|
|
5252
5327
|
/**
|
|
5253
|
-
* Reasoning channel scope (
|
|
5328
|
+
* Reasoning channel scope (wire spec). `"turn"` is ordinary per-turn
|
|
5254
5329
|
* thinking; `"loop"` is a cross-iteration agent reflection (the fold that
|
|
5255
5330
|
* replaced the legacy `agent_reflection` event). Absent for legacy streams.
|
|
5256
5331
|
*/
|