@frankieai/core 0.2.5 → 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.cjs +716 -126
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +349 -2
- package/dist/index.d.ts +349 -2
- package/dist/index.js +695 -125
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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>>;
|
|
@@ -269,6 +276,107 @@ declare const brandingConfigSchema: z.ZodObject<{
|
|
|
269
276
|
avatarUrl: z.ZodOptional<z.ZodString>;
|
|
270
277
|
launcherLabel: z.ZodDefault<z.ZodString>;
|
|
271
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>;
|
|
272
380
|
declare const frankieConfigSchema: z.ZodObject<{
|
|
273
381
|
tenantId: z.ZodString;
|
|
274
382
|
branding: z.ZodPrefault<z.ZodObject<{
|
|
@@ -368,6 +476,7 @@ declare const frankieConfigSchema: z.ZodObject<{
|
|
|
368
476
|
discoveredTools: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
369
477
|
name: z.ZodString;
|
|
370
478
|
description: z.ZodOptional<z.ZodString>;
|
|
479
|
+
inputs: z.ZodOptional<z.ZodString>;
|
|
371
480
|
}, z.core.$strip>>>;
|
|
372
481
|
transport: z.ZodDefault<z.ZodEnum<{
|
|
373
482
|
http: "http";
|
|
@@ -410,6 +519,7 @@ declare const frankieConfigSchema: z.ZodObject<{
|
|
|
410
519
|
}>;
|
|
411
520
|
path: z.ZodString;
|
|
412
521
|
summary: z.ZodOptional<z.ZodString>;
|
|
522
|
+
inputs: z.ZodOptional<z.ZodString>;
|
|
413
523
|
authGap: z.ZodDefault<z.ZodBoolean>;
|
|
414
524
|
}, z.core.$strip>>>;
|
|
415
525
|
headers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -454,12 +564,99 @@ declare const frankieConfigSchema: z.ZodObject<{
|
|
|
454
564
|
}, z.core.$strip>>;
|
|
455
565
|
workspaceAdmin: z.ZodDefault<z.ZodBoolean>;
|
|
456
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>>;
|
|
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>;
|
|
457
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>>>;
|
|
458
654
|
}, z.core.$strip>;
|
|
459
655
|
type ThinkingLevel = z.infer<typeof thinkingLevelSchema>;
|
|
460
656
|
type WidgetThemeConfig = z.infer<typeof widgetThemeSchema>;
|
|
461
657
|
type ModelChoice = z.infer<typeof modelChoiceSchema>;
|
|
462
658
|
type FeaturesConfig = z.infer<typeof featuresConfigSchema>;
|
|
659
|
+
type KnowledgeBaseConfig = z.infer<typeof knowledgeBaseSchema>;
|
|
463
660
|
type ModelConfig = z.infer<typeof modelConfigSchema>;
|
|
464
661
|
type McpServerConfig = z.infer<typeof mcpServerSchema>;
|
|
465
662
|
type ApiCapability = z.infer<typeof apiCapabilitySchema>;
|
|
@@ -469,11 +666,30 @@ type AgentConfig = z.infer<typeof agentConfigSchema>;
|
|
|
469
666
|
type AuthConfig = z.infer<typeof authConfigSchema>;
|
|
470
667
|
type LimitsConfig = z.infer<typeof limitsConfigSchema>;
|
|
471
668
|
type BrandingConfig = z.infer<typeof brandingConfigSchema>;
|
|
669
|
+
type PersonaProfile = z.infer<typeof personaProfileSchema>;
|
|
472
670
|
type FrankieConfig = z.infer<typeof frankieConfigSchema>;
|
|
473
671
|
type FrankieConfigInput = z.input<typeof frankieConfigSchema>;
|
|
474
672
|
declare function parseFrankieConfig(input: unknown): FrankieConfig;
|
|
475
673
|
/** Helper for `frankie.config.ts` files — gives editors full completion. */
|
|
476
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;
|
|
477
693
|
|
|
478
694
|
/**
|
|
479
695
|
* The wire protocol between the embedded widget and the Frankie server.
|
|
@@ -686,6 +902,8 @@ interface PublicWidgetConfig {
|
|
|
686
902
|
showToolActivity: boolean;
|
|
687
903
|
/** Opt-in capabilities the widget should render (attachments, model picker). */
|
|
688
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[];
|
|
689
907
|
}
|
|
690
908
|
/** The subset of `features` config the widget needs to render its controls. */
|
|
691
909
|
interface PublicFeatures {
|
|
@@ -747,6 +965,38 @@ declare const SKILL_TOOL_NAME = "frankie__use_skill";
|
|
|
747
965
|
/** A short human label for a tool call, for the "Frankie is …" line in the UI. */
|
|
748
966
|
declare function describeTool(toolName: string, input: unknown): string;
|
|
749
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;
|
|
750
1000
|
/** One installation plan for GitHub and the local CLI. Never includes credentials. */
|
|
751
1001
|
interface InstallProject {
|
|
752
1002
|
files: Record<string, string>;
|
|
@@ -757,12 +1007,31 @@ interface InstallProject {
|
|
|
757
1007
|
allowAnonymous: boolean;
|
|
758
1008
|
};
|
|
759
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[];
|
|
760
1026
|
}
|
|
761
1027
|
interface InstallPlan {
|
|
1028
|
+
/** Files to write. Files whose content would not change are left out. */
|
|
762
1029
|
files: Array<{
|
|
763
1030
|
path: string;
|
|
764
1031
|
content: string;
|
|
765
1032
|
}>;
|
|
1033
|
+
/** Frankie's own superseded files to remove. */
|
|
1034
|
+
deletions: string[];
|
|
766
1035
|
root: string;
|
|
767
1036
|
chatPath: string;
|
|
768
1037
|
specPath: string;
|
|
@@ -776,9 +1045,52 @@ declare function assertNoCommittedFrankieKeys(files: Array<{
|
|
|
776
1045
|
path: string;
|
|
777
1046
|
content: string;
|
|
778
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
|
+
*/
|
|
779
1060
|
declare function planHostedInstall(input: InstallProject): InstallPlan;
|
|
780
1061
|
/** Where the generated token endpoint gets the signed-in user from. */
|
|
781
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;
|
|
782
1094
|
|
|
783
1095
|
declare const skillSchema: z.ZodObject<{
|
|
784
1096
|
id: z.ZodString;
|
|
@@ -809,6 +1121,7 @@ declare function approvedSkillTools(config: FrankieConfig): string[];
|
|
|
809
1121
|
declare function toolDescriptions(config: FrankieConfig, toolIds: string[]): Array<{
|
|
810
1122
|
id: string;
|
|
811
1123
|
description: string;
|
|
1124
|
+
inputs?: string;
|
|
812
1125
|
}>;
|
|
813
1126
|
/**
|
|
814
1127
|
* Starter suggestion prompts derived from the workspace's own published,
|
|
@@ -826,7 +1139,7 @@ declare function suggestedPromptsFromSkills(config: FrankieConfig): string[];
|
|
|
826
1139
|
/**
|
|
827
1140
|
* Deterministic starter for the manual editor — not a claim that anything
|
|
828
1141
|
* was executed, and not model-generated. Follows the same structure asked of
|
|
829
|
-
* AI-generated instructions (trigger recap, required inputs, numbered steps,
|
|
1142
|
+
* AI-generated instructions (trigger recap, required inputs, quality bar, numbered steps,
|
|
830
1143
|
* reporting, error handling) so a hand-written skill starts from a useful
|
|
831
1144
|
* shape instead of a blank textarea. `label` is each tool's own description
|
|
832
1145
|
* when the caller has one (e.g. from the dashboard's approved-tools list);
|
|
@@ -865,4 +1178,38 @@ declare function compareApiDocuments(before: ApiDocument, after: ApiDocument): {
|
|
|
865
1178
|
unchangedIds: string[];
|
|
866
1179
|
};
|
|
867
1180
|
|
|
868
|
-
|
|
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 };
|