@frankieai/core 0.2.2 → 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.cjs +230 -39
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +138 -3
- package/dist/index.d.ts +138 -3
- package/dist/index.js +228 -39
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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<{
|
|
@@ -167,6 +195,10 @@ declare const agentConfigSchema: z.ZodObject<{
|
|
|
167
195
|
declare const authConfigSchema: z.ZodObject<{
|
|
168
196
|
publishableKey: z.ZodString;
|
|
169
197
|
allowedOrigins: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
198
|
+
userCredential: z.ZodDefault<z.ZodEnum<{
|
|
199
|
+
jwt: "jwt";
|
|
200
|
+
opaque: "opaque";
|
|
201
|
+
}>>;
|
|
170
202
|
allowAnonymous: z.ZodDefault<z.ZodBoolean>;
|
|
171
203
|
jwtSecretEnv: z.ZodDefault<z.ZodString>;
|
|
172
204
|
jwksUrl: z.ZodOptional<z.ZodString>;
|
|
@@ -209,6 +241,10 @@ declare const frankieConfigSchema: z.ZodObject<{
|
|
|
209
241
|
dark: "dark";
|
|
210
242
|
system: "system";
|
|
211
243
|
}>>;
|
|
244
|
+
source: z.ZodDefault<z.ZodEnum<{
|
|
245
|
+
custom: "custom";
|
|
246
|
+
inherit: "inherit";
|
|
247
|
+
}>>;
|
|
212
248
|
}, z.core.$strip>>;
|
|
213
249
|
model: z.ZodPrefault<z.ZodObject<{
|
|
214
250
|
provider: z.ZodDefault<z.ZodString>;
|
|
@@ -243,6 +279,10 @@ declare const frankieConfigSchema: z.ZodObject<{
|
|
|
243
279
|
auth: z.ZodObject<{
|
|
244
280
|
publishableKey: z.ZodString;
|
|
245
281
|
allowedOrigins: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
282
|
+
userCredential: z.ZodDefault<z.ZodEnum<{
|
|
283
|
+
jwt: "jwt";
|
|
284
|
+
opaque: "opaque";
|
|
285
|
+
}>>;
|
|
246
286
|
allowAnonymous: z.ZodDefault<z.ZodBoolean>;
|
|
247
287
|
jwtSecretEnv: z.ZodDefault<z.ZodString>;
|
|
248
288
|
jwksUrl: z.ZodOptional<z.ZodString>;
|
|
@@ -253,6 +293,7 @@ declare const frankieConfigSchema: z.ZodObject<{
|
|
|
253
293
|
}, z.core.$strip>;
|
|
254
294
|
mcpServers: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
255
295
|
name: z.ZodString;
|
|
296
|
+
displayName: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
|
|
256
297
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
257
298
|
selectedTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
258
299
|
discoveredTools: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
@@ -270,6 +311,7 @@ declare const frankieConfigSchema: z.ZodObject<{
|
|
|
270
311
|
}, z.core.$strip>>>;
|
|
271
312
|
apis: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
272
313
|
name: z.ZodString;
|
|
314
|
+
displayName: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
|
|
273
315
|
spec: z.ZodString;
|
|
274
316
|
baseUrl: z.ZodOptional<z.ZodString>;
|
|
275
317
|
operations: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
@@ -282,6 +324,10 @@ declare const frankieConfigSchema: z.ZodObject<{
|
|
|
282
324
|
DELETE: "DELETE";
|
|
283
325
|
}>>>;
|
|
284
326
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
327
|
+
execution: z.ZodDefault<z.ZodEnum<{
|
|
328
|
+
server: "server";
|
|
329
|
+
client: "client";
|
|
330
|
+
}>>;
|
|
285
331
|
selectedTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
286
332
|
exposeAsMcp: z.ZodDefault<z.ZodBoolean>;
|
|
287
333
|
capabilities: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
@@ -371,6 +417,14 @@ type StopReason = "end_turn" | "max_tokens" | "max_turns" | "stop_sequence" | "a
|
|
|
371
417
|
interface UsageSummary {
|
|
372
418
|
inputTokens: number;
|
|
373
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;
|
|
374
428
|
/** Present only when the upstream provider reports a price. */
|
|
375
429
|
costUsd?: number;
|
|
376
430
|
}
|
|
@@ -410,6 +464,21 @@ type FrankieServerEvent = {
|
|
|
410
464
|
toolUseId: string;
|
|
411
465
|
name: string;
|
|
412
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;
|
|
413
482
|
} | {
|
|
414
483
|
type: "turn_end";
|
|
415
484
|
stopReason: StopReason;
|
|
@@ -422,6 +491,38 @@ type FrankieServerEvent = {
|
|
|
422
491
|
} | {
|
|
423
492
|
type: "ping";
|
|
424
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
|
+
}
|
|
425
526
|
type FrankieErrorCode = "unauthorized" | "forbidden_origin" | "rate_limited" | "session_not_found" | "upstream_error" | "budget_exceeded" | "internal";
|
|
426
527
|
/** Display metadata only; instructions never enter the public SDK config. */
|
|
427
528
|
interface LoadedSkill {
|
|
@@ -537,6 +638,12 @@ interface WidgetTheme {
|
|
|
537
638
|
radius?: string;
|
|
538
639
|
fontFamily?: string;
|
|
539
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";
|
|
540
647
|
}
|
|
541
648
|
|
|
542
649
|
interface ToolDecision {
|
|
@@ -575,6 +682,7 @@ interface InstallPlan {
|
|
|
575
682
|
specPath: string;
|
|
576
683
|
operationCount: number;
|
|
577
684
|
needsAuthSetup: boolean;
|
|
685
|
+
authStrategy: AuthStrategy;
|
|
578
686
|
notes: string[];
|
|
579
687
|
}
|
|
580
688
|
/** Last gate before generated files enter GitHub or a local checkout. */
|
|
@@ -583,6 +691,8 @@ declare function assertNoCommittedFrankieKeys(files: Array<{
|
|
|
583
691
|
content: string;
|
|
584
692
|
}>): void;
|
|
585
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";
|
|
586
696
|
|
|
587
697
|
declare const skillSchema: z.ZodObject<{
|
|
588
698
|
id: z.ZodString;
|
|
@@ -600,8 +710,33 @@ type WorkspaceSkill = z.infer<typeof skillSchema>;
|
|
|
600
710
|
declare function activeSkills(config: FrankieConfig, availableTools?: string[]): WorkspaceSkill[];
|
|
601
711
|
/** Only explicitly selected, currently enabled operations may execute through a skill. */
|
|
602
712
|
declare function approvedSkillTools(config: FrankieConfig): string[];
|
|
603
|
-
/**
|
|
604
|
-
|
|
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;
|
|
605
740
|
|
|
606
741
|
/** A repository-owned updater. No customer token is stored by Frankie. */
|
|
607
742
|
declare function sdkUpdateWorkflow(mode: "manual" | "automatic"): string;
|
|
@@ -631,4 +766,4 @@ declare function compareApiDocuments(before: ApiDocument, after: ApiDocument): {
|
|
|
631
766
|
unchangedIds: string[];
|
|
632
767
|
};
|
|
633
768
|
|
|
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 };
|
|
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<{
|
|
@@ -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<{
|
|
@@ -167,6 +195,10 @@ declare const agentConfigSchema: z.ZodObject<{
|
|
|
167
195
|
declare const authConfigSchema: z.ZodObject<{
|
|
168
196
|
publishableKey: z.ZodString;
|
|
169
197
|
allowedOrigins: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
198
|
+
userCredential: z.ZodDefault<z.ZodEnum<{
|
|
199
|
+
jwt: "jwt";
|
|
200
|
+
opaque: "opaque";
|
|
201
|
+
}>>;
|
|
170
202
|
allowAnonymous: z.ZodDefault<z.ZodBoolean>;
|
|
171
203
|
jwtSecretEnv: z.ZodDefault<z.ZodString>;
|
|
172
204
|
jwksUrl: z.ZodOptional<z.ZodString>;
|
|
@@ -209,6 +241,10 @@ declare const frankieConfigSchema: z.ZodObject<{
|
|
|
209
241
|
dark: "dark";
|
|
210
242
|
system: "system";
|
|
211
243
|
}>>;
|
|
244
|
+
source: z.ZodDefault<z.ZodEnum<{
|
|
245
|
+
custom: "custom";
|
|
246
|
+
inherit: "inherit";
|
|
247
|
+
}>>;
|
|
212
248
|
}, z.core.$strip>>;
|
|
213
249
|
model: z.ZodPrefault<z.ZodObject<{
|
|
214
250
|
provider: z.ZodDefault<z.ZodString>;
|
|
@@ -243,6 +279,10 @@ declare const frankieConfigSchema: z.ZodObject<{
|
|
|
243
279
|
auth: z.ZodObject<{
|
|
244
280
|
publishableKey: z.ZodString;
|
|
245
281
|
allowedOrigins: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
282
|
+
userCredential: z.ZodDefault<z.ZodEnum<{
|
|
283
|
+
jwt: "jwt";
|
|
284
|
+
opaque: "opaque";
|
|
285
|
+
}>>;
|
|
246
286
|
allowAnonymous: z.ZodDefault<z.ZodBoolean>;
|
|
247
287
|
jwtSecretEnv: z.ZodDefault<z.ZodString>;
|
|
248
288
|
jwksUrl: z.ZodOptional<z.ZodString>;
|
|
@@ -253,6 +293,7 @@ declare const frankieConfigSchema: z.ZodObject<{
|
|
|
253
293
|
}, z.core.$strip>;
|
|
254
294
|
mcpServers: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
255
295
|
name: z.ZodString;
|
|
296
|
+
displayName: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
|
|
256
297
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
257
298
|
selectedTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
258
299
|
discoveredTools: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
@@ -270,6 +311,7 @@ declare const frankieConfigSchema: z.ZodObject<{
|
|
|
270
311
|
}, z.core.$strip>>>;
|
|
271
312
|
apis: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
272
313
|
name: z.ZodString;
|
|
314
|
+
displayName: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
|
|
273
315
|
spec: z.ZodString;
|
|
274
316
|
baseUrl: z.ZodOptional<z.ZodString>;
|
|
275
317
|
operations: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
@@ -282,6 +324,10 @@ declare const frankieConfigSchema: z.ZodObject<{
|
|
|
282
324
|
DELETE: "DELETE";
|
|
283
325
|
}>>>;
|
|
284
326
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
327
|
+
execution: z.ZodDefault<z.ZodEnum<{
|
|
328
|
+
server: "server";
|
|
329
|
+
client: "client";
|
|
330
|
+
}>>;
|
|
285
331
|
selectedTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
286
332
|
exposeAsMcp: z.ZodDefault<z.ZodBoolean>;
|
|
287
333
|
capabilities: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
@@ -371,6 +417,14 @@ type StopReason = "end_turn" | "max_tokens" | "max_turns" | "stop_sequence" | "a
|
|
|
371
417
|
interface UsageSummary {
|
|
372
418
|
inputTokens: number;
|
|
373
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;
|
|
374
428
|
/** Present only when the upstream provider reports a price. */
|
|
375
429
|
costUsd?: number;
|
|
376
430
|
}
|
|
@@ -410,6 +464,21 @@ type FrankieServerEvent = {
|
|
|
410
464
|
toolUseId: string;
|
|
411
465
|
name: string;
|
|
412
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;
|
|
413
482
|
} | {
|
|
414
483
|
type: "turn_end";
|
|
415
484
|
stopReason: StopReason;
|
|
@@ -422,6 +491,38 @@ type FrankieServerEvent = {
|
|
|
422
491
|
} | {
|
|
423
492
|
type: "ping";
|
|
424
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
|
+
}
|
|
425
526
|
type FrankieErrorCode = "unauthorized" | "forbidden_origin" | "rate_limited" | "session_not_found" | "upstream_error" | "budget_exceeded" | "internal";
|
|
426
527
|
/** Display metadata only; instructions never enter the public SDK config. */
|
|
427
528
|
interface LoadedSkill {
|
|
@@ -537,6 +638,12 @@ interface WidgetTheme {
|
|
|
537
638
|
radius?: string;
|
|
538
639
|
fontFamily?: string;
|
|
539
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";
|
|
540
647
|
}
|
|
541
648
|
|
|
542
649
|
interface ToolDecision {
|
|
@@ -575,6 +682,7 @@ interface InstallPlan {
|
|
|
575
682
|
specPath: string;
|
|
576
683
|
operationCount: number;
|
|
577
684
|
needsAuthSetup: boolean;
|
|
685
|
+
authStrategy: AuthStrategy;
|
|
578
686
|
notes: string[];
|
|
579
687
|
}
|
|
580
688
|
/** Last gate before generated files enter GitHub or a local checkout. */
|
|
@@ -583,6 +691,8 @@ declare function assertNoCommittedFrankieKeys(files: Array<{
|
|
|
583
691
|
content: string;
|
|
584
692
|
}>): void;
|
|
585
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";
|
|
586
696
|
|
|
587
697
|
declare const skillSchema: z.ZodObject<{
|
|
588
698
|
id: z.ZodString;
|
|
@@ -600,8 +710,33 @@ type WorkspaceSkill = z.infer<typeof skillSchema>;
|
|
|
600
710
|
declare function activeSkills(config: FrankieConfig, availableTools?: string[]): WorkspaceSkill[];
|
|
601
711
|
/** Only explicitly selected, currently enabled operations may execute through a skill. */
|
|
602
712
|
declare function approvedSkillTools(config: FrankieConfig): string[];
|
|
603
|
-
/**
|
|
604
|
-
|
|
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;
|
|
605
740
|
|
|
606
741
|
/** A repository-owned updater. No customer token is stored by Frankie. */
|
|
607
742
|
declare function sdkUpdateWorkflow(mode: "manual" | "automatic"): string;
|
|
@@ -631,4 +766,4 @@ declare function compareApiDocuments(before: ApiDocument, after: ApiDocument): {
|
|
|
631
766
|
unchangedIds: string[];
|
|
632
767
|
};
|
|
633
768
|
|
|
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 };
|
|
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 };
|