@frankieai/core 0.2.1 → 0.2.3

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<{
@@ -108,9 +131,11 @@ declare const apiCapabilitySchema: z.ZodObject<{
108
131
  }>;
109
132
  path: z.ZodString;
110
133
  summary: z.ZodOptional<z.ZodString>;
134
+ authGap: z.ZodDefault<z.ZodBoolean>;
111
135
  }, z.core.$strip>;
112
136
  declare const apiSourceSchema: z.ZodObject<{
113
137
  name: z.ZodString;
138
+ displayName: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
114
139
  spec: z.ZodString;
115
140
  baseUrl: z.ZodOptional<z.ZodString>;
116
141
  operations: z.ZodDefault<z.ZodArray<z.ZodString>>;
@@ -123,6 +148,10 @@ declare const apiSourceSchema: z.ZodObject<{
123
148
  DELETE: "DELETE";
124
149
  }>>>;
125
150
  enabled: z.ZodDefault<z.ZodBoolean>;
151
+ execution: z.ZodDefault<z.ZodEnum<{
152
+ server: "server";
153
+ client: "client";
154
+ }>>;
126
155
  selectedTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
127
156
  exposeAsMcp: z.ZodDefault<z.ZodBoolean>;
128
157
  capabilities: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -136,10 +165,12 @@ declare const apiSourceSchema: z.ZodObject<{
136
165
  }>;
137
166
  path: z.ZodString;
138
167
  summary: z.ZodOptional<z.ZodString>;
168
+ authGap: z.ZodDefault<z.ZodBoolean>;
139
169
  }, z.core.$strip>>>;
140
170
  headers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
141
171
  forwardUserTokenAs: z.ZodOptional<z.ZodString>;
142
172
  forwardUserClaims: z.ZodDefault<z.ZodArray<z.ZodString>>;
173
+ security: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
143
174
  timeoutMs: z.ZodDefault<z.ZodNumber>;
144
175
  maxResponseChars: z.ZodDefault<z.ZodNumber>;
145
176
  }, z.core.$strip>;
