@runtypelabs/persona 4.2.1 → 4.3.1
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 +32 -32
- 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 +23 -23
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +32 -32
- 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 +27 -27
- package/dist/theme-editor-preview.d.cts +76 -1
- package/dist/theme-editor-preview.d.ts +76 -1
- package/dist/theme-editor-preview.js +29 -29
- 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/dist/widget.css +3 -0
- package/package.json +1 -1
- package/src/client.test.ts +221 -29
- package/src/client.ts +71 -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/styles/widget.css +3 -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
|
@@ -1654,6 +1654,32 @@ type RuntypeTurnCompleteEvent = RuntypeStreamEventOf<RuntypeExecutionStreamEvent
|
|
|
1654
1654
|
type RuntypeStepCompleteEvent = RuntypeStreamEventOf<RuntypeFlowSSEEvent, "step_complete">;
|
|
1655
1655
|
type RuntypeStopReasonKind = NonNullable<RuntypeTurnCompleteEvent["stopReason"] | RuntypeStepCompleteEvent["stopReason"]>;
|
|
1656
1656
|
|
|
1657
|
+
/**
|
|
1658
|
+
* Target resolution for the normalized, backend-neutral `target` field.
|
|
1659
|
+
*
|
|
1660
|
+
* `target` is a single string that selects which backend resource a widget
|
|
1661
|
+
* talks to, optimized for a browser widget (always serializable, no live
|
|
1662
|
+
* objects). Three shapes are supported:
|
|
1663
|
+
*
|
|
1664
|
+
* - Runtype TypeID (no prefix): `"agent_…"` / `"flow_…"` route to the
|
|
1665
|
+
* Runtype agent/flow paths. The TypeID prefix is self-describing, so no
|
|
1666
|
+
* wrapper is needed for the common case.
|
|
1667
|
+
* - Provider-prefixed: `"<provider>:<id>"` is handed to the matching
|
|
1668
|
+
* `targetProviders[provider]` resolver, which returns the dispatch payload
|
|
1669
|
+
* fragment for that backend (e.g. `eve`, `langgraph`). `"runtype:…"` is a
|
|
1670
|
+
* built-in that re-detects a TypeID.
|
|
1671
|
+
* - Bare name: `"support"` requires a `targetProviders.default` resolver,
|
|
1672
|
+
* otherwise it throws (a bare name is ambiguous without one).
|
|
1673
|
+
*
|
|
1674
|
+
* Resolvers are registered, not passed as the value, which keeps `target`
|
|
1675
|
+
* itself a plain string that survives script-tag installs, `data-config`,
|
|
1676
|
+
* persisted state, and codegen.
|
|
1677
|
+
*/
|
|
1678
|
+
/** Resolver for a provider-prefixed (or default) target id. */
|
|
1679
|
+
type TargetResolver = (id: string) => {
|
|
1680
|
+
payload: Record<string, unknown>;
|
|
1681
|
+
};
|
|
1682
|
+
|
|
1657
1683
|
/**
|
|
1658
1684
|
* Text content part for multi-modal messages
|
|
1659
1685
|
*/
|
|
@@ -1720,6 +1746,9 @@ type AgentWidgetRequestPayloadMessage = {
|
|
|
1720
1746
|
type AgentWidgetRequestPayload = {
|
|
1721
1747
|
messages: AgentWidgetRequestPayloadMessage[];
|
|
1722
1748
|
flowId?: string;
|
|
1749
|
+
agent?: {
|
|
1750
|
+
agentId: string;
|
|
1751
|
+
};
|
|
1723
1752
|
context?: Record<string, unknown>;
|
|
1724
1753
|
metadata?: Record<string, unknown>;
|
|
1725
1754
|
/** Per-turn template variables for /v1/client/chat (merged as root-level {{var}} in Runtype). */
|
|
@@ -4751,6 +4780,52 @@ type AgentWidgetLoadingIndicatorConfig = {
|
|
|
4751
4780
|
type AgentWidgetConfig = {
|
|
4752
4781
|
apiUrl?: string;
|
|
4753
4782
|
flowId?: string;
|
|
4783
|
+
/**
|
|
4784
|
+
* Persisted Runtype agent ID to execute.
|
|
4785
|
+
*
|
|
4786
|
+
* This is the primary Runtype entry point for simple agent-backed widgets.
|
|
4787
|
+
* It is mutually exclusive with `flowId` and with inline `agent` configs.
|
|
4788
|
+
* Voice and Runtype TTS providers inherit this value unless they specify their
|
|
4789
|
+
* own feature-scoped agent ID.
|
|
4790
|
+
*/
|
|
4791
|
+
agentId?: string;
|
|
4792
|
+
/**
|
|
4793
|
+
* Normalized, backend-neutral routing target. A single string that selects
|
|
4794
|
+
* the backend resource to talk to, optimized for portability across
|
|
4795
|
+
* frameworks (it is always serializable: no live objects).
|
|
4796
|
+
*
|
|
4797
|
+
* Shapes:
|
|
4798
|
+
* - Runtype TypeID (no prefix): `"agent_…"` / `"flow_…"` route to the
|
|
4799
|
+
* Runtype agent/flow paths (the prefix is self-describing).
|
|
4800
|
+
* - Provider-prefixed: `"<provider>:<id>"` is resolved by
|
|
4801
|
+
* `targetProviders[provider]` (e.g. `"eve:support"`). `"runtype:…"` is a
|
|
4802
|
+
* built-in that re-detects a TypeID.
|
|
4803
|
+
* - Bare name: `"support"` requires a `targetProviders.default` resolver.
|
|
4804
|
+
*
|
|
4805
|
+
* Mutually exclusive with `agentId`, `flowId`, and inline `agent`. Prefer
|
|
4806
|
+
* `target` for backend-agnostic apps; use `agentId`/`flowId` for the explicit
|
|
4807
|
+
* Runtype path.
|
|
4808
|
+
*
|
|
4809
|
+
* @example
|
|
4810
|
+
* ```typescript
|
|
4811
|
+
* config: { target: "agent_01k..." } // Runtype agent
|
|
4812
|
+
* config: { target: "flow_01k..." } // Runtype flow
|
|
4813
|
+
* config: { // custom backend
|
|
4814
|
+
* apiUrl: "/api/chat",
|
|
4815
|
+
* target: "eve:support",
|
|
4816
|
+
* targetProviders: { eve: (id) => ({ payload: { assistant: id } }) },
|
|
4817
|
+
* }
|
|
4818
|
+
* ```
|
|
4819
|
+
*/
|
|
4820
|
+
target?: string;
|
|
4821
|
+
/**
|
|
4822
|
+
* Prefix-keyed resolvers for `target` strings of the form
|
|
4823
|
+
* `"<provider>:<id>"`. Each resolver maps the id to the dispatch-payload
|
|
4824
|
+
* fragment its backend expects. Register a `default` resolver to also accept
|
|
4825
|
+
* bare (unprefixed, non-TypeID) target names. The built-in `runtype` provider
|
|
4826
|
+
* is always available and does not need to be registered.
|
|
4827
|
+
*/
|
|
4828
|
+
targetProviders?: Record<string, TargetResolver>;
|
|
4754
4829
|
/**
|
|
4755
4830
|
* Override the assistant-bubble copy shown when a dispatch fails before any
|
|
4756
4831
|
* response streams back (connection refused, CORS, 4xx/5xx, malformed
|
|
@@ -5436,7 +5511,7 @@ type AgentWidgetReasoning = {
|
|
|
5436
5511
|
status: "pending" | "streaming" | "complete";
|
|
5437
5512
|
chunks: string[];
|
|
5438
5513
|
/**
|
|
5439
|
-
* Reasoning channel scope (
|
|
5514
|
+
* Reasoning channel scope (wire spec). `"turn"` is ordinary per-turn
|
|
5440
5515
|
* thinking; `"loop"` is a cross-iteration agent reflection (the fold that
|
|
5441
5516
|
* replaced the legacy `agent_reflection` event). Absent for legacy streams.
|
|
5442
5517
|
*/
|
|
@@ -1654,6 +1654,32 @@ type RuntypeTurnCompleteEvent = RuntypeStreamEventOf<RuntypeExecutionStreamEvent
|
|
|
1654
1654
|
type RuntypeStepCompleteEvent = RuntypeStreamEventOf<RuntypeFlowSSEEvent, "step_complete">;
|
|
1655
1655
|
type RuntypeStopReasonKind = NonNullable<RuntypeTurnCompleteEvent["stopReason"] | RuntypeStepCompleteEvent["stopReason"]>;
|
|
1656
1656
|
|
|
1657
|
+
/**
|
|
1658
|
+
* Target resolution for the normalized, backend-neutral `target` field.
|
|
1659
|
+
*
|
|
1660
|
+
* `target` is a single string that selects which backend resource a widget
|
|
1661
|
+
* talks to, optimized for a browser widget (always serializable, no live
|
|
1662
|
+
* objects). Three shapes are supported:
|
|
1663
|
+
*
|
|
1664
|
+
* - Runtype TypeID (no prefix): `"agent_…"` / `"flow_…"` route to the
|
|
1665
|
+
* Runtype agent/flow paths. The TypeID prefix is self-describing, so no
|
|
1666
|
+
* wrapper is needed for the common case.
|
|
1667
|
+
* - Provider-prefixed: `"<provider>:<id>"` is handed to the matching
|
|
1668
|
+
* `targetProviders[provider]` resolver, which returns the dispatch payload
|
|
1669
|
+
* fragment for that backend (e.g. `eve`, `langgraph`). `"runtype:…"` is a
|
|
1670
|
+
* built-in that re-detects a TypeID.
|
|
1671
|
+
* - Bare name: `"support"` requires a `targetProviders.default` resolver,
|
|
1672
|
+
* otherwise it throws (a bare name is ambiguous without one).
|
|
1673
|
+
*
|
|
1674
|
+
* Resolvers are registered, not passed as the value, which keeps `target`
|
|
1675
|
+
* itself a plain string that survives script-tag installs, `data-config`,
|
|
1676
|
+
* persisted state, and codegen.
|
|
1677
|
+
*/
|
|
1678
|
+
/** Resolver for a provider-prefixed (or default) target id. */
|
|
1679
|
+
type TargetResolver = (id: string) => {
|
|
1680
|
+
payload: Record<string, unknown>;
|
|
1681
|
+
};
|
|
1682
|
+
|
|
1657
1683
|
/**
|
|
1658
1684
|
* Text content part for multi-modal messages
|
|
1659
1685
|
*/
|
|
@@ -1720,6 +1746,9 @@ type AgentWidgetRequestPayloadMessage = {
|
|
|
1720
1746
|
type AgentWidgetRequestPayload = {
|
|
1721
1747
|
messages: AgentWidgetRequestPayloadMessage[];
|
|
1722
1748
|
flowId?: string;
|
|
1749
|
+
agent?: {
|
|
1750
|
+
agentId: string;
|
|
1751
|
+
};
|
|
1723
1752
|
context?: Record<string, unknown>;
|
|
1724
1753
|
metadata?: Record<string, unknown>;
|
|
1725
1754
|
/** Per-turn template variables for /v1/client/chat (merged as root-level {{var}} in Runtype). */
|
|
@@ -4751,6 +4780,52 @@ type AgentWidgetLoadingIndicatorConfig = {
|
|
|
4751
4780
|
type AgentWidgetConfig = {
|
|
4752
4781
|
apiUrl?: string;
|
|
4753
4782
|
flowId?: string;
|
|
4783
|
+
/**
|
|
4784
|
+
* Persisted Runtype agent ID to execute.
|
|
4785
|
+
*
|
|
4786
|
+
* This is the primary Runtype entry point for simple agent-backed widgets.
|
|
4787
|
+
* It is mutually exclusive with `flowId` and with inline `agent` configs.
|
|
4788
|
+
* Voice and Runtype TTS providers inherit this value unless they specify their
|
|
4789
|
+
* own feature-scoped agent ID.
|
|
4790
|
+
*/
|
|
4791
|
+
agentId?: string;
|
|
4792
|
+
/**
|
|
4793
|
+
* Normalized, backend-neutral routing target. A single string that selects
|
|
4794
|
+
* the backend resource to talk to, optimized for portability across
|
|
4795
|
+
* frameworks (it is always serializable: no live objects).
|
|
4796
|
+
*
|
|
4797
|
+
* Shapes:
|
|
4798
|
+
* - Runtype TypeID (no prefix): `"agent_…"` / `"flow_…"` route to the
|
|
4799
|
+
* Runtype agent/flow paths (the prefix is self-describing).
|
|
4800
|
+
* - Provider-prefixed: `"<provider>:<id>"` is resolved by
|
|
4801
|
+
* `targetProviders[provider]` (e.g. `"eve:support"`). `"runtype:…"` is a
|
|
4802
|
+
* built-in that re-detects a TypeID.
|
|
4803
|
+
* - Bare name: `"support"` requires a `targetProviders.default` resolver.
|
|
4804
|
+
*
|
|
4805
|
+
* Mutually exclusive with `agentId`, `flowId`, and inline `agent`. Prefer
|
|
4806
|
+
* `target` for backend-agnostic apps; use `agentId`/`flowId` for the explicit
|
|
4807
|
+
* Runtype path.
|
|
4808
|
+
*
|
|
4809
|
+
* @example
|
|
4810
|
+
* ```typescript
|
|
4811
|
+
* config: { target: "agent_01k..." } // Runtype agent
|
|
4812
|
+
* config: { target: "flow_01k..." } // Runtype flow
|
|
4813
|
+
* config: { // custom backend
|
|
4814
|
+
* apiUrl: "/api/chat",
|
|
4815
|
+
* target: "eve:support",
|
|
4816
|
+
* targetProviders: { eve: (id) => ({ payload: { assistant: id } }) },
|
|
4817
|
+
* }
|
|
4818
|
+
* ```
|
|
4819
|
+
*/
|
|
4820
|
+
target?: string;
|
|
4821
|
+
/**
|
|
4822
|
+
* Prefix-keyed resolvers for `target` strings of the form
|
|
4823
|
+
* `"<provider>:<id>"`. Each resolver maps the id to the dispatch-payload
|
|
4824
|
+
* fragment its backend expects. Register a `default` resolver to also accept
|
|
4825
|
+
* bare (unprefixed, non-TypeID) target names. The built-in `runtype` provider
|
|
4826
|
+
* is always available and does not need to be registered.
|
|
4827
|
+
*/
|
|
4828
|
+
targetProviders?: Record<string, TargetResolver>;
|
|
4754
4829
|
/**
|
|
4755
4830
|
* Override the assistant-bubble copy shown when a dispatch fails before any
|
|
4756
4831
|
* response streams back (connection refused, CORS, 4xx/5xx, malformed
|
|
@@ -5436,7 +5511,7 @@ type AgentWidgetReasoning = {
|
|
|
5436
5511
|
status: "pending" | "streaming" | "complete";
|
|
5437
5512
|
chunks: string[];
|
|
5438
5513
|
/**
|
|
5439
|
-
* Reasoning channel scope (
|
|
5514
|
+
* Reasoning channel scope (wire spec). `"turn"` is ordinary per-turn
|
|
5440
5515
|
* thinking; `"loop"` is a cross-iteration agent reflection (the fold that
|
|
5441
5516
|
* replaced the legacy `agent_reflection` event). Absent for legacy streams.
|
|
5442
5517
|
*/
|