@frankieai/core 0.2.6 → 0.2.8
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 +450 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +156 -1
- package/dist/index.d.ts +156 -1
- package/dist/index.js +442 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -248,6 +248,7 @@ declare const agentConfigSchema: z.ZodObject<{
|
|
|
248
248
|
denyByDefault: z.ZodDefault<z.ZodBoolean>;
|
|
249
249
|
}, z.core.$strip>>;
|
|
250
250
|
showToolActivity: z.ZodDefault<z.ZodBoolean>;
|
|
251
|
+
confirmWrites: z.ZodDefault<z.ZodBoolean>;
|
|
251
252
|
}, z.core.$strip>;
|
|
252
253
|
declare const authConfigSchema: z.ZodObject<{
|
|
253
254
|
publishableKey: z.ZodString;
|
|
@@ -309,6 +310,8 @@ declare const personaProfileSchema: z.ZodObject<{
|
|
|
309
310
|
publishableKey: z.ZodString;
|
|
310
311
|
pagePatterns: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
311
312
|
allowAnonymous: z.ZodOptional<z.ZodBoolean>;
|
|
313
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
314
|
+
contactUrl: z.ZodOptional<z.ZodString>;
|
|
312
315
|
branding: z.ZodOptional<z.ZodObject<{
|
|
313
316
|
name: z.ZodOptional<z.ZodString>;
|
|
314
317
|
tagline: z.ZodOptional<z.ZodString>;
|
|
@@ -346,6 +349,7 @@ declare const personaProfileSchema: z.ZodObject<{
|
|
|
346
349
|
denyByDefault: z.ZodDefault<z.ZodBoolean>;
|
|
347
350
|
}, z.core.$strip>>;
|
|
348
351
|
showToolActivity: z.ZodDefault<z.ZodBoolean>;
|
|
352
|
+
confirmWrites: z.ZodDefault<z.ZodBoolean>;
|
|
349
353
|
}, z.core.$strip>>;
|
|
350
354
|
features: z.ZodPrefault<z.ZodObject<{
|
|
351
355
|
attachments: z.ZodPrefault<z.ZodObject<{
|
|
@@ -452,6 +456,7 @@ declare const frankieConfigSchema: z.ZodObject<{
|
|
|
452
456
|
denyByDefault: z.ZodDefault<z.ZodBoolean>;
|
|
453
457
|
}, z.core.$strip>>;
|
|
454
458
|
showToolActivity: z.ZodDefault<z.ZodBoolean>;
|
|
459
|
+
confirmWrites: z.ZodDefault<z.ZodBoolean>;
|
|
455
460
|
}, z.core.$strip>>;
|
|
456
461
|
auth: z.ZodObject<{
|
|
457
462
|
publishableKey: z.ZodString;
|
|
@@ -583,6 +588,8 @@ declare const frankieConfigSchema: z.ZodObject<{
|
|
|
583
588
|
publishableKey: z.ZodString;
|
|
584
589
|
pagePatterns: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
585
590
|
allowAnonymous: z.ZodOptional<z.ZodBoolean>;
|
|
591
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
592
|
+
contactUrl: z.ZodOptional<z.ZodString>;
|
|
586
593
|
branding: z.ZodOptional<z.ZodObject<{
|
|
587
594
|
name: z.ZodOptional<z.ZodString>;
|
|
588
595
|
tagline: z.ZodOptional<z.ZodString>;
|
|
@@ -620,6 +627,7 @@ declare const frankieConfigSchema: z.ZodObject<{
|
|
|
620
627
|
denyByDefault: z.ZodDefault<z.ZodBoolean>;
|
|
621
628
|
}, z.core.$strip>>;
|
|
622
629
|
showToolActivity: z.ZodDefault<z.ZodBoolean>;
|
|
630
|
+
confirmWrites: z.ZodDefault<z.ZodBoolean>;
|
|
623
631
|
}, z.core.$strip>>;
|
|
624
632
|
features: z.ZodPrefault<z.ZodObject<{
|
|
625
633
|
attachments: z.ZodPrefault<z.ZodObject<{
|
|
@@ -651,6 +659,7 @@ declare const frankieConfigSchema: z.ZodObject<{
|
|
|
651
659
|
maxPages: z.ZodDefault<z.ZodNumber>;
|
|
652
660
|
}, z.core.$strip>>;
|
|
653
661
|
}, z.core.$strip>>>;
|
|
662
|
+
agentId: z.ZodOptional<z.ZodString>;
|
|
654
663
|
}, z.core.$strip>;
|
|
655
664
|
type ThinkingLevel = z.infer<typeof thinkingLevelSchema>;
|
|
656
665
|
type WidgetThemeConfig = z.infer<typeof widgetThemeSchema>;
|
|
@@ -681,6 +690,13 @@ declare function defineFrankieConfig(config: FrankieConfigInput): FrankieConfigI
|
|
|
681
690
|
* key returns null.
|
|
682
691
|
*/
|
|
683
692
|
declare function resolvePersonaConfig(config: FrankieConfig, publishableKey: string): FrankieConfig | null;
|
|
693
|
+
/**
|
|
694
|
+
* A persona's instructions as the agent runs them: its role instructions,
|
|
695
|
+
* then what it helps with and the boundary that follows from it. Off-topic
|
|
696
|
+
* questions get a short "not here" (and a hand-off when the agent escalates)
|
|
697
|
+
* rather than a guess.
|
|
698
|
+
*/
|
|
699
|
+
declare function personaInstructions(persona: PersonaProfile): string;
|
|
684
700
|
/**
|
|
685
701
|
* Whether a Next.js `usePathname()` value matches an App-Router path glob:
|
|
686
702
|
* `**` matches any depth (including `/`), `*` matches within one segment, and a
|
|
@@ -750,6 +766,18 @@ type FrankieServerEvent = {
|
|
|
750
766
|
name: string;
|
|
751
767
|
reason: string;
|
|
752
768
|
}
|
|
769
|
+
/**
|
|
770
|
+
* An action that changes data is waiting for the user. The widget shows it
|
|
771
|
+
* with Approve and Cancel and answers with `confirm` on the next message.
|
|
772
|
+
* Nothing has run yet; on Approve the server runs exactly this call.
|
|
773
|
+
*/
|
|
774
|
+
| {
|
|
775
|
+
type: "action_confirm";
|
|
776
|
+
toolUseId: string;
|
|
777
|
+
name: string;
|
|
778
|
+
label: string;
|
|
779
|
+
preview: ActionPreview;
|
|
780
|
+
}
|
|
753
781
|
/**
|
|
754
782
|
* Client-side tool execution: the server asks the widget to make one HTTP
|
|
755
783
|
* call to the host's own API, from the user's browser and on the user's
|
|
@@ -838,6 +866,13 @@ interface ChatRequestBody {
|
|
|
838
866
|
/** Omit to start a new conversation; the server replies with a `session` event. */
|
|
839
867
|
sessionId?: string;
|
|
840
868
|
message: string;
|
|
869
|
+
/**
|
|
870
|
+
* A fresh host-signed user token for the session's own user. Host tokens are
|
|
871
|
+
* short-lived (minutes) while a session lasts an hour, so the widget sends a
|
|
872
|
+
* new one with each message and the server forwards that one to the
|
|
873
|
+
* workspace's tools instead of the expired one it started with.
|
|
874
|
+
*/
|
|
875
|
+
userToken?: string;
|
|
841
876
|
/**
|
|
842
877
|
* Free-form page context the host passes through (current route, plan tier,
|
|
843
878
|
* feature flags). Surfaced to the agent as a system reminder, never trusted
|
|
@@ -851,6 +886,28 @@ interface ChatRequestBody {
|
|
|
851
886
|
model?: string;
|
|
852
887
|
/** Files attached to this turn. Honoured only when attachments are enabled. */
|
|
853
888
|
attachments?: ChatAttachment[];
|
|
889
|
+
/**
|
|
890
|
+
* The widget can show an `action_confirm` card. Without it, actions run as
|
|
891
|
+
* they always have, so an SDK that can't ask the user is never left with a
|
|
892
|
+
* paused action and no button to approve it.
|
|
893
|
+
*/
|
|
894
|
+
confirmActions?: boolean;
|
|
895
|
+
/** The user's answer to the action waiting for approval (`action_confirm`). */
|
|
896
|
+
confirm?: ActionDecision;
|
|
897
|
+
}
|
|
898
|
+
/** Approve or cancel the action an `action_confirm` event paused. */
|
|
899
|
+
interface ActionDecision {
|
|
900
|
+
/** The `toolUseId` from the `action_confirm` event. */
|
|
901
|
+
toolUseId: string;
|
|
902
|
+
approved: boolean;
|
|
903
|
+
}
|
|
904
|
+
/** What an action that's waiting for approval will do, for the confirmation card. */
|
|
905
|
+
interface ActionPreview {
|
|
906
|
+
/** HTTP method and path for an API action, when there is one. */
|
|
907
|
+
method?: string;
|
|
908
|
+
path?: string;
|
|
909
|
+
/** The exact inputs it will run with. */
|
|
910
|
+
input?: unknown;
|
|
854
911
|
}
|
|
855
912
|
/** Client -> server body for `POST /v1/session`. */
|
|
856
913
|
interface CreateSessionBody {
|
|
@@ -904,6 +961,12 @@ interface PublicWidgetConfig {
|
|
|
904
961
|
features: PublicFeatures;
|
|
905
962
|
/** App-Router path globs this agent shows on; empty = every page no other agent claims. Optional so older servers stay compatible. */
|
|
906
963
|
pages?: string[];
|
|
964
|
+
/**
|
|
965
|
+
* Whether the chat shows the "Agent context" bar (skills and APIs loaded for
|
|
966
|
+
* the turn). Off for visitor-facing page agents such as Support and Docs,
|
|
967
|
+
* where it means nothing to the person chatting. Absent (older servers) = shown.
|
|
968
|
+
*/
|
|
969
|
+
agentContext?: boolean;
|
|
907
970
|
}
|
|
908
971
|
/** The subset of `features` config the widget needs to render its controls. */
|
|
909
972
|
interface PublicFeatures {
|
|
@@ -1092,6 +1155,20 @@ declare function renderJson(value: unknown, original: string | undefined): strin
|
|
|
1092
1155
|
*/
|
|
1093
1156
|
declare function moduleImporter(files: Record<string, string>, root: string, sourceRoot: string): (fromFile: string, module: string) => string;
|
|
1094
1157
|
|
|
1158
|
+
/**
|
|
1159
|
+
* A prompt a developer pastes into their AI coding assistant (Claude Code,
|
|
1160
|
+
* Cursor, Copilot…) to add Frankie to their app. The docs show it with
|
|
1161
|
+
* placeholders; the dashboard fills in the workspace's own ID and public key.
|
|
1162
|
+
* It never contains a secret: FRANKIE_JWT_SECRET is only ever named.
|
|
1163
|
+
*/
|
|
1164
|
+
interface InstallPromptOptions {
|
|
1165
|
+
workspaceId?: string;
|
|
1166
|
+
publishableKey?: string;
|
|
1167
|
+
/** The workspace lets visitors chat without signing in: no token endpoint. */
|
|
1168
|
+
allowAnonymous?: boolean;
|
|
1169
|
+
}
|
|
1170
|
+
declare function installPrompt(options?: InstallPromptOptions): string;
|
|
1171
|
+
|
|
1095
1172
|
declare const skillSchema: z.ZodObject<{
|
|
1096
1173
|
id: z.ZodString;
|
|
1097
1174
|
name: z.ZodString;
|
|
@@ -1212,4 +1289,82 @@ declare function normalizeColor(raw: string): string | undefined;
|
|
|
1212
1289
|
*/
|
|
1213
1290
|
declare function inferTheme(files: Record<string, string>, root?: string): InferredTheme | undefined;
|
|
1214
1291
|
|
|
1215
|
-
|
|
1292
|
+
/** Who an end user is, as far as their own app's sign-in token said. */
|
|
1293
|
+
type EndUser = {
|
|
1294
|
+
id: string;
|
|
1295
|
+
displayName?: string;
|
|
1296
|
+
email?: string;
|
|
1297
|
+
anonymous: boolean;
|
|
1298
|
+
};
|
|
1299
|
+
/**
|
|
1300
|
+
* One label for the person behind a conversation, used by the list, the
|
|
1301
|
+
* transcript and the escalations inbox so they always agree. A token's name
|
|
1302
|
+
* wins, then its email; a signed-in user whose app sent neither still gets a
|
|
1303
|
+
* short id, so two people never read as the same "Signed-in user".
|
|
1304
|
+
*/
|
|
1305
|
+
declare function userLabel(user: EndUser): string;
|
|
1306
|
+
/** What a conversation log is built from: the stored conversation as the dashboard and the server both see it. */
|
|
1307
|
+
interface ConversationLogInput {
|
|
1308
|
+
id: string;
|
|
1309
|
+
title: string;
|
|
1310
|
+
createdAt: number;
|
|
1311
|
+
updatedAt: number;
|
|
1312
|
+
costUsd: number;
|
|
1313
|
+
busy: boolean;
|
|
1314
|
+
user: EndUser;
|
|
1315
|
+
/** The transcript the chat UI saved. */
|
|
1316
|
+
messages: unknown[];
|
|
1317
|
+
/** The server's model and tool transcript. */
|
|
1318
|
+
agentMessages: unknown[];
|
|
1319
|
+
escalations?: Array<{
|
|
1320
|
+
id: string;
|
|
1321
|
+
at: number;
|
|
1322
|
+
reason: string;
|
|
1323
|
+
summary: string;
|
|
1324
|
+
email?: string;
|
|
1325
|
+
name?: string;
|
|
1326
|
+
}>;
|
|
1327
|
+
}
|
|
1328
|
+
/**
|
|
1329
|
+
* One conversation as plain Markdown, written to be pasted into any LLM to ask
|
|
1330
|
+
* what happened: a summary, the chat as the person saw it, then the agent's
|
|
1331
|
+
* full trace (model messages, tool calls with their inputs, tool results and
|
|
1332
|
+
* errors). Images are noted, not inlined, and very long blocks are cut so the
|
|
1333
|
+
* log stays pasteable.
|
|
1334
|
+
*/
|
|
1335
|
+
declare function conversationLog(conversation: ConversationLogInput, options?: {
|
|
1336
|
+
workspace?: {
|
|
1337
|
+
id: string;
|
|
1338
|
+
name: string;
|
|
1339
|
+
};
|
|
1340
|
+
agent?: string;
|
|
1341
|
+
}): string;
|
|
1342
|
+
/** A file name for the downloaded log. */
|
|
1343
|
+
declare function conversationLogFileName(conversation: {
|
|
1344
|
+
id: string;
|
|
1345
|
+
title: string;
|
|
1346
|
+
}): string;
|
|
1347
|
+
|
|
1348
|
+
/** Where Frankie's sync workflow lives in a repository. */
|
|
1349
|
+
declare const API_SYNC_WORKFLOW_PATH = ".github/workflows/frankie-api-sync.yml";
|
|
1350
|
+
interface ApiSyncWorkflowOptions {
|
|
1351
|
+
/** The Frankie service the workflow posts to (the control plane's public URL). */
|
|
1352
|
+
url: string;
|
|
1353
|
+
/** The workspace id. */
|
|
1354
|
+
workspace: string;
|
|
1355
|
+
/** The API connection's name in that workspace. */
|
|
1356
|
+
api: string;
|
|
1357
|
+
/** The API description file in the repository, e.g. "public/openapi.json". */
|
|
1358
|
+
path: string;
|
|
1359
|
+
}
|
|
1360
|
+
/**
|
|
1361
|
+
* A repository-owned workflow that sends the API description to Frankie on
|
|
1362
|
+
* every push to the default branch that changes it. It holds no secret: it
|
|
1363
|
+
* asks GitHub for an OIDC token (audience "frankie") that proves the
|
|
1364
|
+
* repository and commit, and Frankie checks that against the workspace.
|
|
1365
|
+
*/
|
|
1366
|
+
declare function apiSyncWorkflow(options: ApiSyncWorkflowOptions): string;
|
|
1367
|
+
/** A plain file path in the repository: no traversal, quoting or glob characters. */
|
|
1368
|
+
declare function isSafeRepositoryPath(path: string): boolean;
|
|
1369
|
+
|
|
1370
|
+
export { API_SYNC_WORKFLOW_PATH, type ActionDecision, type ActionPreview, type AgentConfig, type ApiCapability, type ApiDocument, type ApiSourceConfig, type ApiSyncWorkflowOptions, type ApiToolInventory, type AuthConfig, type AuthStrategy, type BrandingConfig, type ChatAttachment, type ChatRequestBody, type ConversationLogInput, type CreateSessionBody, type CreateSessionResponse, type EndUser, FIREWORKS_MODELS, type FeaturesConfig, type FrankieConfig, type FrankieConfigInput, type FrankieErrorCode, type FrankieServerEvent, type HostToolRequest, type HostToolResult, type InferredTheme, type InstallPlan, type InstallProject, type InstallPromptOptions, type KnowledgeBaseConfig, type LimitsConfig, type LoadedSkill, type McpServerConfig, type ModelChoice, type ModelConfig, type PersonaProfile, type PublicFeatures, type PublicWidgetConfig, SKILL_TOOL_NAME, STANDARD_AGENT_IDS, STARTER_PROMPT_ICONS, type StarterPrompt, type StarterPromptIcon, type StopReason, type ThinkingLevel, type ToolDecision, type ToolPolicy, type ToolResultBody, type UsageSummary, type WidgetTheme, type WidgetThemeConfig, type WorkspaceSkill, activeSkills, agentConfigSchema, apiCapabilitySchema, apiMethods, apiOperations, apiSourceSchema, apiSyncWorkflow, approvedSkillTools, assertNoCommittedFrankieKeys, authConfigSchema, brandingConfigSchema, canonicalJson, compareApiDocuments, conversationLog, conversationLogFileName, defineFrankieConfig, describeTool, draftSkill, evaluateToolPolicy, featuresConfigSchema, frankieConfigSchema, inferTheme, insertImport, installAgentIds, installBranch, installPrompt, installTitle, isSafeRepositoryPath, knowledgeBaseSchema, knowledgeSourceSchema, limitsConfigSchema, matchPath, matchesAnyPagePattern, matchesInstallBranch, matchesPagePattern, mcpServerSchema, modelChoiceSchema, modelConfigSchema, moduleImporter, mountWidget, normalizeColor, operationId, parseFrankieConfig, personaEnvKey, personaInstructions, personaProfileSchema, plainText, planHostedInstall, renderJson, resolvePersonaConfig, sdkUpdateWorkflow, skillSchema, starterPromptSchema, suggestedPromptsFromSkills, thinkingLevelSchema, toolDescriptions, toolPolicySchema, userLabel, validateApiDocument, widgetThemeSchema, withDependencies };
|
package/dist/index.d.ts
CHANGED
|
@@ -248,6 +248,7 @@ declare const agentConfigSchema: z.ZodObject<{
|
|
|
248
248
|
denyByDefault: z.ZodDefault<z.ZodBoolean>;
|
|
249
249
|
}, z.core.$strip>>;
|
|
250
250
|
showToolActivity: z.ZodDefault<z.ZodBoolean>;
|
|
251
|
+
confirmWrites: z.ZodDefault<z.ZodBoolean>;
|
|
251
252
|
}, z.core.$strip>;
|
|
252
253
|
declare const authConfigSchema: z.ZodObject<{
|
|
253
254
|
publishableKey: z.ZodString;
|
|
@@ -309,6 +310,8 @@ declare const personaProfileSchema: z.ZodObject<{
|
|
|
309
310
|
publishableKey: z.ZodString;
|
|
310
311
|
pagePatterns: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
311
312
|
allowAnonymous: z.ZodOptional<z.ZodBoolean>;
|
|
313
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
314
|
+
contactUrl: z.ZodOptional<z.ZodString>;
|
|
312
315
|
branding: z.ZodOptional<z.ZodObject<{
|
|
313
316
|
name: z.ZodOptional<z.ZodString>;
|
|
314
317
|
tagline: z.ZodOptional<z.ZodString>;
|
|
@@ -346,6 +349,7 @@ declare const personaProfileSchema: z.ZodObject<{
|
|
|
346
349
|
denyByDefault: z.ZodDefault<z.ZodBoolean>;
|
|
347
350
|
}, z.core.$strip>>;
|
|
348
351
|
showToolActivity: z.ZodDefault<z.ZodBoolean>;
|
|
352
|
+
confirmWrites: z.ZodDefault<z.ZodBoolean>;
|
|
349
353
|
}, z.core.$strip>>;
|
|
350
354
|
features: z.ZodPrefault<z.ZodObject<{
|
|
351
355
|
attachments: z.ZodPrefault<z.ZodObject<{
|
|
@@ -452,6 +456,7 @@ declare const frankieConfigSchema: z.ZodObject<{
|
|
|
452
456
|
denyByDefault: z.ZodDefault<z.ZodBoolean>;
|
|
453
457
|
}, z.core.$strip>>;
|
|
454
458
|
showToolActivity: z.ZodDefault<z.ZodBoolean>;
|
|
459
|
+
confirmWrites: z.ZodDefault<z.ZodBoolean>;
|
|
455
460
|
}, z.core.$strip>>;
|
|
456
461
|
auth: z.ZodObject<{
|
|
457
462
|
publishableKey: z.ZodString;
|
|
@@ -583,6 +588,8 @@ declare const frankieConfigSchema: z.ZodObject<{
|
|
|
583
588
|
publishableKey: z.ZodString;
|
|
584
589
|
pagePatterns: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
585
590
|
allowAnonymous: z.ZodOptional<z.ZodBoolean>;
|
|
591
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
592
|
+
contactUrl: z.ZodOptional<z.ZodString>;
|
|
586
593
|
branding: z.ZodOptional<z.ZodObject<{
|
|
587
594
|
name: z.ZodOptional<z.ZodString>;
|
|
588
595
|
tagline: z.ZodOptional<z.ZodString>;
|
|
@@ -620,6 +627,7 @@ declare const frankieConfigSchema: z.ZodObject<{
|
|
|
620
627
|
denyByDefault: z.ZodDefault<z.ZodBoolean>;
|
|
621
628
|
}, z.core.$strip>>;
|
|
622
629
|
showToolActivity: z.ZodDefault<z.ZodBoolean>;
|
|
630
|
+
confirmWrites: z.ZodDefault<z.ZodBoolean>;
|
|
623
631
|
}, z.core.$strip>>;
|
|
624
632
|
features: z.ZodPrefault<z.ZodObject<{
|
|
625
633
|
attachments: z.ZodPrefault<z.ZodObject<{
|
|
@@ -651,6 +659,7 @@ declare const frankieConfigSchema: z.ZodObject<{
|
|
|
651
659
|
maxPages: z.ZodDefault<z.ZodNumber>;
|
|
652
660
|
}, z.core.$strip>>;
|
|
653
661
|
}, z.core.$strip>>>;
|
|
662
|
+
agentId: z.ZodOptional<z.ZodString>;
|
|
654
663
|
}, z.core.$strip>;
|
|
655
664
|
type ThinkingLevel = z.infer<typeof thinkingLevelSchema>;
|
|
656
665
|
type WidgetThemeConfig = z.infer<typeof widgetThemeSchema>;
|
|
@@ -681,6 +690,13 @@ declare function defineFrankieConfig(config: FrankieConfigInput): FrankieConfigI
|
|
|
681
690
|
* key returns null.
|
|
682
691
|
*/
|
|
683
692
|
declare function resolvePersonaConfig(config: FrankieConfig, publishableKey: string): FrankieConfig | null;
|
|
693
|
+
/**
|
|
694
|
+
* A persona's instructions as the agent runs them: its role instructions,
|
|
695
|
+
* then what it helps with and the boundary that follows from it. Off-topic
|
|
696
|
+
* questions get a short "not here" (and a hand-off when the agent escalates)
|
|
697
|
+
* rather than a guess.
|
|
698
|
+
*/
|
|
699
|
+
declare function personaInstructions(persona: PersonaProfile): string;
|
|
684
700
|
/**
|
|
685
701
|
* Whether a Next.js `usePathname()` value matches an App-Router path glob:
|
|
686
702
|
* `**` matches any depth (including `/`), `*` matches within one segment, and a
|
|
@@ -750,6 +766,18 @@ type FrankieServerEvent = {
|
|
|
750
766
|
name: string;
|
|
751
767
|
reason: string;
|
|
752
768
|
}
|
|
769
|
+
/**
|
|
770
|
+
* An action that changes data is waiting for the user. The widget shows it
|
|
771
|
+
* with Approve and Cancel and answers with `confirm` on the next message.
|
|
772
|
+
* Nothing has run yet; on Approve the server runs exactly this call.
|
|
773
|
+
*/
|
|
774
|
+
| {
|
|
775
|
+
type: "action_confirm";
|
|
776
|
+
toolUseId: string;
|
|
777
|
+
name: string;
|
|
778
|
+
label: string;
|
|
779
|
+
preview: ActionPreview;
|
|
780
|
+
}
|
|
753
781
|
/**
|
|
754
782
|
* Client-side tool execution: the server asks the widget to make one HTTP
|
|
755
783
|
* call to the host's own API, from the user's browser and on the user's
|
|
@@ -838,6 +866,13 @@ interface ChatRequestBody {
|
|
|
838
866
|
/** Omit to start a new conversation; the server replies with a `session` event. */
|
|
839
867
|
sessionId?: string;
|
|
840
868
|
message: string;
|
|
869
|
+
/**
|
|
870
|
+
* A fresh host-signed user token for the session's own user. Host tokens are
|
|
871
|
+
* short-lived (minutes) while a session lasts an hour, so the widget sends a
|
|
872
|
+
* new one with each message and the server forwards that one to the
|
|
873
|
+
* workspace's tools instead of the expired one it started with.
|
|
874
|
+
*/
|
|
875
|
+
userToken?: string;
|
|
841
876
|
/**
|
|
842
877
|
* Free-form page context the host passes through (current route, plan tier,
|
|
843
878
|
* feature flags). Surfaced to the agent as a system reminder, never trusted
|
|
@@ -851,6 +886,28 @@ interface ChatRequestBody {
|
|
|
851
886
|
model?: string;
|
|
852
887
|
/** Files attached to this turn. Honoured only when attachments are enabled. */
|
|
853
888
|
attachments?: ChatAttachment[];
|
|
889
|
+
/**
|
|
890
|
+
* The widget can show an `action_confirm` card. Without it, actions run as
|
|
891
|
+
* they always have, so an SDK that can't ask the user is never left with a
|
|
892
|
+
* paused action and no button to approve it.
|
|
893
|
+
*/
|
|
894
|
+
confirmActions?: boolean;
|
|
895
|
+
/** The user's answer to the action waiting for approval (`action_confirm`). */
|
|
896
|
+
confirm?: ActionDecision;
|
|
897
|
+
}
|
|
898
|
+
/** Approve or cancel the action an `action_confirm` event paused. */
|
|
899
|
+
interface ActionDecision {
|
|
900
|
+
/** The `toolUseId` from the `action_confirm` event. */
|
|
901
|
+
toolUseId: string;
|
|
902
|
+
approved: boolean;
|
|
903
|
+
}
|
|
904
|
+
/** What an action that's waiting for approval will do, for the confirmation card. */
|
|
905
|
+
interface ActionPreview {
|
|
906
|
+
/** HTTP method and path for an API action, when there is one. */
|
|
907
|
+
method?: string;
|
|
908
|
+
path?: string;
|
|
909
|
+
/** The exact inputs it will run with. */
|
|
910
|
+
input?: unknown;
|
|
854
911
|
}
|
|
855
912
|
/** Client -> server body for `POST /v1/session`. */
|
|
856
913
|
interface CreateSessionBody {
|
|
@@ -904,6 +961,12 @@ interface PublicWidgetConfig {
|
|
|
904
961
|
features: PublicFeatures;
|
|
905
962
|
/** App-Router path globs this agent shows on; empty = every page no other agent claims. Optional so older servers stay compatible. */
|
|
906
963
|
pages?: string[];
|
|
964
|
+
/**
|
|
965
|
+
* Whether the chat shows the "Agent context" bar (skills and APIs loaded for
|
|
966
|
+
* the turn). Off for visitor-facing page agents such as Support and Docs,
|
|
967
|
+
* where it means nothing to the person chatting. Absent (older servers) = shown.
|
|
968
|
+
*/
|
|
969
|
+
agentContext?: boolean;
|
|
907
970
|
}
|
|
908
971
|
/** The subset of `features` config the widget needs to render its controls. */
|
|
909
972
|
interface PublicFeatures {
|
|
@@ -1092,6 +1155,20 @@ declare function renderJson(value: unknown, original: string | undefined): strin
|
|
|
1092
1155
|
*/
|
|
1093
1156
|
declare function moduleImporter(files: Record<string, string>, root: string, sourceRoot: string): (fromFile: string, module: string) => string;
|
|
1094
1157
|
|
|
1158
|
+
/**
|
|
1159
|
+
* A prompt a developer pastes into their AI coding assistant (Claude Code,
|
|
1160
|
+
* Cursor, Copilot…) to add Frankie to their app. The docs show it with
|
|
1161
|
+
* placeholders; the dashboard fills in the workspace's own ID and public key.
|
|
1162
|
+
* It never contains a secret: FRANKIE_JWT_SECRET is only ever named.
|
|
1163
|
+
*/
|
|
1164
|
+
interface InstallPromptOptions {
|
|
1165
|
+
workspaceId?: string;
|
|
1166
|
+
publishableKey?: string;
|
|
1167
|
+
/** The workspace lets visitors chat without signing in: no token endpoint. */
|
|
1168
|
+
allowAnonymous?: boolean;
|
|
1169
|
+
}
|
|
1170
|
+
declare function installPrompt(options?: InstallPromptOptions): string;
|
|
1171
|
+
|
|
1095
1172
|
declare const skillSchema: z.ZodObject<{
|
|
1096
1173
|
id: z.ZodString;
|
|
1097
1174
|
name: z.ZodString;
|
|
@@ -1212,4 +1289,82 @@ declare function normalizeColor(raw: string): string | undefined;
|
|
|
1212
1289
|
*/
|
|
1213
1290
|
declare function inferTheme(files: Record<string, string>, root?: string): InferredTheme | undefined;
|
|
1214
1291
|
|
|
1215
|
-
|
|
1292
|
+
/** Who an end user is, as far as their own app's sign-in token said. */
|
|
1293
|
+
type EndUser = {
|
|
1294
|
+
id: string;
|
|
1295
|
+
displayName?: string;
|
|
1296
|
+
email?: string;
|
|
1297
|
+
anonymous: boolean;
|
|
1298
|
+
};
|
|
1299
|
+
/**
|
|
1300
|
+
* One label for the person behind a conversation, used by the list, the
|
|
1301
|
+
* transcript and the escalations inbox so they always agree. A token's name
|
|
1302
|
+
* wins, then its email; a signed-in user whose app sent neither still gets a
|
|
1303
|
+
* short id, so two people never read as the same "Signed-in user".
|
|
1304
|
+
*/
|
|
1305
|
+
declare function userLabel(user: EndUser): string;
|
|
1306
|
+
/** What a conversation log is built from: the stored conversation as the dashboard and the server both see it. */
|
|
1307
|
+
interface ConversationLogInput {
|
|
1308
|
+
id: string;
|
|
1309
|
+
title: string;
|
|
1310
|
+
createdAt: number;
|
|
1311
|
+
updatedAt: number;
|
|
1312
|
+
costUsd: number;
|
|
1313
|
+
busy: boolean;
|
|
1314
|
+
user: EndUser;
|
|
1315
|
+
/** The transcript the chat UI saved. */
|
|
1316
|
+
messages: unknown[];
|
|
1317
|
+
/** The server's model and tool transcript. */
|
|
1318
|
+
agentMessages: unknown[];
|
|
1319
|
+
escalations?: Array<{
|
|
1320
|
+
id: string;
|
|
1321
|
+
at: number;
|
|
1322
|
+
reason: string;
|
|
1323
|
+
summary: string;
|
|
1324
|
+
email?: string;
|
|
1325
|
+
name?: string;
|
|
1326
|
+
}>;
|
|
1327
|
+
}
|
|
1328
|
+
/**
|
|
1329
|
+
* One conversation as plain Markdown, written to be pasted into any LLM to ask
|
|
1330
|
+
* what happened: a summary, the chat as the person saw it, then the agent's
|
|
1331
|
+
* full trace (model messages, tool calls with their inputs, tool results and
|
|
1332
|
+
* errors). Images are noted, not inlined, and very long blocks are cut so the
|
|
1333
|
+
* log stays pasteable.
|
|
1334
|
+
*/
|
|
1335
|
+
declare function conversationLog(conversation: ConversationLogInput, options?: {
|
|
1336
|
+
workspace?: {
|
|
1337
|
+
id: string;
|
|
1338
|
+
name: string;
|
|
1339
|
+
};
|
|
1340
|
+
agent?: string;
|
|
1341
|
+
}): string;
|
|
1342
|
+
/** A file name for the downloaded log. */
|
|
1343
|
+
declare function conversationLogFileName(conversation: {
|
|
1344
|
+
id: string;
|
|
1345
|
+
title: string;
|
|
1346
|
+
}): string;
|
|
1347
|
+
|
|
1348
|
+
/** Where Frankie's sync workflow lives in a repository. */
|
|
1349
|
+
declare const API_SYNC_WORKFLOW_PATH = ".github/workflows/frankie-api-sync.yml";
|
|
1350
|
+
interface ApiSyncWorkflowOptions {
|
|
1351
|
+
/** The Frankie service the workflow posts to (the control plane's public URL). */
|
|
1352
|
+
url: string;
|
|
1353
|
+
/** The workspace id. */
|
|
1354
|
+
workspace: string;
|
|
1355
|
+
/** The API connection's name in that workspace. */
|
|
1356
|
+
api: string;
|
|
1357
|
+
/** The API description file in the repository, e.g. "public/openapi.json". */
|
|
1358
|
+
path: string;
|
|
1359
|
+
}
|
|
1360
|
+
/**
|
|
1361
|
+
* A repository-owned workflow that sends the API description to Frankie on
|
|
1362
|
+
* every push to the default branch that changes it. It holds no secret: it
|
|
1363
|
+
* asks GitHub for an OIDC token (audience "frankie") that proves the
|
|
1364
|
+
* repository and commit, and Frankie checks that against the workspace.
|
|
1365
|
+
*/
|
|
1366
|
+
declare function apiSyncWorkflow(options: ApiSyncWorkflowOptions): string;
|
|
1367
|
+
/** A plain file path in the repository: no traversal, quoting or glob characters. */
|
|
1368
|
+
declare function isSafeRepositoryPath(path: string): boolean;
|
|
1369
|
+
|
|
1370
|
+
export { API_SYNC_WORKFLOW_PATH, type ActionDecision, type ActionPreview, type AgentConfig, type ApiCapability, type ApiDocument, type ApiSourceConfig, type ApiSyncWorkflowOptions, type ApiToolInventory, type AuthConfig, type AuthStrategy, type BrandingConfig, type ChatAttachment, type ChatRequestBody, type ConversationLogInput, type CreateSessionBody, type CreateSessionResponse, type EndUser, FIREWORKS_MODELS, type FeaturesConfig, type FrankieConfig, type FrankieConfigInput, type FrankieErrorCode, type FrankieServerEvent, type HostToolRequest, type HostToolResult, type InferredTheme, type InstallPlan, type InstallProject, type InstallPromptOptions, type KnowledgeBaseConfig, type LimitsConfig, type LoadedSkill, type McpServerConfig, type ModelChoice, type ModelConfig, type PersonaProfile, type PublicFeatures, type PublicWidgetConfig, SKILL_TOOL_NAME, STANDARD_AGENT_IDS, STARTER_PROMPT_ICONS, type StarterPrompt, type StarterPromptIcon, type StopReason, type ThinkingLevel, type ToolDecision, type ToolPolicy, type ToolResultBody, type UsageSummary, type WidgetTheme, type WidgetThemeConfig, type WorkspaceSkill, activeSkills, agentConfigSchema, apiCapabilitySchema, apiMethods, apiOperations, apiSourceSchema, apiSyncWorkflow, approvedSkillTools, assertNoCommittedFrankieKeys, authConfigSchema, brandingConfigSchema, canonicalJson, compareApiDocuments, conversationLog, conversationLogFileName, defineFrankieConfig, describeTool, draftSkill, evaluateToolPolicy, featuresConfigSchema, frankieConfigSchema, inferTheme, insertImport, installAgentIds, installBranch, installPrompt, installTitle, isSafeRepositoryPath, knowledgeBaseSchema, knowledgeSourceSchema, limitsConfigSchema, matchPath, matchesAnyPagePattern, matchesInstallBranch, matchesPagePattern, mcpServerSchema, modelChoiceSchema, modelConfigSchema, moduleImporter, mountWidget, normalizeColor, operationId, parseFrankieConfig, personaEnvKey, personaInstructions, personaProfileSchema, plainText, planHostedInstall, renderJson, resolvePersonaConfig, sdkUpdateWorkflow, skillSchema, starterPromptSchema, suggestedPromptsFromSkills, thinkingLevelSchema, toolDescriptions, toolPolicySchema, userLabel, validateApiDocument, widgetThemeSchema, withDependencies };
|