@runtypelabs/cli 2.31.3 → 2.31.5
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.js +166 -124
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -15786,7 +15786,7 @@ function resolveFallback(parsed, context, tracking, options = {}) {
|
|
|
15786
15786
|
}
|
|
15787
15787
|
var templateEngine = new SimpleTemplateEngine();
|
|
15788
15788
|
|
|
15789
|
-
// ../shared/dist/chunk-
|
|
15789
|
+
// ../shared/dist/chunk-3DRXBLKO.mjs
|
|
15790
15790
|
var tokensSchema = external_exports.object({ input: external_exports.number(), output: external_exports.number() });
|
|
15791
15791
|
var wireStopReasonSchema = external_exports.enum([
|
|
15792
15792
|
"end_turn",
|
|
@@ -15860,6 +15860,10 @@ var unifiedExecutionCompleteEventSchema = external_exports.object({
|
|
|
15860
15860
|
stopReason: external_exports.string().optional(),
|
|
15861
15861
|
totalCost: external_exports.number().optional(),
|
|
15862
15862
|
totalTokens: tokensSchema.optional(),
|
|
15863
|
+
// Flow-level total token scalar forwarded from the engine's `flow_complete`
|
|
15864
|
+
// (matches the per-step `tokensUsed` scalar on `step_complete`). Debug-only:
|
|
15865
|
+
// FilteredStream strips it for user-facing streams.
|
|
15866
|
+
totalTokensUsed: external_exports.number().optional(),
|
|
15863
15867
|
totalSteps: external_exports.number().optional(),
|
|
15864
15868
|
successfulSteps: external_exports.number().optional(),
|
|
15865
15869
|
failedSteps: external_exports.number().optional(),
|
|
@@ -16116,7 +16120,11 @@ var unifiedToolCompleteEventSchema = external_exports.object({
|
|
|
16116
16120
|
error: external_exports.string().optional(),
|
|
16117
16121
|
executionTime: external_exports.number().optional(),
|
|
16118
16122
|
iteration: external_exports.number().optional(),
|
|
16119
|
-
stepId: external_exports.string().optional()
|
|
16123
|
+
stepId: external_exports.string().optional(),
|
|
16124
|
+
// Debug-only per-tool cost forwarded from the engine's flow `tool_complete`.
|
|
16125
|
+
// FilteredStream strips it for user-facing streams (same gating as
|
|
16126
|
+
// `step_complete.cost`).
|
|
16127
|
+
toolCost: external_exports.number().optional()
|
|
16120
16128
|
});
|
|
16121
16129
|
var unifiedSubagentAttributionSchema = external_exports.object({
|
|
16122
16130
|
toolName: external_exports.string(),
|
|
@@ -39101,6 +39109,13 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
39101
39109
|
"claude-opus-4.8-fast": {
|
|
39102
39110
|
"vercel": "anthropic/claude-opus-4.8-fast"
|
|
39103
39111
|
},
|
|
39112
|
+
"claude-opus-5": {
|
|
39113
|
+
"anthropic": "claude-opus-5",
|
|
39114
|
+
"vercel": "anthropic/claude-opus-5"
|
|
39115
|
+
},
|
|
39116
|
+
"claude-opus-5-fast": {
|
|
39117
|
+
"vercel": "anthropic/claude-opus-5-fast"
|
|
39118
|
+
},
|
|
39104
39119
|
"claude-sonnet-4": {
|
|
39105
39120
|
"vercel": "anthropic/claude-sonnet-4"
|
|
39106
39121
|
},
|
|
@@ -39134,6 +39149,12 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
39134
39149
|
"command-a": {
|
|
39135
39150
|
"vercel": "cohere/command-a"
|
|
39136
39151
|
},
|
|
39152
|
+
"deep-research-max-preview-04-2026": {
|
|
39153
|
+
"google": "deep-research-max-preview-04-2026"
|
|
39154
|
+
},
|
|
39155
|
+
"deep-research-preview-04-2026": {
|
|
39156
|
+
"google": "deep-research-preview-04-2026"
|
|
39157
|
+
},
|
|
39137
39158
|
"deepcogito/cogito-v2-1-671b": {
|
|
39138
39159
|
"togetherai": "togetherai/deepcogito/cogito-v2-1-671b"
|
|
39139
39160
|
},
|
|
@@ -39159,6 +39180,9 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
39159
39180
|
"fugu-ultra": {
|
|
39160
39181
|
"vercel": "sakana/fugu-ultra"
|
|
39161
39182
|
},
|
|
39183
|
+
"gemini-2-5-computer-use-preview-10-2025": {
|
|
39184
|
+
"google": "gemini-2.5-computer-use-preview-10-2025"
|
|
39185
|
+
},
|
|
39162
39186
|
"gemini-2-5-flash": {
|
|
39163
39187
|
"google": "gemini-2.5-flash",
|
|
39164
39188
|
"vercel": "google/gemini-2.5-flash"
|
|
@@ -39175,6 +39199,9 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
39175
39199
|
"google": "gemini-2.5-pro",
|
|
39176
39200
|
"vercel": "google/gemini-2.5-pro"
|
|
39177
39201
|
},
|
|
39202
|
+
"gemini-2.5-computer-use-preview-10-2025": {
|
|
39203
|
+
"google": "gemini-2.5-computer-use-preview-10-2025"
|
|
39204
|
+
},
|
|
39178
39205
|
"gemini-2.5-flash": {
|
|
39179
39206
|
"google": "gemini-2.5-flash",
|
|
39180
39207
|
"vercel": "google/gemini-2.5-flash"
|
|
@@ -39192,6 +39219,7 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
39192
39219
|
"vercel": "google/gemini-2.5-pro"
|
|
39193
39220
|
},
|
|
39194
39221
|
"gemini-3-1-flash-image": {
|
|
39222
|
+
"google": "gemini-3.1-flash-image",
|
|
39195
39223
|
"vercel": "google/gemini-3.1-flash-image"
|
|
39196
39224
|
},
|
|
39197
39225
|
"gemini-3-1-flash-lite": {
|
|
@@ -39199,8 +39227,12 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
39199
39227
|
"vercel": "google/gemini-3.1-flash-lite"
|
|
39200
39228
|
},
|
|
39201
39229
|
"gemini-3-1-flash-lite-image": {
|
|
39230
|
+
"google": "gemini-3.1-flash-lite-image",
|
|
39202
39231
|
"vercel": "google/gemini-3.1-flash-lite-image"
|
|
39203
39232
|
},
|
|
39233
|
+
"gemini-3-1-flash-live": {
|
|
39234
|
+
"google": "gemini-3.1-flash-live-preview"
|
|
39235
|
+
},
|
|
39204
39236
|
"gemini-3-1-pro": {
|
|
39205
39237
|
"google": "gemini-3.1-pro-preview",
|
|
39206
39238
|
"vercel": "google/gemini-3.1-pro-preview"
|
|
@@ -39216,6 +39248,9 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
39216
39248
|
"google": "gemini-3.5-flash-lite",
|
|
39217
39249
|
"vercel": "google/gemini-3.5-flash-lite"
|
|
39218
39250
|
},
|
|
39251
|
+
"gemini-3-5-live-translate": {
|
|
39252
|
+
"google": "gemini-3.5-live-translate-preview"
|
|
39253
|
+
},
|
|
39219
39254
|
"gemini-3-6-flash": {
|
|
39220
39255
|
"google": "gemini-3.6-flash",
|
|
39221
39256
|
"vercel": "google/gemini-3.6-flash"
|
|
@@ -39234,6 +39269,7 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
39234
39269
|
"google": "gemini-3-pro-image-preview"
|
|
39235
39270
|
},
|
|
39236
39271
|
"gemini-3.1-flash-image": {
|
|
39272
|
+
"google": "gemini-3.1-flash-image",
|
|
39237
39273
|
"vercel": "google/gemini-3.1-flash-image"
|
|
39238
39274
|
},
|
|
39239
39275
|
"gemini-3.1-flash-lite": {
|
|
@@ -39241,8 +39277,12 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
39241
39277
|
"vercel": "google/gemini-3.1-flash-lite"
|
|
39242
39278
|
},
|
|
39243
39279
|
"gemini-3.1-flash-lite-image": {
|
|
39280
|
+
"google": "gemini-3.1-flash-lite-image",
|
|
39244
39281
|
"vercel": "google/gemini-3.1-flash-lite-image"
|
|
39245
39282
|
},
|
|
39283
|
+
"gemini-3.1-flash-live-preview": {
|
|
39284
|
+
"google": "gemini-3.1-flash-live-preview"
|
|
39285
|
+
},
|
|
39246
39286
|
"gemini-3.1-pro-preview": {
|
|
39247
39287
|
"google": "gemini-3.1-pro-preview",
|
|
39248
39288
|
"vercel": "google/gemini-3.1-pro-preview"
|
|
@@ -39258,6 +39298,9 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
39258
39298
|
"google": "gemini-3.5-flash-lite",
|
|
39259
39299
|
"vercel": "google/gemini-3.5-flash-lite"
|
|
39260
39300
|
},
|
|
39301
|
+
"gemini-3.5-live-translate-preview": {
|
|
39302
|
+
"google": "gemini-3.5-live-translate-preview"
|
|
39303
|
+
},
|
|
39261
39304
|
"gemini-3.6-flash": {
|
|
39262
39305
|
"google": "gemini-3.6-flash",
|
|
39263
39306
|
"vercel": "google/gemini-3.6-flash"
|
|
@@ -39265,12 +39308,21 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
39265
39308
|
"gemini-embedding-001": {
|
|
39266
39309
|
"google": "gemini-embedding-001"
|
|
39267
39310
|
},
|
|
39311
|
+
"gemini-embedding-2": {
|
|
39312
|
+
"google": "gemini-embedding-2"
|
|
39313
|
+
},
|
|
39268
39314
|
"gemini-omni-flash": {
|
|
39269
39315
|
"vercel": "google/gemini-omni-flash-preview"
|
|
39270
39316
|
},
|
|
39271
39317
|
"gemini-omni-flash-preview": {
|
|
39272
39318
|
"vercel": "google/gemini-omni-flash-preview"
|
|
39273
39319
|
},
|
|
39320
|
+
"gemini-robotics-er-1-6": {
|
|
39321
|
+
"google": "gemini-robotics-er-1.6-preview"
|
|
39322
|
+
},
|
|
39323
|
+
"gemini-robotics-er-1.6-preview": {
|
|
39324
|
+
"google": "gemini-robotics-er-1.6-preview"
|
|
39325
|
+
},
|
|
39274
39326
|
"gemma-4-26b-a4b-it": {
|
|
39275
39327
|
"google": "gemma-4-26b-a4b-it",
|
|
39276
39328
|
"vercel": "google/gemma-4-26b-a4b-it"
|
|
@@ -39350,15 +39402,12 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
39350
39402
|
"openai": "gpt-5.1"
|
|
39351
39403
|
},
|
|
39352
39404
|
"gpt-5-1-codex": {
|
|
39353
|
-
"openai": "gpt-5.1-codex",
|
|
39354
39405
|
"vercel": "openai/gpt-5.1-codex"
|
|
39355
39406
|
},
|
|
39356
39407
|
"gpt-5-1-codex-max": {
|
|
39357
|
-
"openai": "gpt-5.1-codex-max",
|
|
39358
39408
|
"vercel": "openai/gpt-5.1-codex-max"
|
|
39359
39409
|
},
|
|
39360
39410
|
"gpt-5-1-codex-mini": {
|
|
39361
|
-
"openai": "gpt-5.1-codex-mini",
|
|
39362
39411
|
"vercel": "openai/gpt-5.1-codex-mini"
|
|
39363
39412
|
},
|
|
39364
39413
|
"gpt-5-2": {
|
|
@@ -39366,7 +39415,6 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
39366
39415
|
"vercel": "openai/gpt-5.2"
|
|
39367
39416
|
},
|
|
39368
39417
|
"gpt-5-2-codex": {
|
|
39369
|
-
"openai": "gpt-5.2-codex",
|
|
39370
39418
|
"vercel": "openai/gpt-5.2-codex"
|
|
39371
39419
|
},
|
|
39372
39420
|
"gpt-5-2-pro": {
|
|
@@ -39420,7 +39468,6 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
39420
39468
|
"vercel": "openai/gpt-5.6-terra"
|
|
39421
39469
|
},
|
|
39422
39470
|
"gpt-5-codex": {
|
|
39423
|
-
"openai": "gpt-5-codex",
|
|
39424
39471
|
"vercel": "openai/gpt-5-codex"
|
|
39425
39472
|
},
|
|
39426
39473
|
"gpt-5-mini": {
|
|
@@ -39439,15 +39486,12 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
39439
39486
|
"openai": "gpt-5.1"
|
|
39440
39487
|
},
|
|
39441
39488
|
"gpt-5.1-codex": {
|
|
39442
|
-
"openai": "gpt-5.1-codex",
|
|
39443
39489
|
"vercel": "openai/gpt-5.1-codex"
|
|
39444
39490
|
},
|
|
39445
39491
|
"gpt-5.1-codex-max": {
|
|
39446
|
-
"openai": "gpt-5.1-codex-max",
|
|
39447
39492
|
"vercel": "openai/gpt-5.1-codex-max"
|
|
39448
39493
|
},
|
|
39449
39494
|
"gpt-5.1-codex-mini": {
|
|
39450
|
-
"openai": "gpt-5.1-codex-mini",
|
|
39451
39495
|
"vercel": "openai/gpt-5.1-codex-mini"
|
|
39452
39496
|
},
|
|
39453
39497
|
"gpt-5.2": {
|
|
@@ -39455,7 +39499,6 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
39455
39499
|
"vercel": "openai/gpt-5.2"
|
|
39456
39500
|
},
|
|
39457
39501
|
"gpt-5.2-codex": {
|
|
39458
|
-
"openai": "gpt-5.2-codex",
|
|
39459
39502
|
"vercel": "openai/gpt-5.2-codex"
|
|
39460
39503
|
},
|
|
39461
39504
|
"gpt-5.2-pro": {
|
|
@@ -39680,6 +39723,12 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
39680
39723
|
"lfm2-24b-a2b": {
|
|
39681
39724
|
"togetherai": "togetherai/LiquidAI/LFM2-24B-A2B"
|
|
39682
39725
|
},
|
|
39726
|
+
"ling-3-0-flash-free": {
|
|
39727
|
+
"vercel": "inclusionai/ling-3.0-flash-free"
|
|
39728
|
+
},
|
|
39729
|
+
"ling-3.0-flash-free": {
|
|
39730
|
+
"vercel": "inclusionai/ling-3.0-flash-free"
|
|
39731
|
+
},
|
|
39683
39732
|
"LiquidAI/LFM2-24B-A2B": {
|
|
39684
39733
|
"togetherai": "togetherai/LiquidAI/LFM2-24B-A2B"
|
|
39685
39734
|
},
|
|
@@ -39704,6 +39753,18 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
39704
39753
|
"llama3-3-70b": {
|
|
39705
39754
|
"vercel": "meta/llama-3.3-70b"
|
|
39706
39755
|
},
|
|
39756
|
+
"lyria-3-clip": {
|
|
39757
|
+
"google": "lyria-3-clip-preview"
|
|
39758
|
+
},
|
|
39759
|
+
"lyria-3-clip-preview": {
|
|
39760
|
+
"google": "lyria-3-clip-preview"
|
|
39761
|
+
},
|
|
39762
|
+
"lyria-3-pro": {
|
|
39763
|
+
"google": "lyria-3-pro-preview"
|
|
39764
|
+
},
|
|
39765
|
+
"lyria-3-pro-preview": {
|
|
39766
|
+
"google": "lyria-3-pro-preview"
|
|
39767
|
+
},
|
|
39707
39768
|
"magistral-medium": {
|
|
39708
39769
|
"vercel": "mistral/magistral-medium"
|
|
39709
39770
|
},
|
|
@@ -39832,25 +39893,6 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
39832
39893
|
"nvidia/nemotron-3-ultra-550b-a55b": {
|
|
39833
39894
|
"togetherai": "togetherai/nvidia/nemotron-3-ultra-550b-a55b"
|
|
39834
39895
|
},
|
|
39835
|
-
"o3": {
|
|
39836
|
-
"openai": "o3",
|
|
39837
|
-
"vercel": "openai/o3"
|
|
39838
|
-
},
|
|
39839
|
-
"o3-deep-research": {
|
|
39840
|
-
"openai": "o3-deep-research",
|
|
39841
|
-
"vercel": "openai/o3-deep-research"
|
|
39842
|
-
},
|
|
39843
|
-
"o3-pro": {
|
|
39844
|
-
"openai": "o3-pro",
|
|
39845
|
-
"vercel": "openai/o3-pro"
|
|
39846
|
-
},
|
|
39847
|
-
"o4-mini": {
|
|
39848
|
-
"openai": "o4-mini",
|
|
39849
|
-
"vercel": "openai/o4-mini"
|
|
39850
|
-
},
|
|
39851
|
-
"o4-mini-deep-research": {
|
|
39852
|
-
"openai": "o4-mini-deep-research"
|
|
39853
|
-
},
|
|
39854
39896
|
"openai/gpt-oss-120b": {
|
|
39855
39897
|
"togetherai": "togetherai/openai/gpt-oss-120b"
|
|
39856
39898
|
},
|
|
@@ -68267,8 +68309,8 @@ import { execFileSync } from "child_process";
|
|
|
68267
68309
|
// src/lib/persona-init.ts
|
|
68268
68310
|
init_credential_store();
|
|
68269
68311
|
|
|
68270
|
-
// ../../node_modules/.pnpm/@runtypelabs+persona@4.
|
|
68271
|
-
var w = "4.
|
|
68312
|
+
// ../../node_modules/.pnpm/@runtypelabs+persona@4.10.0/node_modules/@runtypelabs/persona/dist/codegen.js
|
|
68313
|
+
var w = "4.10.0";
|
|
68272
68314
|
var c = w;
|
|
68273
68315
|
function u(e) {
|
|
68274
68316
|
if (e !== void 0) return typeof e == "string" ? e : Array.isArray(e) ? `[${e.map((i) => i.toString()).join(", ")}]` : e.toString();
|
|
@@ -68276,7 +68318,7 @@ function u(e) {
|
|
|
68276
68318
|
function P(e) {
|
|
68277
68319
|
if (e) return { getHeaders: u(e.getHeaders), onFeedback: u(e.onFeedback), onCopy: u(e.onCopy), requestMiddleware: u(e.requestMiddleware), actionHandlers: u(e.actionHandlers), actionParsers: u(e.actionParsers), postprocessMessage: u(e.postprocessMessage), contextProviders: u(e.contextProviders), streamParser: u(e.streamParser) };
|
|
68278
68320
|
}
|
|
68279
|
-
var
|
|
68321
|
+
var x = `({ text, message }: any) => {
|
|
68280
68322
|
const jsonSource = (message as any).rawContent || text || message.content;
|
|
68281
68323
|
if (!jsonSource || typeof jsonSource !== 'string') return null;
|
|
68282
68324
|
let cleanJson = jsonSource
|
|
@@ -68290,7 +68332,7 @@ var S = `({ text, message }: any) => {
|
|
|
68290
68332
|
} catch (e) { return null; }
|
|
68291
68333
|
return null;
|
|
68292
68334
|
}`;
|
|
68293
|
-
var
|
|
68335
|
+
var S = `function(ctx) {
|
|
68294
68336
|
var jsonSource = ctx.message.rawContent || ctx.text || ctx.message.content;
|
|
68295
68337
|
if (!jsonSource || typeof jsonSource !== 'string') return null;
|
|
68296
68338
|
var cleanJson = jsonSource
|
|
@@ -68364,35 +68406,35 @@ function g(e) {
|
|
|
68364
68406
|
}
|
|
68365
68407
|
function m(e, i) {
|
|
68366
68408
|
let n = [];
|
|
68367
|
-
return e.toolCall && (n.push(`${i}toolCall: {`), Object.entries(e.toolCall).forEach(([s,
|
|
68368
|
-
typeof
|
|
68409
|
+
return e.toolCall && (n.push(`${i}toolCall: {`), Object.entries(e.toolCall).forEach(([s, a]) => {
|
|
68410
|
+
typeof a == "string" && n.push(`${i} ${s}: "${a}",`);
|
|
68369
68411
|
}), n.push(`${i}},`)), n;
|
|
68370
68412
|
}
|
|
68371
68413
|
function f(e, i, n) {
|
|
68372
|
-
let s = [],
|
|
68373
|
-
return (
|
|
68374
|
-
r === "onFeedback" || r === "onCopy" || (typeof
|
|
68414
|
+
let s = [], a = e.messageActions && Object.entries(e.messageActions).some(([r, o]) => r !== "onFeedback" && r !== "onCopy" && o !== void 0), t = n?.onFeedback || n?.onCopy;
|
|
68415
|
+
return (a || t) && (s.push(`${i}messageActions: {`), e.messageActions && Object.entries(e.messageActions).forEach(([r, o]) => {
|
|
68416
|
+
r === "onFeedback" || r === "onCopy" || (typeof o == "string" ? s.push(`${i} ${r}: "${o}",`) : typeof o == "boolean" && s.push(`${i} ${r}: ${o},`));
|
|
68375
68417
|
}), n?.onFeedback && s.push(`${i} onFeedback: ${n.onFeedback},`), n?.onCopy && s.push(`${i} onCopy: ${n.onCopy},`), s.push(`${i}},`)), s;
|
|
68376
68418
|
}
|
|
68377
68419
|
function y(e, i) {
|
|
68378
68420
|
let n = [];
|
|
68379
68421
|
if (e.markdown) {
|
|
68380
|
-
let s = e.markdown.options && Object.keys(e.markdown.options).length > 0,
|
|
68381
|
-
(s ||
|
|
68422
|
+
let s = e.markdown.options && Object.keys(e.markdown.options).length > 0, a = e.markdown.disableDefaultStyles !== void 0;
|
|
68423
|
+
(s || a) && (n.push(`${i}markdown: {`), s && (n.push(`${i} options: {`), Object.entries(e.markdown.options).forEach(([t, r]) => {
|
|
68382
68424
|
typeof r == "string" ? n.push(`${i} ${t}: "${r}",`) : typeof r == "boolean" && n.push(`${i} ${t}: ${r},`);
|
|
68383
|
-
}), n.push(`${i} },`)),
|
|
68425
|
+
}), n.push(`${i} },`)), a && n.push(`${i} disableDefaultStyles: ${e.markdown.disableDefaultStyles},`), n.push(`${i}},`));
|
|
68384
68426
|
}
|
|
68385
68427
|
return n;
|
|
68386
68428
|
}
|
|
68387
68429
|
function C(e, i) {
|
|
68388
68430
|
let n = [];
|
|
68389
68431
|
if (e.layout) {
|
|
68390
|
-
let s = e.layout.header && Object.keys(e.layout.header).some((t) => t !== "render"),
|
|
68391
|
-
(s ||
|
|
68432
|
+
let s = e.layout.header && Object.keys(e.layout.header).some((t) => t !== "render"), a = e.layout.messages && Object.keys(e.layout.messages).some((t) => t !== "renderUserMessage" && t !== "renderAssistantMessage");
|
|
68433
|
+
(s || a) && (n.push(`${i}layout: {`), s && (n.push(`${i} header: {`), Object.entries(e.layout.header).forEach(([t, r]) => {
|
|
68392
68434
|
t !== "render" && (typeof r == "string" ? n.push(`${i} ${t}: "${r}",`) : typeof r == "boolean" && n.push(`${i} ${t}: ${r},`));
|
|
68393
|
-
}), n.push(`${i} },`)),
|
|
68394
|
-
t === "renderUserMessage" || t === "renderAssistantMessage" || (t === "avatar" && typeof r == "object" && r !== null ? (n.push(`${i} avatar: {`), Object.entries(r).forEach(([
|
|
68395
|
-
typeof p == "string" ? n.push(`${i} ${
|
|
68435
|
+
}), n.push(`${i} },`)), a && (n.push(`${i} messages: {`), Object.entries(e.layout.messages).forEach(([t, r]) => {
|
|
68436
|
+
t === "renderUserMessage" || t === "renderAssistantMessage" || (t === "avatar" && typeof r == "object" && r !== null ? (n.push(`${i} avatar: {`), Object.entries(r).forEach(([o, p]) => {
|
|
68437
|
+
typeof p == "string" ? n.push(`${i} ${o}: "${p}",`) : typeof p == "boolean" && n.push(`${i} ${o}: ${p},`);
|
|
68396
68438
|
}), n.push(`${i} },`)) : t === "timestamp" && typeof r == "object" && r !== null ? Object.entries(r).some(([p]) => p !== "format") && (n.push(`${i} timestamp: {`), Object.entries(r).forEach(([p, l]) => {
|
|
68397
68439
|
p !== "format" && (typeof l == "string" ? n.push(`${i} ${p}: "${l}",`) : typeof l == "boolean" && n.push(`${i} ${p}: ${l},`));
|
|
68398
68440
|
}), n.push(`${i} },`)) : typeof r == "string" ? n.push(`${i} ${t}: "${r}",`) : typeof r == "boolean" && n.push(`${i} ${t}: ${r},`));
|
|
@@ -68405,17 +68447,17 @@ function $(e, i) {
|
|
|
68405
68447
|
return e && (e.getHeaders && n.push(`${i}getHeaders: ${e.getHeaders},`), e.requestMiddleware && n.push(`${i}requestMiddleware: ${e.requestMiddleware},`), e.actionParsers && n.push(`${i}actionParsers: ${e.actionParsers},`), e.actionHandlers && n.push(`${i}actionHandlers: ${e.actionHandlers},`), e.contextProviders && n.push(`${i}contextProviders: ${e.contextProviders},`), e.streamParser && n.push(`${i}streamParser: ${e.streamParser},`)), n;
|
|
68406
68448
|
}
|
|
68407
68449
|
function O(e, i, n) {
|
|
68408
|
-
Object.entries(i).forEach(([s,
|
|
68409
|
-
if (!(
|
|
68410
|
-
if (Array.isArray(
|
|
68411
|
-
e.push(`${n}${s}: ${JSON.stringify(
|
|
68450
|
+
Object.entries(i).forEach(([s, a]) => {
|
|
68451
|
+
if (!(a === void 0 || typeof a == "function")) {
|
|
68452
|
+
if (Array.isArray(a)) {
|
|
68453
|
+
e.push(`${n}${s}: ${JSON.stringify(a)},`);
|
|
68412
68454
|
return;
|
|
68413
68455
|
}
|
|
68414
|
-
if (
|
|
68415
|
-
e.push(`${n}${s}: {`), O(e,
|
|
68456
|
+
if (a && typeof a == "object") {
|
|
68457
|
+
e.push(`${n}${s}: {`), O(e, a, `${n} `), e.push(`${n}},`);
|
|
68416
68458
|
return;
|
|
68417
68459
|
}
|
|
68418
|
-
e.push(`${n}${s}: ${JSON.stringify(
|
|
68460
|
+
e.push(`${n}${s}: ${JSON.stringify(a)},`);
|
|
68419
68461
|
}
|
|
68420
68462
|
});
|
|
68421
68463
|
}
|
|
@@ -68428,38 +68470,38 @@ function h(e) {
|
|
|
68428
68470
|
function T(e, i = "esm", n) {
|
|
68429
68471
|
let s = { ...e };
|
|
68430
68472
|
delete s.postprocessMessage, delete s.initialMessages;
|
|
68431
|
-
let
|
|
68432
|
-
return i === "esm" ? M(s,
|
|
68473
|
+
let a = n ? { ...n, hooks: P(n.hooks) } : void 0;
|
|
68474
|
+
return i === "esm" ? M(s, a) : i === "script-installer" ? H(s, a) : i === "script-advanced" ? D(s, a) : i === "react-component" ? R(s, a) : i === "react-advanced" ? W(s, a) : N(s, a);
|
|
68433
68475
|
}
|
|
68434
68476
|
function M(e, i) {
|
|
68435
|
-
let n = i?.hooks, s = g(e),
|
|
68436
|
-
return e.apiUrl && t.push(` apiUrl: "${e.apiUrl}",`), e.clientToken && t.push(` clientToken: "${e.clientToken}",`), e.agentId && t.push(` agentId: "${e.agentId}",`), e.target && t.push(` target: "${e.target}",`), e.flowId && t.push(` flowId: "${e.flowId}",`),
|
|
68437
|
-
t.push(` ${r}: "${
|
|
68438
|
-
}), t.push(" },")), e.sendButton && (t.push(" sendButton: {"), Object.entries(e.sendButton).forEach(([r,
|
|
68439
|
-
typeof
|
|
68440
|
-
}), t.push(" },")), e.voiceRecognition && (t.push(" voiceRecognition: {"), Object.entries(e.voiceRecognition).forEach(([r,
|
|
68441
|
-
typeof
|
|
68442
|
-
}), t.push(" },")), e.statusIndicator && (t.push(" statusIndicator: {"), Object.entries(e.statusIndicator).forEach(([r,
|
|
68443
|
-
typeof
|
|
68444
|
-
}), t.push(" },")), e.features && (t.push(" features: {"), Object.entries(e.features).forEach(([r,
|
|
68445
|
-
t.push(` ${r}: ${
|
|
68477
|
+
let n = i?.hooks, s = g(e), a = s !== "plain", t = ["import '@runtypelabs/persona/widget.css';", "import { initAgentWidget, markdownPostprocessor } from '@runtypelabs/persona';", "", "initAgentWidget({", ` target: '${h(i)}',`, " config: {"];
|
|
68478
|
+
return e.apiUrl && t.push(` apiUrl: "${e.apiUrl}",`), e.clientToken && t.push(` clientToken: "${e.clientToken}",`), e.agentId && t.push(` agentId: "${e.agentId}",`), e.target && t.push(` target: "${e.target}",`), e.flowId && t.push(` flowId: "${e.flowId}",`), a && t.push(` parserType: "${s}",`), e.theme && typeof e.theme == "object" && Object.keys(e.theme).length > 0 && d(t, "theme", e.theme, " "), e.launcher && d(t, "launcher", e.launcher, " "), e.copy && (t.push(" copy: {"), Object.entries(e.copy).forEach(([r, o]) => {
|
|
68479
|
+
t.push(` ${r}: "${o}",`);
|
|
68480
|
+
}), t.push(" },")), e.sendButton && (t.push(" sendButton: {"), Object.entries(e.sendButton).forEach(([r, o]) => {
|
|
68481
|
+
typeof o == "string" ? t.push(` ${r}: "${o}",`) : typeof o == "boolean" && t.push(` ${r}: ${o},`);
|
|
68482
|
+
}), t.push(" },")), e.voiceRecognition && (t.push(" voiceRecognition: {"), Object.entries(e.voiceRecognition).forEach(([r, o]) => {
|
|
68483
|
+
typeof o == "string" ? t.push(` ${r}: "${o}",`) : typeof o == "boolean" ? t.push(` ${r}: ${o},`) : typeof o == "number" && t.push(` ${r}: ${o},`);
|
|
68484
|
+
}), t.push(" },")), e.statusIndicator && (t.push(" statusIndicator: {"), Object.entries(e.statusIndicator).forEach(([r, o]) => {
|
|
68485
|
+
typeof o == "string" ? t.push(` ${r}: "${o}",`) : typeof o == "boolean" && t.push(` ${r}: ${o},`);
|
|
68486
|
+
}), t.push(" },")), e.features && (t.push(" features: {"), Object.entries(e.features).forEach(([r, o]) => {
|
|
68487
|
+
t.push(` ${r}: ${o},`);
|
|
68446
68488
|
}), t.push(" },")), e.suggestionChips && e.suggestionChips.length > 0 && (t.push(" suggestionChips: ["), e.suggestionChips.forEach((r) => {
|
|
68447
68489
|
t.push(` "${r}",`);
|
|
68448
68490
|
}), t.push(" ],")), e.suggestionChipsConfig && (t.push(" suggestionChipsConfig: {"), e.suggestionChipsConfig.fontFamily && t.push(` fontFamily: "${e.suggestionChipsConfig.fontFamily}",`), e.suggestionChipsConfig.fontWeight && t.push(` fontWeight: "${e.suggestionChipsConfig.fontWeight}",`), e.suggestionChipsConfig.paddingX && t.push(` paddingX: "${e.suggestionChipsConfig.paddingX}",`), e.suggestionChipsConfig.paddingY && t.push(` paddingY: "${e.suggestionChipsConfig.paddingY}",`), t.push(" },")), t.push(...m(e, " ")), t.push(...f(e, " ", n)), t.push(...y(e, " ")), t.push(...C(e, " ")), t.push(...$(n, " ")), e.debug && t.push(` debug: ${e.debug},`), n?.postprocessMessage ? t.push(` postprocessMessage: ${n.postprocessMessage}`) : t.push(" postprocessMessage: ({ text }) => markdownPostprocessor(text)"), t.push(" }"), t.push("});"), t.join(`
|
|
68449
68491
|
`);
|
|
68450
68492
|
}
|
|
68451
68493
|
function R(e, i) {
|
|
68452
|
-
let n = i?.hooks, s = g(e),
|
|
68453
|
-
return e.apiUrl && t.push(` apiUrl: "${e.apiUrl}",`), e.clientToken && t.push(` clientToken: "${e.clientToken}",`), e.agentId && t.push(` agentId: "${e.agentId}",`), e.target && t.push(` target: "${e.target}",`), e.flowId && t.push(` flowId: "${e.flowId}",`),
|
|
68454
|
-
t.push(` ${r}: "${
|
|
68455
|
-
}), t.push(" },")), e.sendButton && (t.push(" sendButton: {"), Object.entries(e.sendButton).forEach(([r,
|
|
68456
|
-
typeof
|
|
68457
|
-
}), t.push(" },")), e.voiceRecognition && (t.push(" voiceRecognition: {"), Object.entries(e.voiceRecognition).forEach(([r,
|
|
68458
|
-
typeof
|
|
68459
|
-
}), t.push(" },")), e.statusIndicator && (t.push(" statusIndicator: {"), Object.entries(e.statusIndicator).forEach(([r,
|
|
68460
|
-
typeof
|
|
68461
|
-
}), t.push(" },")), e.features && (t.push(" features: {"), Object.entries(e.features).forEach(([r,
|
|
68462
|
-
t.push(` ${r}: ${
|
|
68494
|
+
let n = i?.hooks, s = g(e), a = s !== "plain", t = ["// ChatWidget.tsx", "'use client'; // Required for Next.js - remove for Vite/CRA", "", "import { useEffect } from 'react';", "import '@runtypelabs/persona/widget.css';", "import { initAgentWidget, markdownPostprocessor } from '@runtypelabs/persona';", "import type { AgentWidgetInitHandle } from '@runtypelabs/persona';", "", "export function ChatWidget() {", " useEffect(() => {", " let handle: AgentWidgetInitHandle | null = null;", "", " handle = initAgentWidget({", ` target: '${h(i)}',`, " config: {"];
|
|
68495
|
+
return e.apiUrl && t.push(` apiUrl: "${e.apiUrl}",`), e.clientToken && t.push(` clientToken: "${e.clientToken}",`), e.agentId && t.push(` agentId: "${e.agentId}",`), e.target && t.push(` target: "${e.target}",`), e.flowId && t.push(` flowId: "${e.flowId}",`), a && t.push(` parserType: "${s}",`), e.theme && typeof e.theme == "object" && Object.keys(e.theme).length > 0 && d(t, "theme", e.theme, " "), e.launcher && d(t, "launcher", e.launcher, " "), e.copy && (t.push(" copy: {"), Object.entries(e.copy).forEach(([r, o]) => {
|
|
68496
|
+
t.push(` ${r}: "${o}",`);
|
|
68497
|
+
}), t.push(" },")), e.sendButton && (t.push(" sendButton: {"), Object.entries(e.sendButton).forEach(([r, o]) => {
|
|
68498
|
+
typeof o == "string" ? t.push(` ${r}: "${o}",`) : typeof o == "boolean" && t.push(` ${r}: ${o},`);
|
|
68499
|
+
}), t.push(" },")), e.voiceRecognition && (t.push(" voiceRecognition: {"), Object.entries(e.voiceRecognition).forEach(([r, o]) => {
|
|
68500
|
+
typeof o == "string" ? t.push(` ${r}: "${o}",`) : typeof o == "boolean" ? t.push(` ${r}: ${o},`) : typeof o == "number" && t.push(` ${r}: ${o},`);
|
|
68501
|
+
}), t.push(" },")), e.statusIndicator && (t.push(" statusIndicator: {"), Object.entries(e.statusIndicator).forEach(([r, o]) => {
|
|
68502
|
+
typeof o == "string" ? t.push(` ${r}: "${o}",`) : typeof o == "boolean" && t.push(` ${r}: ${o},`);
|
|
68503
|
+
}), t.push(" },")), e.features && (t.push(" features: {"), Object.entries(e.features).forEach(([r, o]) => {
|
|
68504
|
+
t.push(` ${r}: ${o},`);
|
|
68463
68505
|
}), t.push(" },")), e.suggestionChips && e.suggestionChips.length > 0 && (t.push(" suggestionChips: ["), e.suggestionChips.forEach((r) => {
|
|
68464
68506
|
t.push(` "${r}",`);
|
|
68465
68507
|
}), t.push(" ],")), e.suggestionChipsConfig && (t.push(" suggestionChipsConfig: {"), e.suggestionChipsConfig.fontFamily && t.push(` fontFamily: "${e.suggestionChipsConfig.fontFamily}",`), e.suggestionChipsConfig.fontWeight && t.push(` fontWeight: "${e.suggestionChipsConfig.fontWeight}",`), e.suggestionChipsConfig.paddingX && t.push(` paddingX: "${e.suggestionChipsConfig.paddingX}",`), e.suggestionChipsConfig.paddingY && t.push(` paddingY: "${e.suggestionChipsConfig.paddingY}",`), t.push(" },")), t.push(...m(e, " ")), t.push(...f(e, " ", n)), t.push(...y(e, " ")), t.push(...C(e, " ")), t.push(...$(n, " ")), e.debug && t.push(` debug: ${e.debug},`), n?.postprocessMessage ? t.push(` postprocessMessage: ${n.postprocessMessage}`) : t.push(" postprocessMessage: ({ text }) => markdownPostprocessor(text)"), t.push(" }"), t.push(" });"), t.push(""), t.push(" // Cleanup on unmount"), t.push(" return () => {"), t.push(" if (handle) {"), t.push(" handle.destroy();"), t.push(" }"), t.push(" };"), t.push(" }, []);"), t.push(""), t.push(" return null; // Widget injects itself into the DOM"), t.push("}"), t.push(""), t.push("// Usage in your app:"), t.push("// import { ChatWidget } from './components/ChatWidget';"), t.push("//"), t.push("// export default function App() {"), t.push("// return ("), t.push("// <div>"), t.push("// {/* Your app content */}"), t.push("// <ChatWidget />"), t.push("// </div>"), t.push("// );"), t.push("// }"), t.join(`
|
|
@@ -68467,79 +68509,79 @@ function R(e, i) {
|
|
|
68467
68509
|
}
|
|
68468
68510
|
function W(e, i) {
|
|
68469
68511
|
let n = i?.hooks, s = ["// ChatWidgetAdvanced.tsx", "'use client'; // Required for Next.js - remove for Vite/CRA", "", "import { useEffect } from 'react';", "import '@runtypelabs/persona/widget.css';", "import {", " initAgentWidget,", " createFlexibleJsonStreamParser,", " defaultJsonActionParser,", " defaultActionHandlers,", " markdownPostprocessor", "} from '@runtypelabs/persona';", "import type { AgentWidgetInitHandle } from '@runtypelabs/persona';", "", "const STORAGE_KEY = 'chat-widget-state';", "const PROCESSED_ACTIONS_KEY = 'chat-widget-processed-actions';", "", "// Types for DOM elements", "interface PageElement {", " type: string;", " tagName: string;", " selector: string;", " innerText: string;", " href?: string;", "}", "", "interface DOMContext {", " page_elements: PageElement[];", " page_element_count: number;", " element_types: Record<string, number>;", " page_url: string;", " page_title: string;", " timestamp: string;", "}", "", "// DOM context provider - extracts page elements for AI context", "const collectDOMContext = (): DOMContext => {", " const selectors = {", ` products: '[data-product-id], .product-card, .product-item, [role="article"]',`, ` buttons: 'button, [role="button"], .btn',`, " links: 'a[href]',", " inputs: 'input, textarea, select'", " };", "", " const elements: PageElement[] = [];", " Object.entries(selectors).forEach(([type, selector]) => {", " document.querySelectorAll(selector).forEach((element) => {", " if (!(element instanceof HTMLElement)) return;", " ", " // Exclude elements within the widget", " const widgetHost = element.closest('.persona-host');", " if (widgetHost) return;", " ", " const text = element.innerText?.trim();", " if (!text) return;", "", " const selectorString =", " element.id ? `#${element.id}` :", " element.getAttribute('data-testid') ? `[data-testid=\"${element.getAttribute('data-testid')}\"]` :", " element.getAttribute('data-product-id') ? `[data-product-id=\"${element.getAttribute('data-product-id')}\"]` :", " element.tagName.toLowerCase();", "", " const elementData: PageElement = {", " type,", " tagName: element.tagName.toLowerCase(),", " selector: selectorString,", " innerText: text.substring(0, 200)", " };", "", " if (type === 'links' && element instanceof HTMLAnchorElement && element.href) {", " elementData.href = element.href;", " }", "", " elements.push(elementData);", " });", " });", "", " const counts = elements.reduce((acc, el) => {", " acc[el.type] = (acc[el.type] || 0) + 1;", " return acc;", " }, {} as Record<string, number>);", "", " return {", " page_elements: elements.slice(0, 50),", " page_element_count: elements.length,", " element_types: counts,", " page_url: window.location.href,", " page_title: document.title,", " timestamp: new Date().toISOString()", " };", "};", "", "export function ChatWidgetAdvanced() {", " useEffect(() => {", " let handle: AgentWidgetInitHandle | null = null;", "", " // Load saved state", " const loadSavedMessages = () => {", " const savedState = localStorage.getItem(STORAGE_KEY);", " if (savedState) {", " try {", " const { messages } = JSON.parse(savedState);", " return messages || [];", " } catch (e) {", " console.error('Failed to load saved state:', e);", " }", " }", " return [];", " };", "", " handle = initAgentWidget({", ` target: '${h(i)}',`, " config: {"];
|
|
68470
|
-
return e.apiUrl && s.push(` apiUrl: "${e.apiUrl}",`), e.clientToken && s.push(` clientToken: "${e.clientToken}",`), e.agentId && s.push(` agentId: "${e.agentId}",`), e.target && s.push(` target: "${e.target}",`), e.flowId && s.push(` flowId: "${e.flowId}",`), e.theme && typeof e.theme == "object" && Object.keys(e.theme).length > 0 && d(s, "theme", e.theme, " "), e.launcher && d(s, "launcher", e.launcher, " "), e.copy && (s.push(" copy: {"), Object.entries(e.copy).forEach(([
|
|
68471
|
-
s.push(` ${
|
|
68472
|
-
}), s.push(" },")), e.sendButton && (s.push(" sendButton: {"), Object.entries(e.sendButton).forEach(([
|
|
68473
|
-
typeof t == "string" ? s.push(` ${
|
|
68474
|
-
}), s.push(" },")), e.voiceRecognition && (s.push(" voiceRecognition: {"), Object.entries(e.voiceRecognition).forEach(([
|
|
68475
|
-
typeof t == "string" ? s.push(` ${
|
|
68476
|
-
}), s.push(" },")), e.statusIndicator && (s.push(" statusIndicator: {"), Object.entries(e.statusIndicator).forEach(([
|
|
68477
|
-
typeof t == "string" ? s.push(` ${
|
|
68478
|
-
}), s.push(" },")), e.features && (s.push(" features: {"), Object.entries(e.features).forEach(([
|
|
68479
|
-
s.push(` ${
|
|
68480
|
-
}), s.push(" },")), e.suggestionChips && e.suggestionChips.length > 0 && (s.push(" suggestionChips: ["), e.suggestionChips.forEach((
|
|
68481
|
-
s.push(` "${
|
|
68482
|
-
}), s.push(" ],")), e.suggestionChipsConfig && (s.push(" suggestionChipsConfig: {"), e.suggestionChipsConfig.fontFamily && s.push(` fontFamily: "${e.suggestionChipsConfig.fontFamily}",`), e.suggestionChipsConfig.fontWeight && s.push(` fontWeight: "${e.suggestionChipsConfig.fontWeight}",`), e.suggestionChipsConfig.paddingX && s.push(` paddingX: "${e.suggestionChipsConfig.paddingX}",`), e.suggestionChipsConfig.paddingY && s.push(` paddingY: "${e.suggestionChipsConfig.paddingY}",`), s.push(" },")), s.push(...m(e, " ")), s.push(...f(e, " ", n)), s.push(...y(e, " ")), s.push(...C(e, " ")), n?.getHeaders && s.push(` getHeaders: ${n.getHeaders},`), n?.contextProviders && s.push(` contextProviders: ${n.contextProviders},`), e.debug && s.push(` debug: ${e.debug},`), s.push(" initialMessages: loadSavedMessages(),"), n?.streamParser ? s.push(` streamParser: ${n.streamParser},`) : (s.push(" // Flexible JSON stream parser for handling structured actions"), s.push(` streamParser: () => createFlexibleJsonStreamParser(${v}),`)), n?.actionParsers ? (s.push(" // Action parsers (custom merged with defaults)"), s.push(` actionParsers: [...(${n.actionParsers}), defaultJsonActionParser,`), s.push(" // Built-in parser for markdown-wrapped JSON"), s.push(` ${
|
|
68512
|
+
return e.apiUrl && s.push(` apiUrl: "${e.apiUrl}",`), e.clientToken && s.push(` clientToken: "${e.clientToken}",`), e.agentId && s.push(` agentId: "${e.agentId}",`), e.target && s.push(` target: "${e.target}",`), e.flowId && s.push(` flowId: "${e.flowId}",`), e.theme && typeof e.theme == "object" && Object.keys(e.theme).length > 0 && d(s, "theme", e.theme, " "), e.launcher && d(s, "launcher", e.launcher, " "), e.copy && (s.push(" copy: {"), Object.entries(e.copy).forEach(([a, t]) => {
|
|
68513
|
+
s.push(` ${a}: "${t}",`);
|
|
68514
|
+
}), s.push(" },")), e.sendButton && (s.push(" sendButton: {"), Object.entries(e.sendButton).forEach(([a, t]) => {
|
|
68515
|
+
typeof t == "string" ? s.push(` ${a}: "${t}",`) : typeof t == "boolean" && s.push(` ${a}: ${t},`);
|
|
68516
|
+
}), s.push(" },")), e.voiceRecognition && (s.push(" voiceRecognition: {"), Object.entries(e.voiceRecognition).forEach(([a, t]) => {
|
|
68517
|
+
typeof t == "string" ? s.push(` ${a}: "${t}",`) : typeof t == "boolean" ? s.push(` ${a}: ${t},`) : typeof t == "number" && s.push(` ${a}: ${t},`);
|
|
68518
|
+
}), s.push(" },")), e.statusIndicator && (s.push(" statusIndicator: {"), Object.entries(e.statusIndicator).forEach(([a, t]) => {
|
|
68519
|
+
typeof t == "string" ? s.push(` ${a}: "${t}",`) : typeof t == "boolean" && s.push(` ${a}: ${t},`);
|
|
68520
|
+
}), s.push(" },")), e.features && (s.push(" features: {"), Object.entries(e.features).forEach(([a, t]) => {
|
|
68521
|
+
s.push(` ${a}: ${t},`);
|
|
68522
|
+
}), s.push(" },")), e.suggestionChips && e.suggestionChips.length > 0 && (s.push(" suggestionChips: ["), e.suggestionChips.forEach((a) => {
|
|
68523
|
+
s.push(` "${a}",`);
|
|
68524
|
+
}), s.push(" ],")), e.suggestionChipsConfig && (s.push(" suggestionChipsConfig: {"), e.suggestionChipsConfig.fontFamily && s.push(` fontFamily: "${e.suggestionChipsConfig.fontFamily}",`), e.suggestionChipsConfig.fontWeight && s.push(` fontWeight: "${e.suggestionChipsConfig.fontWeight}",`), e.suggestionChipsConfig.paddingX && s.push(` paddingX: "${e.suggestionChipsConfig.paddingX}",`), e.suggestionChipsConfig.paddingY && s.push(` paddingY: "${e.suggestionChipsConfig.paddingY}",`), s.push(" },")), s.push(...m(e, " ")), s.push(...f(e, " ", n)), s.push(...y(e, " ")), s.push(...C(e, " ")), n?.getHeaders && s.push(` getHeaders: ${n.getHeaders},`), n?.contextProviders && s.push(` contextProviders: ${n.contextProviders},`), e.debug && s.push(` debug: ${e.debug},`), s.push(" initialMessages: loadSavedMessages(),"), n?.streamParser ? s.push(` streamParser: ${n.streamParser},`) : (s.push(" // Flexible JSON stream parser for handling structured actions"), s.push(` streamParser: () => createFlexibleJsonStreamParser(${v}),`)), n?.actionParsers ? (s.push(" // Action parsers (custom merged with defaults)"), s.push(` actionParsers: [...(${n.actionParsers}), defaultJsonActionParser,`), s.push(" // Built-in parser for markdown-wrapped JSON"), s.push(` ${x}`), s.push(" ],")) : (s.push(" // Action parsers to detect JSON actions in responses"), s.push(" actionParsers: ["), s.push(" defaultJsonActionParser,"), s.push(" // Parser for markdown-wrapped JSON"), s.push(` ${x}`), s.push(" ],")), n?.actionHandlers ? (s.push(" // Action handlers (custom merged with defaults)"), s.push(` actionHandlers: [...(${n.actionHandlers}),`), s.push(" defaultActionHandlers.message,"), s.push(" defaultActionHandlers.messageAndClick,"), s.push(" // Built-in handler for nav_then_click action"), s.push(` ${A}`), s.push(" ],")) : (s.push(" // Action handlers for navigation and other actions"), s.push(" actionHandlers: ["), s.push(" defaultActionHandlers.message,"), s.push(" defaultActionHandlers.messageAndClick,"), s.push(" // Handler for nav_then_click action"), s.push(` ${A}`), s.push(" ],")), n?.postprocessMessage ? s.push(` postprocessMessage: ${n.postprocessMessage},`) : s.push(" postprocessMessage: ({ text }) => markdownPostprocessor(text),"), n?.requestMiddleware ? (s.push(" // Request middleware (custom merged with DOM context)"), s.push(" requestMiddleware: ({ payload, config }) => {"), s.push(` const customResult = (${n.requestMiddleware})({ payload, config });`), s.push(" const merged = customResult || payload;"), s.push(" return {"), s.push(" ...merged,"), s.push(" metadata: { ...merged.metadata, ...collectDOMContext() }"), s.push(" };"), s.push(" }")) : (s.push(" requestMiddleware: ({ payload }) => {"), s.push(" return {"), s.push(" ...payload,"), s.push(" metadata: collectDOMContext()"), s.push(" };"), s.push(" }")), s.push(" }"), s.push(" });"), s.push(""), s.push(" // Save state on message events"), s.push(" const handleMessage = () => {"), s.push(" const session = handle?.getSession?.();"), s.push(" if (session) {"), s.push(" localStorage.setItem(STORAGE_KEY, JSON.stringify({"), s.push(" messages: session.messages,"), s.push(" timestamp: new Date().toISOString()"), s.push(" }));"), s.push(" }"), s.push(" };"), s.push(""), s.push(" // Clear state on clear chat"), s.push(" const handleClearChat = () => {"), s.push(" localStorage.removeItem(STORAGE_KEY);"), s.push(" localStorage.removeItem(PROCESSED_ACTIONS_KEY);"), s.push(" };"), s.push(""), s.push(" window.addEventListener('persona:message', handleMessage);"), s.push(" window.addEventListener('persona:clear-chat', handleClearChat);"), s.push(""), s.push(" // Cleanup on unmount"), s.push(" return () => {"), s.push(" window.removeEventListener('persona:message', handleMessage);"), s.push(" window.removeEventListener('persona:clear-chat', handleClearChat);"), s.push(" if (handle) {"), s.push(" handle.destroy();"), s.push(" }"), s.push(" };"), s.push(" }, []);"), s.push(""), s.push(" return null; // Widget injects itself into the DOM"), s.push("}"), s.push(""), s.push("// Usage: Collects DOM context for AI-powered navigation"), s.push("// Features:"), s.push("// - Extracts page elements (products, buttons, links)"), s.push("// - Persists chat history across page loads"), s.push("// - Handles navigation actions (nav_then_click)"), s.push("// - Processes structured JSON actions from AI"), s.push("//"), s.push("// Example usage in Next.js:"), s.push("// import { ChatWidgetAdvanced } from './components/ChatWidgetAdvanced';"), s.push("//"), s.push("// export default function RootLayout({ children }) {"), s.push("// return ("), s.push('// <html lang="en">'), s.push("// <body>"), s.push("// {children}"), s.push("// <ChatWidgetAdvanced />"), s.push("// </body>"), s.push("// </html>"), s.push("// );"), s.push("// }"), s.join(`
|
|
68483
68525
|
`);
|
|
68484
68526
|
}
|
|
68485
68527
|
function E(e) {
|
|
68486
68528
|
let i = g(e), n = i !== "plain", s = {};
|
|
68487
68529
|
if (e.apiUrl && (s.apiUrl = e.apiUrl), e.clientToken && (s.clientToken = e.clientToken), e.agentId && (s.agentId = e.agentId), e.target && (s.target = e.target), e.flowId && (s.flowId = e.flowId), n && (s.parserType = i), e.theme && (s.theme = e.theme), e.launcher && (s.launcher = e.launcher), e.copy && (s.copy = e.copy), e.sendButton && (s.sendButton = e.sendButton), e.voiceRecognition && (s.voiceRecognition = e.voiceRecognition), e.statusIndicator && (s.statusIndicator = e.statusIndicator), e.features && (s.features = e.features), e.suggestionChips?.length > 0 && (s.suggestionChips = e.suggestionChips), e.suggestionChipsConfig && (s.suggestionChipsConfig = e.suggestionChipsConfig), e.debug && (s.debug = e.debug), e.toolCall) {
|
|
68488
|
-
let
|
|
68530
|
+
let a = {};
|
|
68489
68531
|
Object.entries(e.toolCall).forEach(([t, r]) => {
|
|
68490
|
-
typeof r == "string" && (
|
|
68491
|
-
}), Object.keys(
|
|
68532
|
+
typeof r == "string" && (a[t] = r);
|
|
68533
|
+
}), Object.keys(a).length > 0 && (s.toolCall = a);
|
|
68492
68534
|
}
|
|
68493
68535
|
if (e.messageActions) {
|
|
68494
|
-
let
|
|
68536
|
+
let a = {};
|
|
68495
68537
|
Object.entries(e.messageActions).forEach(([t, r]) => {
|
|
68496
|
-
t !== "onFeedback" && t !== "onCopy" && r !== void 0 && (typeof r == "string" || typeof r == "boolean") && (
|
|
68497
|
-
}), Object.keys(
|
|
68538
|
+
t !== "onFeedback" && t !== "onCopy" && r !== void 0 && (typeof r == "string" || typeof r == "boolean") && (a[t] = r);
|
|
68539
|
+
}), Object.keys(a).length > 0 && (s.messageActions = a);
|
|
68498
68540
|
}
|
|
68499
68541
|
if (e.markdown) {
|
|
68500
|
-
let
|
|
68501
|
-
e.markdown.options && (
|
|
68542
|
+
let a = {};
|
|
68543
|
+
e.markdown.options && (a.options = e.markdown.options), e.markdown.disableDefaultStyles !== void 0 && (a.disableDefaultStyles = e.markdown.disableDefaultStyles), Object.keys(a).length > 0 && (s.markdown = a);
|
|
68502
68544
|
}
|
|
68503
68545
|
if (e.layout) {
|
|
68504
|
-
let
|
|
68546
|
+
let a = {};
|
|
68505
68547
|
if (e.layout.header) {
|
|
68506
68548
|
let t = {};
|
|
68507
|
-
Object.entries(e.layout.header).forEach(([r,
|
|
68508
|
-
r !== "render" && (typeof
|
|
68509
|
-
}), Object.keys(t).length > 0 && (
|
|
68549
|
+
Object.entries(e.layout.header).forEach(([r, o]) => {
|
|
68550
|
+
r !== "render" && (typeof o == "string" || typeof o == "boolean") && (t[r] = o);
|
|
68551
|
+
}), Object.keys(t).length > 0 && (a.header = t);
|
|
68510
68552
|
}
|
|
68511
68553
|
if (e.layout.messages) {
|
|
68512
68554
|
let t = {};
|
|
68513
|
-
Object.entries(e.layout.messages).forEach(([r,
|
|
68514
|
-
if (r !== "renderUserMessage" && r !== "renderAssistantMessage") if (r === "avatar" && typeof
|
|
68515
|
-
else if (r === "timestamp" && typeof
|
|
68555
|
+
Object.entries(e.layout.messages).forEach(([r, o]) => {
|
|
68556
|
+
if (r !== "renderUserMessage" && r !== "renderAssistantMessage") if (r === "avatar" && typeof o == "object" && o !== null) t.avatar = o;
|
|
68557
|
+
else if (r === "timestamp" && typeof o == "object" && o !== null) {
|
|
68516
68558
|
let p = {};
|
|
68517
|
-
Object.entries(
|
|
68559
|
+
Object.entries(o).forEach(([l, b]) => {
|
|
68518
68560
|
l !== "format" && (typeof b == "string" || typeof b == "boolean") && (p[l] = b);
|
|
68519
68561
|
}), Object.keys(p).length > 0 && (t.timestamp = p);
|
|
68520
|
-
} else (typeof
|
|
68521
|
-
}), Object.keys(t).length > 0 && (
|
|
68562
|
+
} else (typeof o == "string" || typeof o == "boolean") && (t[r] = o);
|
|
68563
|
+
}), Object.keys(t).length > 0 && (a.messages = t);
|
|
68522
68564
|
}
|
|
68523
|
-
Object.keys(
|
|
68565
|
+
Object.keys(a).length > 0 && (s.layout = a);
|
|
68524
68566
|
}
|
|
68525
68567
|
return s;
|
|
68526
68568
|
}
|
|
68527
68569
|
function H(e, i) {
|
|
68528
|
-
let n = E(e),
|
|
68570
|
+
let n = E(e), a = !!(i?.windowKey || i?.target) ? { config: n, ...i?.windowKey ? { windowKey: i.windowKey } : {}, ...i?.target ? { target: i.target } : {} } : n, t = JSON.stringify(a, null, 0).replace(/'/g, "'");
|
|
68529
68571
|
return `<script src="https://cdn.jsdelivr.net/npm/@runtypelabs/persona@${c}/dist/install.global.js" data-config='${t}'></script>`;
|
|
68530
68572
|
}
|
|
68531
68573
|
function N(e, i) {
|
|
68532
|
-
let n = i?.hooks, s = g(e),
|
|
68533
|
-
return e.apiUrl && t.push(` apiUrl: "${e.apiUrl}",`), e.clientToken && t.push(` clientToken: "${e.clientToken}",`), e.agentId && t.push(` agentId: "${e.agentId}",`), e.target && t.push(` target: "${e.target}",`), e.flowId && t.push(` flowId: "${e.flowId}",`),
|
|
68534
|
-
t.push(` ${r}: "${
|
|
68535
|
-
}), t.push(" },")), e.sendButton && (t.push(" sendButton: {"), Object.entries(e.sendButton).forEach(([r,
|
|
68536
|
-
typeof
|
|
68537
|
-
}), t.push(" },")), e.voiceRecognition && (t.push(" voiceRecognition: {"), Object.entries(e.voiceRecognition).forEach(([r,
|
|
68538
|
-
typeof
|
|
68539
|
-
}), t.push(" },")), e.statusIndicator && (t.push(" statusIndicator: {"), Object.entries(e.statusIndicator).forEach(([r,
|
|
68540
|
-
typeof
|
|
68541
|
-
}), t.push(" },")), e.features && (t.push(" features: {"), Object.entries(e.features).forEach(([r,
|
|
68542
|
-
t.push(` ${r}: ${
|
|
68574
|
+
let n = i?.hooks, s = g(e), a = s !== "plain", t = ["<!-- Load CSS -->", `<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@runtypelabs/persona@${c}/dist/widget.css" />`, "", "<!-- Load JavaScript -->", `<script src="https://cdn.jsdelivr.net/npm/@runtypelabs/persona@${c}/dist/index.global.js"></script>`, "", "<!-- Initialize widget -->", "<script>", " var handle = window.AgentWidget.initAgentWidget({", ` target: '${h(i)}',`, ...i?.windowKey ? [` windowKey: '${i.windowKey}',`] : [], " config: {"];
|
|
68575
|
+
return e.apiUrl && t.push(` apiUrl: "${e.apiUrl}",`), e.clientToken && t.push(` clientToken: "${e.clientToken}",`), e.agentId && t.push(` agentId: "${e.agentId}",`), e.target && t.push(` target: "${e.target}",`), e.flowId && t.push(` flowId: "${e.flowId}",`), a && t.push(` parserType: "${s}",`), e.theme && typeof e.theme == "object" && Object.keys(e.theme).length > 0 && d(t, "theme", e.theme, " "), e.launcher && d(t, "launcher", e.launcher, " "), e.copy && (t.push(" copy: {"), Object.entries(e.copy).forEach(([r, o]) => {
|
|
68576
|
+
t.push(` ${r}: "${o}",`);
|
|
68577
|
+
}), t.push(" },")), e.sendButton && (t.push(" sendButton: {"), Object.entries(e.sendButton).forEach(([r, o]) => {
|
|
68578
|
+
typeof o == "string" ? t.push(` ${r}: "${o}",`) : typeof o == "boolean" && t.push(` ${r}: ${o},`);
|
|
68579
|
+
}), t.push(" },")), e.voiceRecognition && (t.push(" voiceRecognition: {"), Object.entries(e.voiceRecognition).forEach(([r, o]) => {
|
|
68580
|
+
typeof o == "string" ? t.push(` ${r}: "${o}",`) : typeof o == "boolean" ? t.push(` ${r}: ${o},`) : typeof o == "number" && t.push(` ${r}: ${o},`);
|
|
68581
|
+
}), t.push(" },")), e.statusIndicator && (t.push(" statusIndicator: {"), Object.entries(e.statusIndicator).forEach(([r, o]) => {
|
|
68582
|
+
typeof o == "string" ? t.push(` ${r}: "${o}",`) : typeof o == "boolean" && t.push(` ${r}: ${o},`);
|
|
68583
|
+
}), t.push(" },")), e.features && (t.push(" features: {"), Object.entries(e.features).forEach(([r, o]) => {
|
|
68584
|
+
t.push(` ${r}: ${o},`);
|
|
68543
68585
|
}), t.push(" },")), e.suggestionChips && e.suggestionChips.length > 0 && (t.push(" suggestionChips: ["), e.suggestionChips.forEach((r) => {
|
|
68544
68586
|
t.push(` "${r}",`);
|
|
68545
68587
|
}), t.push(" ],")), e.suggestionChipsConfig && (t.push(" suggestionChipsConfig: {"), e.suggestionChipsConfig.fontFamily && t.push(` fontFamily: "${e.suggestionChipsConfig.fontFamily}",`), e.suggestionChipsConfig.fontWeight && t.push(` fontWeight: "${e.suggestionChipsConfig.fontWeight}",`), e.suggestionChipsConfig.paddingX && t.push(` paddingX: "${e.suggestionChipsConfig.paddingX}",`), e.suggestionChipsConfig.paddingY && t.push(` paddingY: "${e.suggestionChipsConfig.paddingY}",`), t.push(" },")), t.push(...m(e, " ")), t.push(...f(e, " ", n)), t.push(...y(e, " ")), t.push(...C(e, " ")), t.push(...$(n, " ")), e.debug && t.push(` debug: ${e.debug},`), n?.postprocessMessage ? t.push(` postprocessMessage: ${n.postprocessMessage}`) : t.push(" postprocessMessage: ({ text }) => window.AgentWidget.markdownPostprocessor(text)"), t.push(" }"), t.push(" });"), t.push("</script>"), t.join(`
|
|
@@ -68547,9 +68589,9 @@ function N(e, i) {
|
|
|
68547
68589
|
}
|
|
68548
68590
|
function D(e, i) {
|
|
68549
68591
|
let n = i?.hooks, s = E(e), t = ["<script>", "(function() {", " 'use strict';", "", " // Configuration", ` var CONFIG = ${JSON.stringify(s, null, 2).split(`
|
|
68550
|
-
`).map((r,
|
|
68592
|
+
`).map((r, o) => o === 0 ? r : " " + r).join(`
|
|
68551
68593
|
`)};`, "", " // Constants", ` var CDN_BASE = 'https://cdn.jsdelivr.net/npm/@runtypelabs/persona@${c}/dist';`, " var STORAGE_KEY = 'chat-widget-state';", " var PROCESSED_ACTIONS_KEY = 'chat-widget-processed-actions';", "", " // DOM context provider - extracts page elements for AI context", " var domContextProvider = function() {", " var selectors = {", ` products: '[data-product-id], .product-card, .product-item, [role="article"]',`, ` buttons: 'button, [role="button"], .btn',`, " links: 'a[href]',", " inputs: 'input, textarea, select'", " };", "", " var elements = [];", " Object.entries(selectors).forEach(function(entry) {", " var type = entry[0], selector = entry[1];", " document.querySelectorAll(selector).forEach(function(element) {", " if (!(element instanceof HTMLElement)) return;", " var widgetHost = element.closest('.persona-host');", " if (widgetHost) return;", " var text = element.innerText ? element.innerText.trim() : '';", " if (!text) return;", "", " var selectorString = element.id ? '#' + element.id :", ` element.getAttribute('data-testid') ? '[data-testid="' + element.getAttribute('data-testid') + '"]' :`, ` element.getAttribute('data-product-id') ? '[data-product-id="' + element.getAttribute('data-product-id') + '"]' :`, " element.tagName.toLowerCase();", "", " var elementData = {", " type: type,", " tagName: element.tagName.toLowerCase(),", " selector: selectorString,", " innerText: text.substring(0, 200)", " };", "", " if (type === 'links' && element instanceof HTMLAnchorElement && element.href) {", " elementData.href = element.href;", " }", " elements.push(elementData);", " });", " });", "", " var counts = elements.reduce(function(acc, el) {", " acc[el.type] = (acc[el.type] || 0) + 1;", " return acc;", " }, {});", "", " return {", " page_elements: elements.slice(0, 50),", " page_element_count: elements.length,", " element_types: counts,", " page_url: window.location.href,", " page_title: document.title,", " timestamp: new Date().toISOString()", " };", " };", "", " // Load CSS dynamically", " var loadCSS = function() {", " if (document.querySelector('link[data-persona]')) return;", " var link = document.createElement('link');", " link.rel = 'stylesheet';", " link.href = CDN_BASE + '/widget.css';", " link.setAttribute('data-persona', 'true');", " document.head.appendChild(link);", " };", "", " // Load JS dynamically", " var loadJS = function(callback) {", " if (window.AgentWidget) { callback(); return; }", " var script = document.createElement('script');", " script.src = CDN_BASE + '/index.global.js';", " script.onload = callback;", " script.onerror = function() { console.error('Failed to load AgentWidget'); };", " document.head.appendChild(script);", " };", "", " // Create widget config with advanced features", " var createWidgetConfig = function(agentWidget) {", " var widgetConfig = Object.assign({}, CONFIG);", ""];
|
|
68552
|
-
return n?.getHeaders && (t.push(` widgetConfig.getHeaders = ${n.getHeaders};`), t.push("")), n?.contextProviders && (t.push(` widgetConfig.contextProviders = ${n.contextProviders};`), t.push("")), n?.streamParser ? t.push(` widgetConfig.streamParser = ${n.streamParser};`) : (t.push(" // Flexible JSON stream parser for handling structured actions"), t.push(" widgetConfig.streamParser = function() {"), t.push(` return agentWidget.createFlexibleJsonStreamParser(${I});`), t.push(" };")), t.push(""), n?.actionParsers ? (t.push(" // Action parsers (custom merged with defaults)"), t.push(` var customParsers = ${n.actionParsers};`), t.push(" widgetConfig.actionParsers = customParsers.concat(["), t.push(" agentWidget.defaultJsonActionParser,"), t.push(` ${
|
|
68594
|
+
return n?.getHeaders && (t.push(` widgetConfig.getHeaders = ${n.getHeaders};`), t.push("")), n?.contextProviders && (t.push(` widgetConfig.contextProviders = ${n.contextProviders};`), t.push("")), n?.streamParser ? t.push(` widgetConfig.streamParser = ${n.streamParser};`) : (t.push(" // Flexible JSON stream parser for handling structured actions"), t.push(" widgetConfig.streamParser = function() {"), t.push(` return agentWidget.createFlexibleJsonStreamParser(${I});`), t.push(" };")), t.push(""), n?.actionParsers ? (t.push(" // Action parsers (custom merged with defaults)"), t.push(` var customParsers = ${n.actionParsers};`), t.push(" widgetConfig.actionParsers = customParsers.concat(["), t.push(" agentWidget.defaultJsonActionParser,"), t.push(` ${S}`), t.push(" ]);")) : (t.push(" // Action parsers to detect JSON actions in responses"), t.push(" widgetConfig.actionParsers = ["), t.push(" agentWidget.defaultJsonActionParser,"), t.push(` ${S}`), t.push(" ];")), t.push(""), n?.actionHandlers ? (t.push(" // Action handlers (custom merged with defaults)"), t.push(` var customHandlers = ${n.actionHandlers};`), t.push(" widgetConfig.actionHandlers = customHandlers.concat(["), t.push(" agentWidget.defaultActionHandlers.message,"), t.push(" agentWidget.defaultActionHandlers.messageAndClick,"), t.push(` ${j}`), t.push(" ]);")) : (t.push(" // Action handlers for navigation and other actions"), t.push(" widgetConfig.actionHandlers = ["), t.push(" agentWidget.defaultActionHandlers.message,"), t.push(" agentWidget.defaultActionHandlers.messageAndClick,"), t.push(` ${j}`), t.push(" ];")), t.push(""), n?.requestMiddleware ? (t.push(" // Request middleware (custom merged with DOM context)"), t.push(" widgetConfig.requestMiddleware = function(ctx) {"), t.push(` var customResult = (${n.requestMiddleware})(ctx);`), t.push(" var merged = customResult || ctx.payload;"), t.push(" return Object.assign({}, merged, { metadata: Object.assign({}, merged.metadata, domContextProvider()) });"), t.push(" };")) : (t.push(" // Send DOM context with each request"), t.push(" widgetConfig.requestMiddleware = function(ctx) {"), t.push(" return Object.assign({}, ctx.payload, { metadata: domContextProvider() });"), t.push(" };")), t.push(""), n?.postprocessMessage ? t.push(` widgetConfig.postprocessMessage = ${n.postprocessMessage};`) : (t.push(" // Markdown postprocessor"), t.push(" widgetConfig.postprocessMessage = function(ctx) {"), t.push(" return agentWidget.markdownPostprocessor(ctx.text);"), t.push(" };")), t.push(""), (n?.onFeedback || n?.onCopy) && (t.push(" // Message action callbacks"), t.push(" widgetConfig.messageActions = widgetConfig.messageActions || {};"), n?.onFeedback && t.push(` widgetConfig.messageActions.onFeedback = ${n.onFeedback};`), n?.onCopy && t.push(` widgetConfig.messageActions.onCopy = ${n.onCopy};`), t.push("")), t.push(" return widgetConfig;", " };", "", " // Initialize widget", " var init = function() {", " var agentWidget = window.AgentWidget;", " if (!agentWidget) {", " console.error('AgentWidget not loaded');", " return;", " }", "", " var widgetConfig = createWidgetConfig(agentWidget);", "", " // Load saved state", " var savedState = localStorage.getItem(STORAGE_KEY);", " if (savedState) {", " try {", " var parsed = JSON.parse(savedState);", " widgetConfig.initialMessages = parsed.messages || [];", " } catch (e) {", " console.error('Failed to load saved state:', e);", " }", " }", "", " // Initialize widget", " var handle = agentWidget.initAgentWidget({", ` target: '${h(i)}',`, " useShadowDom: false,", ...i?.windowKey ? [` windowKey: '${i.windowKey}',`] : [], " config: widgetConfig", " });", "", " // Save state on message events", " window.addEventListener('persona:message', function() {", " var session = handle.getSession ? handle.getSession() : null;", " if (session) {", " localStorage.setItem(STORAGE_KEY, JSON.stringify({", " messages: session.messages,", " timestamp: new Date().toISOString()", " }));", " }", " });", "", " // Clear state on clear chat", " window.addEventListener('persona:clear-chat', function() {", " localStorage.removeItem(STORAGE_KEY);", " localStorage.removeItem(PROCESSED_ACTIONS_KEY);", " });", " };", "", " // Wait for framework hydration to complete (Next.js, Nuxt, etc.)", " // This prevents the framework from removing dynamically added CSS during reconciliation", " var waitForHydration = function(callback) {", " var executed = false;", " ", " var execute = function() {", " if (executed) return;", " executed = true;", " callback();", " };", "", " var afterDom = function() {", " // Strategy 1: Use requestIdleCallback if available (best for detecting idle after hydration)", " if (typeof requestIdleCallback !== 'undefined') {", " requestIdleCallback(function() {", " // Double requestAnimationFrame ensures at least one full paint cycle completed", " requestAnimationFrame(function() {", " requestAnimationFrame(execute);", " });", " }, { timeout: 3000 }); // Max wait 3 seconds, then proceed anyway", " } else {", " // Strategy 2: Fallback for Safari (no requestIdleCallback)", " // 300ms is typically enough for hydration on most pages", " setTimeout(execute, 300);", " }", " };", "", " if (document.readyState === 'loading') {", " document.addEventListener('DOMContentLoaded', afterDom);", " } else {", " // DOM already ready, but still wait for potential hydration", " afterDom();", " }", " };", "", " // Boot sequence: wait for hydration, then load CSS and JS, then initialize", " // This prevents Next.js/Nuxt/etc. from removing dynamically added CSS during reconciliation", " waitForHydration(function() {", " loadCSS();", " loadJS(function() {", " init();", " });", " });", "})();", "</script>"), t.join(`
|
|
68553
68595
|
`);
|
|
68554
68596
|
}
|
|
68555
68597
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@runtypelabs/cli",
|
|
3
|
-
"version": "2.31.
|
|
3
|
+
"version": "2.31.5",
|
|
4
4
|
"description": "Command-line interface for Runtype AI platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
"react": "^19.2.4",
|
|
26
26
|
"rosie-skills": "0.8.1",
|
|
27
27
|
"yaml": "^2.9.0",
|
|
28
|
-
"@runtypelabs/
|
|
29
|
-
"@runtypelabs/sdk": "6.3.
|
|
30
|
-
"@runtypelabs/
|
|
28
|
+
"@runtypelabs/ink-components": "0.3.5",
|
|
29
|
+
"@runtypelabs/sdk": "6.3.2",
|
|
30
|
+
"@runtypelabs/terminal-animations": "0.2.2"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@runtypelabs/persona": "4.
|
|
33
|
+
"@runtypelabs/persona": "4.10.0",
|
|
34
34
|
"@types/express": "^5.0.6",
|
|
35
35
|
"@types/micromatch": "^4.0.9",
|
|
36
36
|
"@types/node": "^25.3.3",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"tsx": "^4.7.1",
|
|
42
42
|
"typescript": "^6.0.3",
|
|
43
43
|
"vitest": "^4.1.0",
|
|
44
|
-
"@runtypelabs/shared": "3.8.
|
|
44
|
+
"@runtypelabs/shared": "3.8.2"
|
|
45
45
|
},
|
|
46
46
|
"engines": {
|
|
47
47
|
"node": ">=22.12.0"
|