@@ -164,6 +195,10 @@ declare const agentConfigSchema: z.ZodObject<{
164
195
  declare const authConfigSchema: z.ZodObject<{
165
196
  publishableKey: z.ZodString;
166
197
  allowedOrigins: z.ZodDefault<z.ZodArray<z.ZodString>>;
198
+ userCredential: z.ZodDefault<z.ZodEnum<{
199
+ jwt: "jwt";
200
+ opaque: "opaque";
201
+ }>>;
167
202
  allowAnonymous: z.ZodDefault<z.ZodBoolean>;
168
203
  jwtSecretEnv: z.ZodDefault<z.ZodString>;
169
204
  jwksUrl: z.ZodOptional<z.ZodString>;
@@ -206,6 +241,10 @@ declare const frankieConfigSchema: z.ZodObject<{
206
241
  dark: "dark";
207
242
  system: "system";
208
243
  }>>;
244
+ source: z.ZodDefault<z.ZodEnum<{
245
+ custom: "custom";
246
+ inherit: "inherit";
247
+ }>>;
209
248
  }, z.core.$strip>>;
210
249
  model: z.ZodPrefault<z.ZodObject<{
211
250
  provider: z.ZodDefault<z.ZodString>;
@@ -240,6 +279,10 @@ declare const frankieConfigSchema: z.ZodObject<{
240
279
  auth: z.ZodObject<{
241
280
  publishableKey: z.ZodString;
242
281
  allowedOrigins: z.ZodDefault<z.ZodArray<z.ZodString>>;
282
+ userCredential: z.ZodDefault<z.ZodEnum<{
283
+ jwt: "jwt";
284
+ opaque: "opaque";
285
+ }>>;
243
286
  allowAnonymous: z.ZodDefault<z.ZodBoolean>;
244
287
  jwtSecretEnv: z.ZodDefault<z.ZodString>;
245
288
  jwksUrl: z.ZodOptional<z.ZodString>;
@@ -250,6 +293,7 @@ declare const frankieConfigSchema: z.ZodObject<{
250
293
  }, z.core.$strip>;
251
294
  mcpServers: z.ZodDefault<z.ZodArray<z.ZodObject<{
252
295
  name: z.ZodString;
296
+ displayName: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
253
297
  enabled: z.ZodDefault<z.ZodBoolean>;
254
298
  selectedTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
255
299
  discoveredTools: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -267,6 +311,7 @@ declare const frankieConfigSchema: z.ZodObject<{
267
311
  }, z.core.$strip>>>;
268
312
  apis: z.ZodDefault<z.ZodArray<z.ZodObject<{
269
313
  name: z.ZodString;
314
+ displayName: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
270
315
  spec: z.ZodString;
271
316
  baseUrl: z.ZodOptional<z.ZodString>;
272
317
  operations: z.ZodDefault<z.ZodArray<z.ZodString>>;
@@ -279,6 +324,10 @@ declare const frankieConfigSchema: z.ZodObject<{
279
324
  DELETE: "DELETE";
280
325
  }>>>;
281
326
  enabled: z.ZodDefault<z.ZodBoolean>;
327
+ execution: z.ZodDefault<z.ZodEnum<{
328
+ server: "server";
329
+ client: "client";
330
+ }>>;
282
331
  selectedTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
283
332
  exposeAsMcp: z.ZodDefault<z.ZodBoolean>;
284
333
  capabilities: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -292,10 +341,12 @@ declare const frankieConfigSchema: z.ZodObject<{
292
341
  }>;
293
342
  path: z.ZodString;
294
343
  summary: z.ZodOptional<z.ZodString>;
344
+ authGap: z.ZodDefault<z.ZodBoolean>;
295
345
  }, z.core.$strip>>>;
296
346
  headers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
297
347
  forwardUserTokenAs: z.ZodOptional<z.ZodString>;
298
348
  forwardUserClaims: z.ZodDefault<z.ZodArray<z.ZodString>>;
349
+ security: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
299
350
  timeoutMs: z.ZodDefault<z.ZodNumber>;
300
351
  maxResponseChars: z.ZodDefault<z.ZodNumber>;
301
352
  }, z.core.$strip>>>;
@@ -366,6 +417,14 @@ type StopReason = "end_turn" | "max_tokens" | "max_turns" | "stop_sequence" | "a
366
417
  interface UsageSummary {
367
418
  inputTokens: number;
368
419
  outputTokens: number;
420
+ /**
421
+ * Prompt-cache hits and writes, when the provider reports them. A cached
422
+ * input token costs a fraction of a fresh one, so this is what says whether
423
+ * the stable prefix — system prompt, tools, earlier turns — is actually being
424
+ * served from cache or re-read every turn.
425
+ */
426
+ cacheReadTokens?: number;
427
+ cacheWriteTokens?: number;
369
428
  /** Present only when the upstream provider reports a price. */
370
429
  costUsd?: number;
371
430
  }
@@ -373,6 +432,9 @@ interface UsageSummary {
373
432
  type FrankieServerEvent = {
374
433
  type: "skills_loaded";
375
434
  skills: LoadedSkill[];
435
+ } | {
436
+ type: "tools_active";
437
+ apis: ApiToolInventory[];
376
438
  } | {
377
439
  type: "session";
378
440
  sessionId: string;
@@ -402,6 +464,21 @@ type FrankieServerEvent = {
402
464
  toolUseId: string;
403
465
  name: string;
404
466
  reason: string;
467
+ }
468
+ /**
469
+ * Client-side tool execution: the server asks the widget to make one HTTP
470
+ * call to the host's own API, from the user's browser and on the user's
471
+ * existing session, and to POST the outcome back to `/v1/chat/tool-result`
472
+ * with this `callId`. Emitted only for API sources marked
473
+ * `execution: "client"`. The turn's agent loop is paused on this call until
474
+ * the result arrives (or the turn times out). See `HostToolRequest`.
475
+ */
476
+ | {
477
+ type: "tool_call_request";
478
+ callId: string;
479
+ toolUseId: string;
480
+ name: string;
481
+ request: HostToolRequest;
405
482
  } | {
406
483
  type: "turn_end";
407
484
  stopReason: StopReason;
@@ -414,6 +491,38 @@ type FrankieServerEvent = {
414
491
  } | {
415
492
  type: "ping";
416
493
  };
494
+ /**
495
+ * One HTTP call Frankie asks the browser to make against the host's own API,
496
+ * on the signed-in user's existing session. `path` is always relative (path +
497
+ * query, no scheme or host): the widget resolves it against the `api.baseUrl`
498
+ * the host configured, and attaches the user's own credentials (cookies or a
499
+ * bearer token). Frankie sends no credential of its own — the host API is the
500
+ * authorization boundary, exactly as for any request from the host's frontend.
501
+ */
502
+ interface HostToolRequest {
503
+ /** The API source the operation belongs to (`api__<source>__...`). Diagnostic only. */
504
+ source: string;
505
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
506
+ /** Path + query string relative to `api.baseUrl`, params already interpolated. */
507
+ path: string;
508
+ /** JSON request body, when the operation declares one. */
509
+ body?: unknown;
510
+ }
511
+ /** The browser's outcome for a `tool_call_request`, POSTed back to the server. */
512
+ interface HostToolResult {
513
+ /** HTTP status the host API returned, or 0 when the fetch itself failed. */
514
+ status: number;
515
+ /** Response body text as returned by the host API. */
516
+ body?: string;
517
+ /** A transport-level error (network failure, no host API configured). */
518
+ error?: string;
519
+ }
520
+ /** Client -> server body for `POST /v1/chat/tool-result`. */
521
+ interface ToolResultBody {
522
+ /** The `callId` from the `tool_call_request` this answers. */
523
+ callId: string;
524
+ result: HostToolResult;
525
+ }
417
526
  type FrankieErrorCode = "unauthorized" | "forbidden_origin" | "rate_limited" | "session_not_found" | "upstream_error" | "budget_exceeded" | "internal";
418
527
  /** Display metadata only; instructions never enter the public SDK config. */
419
528
  interface LoadedSkill {
@@ -421,6 +530,16 @@ interface LoadedSkill {
421
530
  name: string;
422
531
  revision: number;
423
532
  }
533
+ /**
534
+ * Which OpenAPI source is live for this turn, and a content fingerprint of the
535
+ * exact spec loaded — so a host or a signed-in admin can see that a refresh
536
+ * actually changed what chat is calling, without exposing the spec itself.
537
+ */
538
+ interface ApiToolInventory {
539
+ name: string;
540
+ specHash: string;
541
+ operationCount: number;
542
+ }
424
543
  /** A file the end user attached to a turn. `data` is base64 (no data-URL prefix). */
425
544
  interface ChatAttachment {
426
545
  name: string;
@@ -519,6 +638,12 @@ interface WidgetTheme {
519
638
  radius?: string;
520
639
  fontFamily?: string;
521
640
  mode?: "light" | "dark" | "system";
641
+ /**
642
+ * "inherit" tells the widget to sample the host page's own colors instead
643
+ * of using the ones configured here, which then serve only as a fallback.
644
+ * Defaults to "custom" (use the configured colors) when unset.
645
+ */
646
+ source?: "custom" | "inherit";
522
647
  }
523
648
 
524
649
  interface ToolDecision {
@@ -557,6 +682,7 @@ interface InstallPlan {
557
682
  specPath: string;
558
683
  operationCount: number;
559
684
  needsAuthSetup: boolean;
685
+ authStrategy: AuthStrategy;
560
686
  notes: string[];
561
687
  }
562
688
  /** Last gate before generated files enter GitHub or a local checkout. */
@@ -565,6 +691,8 @@ declare function assertNoCommittedFrankieKeys(files: Array<{
565
691
  content: string;
566
692
  }>): void;
567
693
  declare function planHostedInstall(input: InstallProject): InstallPlan;
694
+ /** Where the generated token endpoint gets the signed-in user from. */
695
+ type AuthStrategy = "firebase" | "nextauth" | "supabase" | "custom" | "existing" | "anonymous" | "unconfigured";
568
696
 
569
697
  declare const skillSchema: z.ZodObject<{
570
698
  id: z.ZodString;
@@ -582,8 +710,33 @@ type WorkspaceSkill = z.infer<typeof skillSchema>;
582
710
  declare function activeSkills(config: FrankieConfig, availableTools?: string[]): WorkspaceSkill[];
583
711
  /** Only explicitly selected, currently enabled operations may execute through a skill. */
584
712
  declare function approvedSkillTools(config: FrankieConfig): string[];
585
- /** Deterministic starter, not a claim that new API code has been generated. */
586
- declare function draftSkill(goal: string, tools: string[]): string;
713
+ /**
714
+ * What each tool identifier actually does, drawn from the connected sources'
715
+ * own inventories — the same data the dashboard shows next to each checkbox.
716
+ * Skill generation is only as concrete as the material it's given: a bare
717
+ * list of ids like `api__product__listItems` tells a model nothing about
718
+ * what to ask the user, what order to call things in, or how to summarize a
719
+ * result. This hands it the method/path/summary (or MCP description) for
720
+ * every tool a skill is being written for. Falls back to the bare id for a
721
+ * tool that isn't found (already removed, or awaiting a fresh inventory).
722
+ */
723
+ declare function toolDescriptions(config: FrankieConfig, toolIds: string[]): Array<{
724
+ id: string;
725
+ description: string;
726
+ }>;
727
+ /**
728
+ * Deterministic starter for the manual editor — not a claim that anything
729
+ * was executed, and not model-generated. Follows the same structure asked of
730
+ * AI-generated instructions (trigger recap, required inputs, numbered steps,
731
+ * reporting, error handling) so a hand-written skill starts from a useful
732
+ * shape instead of a blank textarea. `label` is each tool's own description
733
+ * when the caller has one (e.g. from the dashboard's approved-tools list);
734
+ * falls back to the bare id.
735
+ */
736
+ declare function draftSkill(goal: string, tools: Array<{
737
+ id: string;
738
+ label?: string;
739
+ }>): string;
587
740
 
588
741
  /** A repository-owned updater. No customer token is stored by Frankie. */
589
742
  declare function sdkUpdateWorkflow(mode: "manual" | "automatic"): string;
@@ -600,6 +753,12 @@ declare function apiOperations(doc: ApiDocument): Map<string, {
600
753
  id: string;
601
754
  fingerprint: string;
602
755
  }>;
756
+ /**
757
+ * `/projects/*` matches one path segment; `/projects/**` matches any depth and
758
+ * the base path itself, since a tenant writing that plainly means "this part of
759
+ * the API" rather than "everything under it but not it".
760
+ */
761
+ declare function matchPath(glob: string, path: string): boolean;
603
762
  declare function compareApiDocuments(before: ApiDocument, after: ApiDocument): {
604
763
  added: string[];
605
764
  changed: string[];
@@ -607,4 +766,4 @@ declare function compareApiDocuments(before: ApiDocument, after: ApiDocument): {
607
766
  unchangedIds: string[];
608
767
  };
609
768
 
610
- export { type AgentConfig, type ApiCapability, type ApiDocument, type ApiSourceConfig, 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, mcpServerSchema, modelChoiceSchema, modelConfigSchema, operationId, parseFrankieConfig, planHostedInstall, sdkUpdateWorkflow, skillSchema, thinkingLevelSchema, toolPolicySchema, validateApiDocument, widgetThemeSchema };
769
+ 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 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, 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<{
@@ -108,9 +131,11 @@ declare const apiCapabilitySchema: z.ZodObject<{
108
131
  }>;
109
132
  path: z.ZodString;
110
133
  summary: z.ZodOptional<z.ZodString>;
134
+ authGap: z.ZodDefault<z.ZodBoolean>;
111
135
  }, z.core.$strip>;
112
136
  declare const apiSourceSchema: z.ZodObject<{
113
137
  name: z.ZodString;
138
+ displayName: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
114
139
  spec: z.ZodString;
115
140
  baseUrl: z.ZodOptional<z.ZodString>;
116
141
  operations: z.ZodDefault<z.ZodArray<z.ZodString>>;
@@ -123,6 +148,10 @@ declare const apiSourceSchema: z.ZodObject<{
123
148
  DELETE: "DELETE";
124
149
  }>>>;
125
150
  enabled: z.ZodDefault<z.ZodBoolean>;
151
+ execution: z.ZodDefault<z.ZodEnum<{
152
+ server: "server";
153
+ client: "client";
154
+ }>>;
126
155
  selectedTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
127
156
  exposeAsMcp: z.ZodDefault<z.ZodBoolean>;
128
157
  capabilities: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -136,10 +165,12 @@ declare const apiSourceSchema: z.ZodObject<{
136
165
  }>;
137
166
  path: z.ZodString;
138
167
  summary: z.ZodOptional<z.ZodString>;
168
+ authGap: z.ZodDefault<z.ZodBoolean>;
139
169
  }, z.core.$strip>>>;
140
170
  headers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
141
171
  forwardUserTokenAs: z.ZodOptional<z.ZodString>;
142
172
  forwardUserClaims: z.ZodDefault<z.ZodArray<z.ZodString>>;
173
+ security: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
143
174
  timeoutMs: z.ZodDefault<z.ZodNumber>;
144
175
  maxResponseChars: z.ZodDefault<z.ZodNumber>;
145
176
  }, z.core.$strip>;
@@ -164,6 +195,10 @@ declare const agentConfigSchema: z.ZodObject<{
164
195
  declare const authConfigSchema: z.ZodObject<{
165
196
  publishableKey: z.ZodString;
166
197
  allowedOrigins: z.ZodDefault<z.ZodArray<z.ZodString>>;
198
+ userCredential: z.ZodDefault<z.ZodEnum<{
199
+ jwt: "jwt";
200
+ opaque: "opaque";
201
+ }>>;
167
202
  allowAnonymous: z.ZodDefault<z.ZodBoolean>;
168
203
  jwtSecretEnv: z.ZodDefault<z.ZodString>;
169
204
  jwksUrl: z.ZodOptional<z.ZodString>;
@@ -206,6 +241,10 @@ declare const frankieConfigSchema: z.ZodObject<{
206
241
  dark: "dark";
207
242
  system: "system";
208
243
  }>>;
244
+ source: z.ZodDefault<z.ZodEnum<{
245
+ custom: "custom";
246
+ inherit: "inherit";
247
+ }>>;
209
248
  }, z.core.$strip>>;
210
249
  model: z.ZodPrefault<z.ZodObject<{
211
250
  provider: z.ZodDefault<z.ZodString>;
@@ -240,6 +279,10 @@ declare const frankieConfigSchema: z.ZodObject<{
240
279
  auth: z.ZodObject<{
241
280
  publishableKey: z.ZodString;
242
281
  allowedOrigins: z.ZodDefault<z.ZodArray<z.ZodString>>;
282
+ userCredential: z.ZodDefault<z.ZodEnum<{
283
+ jwt: "jwt";
284
+ opaque: "opaque";
285
+ }>>;
243
286
  allowAnonymous: z.ZodDefault<z.ZodBoolean>;
244
287
  jwtSecretEnv: z.ZodDefault<z.ZodString>;
245
288
  jwksUrl: z.ZodOptional<z.ZodString>;
@@ -250,6 +293,7 @@ declare const frankieConfigSchema: z.ZodObject<{
250
293
  }, z.core.$strip>;
251
294
  mcpServers: z.ZodDefault<z.ZodArray<z.ZodObject<{
252
295
  name: z.ZodString;
296
+ displayName: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
253
297
  enabled: z.ZodDefault<z.ZodBoolean>;
254
298
  selectedTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
255
299
  discoveredTools: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -267,6 +311,7 @@ declare const frankieConfigSchema: z.ZodObject<{
267
311
  }, z.core.$strip>>>;
268
312
  apis: z.ZodDefault<z.ZodArray<z.ZodObject<{
269
313
  name: z.ZodString;
314
+ displayName: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
270
315
  spec: z.ZodString;
271
316
  baseUrl: z.ZodOptional<z.ZodString>;
272
317
  operations: z.ZodDefault<z.ZodArray<z.ZodString>>;
@@ -279,6 +324,10 @@ declare const frankieConfigSchema: z.ZodObject<{
279
324
  DELETE: "DELETE";
280
325
  }>>>;
281
326
  enabled: z.ZodDefault<z.ZodBoolean>;
327
+ execution: z.ZodDefault<z.ZodEnum<{
328
+ server: "server";
329
+ client: "client";
330
+ }>>;
282
331
  selectedTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
283
332
  exposeAsMcp: z.ZodDefault<z.ZodBoolean>;
284
333
  capabilities: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -292,10 +341,12 @@ declare const frankieConfigSchema: z.ZodObject<{
292
341
  }>;
293
342
  path: z.ZodString;
294
343
  summary: z.ZodOptional<z.ZodString>;
344
+ authGap: z.ZodDefault<z.ZodBoolean>;
295
345
  }, z.core.$strip>>>;
296
346
  headers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
297
347
  forwardUserTokenAs: z.ZodOptional<z.ZodString>;
298
348
  forwardUserClaims: z.ZodDefault<z.ZodArray<z.ZodString>>;
349
+ security: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
299
350
  timeoutMs: z.ZodDefault<z.ZodNumber>;
300
351
  maxResponseChars: z.ZodDefault<z.ZodNumber>;
301
352
  }, z.core.$strip>>>;
@@ -366,6 +417,14 @@ type StopReason = "end_turn" | "max_tokens" | "max_turns" | "stop_sequence" | "a
366
417
  interface UsageSummary {
367
418
  inputTokens: number;
368
419
  outputTokens: number;
420
+ /**
421
+ * Prompt-cache hits and writes, when the provider reports them. A cached
422
+ * input token costs a fraction of a fresh one, so this is what says whether
423
+ * the stable prefix — system prompt, tools, earlier turns — is actually being
424
+ * served from cache or re-read every turn.
425
+ */
426
+ cacheReadTokens?: number;
427
+ cacheWriteTokens?: number;
369
428
  /** Present only when the upstream provider reports a price. */
370
429
  costUsd?: number;
371
430
  }
@@ -373,6 +432,9 @@ interface UsageSummary {
373
432
  type FrankieServerEvent = {
374
433
  type: "skills_loaded";
375
434
  skills: LoadedSkill[];
435
+ } | {
436
+ type: "tools_active";
437
+ apis: ApiToolInventory[];
376
438
  } | {
377
439
  type: "session";
378
440
  sessionId: string;
@@ -402,6 +464,21 @@ type FrankieServerEvent = {
402
464
  toolUseId: string;
403
465
  name: string;
404
466
  reason: string;
467
+ }
468
+ /**
469
+ * Client-side tool execution: the server asks the widget to make one HTTP
470
+ * call to the host's own API, from the user's browser and on the user's
471
+ * existing session, and to POST the outcome back to `/v1/chat/tool-result`
472
+ * with this `callId`. Emitted only for API sources marked
473
+ * `execution: "client"`. The turn's agent loop is paused on this call until
474
+ * the result arrives (or the turn times out). See `HostToolRequest`.
475
+ */
476
+ | {
477
+ type: "tool_call_request";
478
+ callId: string;
479
+ toolUseId: string;
480
+ name: string;
481
+ request: HostToolRequest;
405
482
  } | {
406
483
  type: "turn_end";
407
484
  stopReason: StopReason;
@@ -414,6 +491,38 @@ type FrankieServerEvent = {
414
491
  } | {
415
492
  type: "ping";
416
493
  };
494
+ /**
495
+ * One HTTP call Frankie asks the browser to make against the host's own API,
496
+ * on the signed-in user's existing session. `path` is always relative (path +
497
+ * query, no scheme or host): the widget resolves it against the `api.baseUrl`
498
+ * the host configured, and attaches the user's own credentials (cookies or a
499
+ * bearer token). Frankie sends no credential of its own — the host API is the
500
+ * authorization boundary, exactly as for any request from the host's frontend.
501
+ */
502
+ interface HostToolRequest {
503
+ /** The API source the operation belongs to (`api__<source>__...`). Diagnostic only. */
504
+ source: string;
505
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
506
+ /** Path + query string relative to `api.baseUrl`, params already interpolated. */
507
+ path: string;
508
+ /** JSON request body, when the operation declares one. */
509
+ body?: unknown;
510
+ }
511
+ /** The browser's outcome for a `tool_call_request`, POSTed back to the server. */
512
+ interface HostToolResult {
513
+ /** HTTP status the host API returned, or 0 when the fetch itself failed. */
514
+ status: number;
515
+ /** Response body text as returned by the host API. */
516
+ body?: string;
517
+ /** A transport-level error (network failure, no host API configured). */
518
+ error?: string;
519
+ }
520
+ /** Client -> server body for `POST /v1/chat/tool-result`. */
521
+ interface ToolResultBody {
522
+ /** The `callId` from the `tool_call_request` this answers. */
523
+ callId: string;
524
+ result: HostToolResult;
525
+ }
417
526
  type FrankieErrorCode = "unauthorized" | "forbidden_origin" | "rate_limited" | "session_not_found" | "upstream_error" | "budget_exceeded" | "internal";
418
527
  /** Display metadata only; instructions never enter the public SDK config. */
419
528
  interface LoadedSkill {
@@ -421,6 +530,16 @@ interface LoadedSkill {
421
530
  name: string;
422
531
  revision: number;
423
532
  }
533
+ /**
534
+ * Which OpenAPI source is live for this turn, and a content fingerprint of the
535
+ * exact spec loaded — so a host or a signed-in admin can see that a refresh
536
+ * actually changed what chat is calling, without exposing the spec itself.
537
+ */
538
+ interface ApiToolInventory {
539
+ name: string;
540
+ specHash: string;
541
+ operationCount: number;
542
+ }
424
543
  /** A file the end user attached to a turn. `data` is base64 (no data-URL prefix). */
425
544
  interface ChatAttachment {
426
545
  name: string;
@@ -519,6 +638,12 @@ interface WidgetTheme {
519
638
  radius?: string;
520
639
  fontFamily?: string;
521
640
  mode?: "light" | "dark" | "system";
641
+ /**
642
+ * "inherit" tells the widget to sample the host page's own colors instead
643
+ * of using the ones configured here, which then serve only as a fallback.
644
+ * Defaults to "custom" (use the configured colors) when unset.
645
+ */
646
+ source?: "custom" | "inherit";
522
647
  }
523
648
 
524
649
  interface ToolDecision {
@@ -557,6 +682,7 @@ interface InstallPlan {
557
682
  specPath: string;
558
683
  operationCount: number;
559
684
  needsAuthSetup: boolean;
685
+ authStrategy: AuthStrategy;
560
686
  notes: string[];
561
687
  }
562
688
  /** Last gate before generated files enter GitHub or a local checkout. */
@@ -565,6 +691,8 @@ declare function assertNoCommittedFrankieKeys(files: Array<{
565
691
  content: string;
566
692
  }>): void;
567
693
  declare function planHostedInstall(input: InstallProject): InstallPlan;
694
+ /** Where the generated token endpoint gets the signed-in user from. */
695
+ type AuthStrategy = "firebase" | "nextauth" | "supabase" | "custom" | "existing" | "anonymous" | "unconfigured";
568
696
 
569
697
  declare const skillSchema: z.ZodObject<{
570
698
  id: z.ZodString;
@@ -582,8 +710,33 @@ type WorkspaceSkill = z.infer<typeof skillSchema>;
582
710
  declare function activeSkills(config: FrankieConfig, availableTools?: string[]): WorkspaceSkill[];
583
711
  /** Only explicitly selected, currently enabled operations may execute through a skill. */
584
712
  declare function approvedSkillTools(config: FrankieConfig): string[];
585
- /** Deterministic starter, not a claim that new API code has been generated. */
586
- declare function draftSkill(goal: string, tools: string[]): string;
713
+ /**
714
+ * What each tool identifier actually does, drawn from the connected sources'
715
+ * own inventories — the same data the dashboard shows next to each checkbox.
716
+ * Skill generation is only as concrete as the material it's given: a bare
717
+ * list of ids like `api__product__listItems` tells a model nothing about
718
+ * what to ask the user, what order to call things in, or how to summarize a
719
+ * result. This hands it the method/path/summary (or MCP description) for
720
+ * every tool a skill is being written for. Falls back to the bare id for a
721
+ * tool that isn't found (already removed, or awaiting a fresh inventory).
722
+ */
723
+ declare function toolDescriptions(config: FrankieConfig, toolIds: string[]): Array<{
724
+ id: string;
725
+ description: string;
726
+ }>;
727
+ /**
728
+ * Deterministic starter for the manual editor — not a claim that anything
729
+ * was executed, and not model-generated. Follows the same structure asked of
730
+ * AI-generated instructions (trigger recap, required inputs, numbered steps,
731
+ * reporting, error handling) so a hand-written skill starts from a useful
732
+ * shape instead of a blank textarea. `label` is each tool's own description
733
+ * when the caller has one (e.g. from the dashboard's approved-tools list);
734
+ * falls back to the bare id.
735
+ */
736
+ declare function draftSkill(goal: string, tools: Array<{
737
+ id: string;
738
+ label?: string;
739
+ }>): string;
587
740
 
588
741
  /** A repository-owned updater. No customer token is stored by Frankie. */
589
742
  declare function sdkUpdateWorkflow(mode: "manual" | "automatic"): string;
@@ -600,6 +753,12 @@ declare function apiOperations(doc: ApiDocument): Map<string, {
600
753
  id: string;
601
754
  fingerprint: string;
602
755
  }>;
756
+ /**
757
+ * `/projects/*` matches one path segment; `/projects/**` matches any depth and
758
+ * the base path itself, since a tenant writing that plainly means "this part of
759
+ * the API" rather than "everything under it but not it".
760
+ */
761
+ declare function matchPath(glob: string, path: string): boolean;
603
762
  declare function compareApiDocuments(before: ApiDocument, after: ApiDocument): {
604
763
  added: string[];
605
764
  changed: string[];
@@ -607,4 +766,4 @@ declare function compareApiDocuments(before: ApiDocument, after: ApiDocument): {
607
766
  unchangedIds: string[];
608
767
  };
609
768
 
610
- export { type AgentConfig, type ApiCapability, type ApiDocument, type ApiSourceConfig, 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, mcpServerSchema, modelChoiceSchema, modelConfigSchema, operationId, parseFrankieConfig, planHostedInstall, sdkUpdateWorkflow, skillSchema, thinkingLevelSchema, toolPolicySchema, validateApiDocument, widgetThemeSchema };
769
+ 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 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, thinkingLevelSchema, toolDescriptions, toolPolicySchema, validateApiDocument, widgetThemeSchema };