@frankieai/core 0.2.4 → 0.2.6

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
@@ -95,6 +95,10 @@ declare const featuresConfigSchema: z.ZodPrefault<z.ZodObject<{
95
95
  }, z.core.$strip>>;
96
96
  workspaceAdmin: z.ZodDefault<z.ZodBoolean>;
97
97
  configurationAssistant: z.ZodDefault<z.ZodBoolean>;
98
+ escalation: z.ZodPrefault<z.ZodObject<{
99
+ enabled: z.ZodDefault<z.ZodBoolean>;
100
+ webhookUrl: z.ZodOptional<z.ZodString>;
101
+ }, z.core.$strip>>;
98
102
  }, z.core.$strip>>;
99
103
  declare const mcpServerSchema: z.ZodObject<{
100
104
  name: z.ZodString;
@@ -104,6 +108,7 @@ declare const mcpServerSchema: z.ZodObject<{
104
108
  discoveredTools: z.ZodDefault<z.ZodArray<z.ZodObject<{
105
109
  name: z.ZodString;
106
110
  description: z.ZodOptional<z.ZodString>;
111
+ inputs: z.ZodOptional<z.ZodString>;
107
112
  }, z.core.$strip>>>;
108
113
  transport: z.ZodDefault<z.ZodEnum<{
109
114
  http: "http";
@@ -131,6 +136,7 @@ declare const apiCapabilitySchema: z.ZodObject<{
131
136
  }>;
132
137
  path: z.ZodString;
133
138
  summary: z.ZodOptional<z.ZodString>;
139
+ inputs: z.ZodOptional<z.ZodString>;
134
140
  authGap: z.ZodDefault<z.ZodBoolean>;
135
141
  }, z.core.$strip>;
136
142
  declare const apiSourceSchema: z.ZodObject<{
@@ -165,6 +171,7 @@ declare const apiSourceSchema: z.ZodObject<{
165
171
  }>;
166
172
  path: z.ZodString;
167
173
  summary: z.ZodOptional<z.ZodString>;
174
+ inputs: z.ZodOptional<z.ZodString>;
168
175
  authGap: z.ZodDefault<z.ZodBoolean>;
169
176
  }, z.core.$strip>>>;
170
177
  headers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
@@ -180,14 +187,35 @@ declare const toolPolicySchema: z.ZodObject<{
180
187
  denyByDefault: z.ZodDefault<z.ZodBoolean>;
181
188
  }, z.core.$strip>;
182
189
  /**
183
- * A starter card shown on the empty chat screen: a title and short description
184
- * the reader sees, and the message that is sent as if they typed it when they
185
- * click the card. Configured per workspace in the dashboard's Appearance tab.
190
+ * The icons a starter card may use, shared by the dashboard picker and the SDK
191
+ * so the choices stay in step. Each maps to a concrete icon in the widget.
192
+ */
193
+ declare const STARTER_PROMPT_ICONS: readonly ["sparkles", "wand", "book", "chat", "chart", "bolt", "music", "mic", "image", "compass", "lightbulb", "file"];
194
+ type StarterPromptIcon = (typeof STARTER_PROMPT_ICONS)[number];
195
+ /**
196
+ * A starter card shown on the empty chat screen: an icon, a title and short
197
+ * description the reader sees, and the message that is sent as if they typed it
198
+ * when they click the card. Configured per workspace in the dashboard's
199
+ * Appearance tab.
186
200
  */
187
201
  declare const starterPromptSchema: z.ZodObject<{
188
202
  title: z.ZodString;
189
203
  description: z.ZodOptional<z.ZodString>;
190
204
  message: z.ZodString;
205
+ icon: z.ZodOptional<z.ZodEnum<{
206
+ file: "file";
207
+ sparkles: "sparkles";
208
+ wand: "wand";
209
+ book: "book";
210
+ chat: "chat";
211
+ chart: "chart";
212
+ bolt: "bolt";
213
+ music: "music";
214
+ mic: "mic";
215
+ image: "image";
216
+ compass: "compass";
217
+ lightbulb: "lightbulb";
218
+ }>>;
191
219
  }, z.core.$strip>;
192
220
  declare const agentConfigSchema: z.ZodObject<{
193
221
  systemPrompt: z.ZodDefault<z.ZodString>;
@@ -197,6 +225,20 @@ declare const agentConfigSchema: z.ZodObject<{
197
225
  title: z.ZodString;
198
226
  description: z.ZodOptional<z.ZodString>;
199
227
  message: z.ZodString;
228
+ icon: z.ZodOptional<z.ZodEnum<{
229
+ file: "file";
230
+ sparkles: "sparkles";
231
+ wand: "wand";
232
+ book: "book";
233
+ chat: "chat";
234
+ chart: "chart";
235
+ bolt: "bolt";
236
+ music: "music";
237
+ mic: "mic";
238
+ image: "image";
239
+ compass: "compass";
240
+ lightbulb: "lightbulb";
241
+ }>>;
200
242
  }, z.core.$strip>>>;
201
243
  maxTurns: z.ZodDefault<z.ZodNumber>;
202
244
  maxBudgetUsd: z.ZodOptional<z.ZodNumber>;
@@ -234,6 +276,107 @@ declare const brandingConfigSchema: z.ZodObject<{
234
276
  avatarUrl: z.ZodOptional<z.ZodString>;
235
277
  launcherLabel: z.ZodDefault<z.ZodString>;
236
278
  }, z.core.$strip>;
279
+ /**
280
+ * Knowledge base: documentation the agent answers from. Each source is an entry
281
+ * URL Frankie crawls (same-origin, bounded) to build a semantic index; the
282
+ * chunks + embeddings live in the knowledge store, not in this config. Enabling
283
+ * it gives the agent a `frankie__docs__search` tool and grounds its answers.
284
+ */
285
+ declare const knowledgeSourceSchema: z.ZodObject<{
286
+ url: z.ZodString;
287
+ }, z.core.$strip>;
288
+ declare const knowledgeBaseSchema: z.ZodPrefault<z.ZodObject<{
289
+ enabled: z.ZodDefault<z.ZodBoolean>;
290
+ sources: z.ZodDefault<z.ZodArray<z.ZodObject<{
291
+ url: z.ZodString;
292
+ }, z.core.$strip>>>;
293
+ maxPages: z.ZodDefault<z.ZodNumber>;
294
+ }, z.core.$strip>>;
295
+ /**
296
+ * An additional embedded agent on the same workspace. Frankie is one-agent-per
297
+ * publishable-key: a persona carries its OWN key, so the data plane still
298
+ * resolves one key to one agent (see `resolvePersonaConfig`). A persona overrides
299
+ * the distinct slice of a config — its branding, agent copy, capabilities and
300
+ * knowledge base — while sharing the workspace's auth, model, origins and tools.
301
+ * `pagePatterns` says which routes the persona shows on (e.g. support on "/",
302
+ * docs on "/docs/**"). It is served in `/v1/config` as `pages`, and the
303
+ * generated `FrankieAgents` mount reads it at runtime, so changing it never
304
+ * needs a new install PR.
305
+ */
306
+ declare const personaProfileSchema: z.ZodObject<{
307
+ id: z.ZodString;
308
+ label: z.ZodString;
309
+ publishableKey: z.ZodString;
310
+ pagePatterns: z.ZodDefault<z.ZodArray<z.ZodString>>;
311
+ allowAnonymous: z.ZodOptional<z.ZodBoolean>;
312
+ branding: z.ZodOptional<z.ZodObject<{
313
+ name: z.ZodOptional<z.ZodString>;
314
+ tagline: z.ZodOptional<z.ZodString>;
315
+ avatarUrl: z.ZodOptional<z.ZodString>;
316
+ launcherLabel: z.ZodOptional<z.ZodString>;
317
+ }, z.core.$strip>>;
318
+ agent: z.ZodPrefault<z.ZodObject<{
319
+ systemPrompt: z.ZodDefault<z.ZodString>;
320
+ greeting: z.ZodDefault<z.ZodString>;
321
+ suggestedPrompts: z.ZodDefault<z.ZodArray<z.ZodString>>;
322
+ starterPrompts: z.ZodDefault<z.ZodArray<z.ZodObject<{
323
+ title: z.ZodString;
324
+ description: z.ZodOptional<z.ZodString>;
325
+ message: z.ZodString;
326
+ icon: z.ZodOptional<z.ZodEnum<{
327
+ file: "file";
328
+ sparkles: "sparkles";
329
+ wand: "wand";
330
+ book: "book";
331
+ chat: "chat";
332
+ chart: "chart";
333
+ bolt: "bolt";
334
+ music: "music";
335
+ mic: "mic";
336
+ image: "image";
337
+ compass: "compass";
338
+ lightbulb: "lightbulb";
339
+ }>>;
340
+ }, z.core.$strip>>>;
341
+ maxTurns: z.ZodDefault<z.ZodNumber>;
342
+ maxBudgetUsd: z.ZodOptional<z.ZodNumber>;
343
+ tools: z.ZodPrefault<z.ZodObject<{
344
+ allow: z.ZodDefault<z.ZodArray<z.ZodString>>;
345
+ deny: z.ZodDefault<z.ZodArray<z.ZodString>>;
346
+ denyByDefault: z.ZodDefault<z.ZodBoolean>;
347
+ }, z.core.$strip>>;
348
+ showToolActivity: z.ZodDefault<z.ZodBoolean>;
349
+ }, z.core.$strip>>;
350
+ features: z.ZodPrefault<z.ZodObject<{
351
+ attachments: z.ZodPrefault<z.ZodObject<{
352
+ enabled: z.ZodDefault<z.ZodBoolean>;
353
+ accept: z.ZodDefault<z.ZodArray<z.ZodString>>;
354
+ maxMb: z.ZodDefault<z.ZodNumber>;
355
+ maxCount: z.ZodDefault<z.ZodNumber>;
356
+ }, z.core.$strip>>;
357
+ modelPicker: z.ZodPrefault<z.ZodObject<{
358
+ enabled: z.ZodDefault<z.ZodBoolean>;
359
+ models: z.ZodDefault<z.ZodArray<z.ZodObject<{
360
+ id: z.ZodString;
361
+ label: z.ZodString;
362
+ provider: z.ZodOptional<z.ZodString>;
363
+ }, z.core.$strip>>>;
364
+ }, z.core.$strip>>;
365
+ workspaceAdmin: z.ZodDefault<z.ZodBoolean>;
366
+ configurationAssistant: z.ZodDefault<z.ZodBoolean>;
367
+ escalation: z.ZodPrefault<z.ZodObject<{
368
+ enabled: z.ZodDefault<z.ZodBoolean>;
369
+ webhookUrl: z.ZodOptional<z.ZodString>;
370
+ }, z.core.$strip>>;
371
+ }, z.core.$strip>>;
372
+ knowledgeBase: z.ZodPrefault<z.ZodObject<{
373
+ enabled: z.ZodDefault<z.ZodBoolean>;
374
+ sources: z.ZodDefault<z.ZodArray<z.ZodObject<{
375
+ url: z.ZodString;
376
+ }, z.core.$strip>>>;
377
+ maxPages: z.ZodDefault<z.ZodNumber>;
378
+ }, z.core.$strip>>;
379
+ }, z.core.$strip>;
237
380
  declare const frankieConfigSchema: z.ZodObject<{
238
381
  tenantId: z.ZodString;
239
382
  branding: z.ZodPrefault<z.ZodObject<{
@@ -286,6 +429,20 @@ declare const frankieConfigSchema: z.ZodObject<{
286
429
  title: z.ZodString;
287
430
  description: z.ZodOptional<z.ZodString>;
288
431
  message: z.ZodString;
432
+ icon: z.ZodOptional<z.ZodEnum<{
433
+ file: "file";
434
+ sparkles: "sparkles";
435
+ wand: "wand";
436
+ book: "book";
437
+ chat: "chat";
438
+ chart: "chart";
439
+ bolt: "bolt";
440
+ music: "music";
441
+ mic: "mic";
442
+ image: "image";
443
+ compass: "compass";
444
+ lightbulb: "lightbulb";
445
+ }>>;
289
446
  }, z.core.$strip>>>;
290
447
  maxTurns: z.ZodDefault<z.ZodNumber>;
291
448
  maxBudgetUsd: z.ZodOptional<z.ZodNumber>;
@@ -319,6 +476,7 @@ declare const frankieConfigSchema: z.ZodObject<{
319
476
  discoveredTools: z.ZodDefault<z.ZodArray<z.ZodObject<{
320
477
  name: z.ZodString;
321
478
  description: z.ZodOptional<z.ZodString>;
479
+ inputs: z.ZodOptional<z.ZodString>;
322
480
  }, z.core.$strip>>>;
323
481
  transport: z.ZodDefault<z.ZodEnum<{
324
482
  http: "http";
@@ -361,6 +519,7 @@ declare const frankieConfigSchema: z.ZodObject<{
361
519
  }>;
362
520
  path: z.ZodString;
363
521
  summary: z.ZodOptional<z.ZodString>;
522
+ inputs: z.ZodOptional<z.ZodString>;
364
523
  authGap: z.ZodDefault<z.ZodBoolean>;
365
524
  }, z.core.$strip>>>;
366
525
  headers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
@@ -405,12 +564,99 @@ declare const frankieConfigSchema: z.ZodObject<{
405
564
  }, z.core.$strip>>;
406
565
  workspaceAdmin: z.ZodDefault<z.ZodBoolean>;
407
566
  configurationAssistant: z.ZodDefault<z.ZodBoolean>;
567
+ escalation: z.ZodPrefault<z.ZodObject<{
568
+ enabled: z.ZodDefault<z.ZodBoolean>;
569
+ webhookUrl: z.ZodOptional<z.ZodString>;
570
+ }, z.core.$strip>>;
408
571
  }, z.core.$strip>>;
572
+ knowledgeBase: z.ZodPrefault<z.ZodObject<{
573
+ enabled: z.ZodDefault<z.ZodBoolean>;
574
+ sources: z.ZodDefault<z.ZodArray<z.ZodObject<{
575
+ url: z.ZodString;
576
+ }, z.core.$strip>>>;
577
+ maxPages: z.ZodDefault<z.ZodNumber>;
578
+ }, z.core.$strip>>;
579
+ pagePatterns: z.ZodDefault<z.ZodArray<z.ZodString>>;
580
+ personas: z.ZodDefault<z.ZodArray<z.ZodObject<{
581
+ id: z.ZodString;
582
+ label: z.ZodString;
583
+ publishableKey: z.ZodString;
584
+ pagePatterns: z.ZodDefault<z.ZodArray<z.ZodString>>;
585
+ allowAnonymous: z.ZodOptional<z.ZodBoolean>;
586
+ branding: z.ZodOptional<z.ZodObject<{
587
+ name: z.ZodOptional<z.ZodString>;
588
+ tagline: z.ZodOptional<z.ZodString>;
589
+ avatarUrl: z.ZodOptional<z.ZodString>;
590
+ launcherLabel: z.ZodOptional<z.ZodString>;
591
+ }, z.core.$strip>>;
592
+ agent: z.ZodPrefault<z.ZodObject<{
593
+ systemPrompt: z.ZodDefault<z.ZodString>;
594
+ greeting: z.ZodDefault<z.ZodString>;
595
+ suggestedPrompts: z.ZodDefault<z.ZodArray<z.ZodString>>;
596
+ starterPrompts: z.ZodDefault<z.ZodArray<z.ZodObject<{
597
+ title: z.ZodString;
598
+ description: z.ZodOptional<z.ZodString>;
599
+ message: z.ZodString;
600
+ icon: z.ZodOptional<z.ZodEnum<{
601
+ file: "file";
602
+ sparkles: "sparkles";
603
+ wand: "wand";
604
+ book: "book";
605
+ chat: "chat";
606
+ chart: "chart";
607
+ bolt: "bolt";
608
+ music: "music";
609
+ mic: "mic";
610
+ image: "image";
611
+ compass: "compass";
612
+ lightbulb: "lightbulb";
613
+ }>>;
614
+ }, z.core.$strip>>>;
615
+ maxTurns: z.ZodDefault<z.ZodNumber>;
616
+ maxBudgetUsd: z.ZodOptional<z.ZodNumber>;
617
+ tools: z.ZodPrefault<z.ZodObject<{
618
+ allow: z.ZodDefault<z.ZodArray<z.ZodString>>;
619
+ deny: z.ZodDefault<z.ZodArray<z.ZodString>>;
620
+ denyByDefault: z.ZodDefault<z.ZodBoolean>;
621
+ }, z.core.$strip>>;
622
+ showToolActivity: z.ZodDefault<z.ZodBoolean>;
623
+ }, z.core.$strip>>;
624
+ features: z.ZodPrefault<z.ZodObject<{
625
+ attachments: z.ZodPrefault<z.ZodObject<{
626
+ enabled: z.ZodDefault<z.ZodBoolean>;
627
+ accept: z.ZodDefault<z.ZodArray<z.ZodString>>;
628
+ maxMb: z.ZodDefault<z.ZodNumber>;
629
+ maxCount: z.ZodDefault<z.ZodNumber>;
630
+ }, z.core.$strip>>;
631
+ modelPicker: z.ZodPrefault<z.ZodObject<{
632
+ enabled: z.ZodDefault<z.ZodBoolean>;
633
+ models: z.ZodDefault<z.ZodArray<z.ZodObject<{
634
+ id: z.ZodString;
635
+ label: z.ZodString;
636
+ provider: z.ZodOptional<z.ZodString>;
637
+ }, z.core.$strip>>>;
638
+ }, z.core.$strip>>;
639
+ workspaceAdmin: z.ZodDefault<z.ZodBoolean>;
640
+ configurationAssistant: z.ZodDefault<z.ZodBoolean>;
641
+ escalation: z.ZodPrefault<z.ZodObject<{
642
+ enabled: z.ZodDefault<z.ZodBoolean>;
643
+ webhookUrl: z.ZodOptional<z.ZodString>;
644
+ }, z.core.$strip>>;
645
+ }, z.core.$strip>>;
646
+ knowledgeBase: z.ZodPrefault<z.ZodObject<{
647
+ enabled: z.ZodDefault<z.ZodBoolean>;
648
+ sources: z.ZodDefault<z.ZodArray<z.ZodObject<{
649
+ url: z.ZodString;
650
+ }, z.core.$strip>>>;
651
+ maxPages: z.ZodDefault<z.ZodNumber>;
652
+ }, z.core.$strip>>;
653
+ }, z.core.$strip>>>;
409
654
  }, z.core.$strip>;
410
655
  type ThinkingLevel = z.infer<typeof thinkingLevelSchema>;
411
656
  type WidgetThemeConfig = z.infer<typeof widgetThemeSchema>;
412
657
  type ModelChoice = z.infer<typeof modelChoiceSchema>;
413
658
  type FeaturesConfig = z.infer<typeof featuresConfigSchema>;
659
+ type KnowledgeBaseConfig = z.infer<typeof knowledgeBaseSchema>;
414
660
  type ModelConfig = z.infer<typeof modelConfigSchema>;
415
661
  type McpServerConfig = z.infer<typeof mcpServerSchema>;
416
662
  type ApiCapability = z.infer<typeof apiCapabilitySchema>;
@@ -420,11 +666,30 @@ type AgentConfig = z.infer<typeof agentConfigSchema>;
420
666
  type AuthConfig = z.infer<typeof authConfigSchema>;
421
667
  type LimitsConfig = z.infer<typeof limitsConfigSchema>;
422
668
  type BrandingConfig = z.infer<typeof brandingConfigSchema>;
669
+ type PersonaProfile = z.infer<typeof personaProfileSchema>;
423
670
  type FrankieConfig = z.infer<typeof frankieConfigSchema>;
424
671
  type FrankieConfigInput = z.input<typeof frankieConfigSchema>;
425
672
  declare function parseFrankieConfig(input: unknown): FrankieConfig;
426
673
  /** Helper for `frankie.config.ts` files — gives editors full completion. */
427
674
  declare function defineFrankieConfig(config: FrankieConfigInput): FrankieConfigInput;
675
+ /**
676
+ * Flatten a stored config to the single-agent config that a publishable key
677
+ * selects. The base key returns the config unchanged (the primary persona). A
678
+ * persona key returns a config carrying that persona's branding/agent/features/
679
+ * knowledgeBase, its key, and no further personas — so every *resolved* config is
680
+ * still exactly one agent, preserving the one-key-one-agent invariant. An unknown
681
+ * key returns null.
682
+ */
683
+ declare function resolvePersonaConfig(config: FrankieConfig, publishableKey: string): FrankieConfig | null;
684
+ /**
685
+ * Whether a Next.js `usePathname()` value matches an App-Router path glob:
686
+ * `**` matches any depth (including `/`), `*` matches within one segment, and a
687
+ * trailing `/**` also matches the base path itself (`/docs/**` matches `/docs`).
688
+ * Everything else is literal and case-sensitive.
689
+ */
690
+ declare function matchesPagePattern(pathname: string, pattern: string): boolean;
691
+ /** True when `pathname` matches any pattern, or when there are none (host decides). */
692
+ declare function matchesAnyPagePattern(pathname: string, patterns: readonly string[]): boolean;
428
693
 
429
694
  /**
430
695
  * The wire protocol between the embedded widget and the Frankie server.
@@ -614,6 +879,8 @@ interface StarterPrompt {
614
879
  title: string;
615
880
  description?: string;
616
881
  message: string;
882
+ /** One of STARTER_PROMPT_ICONS; the widget maps it to a concrete icon. */
883
+ icon?: string;
617
884
  }
618
885
  /** The subset of tenant config the widget is allowed to see. */
619
886
  interface PublicWidgetConfig {
@@ -635,6 +902,8 @@ interface PublicWidgetConfig {
635
902
  showToolActivity: boolean;
636
903
  /** Opt-in capabilities the widget should render (attachments, model picker). */
637
904
  features: PublicFeatures;
905
+ /** App-Router path globs this agent shows on; empty = every page no other agent claims. Optional so older servers stay compatible. */
906
+ pages?: string[];
638
907
  }
639
908
  /** The subset of `features` config the widget needs to render its controls. */
640
909
  interface PublicFeatures {
@@ -686,9 +955,48 @@ interface ToolDecision {
686
955
  * also allows every tool on the `acme` server.
687
956
  */
688
957
  declare function evaluateToolPolicy(toolName: string, policy: ToolPolicy): ToolDecision;
958
+ /**
959
+ * The agent-harness tool a skill-following agent calls to announce which
960
+ * reviewed workspace skill it is about to apply. It grants no permissions and
961
+ * does nothing on its own — it exists so a skill shows up in the transcript like
962
+ * any other tool call, instead of being followed invisibly.
963
+ */
964
+ declare const SKILL_TOOL_NAME = "frankie__use_skill";
689
965
  /** A short human label for a tool call, for the "Frankie is …" line in the UI. */
690
966
  declare function describeTool(toolName: string, input: unknown): string;
691
967
 
968
+ /** The public env var a persona's publishable key lives in. */
969
+ declare function personaEnvKey(personaId: string): string;
970
+ /**
971
+ * The agents every generated mount lists, ahead of the workspace's own custom
972
+ * ones. Listing them even before they exist means turning one on later is an
973
+ * environment variable, not another pull request.
974
+ */
975
+ declare const STANDARD_AGENT_IDS: readonly ["support", "docs"];
976
+ /** The persona ids a generated mount lists, in priority order: the standard ones, then custom ones alphabetically. */
977
+ declare function installAgentIds(personaIds?: string[]): string[];
978
+ /**
979
+ * The install branch for a workspace, or one of its personas. One commit,
980
+ * `<sha8>`-suffixed so a re-run on a new base opens a fresh PR. A persona is
981
+ * joined with `--` so workspace `acme` + persona `support` never shares a
982
+ * branch with workspace `acme-support`.
983
+ */
984
+ declare function installBranch(workspaceId: string, baseSha: string, personaId?: string): string;
985
+ /**
986
+ * A workspace-supplied name (workspace, agent label, page pattern) made safe
987
+ * to drop into a PR body or committed Markdown: one line, no markup that
988
+ * could add links, images, code or headings under the installer's name.
989
+ */
990
+ declare function plainText(value: string, max?: number): string;
991
+ /** The install PR title: plain for the primary agent, suffixed with the persona's label otherwise. */
992
+ declare function installTitle(personaLabel?: string): string;
993
+ /**
994
+ * Whether an open PR's head ref is the install branch for this
995
+ * workspace/persona — used to adopt a PR a prior run opened. The anchored
996
+ * 8-hex suffix keeps a persona branch from matching the primary and vice
997
+ * versa; a persona also matches the older single-dash form.
998
+ */
999
+ declare function matchesInstallBranch(ref: string, workspaceId: string, personaId?: string): boolean;
692
1000
  /** One installation plan for GitHub and the local CLI. Never includes credentials. */
693
1001
  interface InstallProject {
694
1002
  files: Record<string, string>;
@@ -699,12 +1007,31 @@ interface InstallProject {
699
1007
  allowAnonymous: boolean;
700
1008
  };
701
1009
  apiBaseUrl?: string;
1010
+ /**
1011
+ * The agent this PR is for, when it is a persona (Support, Docs, a custom
1012
+ * one) rather than the product agent. It only changes what else the PR
1013
+ * carries: every PR writes the same `FrankieAgents` mount, so a persona PR
1014
+ * and a product PR opened together never conflict. The key stays in the
1015
+ * environment, never here.
1016
+ */
1017
+ persona?: {
1018
+ id: string;
1019
+ label: string;
1020
+ publishableKey?: string;
1021
+ pagePatterns?: string[];
1022
+ envKey?: string;
1023
+ };
1024
+ /** Every persona id on the workspace, so the mount lists the custom ones too. */
1025
+ agents?: string[];
702
1026
  }
703
1027
  interface InstallPlan {
1028
+ /** Files to write. Files whose content would not change are left out. */
704
1029
  files: Array<{
705
1030
  path: string;
706
1031
  content: string;
707
1032
  }>;
1033
+ /** Frankie's own superseded files to remove. */
1034
+ deletions: string[];
708
1035
  root: string;
709
1036
  chatPath: string;
710
1037
  specPath: string;
@@ -718,9 +1045,52 @@ declare function assertNoCommittedFrankieKeys(files: Array<{
718
1045
  path: string;
719
1046
  content: string;
720
1047
  }>): void;
1048
+ /**
1049
+ * Plan the files for an install PR.
1050
+ *
1051
+ * Every agent (product, support, docs, custom) mounts from one generated
1052
+ * client component, `<app>/frankie/FrankieAgents.tsx`, rendered once in the
1053
+ * root layout. It lists each agent by its own env var, turns an agent on only
1054
+ * when that key is set, and reads each agent's pages from `/v1/config` at
1055
+ * runtime. Its content depends only on the repository and the workspace — not
1056
+ * on which agent the PR is for — so the shared files (mount, layout edit,
1057
+ * package.json, .env.example, health route) are byte-identical in every PR,
1058
+ * and any two install PRs merge cleanly in either order.
1059
+ */
721
1060
  declare function planHostedInstall(input: InstallProject): InstallPlan;
722
1061
  /** Where the generated token endpoint gets the signed-in user from. */
723
1062
  type AuthStrategy = "firebase" | "nextauth" | "supabase" | "custom" | "existing" | "anonymous" | "unconfigured";
1063
+ /**
1064
+ * Where a new import may go in a module: after the directive prologue, any
1065
+ * leading comments and the existing imports (multi-line ones included), and
1066
+ * never above a `"use client"`. A directive is only a directive while it is the
1067
+ * first statement — an import placed ahead of it turns it into a no-op string,
1068
+ * and the layout silently stops being a client component.
1069
+ */
1070
+ declare function insertImport(source: string, importLine: string): string;
1071
+ /**
1072
+ * Adds `<FrankieWidgetMount />` (or another component) just inside the layout's `</body>` (else
1073
+ * `</main>`, else after `{children}`), indented like the line it joins so the
1074
+ * change is one clean line in the PR and a formatter check does not fail on it.
1075
+ */
1076
+ declare function mountWidget(layout: string, component?: string): string | undefined;
1077
+ /**
1078
+ * The manifest's dependencies with Frankie's added — keeping an entry the
1079
+ * project already pins, and keeping alphabetical order when the project keeps
1080
+ * it (as npm and pnpm write it), so the PR's diff is the added lines only.
1081
+ */
1082
+ declare function withDependencies(current: Record<string, string> | undefined, added: Record<string, string>): Record<string, string>;
1083
+ /** JSON written the way the file already was: its indentation (tabs or spaces) and its final newline. */
1084
+ declare function renderJson(value: unknown, original: string | undefined): string;
1085
+ /**
1086
+ * How a generated file imports a module under the app's source root
1087
+ * (`lib/frankie-auth`, `auth`, …). The repo's own `tsconfig.json` decides:
1088
+ * whichever `paths` alias maps onto the source root is used (`@/`, `~/`,
1089
+ * `@src/`…); with a tsconfig that declares no such alias the import is
1090
+ * relative, which resolves everywhere. Without a tsconfig to read, `@/` stands —
1091
+ * Next.js's own default — rather than a guess at a relative layout.
1092
+ */
1093
+ declare function moduleImporter(files: Record<string, string>, root: string, sourceRoot: string): (fromFile: string, module: string) => string;
724
1094
 
725
1095
  declare const skillSchema: z.ZodObject<{
726
1096
  id: z.ZodString;
@@ -751,6 +1121,7 @@ declare function approvedSkillTools(config: FrankieConfig): string[];
751
1121
  declare function toolDescriptions(config: FrankieConfig, toolIds: string[]): Array<{
752
1122
  id: string;
753
1123
  description: string;
1124
+ inputs?: string;
754
1125
  }>;
755
1126
  /**
756
1127
  * Starter suggestion prompts derived from the workspace's own published,
@@ -768,7 +1139,7 @@ declare function suggestedPromptsFromSkills(config: FrankieConfig): string[];
768
1139
  /**
769
1140
  * Deterministic starter for the manual editor — not a claim that anything
770
1141
  * was executed, and not model-generated. Follows the same structure asked of
771
- * AI-generated instructions (trigger recap, required inputs, numbered steps,
1142
+ * AI-generated instructions (trigger recap, required inputs, quality bar, numbered steps,
772
1143
  * reporting, error handling) so a hand-written skill starts from a useful
773
1144
  * shape instead of a blank textarea. `label` is each tool's own description
774
1145
  * when the caller has one (e.g. from the dashboard's approved-tools list);
@@ -807,4 +1178,38 @@ declare function compareApiDocuments(before: ApiDocument, after: ApiDocument): {
807
1178
  unchangedIds: string[];
808
1179
  };
809
1180
 
810
- export { type AgentConfig, type ApiCapability, type ApiDocument, type ApiSourceConfig, type ApiToolInventory, type AuthConfig, type AuthStrategy, type BrandingConfig, type ChatAttachment, type ChatRequestBody, type CreateSessionBody, type CreateSessionResponse, FIREWORKS_MODELS, type FeaturesConfig, type FrankieConfig, type FrankieConfigInput, type FrankieErrorCode, type FrankieServerEvent, type HostToolRequest, type HostToolResult, type InstallPlan, type InstallProject, type LimitsConfig, type LoadedSkill, type McpServerConfig, type ModelChoice, type ModelConfig, type PublicFeatures, type PublicWidgetConfig, type StarterPrompt, type StopReason, type ThinkingLevel, type ToolDecision, type ToolPolicy, type ToolResultBody, type UsageSummary, type WidgetTheme, type WidgetThemeConfig, type WorkspaceSkill, activeSkills, agentConfigSchema, apiCapabilitySchema, apiMethods, apiOperations, apiSourceSchema, approvedSkillTools, assertNoCommittedFrankieKeys, authConfigSchema, brandingConfigSchema, canonicalJson, compareApiDocuments, defineFrankieConfig, describeTool, draftSkill, evaluateToolPolicy, featuresConfigSchema, frankieConfigSchema, limitsConfigSchema, matchPath, mcpServerSchema, modelChoiceSchema, modelConfigSchema, operationId, parseFrankieConfig, planHostedInstall, sdkUpdateWorkflow, skillSchema, starterPromptSchema, suggestedPromptsFromSkills, thinkingLevelSchema, toolDescriptions, toolPolicySchema, validateApiDocument, widgetThemeSchema };
1181
+ /**
1182
+ * Suggest a widget theme from a repository's own styling, at install time.
1183
+ *
1184
+ * Reads what a Next.js app already declares — CSS custom properties on `:root`
1185
+ * (shadcn/ui, Tailwind v4 `@theme`), the Tailwind config's colors, the
1186
+ * `themeColor` metadata and the web app manifest — and normalizes the colors it
1187
+ * can read to `#rrggbb`. Like the rest of the installer it is regex over source:
1188
+ * nothing is executed, and anything it can't read with confidence is left out
1189
+ * rather than guessed. The result is a *suggestion* the dashboard asks the user
1190
+ * to accept; it never replaces a theme someone chose.
1191
+ */
1192
+ interface InferredTheme {
1193
+ /** Always carries a brand color: without one there is nothing to suggest. */
1194
+ theme: {
1195
+ primary: string;
1196
+ background?: string;
1197
+ foreground?: string;
1198
+ radius?: string;
1199
+ };
1200
+ /** Where each value came from, for the "suggested from your repo" explanation. */
1201
+ sources: Array<{
1202
+ field: "primary" | "background" | "foreground" | "radius";
1203
+ path: string;
1204
+ }>;
1205
+ }
1206
+ /** Normalize a CSS color to `#rrggbb`, or undefined when it isn't one we can read confidently. */
1207
+ declare function normalizeColor(raw: string): string | undefined;
1208
+ /**
1209
+ * Infer a theme from repository files (path → content). `root` scopes the search
1210
+ * to one app in a monorepo ("" for the repository root). Returns undefined when
1211
+ * no brand color can be read — a background alone is not a theme.
1212
+ */
1213
+ declare function inferTheme(files: Record<string, string>, root?: string): InferredTheme | undefined;
1214
+
1215
+ export { type AgentConfig, type ApiCapability, type ApiDocument, type ApiSourceConfig, type ApiToolInventory, type AuthConfig, type AuthStrategy, type BrandingConfig, type ChatAttachment, type ChatRequestBody, type CreateSessionBody, type CreateSessionResponse, FIREWORKS_MODELS, type FeaturesConfig, type FrankieConfig, type FrankieConfigInput, type FrankieErrorCode, type FrankieServerEvent, type HostToolRequest, type HostToolResult, type InferredTheme, type InstallPlan, type InstallProject, type KnowledgeBaseConfig, type LimitsConfig, type LoadedSkill, type McpServerConfig, type ModelChoice, type ModelConfig, type PersonaProfile, type PublicFeatures, type PublicWidgetConfig, SKILL_TOOL_NAME, STANDARD_AGENT_IDS, STARTER_PROMPT_ICONS, type StarterPrompt, type StarterPromptIcon, type StopReason, type ThinkingLevel, type ToolDecision, type ToolPolicy, type ToolResultBody, type UsageSummary, type WidgetTheme, type WidgetThemeConfig, type WorkspaceSkill, activeSkills, agentConfigSchema, apiCapabilitySchema, apiMethods, apiOperations, apiSourceSchema, approvedSkillTools, assertNoCommittedFrankieKeys, authConfigSchema, brandingConfigSchema, canonicalJson, compareApiDocuments, defineFrankieConfig, describeTool, draftSkill, evaluateToolPolicy, featuresConfigSchema, frankieConfigSchema, inferTheme, insertImport, installAgentIds, installBranch, installTitle, knowledgeBaseSchema, knowledgeSourceSchema, limitsConfigSchema, matchPath, matchesAnyPagePattern, matchesInstallBranch, matchesPagePattern, mcpServerSchema, modelChoiceSchema, modelConfigSchema, moduleImporter, mountWidget, normalizeColor, operationId, parseFrankieConfig, personaEnvKey, personaProfileSchema, plainText, planHostedInstall, renderJson, resolvePersonaConfig, sdkUpdateWorkflow, skillSchema, starterPromptSchema, suggestedPromptsFromSkills, thinkingLevelSchema, toolDescriptions, toolPolicySchema, validateApiDocument, widgetThemeSchema, withDependencies };