@frankieai/core 0.2.2 → 0.2.4

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
@@ -19,6 +19,10 @@ declare const widgetThemeSchema: z.ZodPrefault<z.ZodObject<{
19
19
  dark: "dark";
20
20
  system: "system";
21
21
  }>>;
22
+ source: z.ZodDefault<z.ZodEnum<{
23
+ custom: "custom";
24
+ inherit: "inherit";
25
+ }>>;
22
26
  }, z.core.$strip>>;
23
27
  declare const thinkingLevelSchema: z.ZodEnum<{
24
28
  minimal: "minimal";
@@ -51,6 +55,24 @@ declare const modelChoiceSchema: z.ZodObject<{
51
55
  label: z.ZodString;
52
56
  provider: z.ZodOptional<z.ZodString>;
53
57
  }, z.core.$strip>;
58
+ /**
59
+ * The Fireworks-hosted models Frankie offers in the dashboard's model-picker
60
+ * dropdown, so an admin can choose one instead of typing a raw model id. Any
61
+ * other provider model can still be entered by hand. Kept here so the dashboard
62
+ * and docs share one source.
63
+ *
64
+ * Deliberately limited to models that speak Fireworks' OpenAI-completions API:
65
+ * on Fireworks the Anthropic-Messages models inline their reasoning into the
66
+ * visible answer, which leaks the chain-of-thought into the chat, whereas the
67
+ * completions API keeps reasoning on a separate channel. All are large-context
68
+ * and tool-capable. (The leaky Anthropic-Messages models — e.g. Kimi K2.6 /
69
+ * K2.7 Code — are still reachable via the "Other" free-text option.)
70
+ */
71
+ declare const FIREWORKS_MODELS: readonly {
72
+ id: string;
73
+ label: string;
74
+ note: string;
75
+ }[];
54
76
  /**
55
77
  * Optional, opt-in chat capabilities the SDK consumer turns on per workspace.
56
78
  * Everything here is OFF by default: an embedded agent only gets a wider surface
@@ -76,6 +98,7 @@ declare const featuresConfigSchema: z.ZodPrefault<z.ZodObject<{
76
98
  }, z.core.$strip>>;
77
99
  declare const mcpServerSchema: z.ZodObject<{
78
100
  name: z.ZodString;
101
+ displayName: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
79
102
  enabled: z.ZodDefault<z.ZodBoolean>;
80
103
  selectedTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
81
104
  discoveredTools: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -112,6 +135,7 @@ declare const apiCapabilitySchema: z.ZodObject<{
112
135
  }, z.core.$strip>;
113
136
  declare const apiSourceSchema: z.ZodObject<{
114
137
  name: z.ZodString;
138
+ displayName: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
115
139
  spec: z.ZodString;
116
140
  baseUrl: z.ZodOptional<z.ZodString>;
117
141
  operations: z.ZodDefault<z.ZodArray<z.ZodString>>;
@@ -124,6 +148,10 @@ declare const apiSourceSchema: z.ZodObject<{
124
148
  DELETE: "DELETE";
125
149
  }>>>;
126
150
  enabled: z.ZodDefault<z.ZodBoolean>;
151
+ execution: z.ZodDefault<z.ZodEnum<{
152
+ server: "server";
153
+ client: "client";
154
+ }>>;
127
155
  selectedTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
128
156
  exposeAsMcp: z.ZodDefault<z.ZodBoolean>;
129
157
  capabilities: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -151,10 +179,25 @@ declare const toolPolicySchema: z.ZodObject<{
151
179
  deny: z.ZodDefault<z.ZodArray<z.ZodString>>;
152
180
  denyByDefault: z.ZodDefault<z.ZodBoolean>;
153
181
  }, z.core.$strip>;
182
+ /**
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.
186
+ */
187
+ declare const starterPromptSchema: z.ZodObject<{
188
+ title: z.ZodString;
189
+ description: z.ZodOptional<z.ZodString>;
190
+ message: z.ZodString;
191
+ }, z.core.$strip>;
154
192
  declare const agentConfigSchema: z.ZodObject<{
155
193
  systemPrompt: z.ZodDefault<z.ZodString>;
156
194
  greeting: z.ZodDefault<z.ZodString>;
157
195
  suggestedPrompts: z.ZodDefault<z.ZodArray<z.ZodString>>;
196
+ starterPrompts: z.ZodDefault<z.ZodArray<z.ZodObject<{
197
+ title: z.ZodString;
198
+ description: z.ZodOptional<z.ZodString>;
199
+ message: z.ZodString;
200
+ }, z.core.$strip>>>;
158
201
  maxTurns: z.ZodDefault<z.ZodNumber>;
159
202
  maxBudgetUsd: z.ZodOptional<z.ZodNumber>;
160
203
  tools: z.ZodPrefault<z.ZodObject<{
@@ -167,6 +210,10 @@ declare const agentConfigSchema: z.ZodObject<{
167
210
  declare const authConfigSchema: z.ZodObject<{
168
211
  publishableKey: z.ZodString;
169
212
  allowedOrigins: z.ZodDefault<z.ZodArray<z.ZodString>>;
213
+ userCredential: z.ZodDefault<z.ZodEnum<{
214
+ jwt: "jwt";
215
+ opaque: "opaque";
216
+ }>>;
170
217
  allowAnonymous: z.ZodDefault<z.ZodBoolean>;
171
218
  jwtSecretEnv: z.ZodDefault<z.ZodString>;
172
219
  jwksUrl: z.ZodOptional<z.ZodString>;
@@ -209,6 +256,10 @@ declare const frankieConfigSchema: z.ZodObject<{
209
256
  dark: "dark";
210
257
  system: "system";
211
258
  }>>;
259
+ source: z.ZodDefault<z.ZodEnum<{
260
+ custom: "custom";
261
+ inherit: "inherit";
262
+ }>>;
212
263
  }, z.core.$strip>>;
213
264
  model: z.ZodPrefault<z.ZodObject<{
214
265
  provider: z.ZodDefault<z.ZodString>;
@@ -231,6 +282,11 @@ declare const frankieConfigSchema: z.ZodObject<{
231
282
  systemPrompt: z.ZodDefault<z.ZodString>;
232
283
  greeting: z.ZodDefault<z.ZodString>;
233
284
  suggestedPrompts: z.ZodDefault<z.ZodArray<z.ZodString>>;
285
+ starterPrompts: z.ZodDefault<z.ZodArray<z.ZodObject<{
286
+ title: z.ZodString;
287
+ description: z.ZodOptional<z.ZodString>;
288
+ message: z.ZodString;
289
+ }, z.core.$strip>>>;
234
290
  maxTurns: z.ZodDefault<z.ZodNumber>;
235
291
  maxBudgetUsd: z.ZodOptional<z.ZodNumber>;
236
292
  tools: z.ZodPrefault<z.ZodObject<{
@@ -243,6 +299,10 @@ declare const frankieConfigSchema: z.ZodObject<{
243
299
  auth: z.ZodObject<{
244
300
  publishableKey: z.ZodString;
245
301
  allowedOrigins: z.ZodDefault<z.ZodArray<z.ZodString>>;
302
+ userCredential: z.ZodDefault<z.ZodEnum<{
303
+ jwt: "jwt";
304
+ opaque: "opaque";
305
+ }>>;
246
306
  allowAnonymous: z.ZodDefault<z.ZodBoolean>;
247
307
  jwtSecretEnv: z.ZodDefault<z.ZodString>;
248
308
  jwksUrl: z.ZodOptional<z.ZodString>;
@@ -253,6 +313,7 @@ declare const frankieConfigSchema: z.ZodObject<{
253
313
  }, z.core.$strip>;
254
314
  mcpServers: z.ZodDefault<z.ZodArray<z.ZodObject<{
255
315
  name: z.ZodString;
316
+ displayName: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
256
317
  enabled: z.ZodDefault<z.ZodBoolean>;
257
318
  selectedTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
258
319
  discoveredTools: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -270,6 +331,7 @@ declare const frankieConfigSchema: z.ZodObject<{
270
331
  }, z.core.$strip>>>;
271
332
  apis: z.ZodDefault<z.ZodArray<z.ZodObject<{
272
333
  name: z.ZodString;
334
+ displayName: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
273
335
  spec: z.ZodString;
274
336
  baseUrl: z.ZodOptional<z.ZodString>;
275
337
  operations: z.ZodDefault<z.ZodArray<z.ZodString>>;
@@ -282,6 +344,10 @@ declare const frankieConfigSchema: z.ZodObject<{
282
344
  DELETE: "DELETE";
283
345
  }>>>;
284
346
  enabled: z.ZodDefault<z.ZodBoolean>;
347
+ execution: z.ZodDefault<z.ZodEnum<{
348
+ server: "server";
349
+ client: "client";
350
+ }>>;
285
351
  selectedTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
286
352
  exposeAsMcp: z.ZodDefault<z.ZodBoolean>;
287
353
  capabilities: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -371,6 +437,14 @@ type StopReason = "end_turn" | "max_tokens" | "max_turns" | "stop_sequence" | "a
371
437
  interface UsageSummary {
372
438
  inputTokens: number;
373
439
  outputTokens: number;
440
+ /**
441
+ * Prompt-cache hits and writes, when the provider reports them. A cached
442
+ * input token costs a fraction of a fresh one, so this is what says whether
443
+ * the stable prefix — system prompt, tools, earlier turns — is actually being
444
+ * served from cache or re-read every turn.
445
+ */
446
+ cacheReadTokens?: number;
447
+ cacheWriteTokens?: number;
374
448
  /** Present only when the upstream provider reports a price. */
375
449
  costUsd?: number;
376
450
  }
@@ -410,6 +484,21 @@ type FrankieServerEvent = {
410
484
  toolUseId: string;
411
485
  name: string;
412
486
  reason: string;
487
+ }
488
+ /**
489
+ * Client-side tool execution: the server asks the widget to make one HTTP
490
+ * call to the host's own API, from the user's browser and on the user's
491
+ * existing session, and to POST the outcome back to `/v1/chat/tool-result`
492
+ * with this `callId`. Emitted only for API sources marked
493
+ * `execution: "client"`. The turn's agent loop is paused on this call until
494
+ * the result arrives (or the turn times out). See `HostToolRequest`.
495
+ */
496
+ | {
497
+ type: "tool_call_request";
498
+ callId: string;
499
+ toolUseId: string;
500
+ name: string;
501
+ request: HostToolRequest;
413
502
  } | {
414
503
  type: "turn_end";
415
504
  stopReason: StopReason;
@@ -422,6 +511,38 @@ type FrankieServerEvent = {
422
511
  } | {
423
512
  type: "ping";
424
513
  };
514
+ /**
515
+ * One HTTP call Frankie asks the browser to make against the host's own API,
516
+ * on the signed-in user's existing session. `path` is always relative (path +
517
+ * query, no scheme or host): the widget resolves it against the `api.baseUrl`
518
+ * the host configured, and attaches the user's own credentials (cookies or a
519
+ * bearer token). Frankie sends no credential of its own — the host API is the
520
+ * authorization boundary, exactly as for any request from the host's frontend.
521
+ */
522
+ interface HostToolRequest {
523
+ /** The API source the operation belongs to (`api__<source>__...`). Diagnostic only. */
524
+ source: string;
525
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
526
+ /** Path + query string relative to `api.baseUrl`, params already interpolated. */
527
+ path: string;
528
+ /** JSON request body, when the operation declares one. */
529
+ body?: unknown;
530
+ }
531
+ /** The browser's outcome for a `tool_call_request`, POSTed back to the server. */
532
+ interface HostToolResult {
533
+ /** HTTP status the host API returned, or 0 when the fetch itself failed. */
534
+ status: number;
535
+ /** Response body text as returned by the host API. */
536
+ body?: string;
537
+ /** A transport-level error (network failure, no host API configured). */
538
+ error?: string;
539
+ }
540
+ /** Client -> server body for `POST /v1/chat/tool-result`. */
541
+ interface ToolResultBody {
542
+ /** The `callId` from the `tool_call_request` this answers. */
543
+ callId: string;
544
+ result: HostToolResult;
545
+ }
425
546
  type FrankieErrorCode = "unauthorized" | "forbidden_origin" | "rate_limited" | "session_not_found" | "upstream_error" | "budget_exceeded" | "internal";
426
547
  /** Display metadata only; instructions never enter the public SDK config. */
427
548
  interface LoadedSkill {
@@ -488,6 +609,12 @@ interface CreateSessionResponse {
488
609
  anonymous: boolean;
489
610
  };
490
611
  }
612
+ /** A starter card on the empty chat screen: what the reader sees, and the message clicking it sends. */
613
+ interface StarterPrompt {
614
+ title: string;
615
+ description?: string;
616
+ message: string;
617
+ }
491
618
  /** The subset of tenant config the widget is allowed to see. */
492
619
  interface PublicWidgetConfig {
493
620
  tenantId: string;
@@ -499,6 +626,8 @@ interface PublicWidgetConfig {
499
626
  };
500
627
  greeting: string;
501
628
  suggestedPrompts: string[];
629
+ /** Explicit starter cards (title + description + message). Take precedence over `suggestedPrompts` on the empty screen. Optional so older servers stay compatible. */
630
+ starterPrompts?: StarterPrompt[];
502
631
  theme: WidgetTheme;
503
632
  /** Whether the widget may open a session without a host-signed user token. */
504
633
  allowAnonymous: boolean;
@@ -537,6 +666,12 @@ interface WidgetTheme {
537
666
  radius?: string;
538
667
  fontFamily?: string;
539
668
  mode?: "light" | "dark" | "system";
669
+ /**
670
+ * "inherit" tells the widget to sample the host page's own colors instead
671
+ * of using the ones configured here, which then serve only as a fallback.
672
+ * Defaults to "custom" (use the configured colors) when unset.
673
+ */
674
+ source?: "custom" | "inherit";
540
675
  }
541
676
 
542
677
  interface ToolDecision {
@@ -575,6 +710,7 @@ interface InstallPlan {
575
710
  specPath: string;
576
711
  operationCount: number;
577
712
  needsAuthSetup: boolean;
713
+ authStrategy: AuthStrategy;
578
714
  notes: string[];
579
715
  }
580
716
  /** Last gate before generated files enter GitHub or a local checkout. */
@@ -583,6 +719,8 @@ declare function assertNoCommittedFrankieKeys(files: Array<{
583
719
  content: string;
584
720
  }>): void;
585
721
  declare function planHostedInstall(input: InstallProject): InstallPlan;
722
+ /** Where the generated token endpoint gets the signed-in user from. */
723
+ type AuthStrategy = "firebase" | "nextauth" | "supabase" | "custom" | "existing" | "anonymous" | "unconfigured";
586
724
 
587
725
  declare const skillSchema: z.ZodObject<{
588
726
  id: z.ZodString;
@@ -600,8 +738,46 @@ type WorkspaceSkill = z.infer<typeof skillSchema>;
600
738
  declare function activeSkills(config: FrankieConfig, availableTools?: string[]): WorkspaceSkill[];
601
739
  /** Only explicitly selected, currently enabled operations may execute through a skill. */
602
740
  declare function approvedSkillTools(config: FrankieConfig): string[];
603
- /** Deterministic starter, not a claim that new API code has been generated. */
604
- declare function draftSkill(goal: string, tools: string[]): string;
741
+ /**
742
+ * What each tool identifier actually does, drawn from the connected sources'
743
+ * own inventories — the same data the dashboard shows next to each checkbox.
744
+ * Skill generation is only as concrete as the material it's given: a bare
745
+ * list of ids like `api__product__listItems` tells a model nothing about
746
+ * what to ask the user, what order to call things in, or how to summarize a
747
+ * result. This hands it the method/path/summary (or MCP description) for
748
+ * every tool a skill is being written for. Falls back to the bare id for a
749
+ * tool that isn't found (already removed, or awaiting a fresh inventory).
750
+ */
751
+ declare function toolDescriptions(config: FrankieConfig, toolIds: string[]): Array<{
752
+ id: string;
753
+ description: string;
754
+ }>;
755
+ /**
756
+ * Starter suggestion prompts derived from the workspace's own published,
757
+ * runnable skills, so an empty chat offers what this assistant can actually do
758
+ * instead of a blank screen. Each entry is a clean action title ("Generate a
759
+ * lesson"), optionally with a short subtitle after " — " when the skill's goal
760
+ * adds real information. The chat empty state shows the title as the card title
761
+ * and the subtitle beneath it, and sends only the title. Auto-generated skill
762
+ * names (e.g. "product · generate lesson") and their boilerplate CRUD goals are
763
+ * cleaned up so the cards read like real suggestions, not internal ids. Used
764
+ * only when the workspace hasn't authored its own `suggestedPrompts`; deduped
765
+ * and capped to the config limit (6).
766
+ */
767
+ declare function suggestedPromptsFromSkills(config: FrankieConfig): string[];
768
+ /**
769
+ * Deterministic starter for the manual editor — not a claim that anything
770
+ * was executed, and not model-generated. Follows the same structure asked of
771
+ * AI-generated instructions (trigger recap, required inputs, numbered steps,
772
+ * reporting, error handling) so a hand-written skill starts from a useful
773
+ * shape instead of a blank textarea. `label` is each tool's own description
774
+ * when the caller has one (e.g. from the dashboard's approved-tools list);
775
+ * falls back to the bare id.
776
+ */
777
+ declare function draftSkill(goal: string, tools: Array<{
778
+ id: string;
779
+ label?: string;
780
+ }>): string;
605
781
 
606
782
  /** A repository-owned updater. No customer token is stored by Frankie. */
607
783
  declare function sdkUpdateWorkflow(mode: "manual" | "automatic"): string;
@@ -631,4 +807,4 @@ declare function compareApiDocuments(before: ApiDocument, after: ApiDocument): {
631
807
  unchangedIds: string[];
632
808
  };
633
809
 
634
- export { type AgentConfig, type ApiCapability, type ApiDocument, type ApiSourceConfig, type ApiToolInventory, type AuthConfig, type BrandingConfig, type ChatAttachment, type ChatRequestBody, type CreateSessionBody, type CreateSessionResponse, type FeaturesConfig, type FrankieConfig, type FrankieConfigInput, type FrankieErrorCode, type FrankieServerEvent, type InstallPlan, type InstallProject, type LimitsConfig, type LoadedSkill, type McpServerConfig, type ModelChoice, type ModelConfig, type PublicFeatures, type PublicWidgetConfig, type StopReason, type ThinkingLevel, type ToolDecision, type ToolPolicy, 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, thinkingLevelSchema, toolPolicySchema, validateApiDocument, widgetThemeSchema };
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 };
package/dist/index.d.ts CHANGED
@@ -19,6 +19,10 @@ declare const widgetThemeSchema: z.ZodPrefault<z.ZodObject<{
19
19
  dark: "dark";
20
20
  system: "system";
21
21
  }>>;
22
+ source: z.ZodDefault<z.ZodEnum<{
23
+ custom: "custom";
24
+ inherit: "inherit";
25
+ }>>;
22
26
  }, z.core.$strip>>;
23
27
  declare const thinkingLevelSchema: z.ZodEnum<{
24
28
  minimal: "minimal";
@@ -51,6 +55,24 @@ declare const modelChoiceSchema: z.ZodObject<{
51
55
  label: z.ZodString;
52
56
  provider: z.ZodOptional<z.ZodString>;
53
57
  }, z.core.$strip>;
58
+ /**
59
+ * The Fireworks-hosted models Frankie offers in the dashboard's model-picker
60
+ * dropdown, so an admin can choose one instead of typing a raw model id. Any
61
+ * other provider model can still be entered by hand. Kept here so the dashboard
62
+ * and docs share one source.
63
+ *
64
+ * Deliberately limited to models that speak Fireworks' OpenAI-completions API:
65
+ * on Fireworks the Anthropic-Messages models inline their reasoning into the
66
+ * visible answer, which leaks the chain-of-thought into the chat, whereas the
67
+ * completions API keeps reasoning on a separate channel. All are large-context
68
+ * and tool-capable. (The leaky Anthropic-Messages models — e.g. Kimi K2.6 /
69
+ * K2.7 Code — are still reachable via the "Other" free-text option.)
70
+ */
71
+ declare const FIREWORKS_MODELS: readonly {
72
+ id: string;
73
+ label: string;
74
+ note: string;
75
+ }[];
54
76
  /**
55
77
  * Optional, opt-in chat capabilities the SDK consumer turns on per workspace.
56
78
  * Everything here is OFF by default: an embedded agent only gets a wider surface
@@ -76,6 +98,7 @@ declare const featuresConfigSchema: z.ZodPrefault<z.ZodObject<{
76
98
  }, z.core.$strip>>;
77
99
  declare const mcpServerSchema: z.ZodObject<{
78
100
  name: z.ZodString;
101
+ displayName: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
79
102
  enabled: z.ZodDefault<z.ZodBoolean>;
80
103
  selectedTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
81
104
  discoveredTools: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -112,6 +135,7 @@ declare const apiCapabilitySchema: z.ZodObject<{
112
135
  }, z.core.$strip>;
113
136
  declare const apiSourceSchema: z.ZodObject<{
114
137
  name: z.ZodString;
138
+ displayName: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
115
139
  spec: z.ZodString;
116
140
  baseUrl: z.ZodOptional<z.ZodString>;
117
141
  operations: z.ZodDefault<z.ZodArray<z.ZodString>>;
@@ -124,6 +148,10 @@ declare const apiSourceSchema: z.ZodObject<{
124
148
  DELETE: "DELETE";
125
149
  }>>>;
126
150
  enabled: z.ZodDefault<z.ZodBoolean>;
151
+ execution: z.ZodDefault<z.ZodEnum<{
152
+ server: "server";
153
+ client: "client";
154
+ }>>;
127
155
  selectedTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
128
156
  exposeAsMcp: z.ZodDefault<z.ZodBoolean>;
129
157
  capabilities: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -151,10 +179,25 @@ declare const toolPolicySchema: z.ZodObject<{
151
179
  deny: z.ZodDefault<z.ZodArray<z.ZodString>>;
152
180
  denyByDefault: z.ZodDefault<z.ZodBoolean>;
153
181
  }, z.core.$strip>;
182
+ /**
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.
186
+ */
187
+ declare const starterPromptSchema: z.ZodObject<{
188
+ title: z.ZodString;
189
+ description: z.ZodOptional<z.ZodString>;
190
+ message: z.ZodString;
191
+ }, z.core.$strip>;
154
192
  declare const agentConfigSchema: z.ZodObject<{
155
193
  systemPrompt: z.ZodDefault<z.ZodString>;
156
194
  greeting: z.ZodDefault<z.ZodString>;
157
195
  suggestedPrompts: z.ZodDefault<z.ZodArray<z.ZodString>>;
196
+ starterPrompts: z.ZodDefault<z.ZodArray<z.ZodObject<{
197
+ title: z.ZodString;
198
+ description: z.ZodOptional<z.ZodString>;
199
+ message: z.ZodString;
200
+ }, z.core.$strip>>>;
158
201
  maxTurns: z.ZodDefault<z.ZodNumber>;
159
202
  maxBudgetUsd: z.ZodOptional<z.ZodNumber>;
160
203
  tools: z.ZodPrefault<z.ZodObject<{
@@ -167,6 +210,10 @@ declare const agentConfigSchema: z.ZodObject<{
167
210
  declare const authConfigSchema: z.ZodObject<{
168
211
  publishableKey: z.ZodString;
169
212
  allowedOrigins: z.ZodDefault<z.ZodArray<z.ZodString>>;
213
+ userCredential: z.ZodDefault<z.ZodEnum<{
214
+ jwt: "jwt";
215
+ opaque: "opaque";
216
+ }>>;
170
217
  allowAnonymous: z.ZodDefault<z.ZodBoolean>;
171
218
  jwtSecretEnv: z.ZodDefault<z.ZodString>;
172
219
  jwksUrl: z.ZodOptional<z.ZodString>;
@@ -209,6 +256,10 @@ declare const frankieConfigSchema: z.ZodObject<{
209
256
  dark: "dark";
210
257
  system: "system";
211
258
  }>>;
259
+ source: z.ZodDefault<z.ZodEnum<{
260
+ custom: "custom";
261
+ inherit: "inherit";
262
+ }>>;
212
263
  }, z.core.$strip>>;
213
264
  model: z.ZodPrefault<z.ZodObject<{
214
265
  provider: z.ZodDefault<z.ZodString>;
@@ -231,6 +282,11 @@ declare const frankieConfigSchema: z.ZodObject<{
231
282
  systemPrompt: z.ZodDefault<z.ZodString>;
232
283
  greeting: z.ZodDefault<z.ZodString>;
233
284
  suggestedPrompts: z.ZodDefault<z.ZodArray<z.ZodString>>;
285
+ starterPrompts: z.ZodDefault<z.ZodArray<z.ZodObject<{
286
+ title: z.ZodString;
287
+ description: z.ZodOptional<z.ZodString>;
288
+ message: z.ZodString;
289
+ }, z.core.$strip>>>;
234
290
  maxTurns: z.ZodDefault<z.ZodNumber>;
235
291
  maxBudgetUsd: z.ZodOptional<z.ZodNumber>;
236
292
  tools: z.ZodPrefault<z.ZodObject<{
@@ -243,6 +299,10 @@ declare const frankieConfigSchema: z.ZodObject<{
243
299
  auth: z.ZodObject<{
244
300
  publishableKey: z.ZodString;
245
301
  allowedOrigins: z.ZodDefault<z.ZodArray<z.ZodString>>;
302
+ userCredential: z.ZodDefault<z.ZodEnum<{
303
+ jwt: "jwt";
304
+ opaque: "opaque";
305
+ }>>;
246
306
  allowAnonymous: z.ZodDefault<z.ZodBoolean>;
247
307
  jwtSecretEnv: z.ZodDefault<z.ZodString>;
248
308
  jwksUrl: z.ZodOptional<z.ZodString>;
@@ -253,6 +313,7 @@ declare const frankieConfigSchema: z.ZodObject<{
253
313
  }, z.core.$strip>;
254
314
  mcpServers: z.ZodDefault<z.ZodArray<z.ZodObject<{
255
315
  name: z.ZodString;
316
+ displayName: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
256
317
  enabled: z.ZodDefault<z.ZodBoolean>;
257
318
  selectedTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
258
319
  discoveredTools: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -270,6 +331,7 @@ declare const frankieConfigSchema: z.ZodObject<{
270
331
  }, z.core.$strip>>>;
271
332
  apis: z.ZodDefault<z.ZodArray<z.ZodObject<{
272
333
  name: z.ZodString;
334
+ displayName: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
273
335
  spec: z.ZodString;
274
336
  baseUrl: z.ZodOptional<z.ZodString>;
275
337
  operations: z.ZodDefault<z.ZodArray<z.ZodString>>;
@@ -282,6 +344,10 @@ declare const frankieConfigSchema: z.ZodObject<{
282
344
  DELETE: "DELETE";
283
345
  }>>>;
284
346
  enabled: z.ZodDefault<z.ZodBoolean>;
347
+ execution: z.ZodDefault<z.ZodEnum<{
348
+ server: "server";
349
+ client: "client";
350
+ }>>;
285
351
  selectedTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
286
352
  exposeAsMcp: z.ZodDefault<z.ZodBoolean>;
287
353
  capabilities: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -371,6 +437,14 @@ type StopReason = "end_turn" | "max_tokens" | "max_turns" | "stop_sequence" | "a
371
437
  interface UsageSummary {
372
438
  inputTokens: number;
373
439
  outputTokens: number;
440
+ /**
441
+ * Prompt-cache hits and writes, when the provider reports them. A cached
442
+ * input token costs a fraction of a fresh one, so this is what says whether
443
+ * the stable prefix — system prompt, tools, earlier turns — is actually being
444
+ * served from cache or re-read every turn.
445
+ */
446
+ cacheReadTokens?: number;
447
+ cacheWriteTokens?: number;
374
448
  /** Present only when the upstream provider reports a price. */
375
449
  costUsd?: number;
376
450
  }
@@ -410,6 +484,21 @@ type FrankieServerEvent = {
410
484
  toolUseId: string;
411
485
  name: string;
412
486
  reason: string;
487
+ }
488
+ /**
489
+ * Client-side tool execution: the server asks the widget to make one HTTP
490
+ * call to the host's own API, from the user's browser and on the user's
491
+ * existing session, and to POST the outcome back to `/v1/chat/tool-result`
492
+ * with this `callId`. Emitted only for API sources marked
493
+ * `execution: "client"`. The turn's agent loop is paused on this call until
494
+ * the result arrives (or the turn times out). See `HostToolRequest`.
495
+ */
496
+ | {
497
+ type: "tool_call_request";
498
+ callId: string;
499
+ toolUseId: string;
500
+ name: string;
501
+ request: HostToolRequest;
413
502
  } | {
414
503
  type: "turn_end";
415
504
  stopReason: StopReason;
@@ -422,6 +511,38 @@ type FrankieServerEvent = {
422
511
  } | {
423
512
  type: "ping";
424
513
  };
514
+ /**
515
+ * One HTTP call Frankie asks the browser to make against the host's own API,
516
+ * on the signed-in user's existing session. `path` is always relative (path +
517
+ * query, no scheme or host): the widget resolves it against the `api.baseUrl`
518
+ * the host configured, and attaches the user's own credentials (cookies or a
519
+ * bearer token). Frankie sends no credential of its own — the host API is the
520
+ * authorization boundary, exactly as for any request from the host's frontend.
521
+ */
522
+ interface HostToolRequest {
523
+ /** The API source the operation belongs to (`api__<source>__...`). Diagnostic only. */
524
+ source: string;
525
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
526
+ /** Path + query string relative to `api.baseUrl`, params already interpolated. */
527
+ path: string;
528
+ /** JSON request body, when the operation declares one. */
529
+ body?: unknown;
530
+ }
531
+ /** The browser's outcome for a `tool_call_request`, POSTed back to the server. */
532
+ interface HostToolResult {
533
+ /** HTTP status the host API returned, or 0 when the fetch itself failed. */
534
+ status: number;
535
+ /** Response body text as returned by the host API. */
536
+ body?: string;
537
+ /** A transport-level error (network failure, no host API configured). */
538
+ error?: string;
539
+ }
540
+ /** Client -> server body for `POST /v1/chat/tool-result`. */
541
+ interface ToolResultBody {
542
+ /** The `callId` from the `tool_call_request` this answers. */
543
+ callId: string;
544
+ result: HostToolResult;
545
+ }
425
546
  type FrankieErrorCode = "unauthorized" | "forbidden_origin" | "rate_limited" | "session_not_found" | "upstream_error" | "budget_exceeded" | "internal";
426
547
  /** Display metadata only; instructions never enter the public SDK config. */
427
548
  interface LoadedSkill {
@@ -488,6 +609,12 @@ interface CreateSessionResponse {
488
609
  anonymous: boolean;
489
610
  };
490
611
  }
612
+ /** A starter card on the empty chat screen: what the reader sees, and the message clicking it sends. */
613
+ interface StarterPrompt {
614
+ title: string;
615
+ description?: string;
616
+ message: string;
617
+ }
491
618
  /** The subset of tenant config the widget is allowed to see. */
492
619
  interface PublicWidgetConfig {
493
620
  tenantId: string;
@@ -499,6 +626,8 @@ interface PublicWidgetConfig {
499
626
  };
500
627
  greeting: string;
501
628
  suggestedPrompts: string[];
629
+ /** Explicit starter cards (title + description + message). Take precedence over `suggestedPrompts` on the empty screen. Optional so older servers stay compatible. */
630
+ starterPrompts?: StarterPrompt[];
502
631
  theme: WidgetTheme;
503
632
  /** Whether the widget may open a session without a host-signed user token. */
504
633
  allowAnonymous: boolean;
@@ -537,6 +666,12 @@ interface WidgetTheme {
537
666
  radius?: string;
538
667
  fontFamily?: string;
539
668
  mode?: "light" | "dark" | "system";
669
+ /**
670
+ * "inherit" tells the widget to sample the host page's own colors instead
671
+ * of using the ones configured here, which then serve only as a fallback.
672
+ * Defaults to "custom" (use the configured colors) when unset.
673
+ */
674
+ source?: "custom" | "inherit";
540
675
  }
541
676
 
542
677
  interface ToolDecision {
@@ -575,6 +710,7 @@ interface InstallPlan {
575
710
  specPath: string;
576
711
  operationCount: number;
577
712
  needsAuthSetup: boolean;
713
+ authStrategy: AuthStrategy;
578
714
  notes: string[];
579
715
  }
580
716
  /** Last gate before generated files enter GitHub or a local checkout. */
@@ -583,6 +719,8 @@ declare function assertNoCommittedFrankieKeys(files: Array<{
583
719
  content: string;
584
720
  }>): void;
585
721
  declare function planHostedInstall(input: InstallProject): InstallPlan;
722
+ /** Where the generated token endpoint gets the signed-in user from. */
723
+ type AuthStrategy = "firebase" | "nextauth" | "supabase" | "custom" | "existing" | "anonymous" | "unconfigured";
586
724
 
587
725
  declare const skillSchema: z.ZodObject<{
588
726
  id: z.ZodString;
@@ -600,8 +738,46 @@ type WorkspaceSkill = z.infer<typeof skillSchema>;
600
738
  declare function activeSkills(config: FrankieConfig, availableTools?: string[]): WorkspaceSkill[];
601
739
  /** Only explicitly selected, currently enabled operations may execute through a skill. */
602
740
  declare function approvedSkillTools(config: FrankieConfig): string[];
603
- /** Deterministic starter, not a claim that new API code has been generated. */
604
- declare function draftSkill(goal: string, tools: string[]): string;
741
+ /**
742
+ * What each tool identifier actually does, drawn from the connected sources'
743
+ * own inventories — the same data the dashboard shows next to each checkbox.
744
+ * Skill generation is only as concrete as the material it's given: a bare
745
+ * list of ids like `api__product__listItems` tells a model nothing about
746
+ * what to ask the user, what order to call things in, or how to summarize a
747
+ * result. This hands it the method/path/summary (or MCP description) for
748
+ * every tool a skill is being written for. Falls back to the bare id for a
749
+ * tool that isn't found (already removed, or awaiting a fresh inventory).
750
+ */
751
+ declare function toolDescriptions(config: FrankieConfig, toolIds: string[]): Array<{
752
+ id: string;
753
+ description: string;
754
+ }>;
755
+ /**
756
+ * Starter suggestion prompts derived from the workspace's own published,
757
+ * runnable skills, so an empty chat offers what this assistant can actually do
758
+ * instead of a blank screen. Each entry is a clean action title ("Generate a
759
+ * lesson"), optionally with a short subtitle after " — " when the skill's goal
760
+ * adds real information. The chat empty state shows the title as the card title
761
+ * and the subtitle beneath it, and sends only the title. Auto-generated skill
762
+ * names (e.g. "product · generate lesson") and their boilerplate CRUD goals are
763
+ * cleaned up so the cards read like real suggestions, not internal ids. Used
764
+ * only when the workspace hasn't authored its own `suggestedPrompts`; deduped
765
+ * and capped to the config limit (6).
766
+ */
767
+ declare function suggestedPromptsFromSkills(config: FrankieConfig): string[];
768
+ /**
769
+ * Deterministic starter for the manual editor — not a claim that anything
770
+ * was executed, and not model-generated. Follows the same structure asked of
771
+ * AI-generated instructions (trigger recap, required inputs, numbered steps,
772
+ * reporting, error handling) so a hand-written skill starts from a useful
773
+ * shape instead of a blank textarea. `label` is each tool's own description
774
+ * when the caller has one (e.g. from the dashboard's approved-tools list);
775
+ * falls back to the bare id.
776
+ */
777
+ declare function draftSkill(goal: string, tools: Array<{
778
+ id: string;
779
+ label?: string;
780
+ }>): string;
605
781
 
606
782
  /** A repository-owned updater. No customer token is stored by Frankie. */
607
783
  declare function sdkUpdateWorkflow(mode: "manual" | "automatic"): string;
@@ -631,4 +807,4 @@ declare function compareApiDocuments(before: ApiDocument, after: ApiDocument): {
631
807
  unchangedIds: string[];
632
808
  };
633
809
 
634
- export { type AgentConfig, type ApiCapability, type ApiDocument, type ApiSourceConfig, type ApiToolInventory, type AuthConfig, type BrandingConfig, type ChatAttachment, type ChatRequestBody, type CreateSessionBody, type CreateSessionResponse, type FeaturesConfig, type FrankieConfig, type FrankieConfigInput, type FrankieErrorCode, type FrankieServerEvent, type InstallPlan, type InstallProject, type LimitsConfig, type LoadedSkill, type McpServerConfig, type ModelChoice, type ModelConfig, type PublicFeatures, type PublicWidgetConfig, type StopReason, type ThinkingLevel, type ToolDecision, type ToolPolicy, 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, thinkingLevelSchema, toolPolicySchema, validateApiDocument, widgetThemeSchema };
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 };