@frankieai/core 0.2.3 → 0.2.5
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 +94 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +100 -1
- package/dist/index.d.ts +100 -1
- package/dist/index.js +90 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -179,10 +179,60 @@ declare const toolPolicySchema: z.ZodObject<{
|
|
|
179
179
|
deny: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
180
180
|
denyByDefault: z.ZodDefault<z.ZodBoolean>;
|
|
181
181
|
}, z.core.$strip>;
|
|
182
|
+
/**
|
|
183
|
+
* The icons a starter card may use, shared by the dashboard picker and the SDK
|
|
184
|
+
* so the choices stay in step. Each maps to a concrete icon in the widget.
|
|
185
|
+
*/
|
|
186
|
+
declare const STARTER_PROMPT_ICONS: readonly ["sparkles", "wand", "book", "chat", "chart", "bolt", "music", "mic", "image", "compass", "lightbulb", "file"];
|
|
187
|
+
type StarterPromptIcon = (typeof STARTER_PROMPT_ICONS)[number];
|
|
188
|
+
/**
|
|
189
|
+
* A starter card shown on the empty chat screen: an icon, a title and short
|
|
190
|
+
* description the reader sees, and the message that is sent as if they typed it
|
|
191
|
+
* when they click the card. Configured per workspace in the dashboard's
|
|
192
|
+
* Appearance tab.
|
|
193
|
+
*/
|
|
194
|
+
declare const starterPromptSchema: z.ZodObject<{
|
|
195
|
+
title: z.ZodString;
|
|
196
|
+
description: z.ZodOptional<z.ZodString>;
|
|
197
|
+
message: z.ZodString;
|
|
198
|
+
icon: z.ZodOptional<z.ZodEnum<{
|
|
199
|
+
file: "file";
|
|
200
|
+
sparkles: "sparkles";
|
|
201
|
+
wand: "wand";
|
|
202
|
+
book: "book";
|
|
203
|
+
chat: "chat";
|
|
204
|
+
chart: "chart";
|
|
205
|
+
bolt: "bolt";
|
|
206
|
+
music: "music";
|
|
207
|
+
mic: "mic";
|
|
208
|
+
image: "image";
|
|
209
|
+
compass: "compass";
|
|
210
|
+
lightbulb: "lightbulb";
|
|
211
|
+
}>>;
|
|
212
|
+
}, z.core.$strip>;
|
|
182
213
|
declare const agentConfigSchema: z.ZodObject<{
|
|
183
214
|
systemPrompt: z.ZodDefault<z.ZodString>;
|
|
184
215
|
greeting: z.ZodDefault<z.ZodString>;
|
|
185
216
|
suggestedPrompts: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
217
|
+
starterPrompts: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
218
|
+
title: z.ZodString;
|
|
219
|
+
description: z.ZodOptional<z.ZodString>;
|
|
220
|
+
message: z.ZodString;
|
|
221
|
+
icon: z.ZodOptional<z.ZodEnum<{
|
|
222
|
+
file: "file";
|
|
223
|
+
sparkles: "sparkles";
|
|
224
|
+
wand: "wand";
|
|
225
|
+
book: "book";
|
|
226
|
+
chat: "chat";
|
|
227
|
+
chart: "chart";
|
|
228
|
+
bolt: "bolt";
|
|
229
|
+
music: "music";
|
|
230
|
+
mic: "mic";
|
|
231
|
+
image: "image";
|
|
232
|
+
compass: "compass";
|
|
233
|
+
lightbulb: "lightbulb";
|
|
234
|
+
}>>;
|
|
235
|
+
}, z.core.$strip>>>;
|
|
186
236
|
maxTurns: z.ZodDefault<z.ZodNumber>;
|
|
187
237
|
maxBudgetUsd: z.ZodOptional<z.ZodNumber>;
|
|
188
238
|
tools: z.ZodPrefault<z.ZodObject<{
|
|
@@ -267,6 +317,25 @@ declare const frankieConfigSchema: z.ZodObject<{
|
|
|
267
317
|
systemPrompt: z.ZodDefault<z.ZodString>;
|
|
268
318
|
greeting: z.ZodDefault<z.ZodString>;
|
|
269
319
|
suggestedPrompts: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
320
|
+
starterPrompts: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
321
|
+
title: z.ZodString;
|
|
322
|
+
description: z.ZodOptional<z.ZodString>;
|
|
323
|
+
message: z.ZodString;
|
|
324
|
+
icon: z.ZodOptional<z.ZodEnum<{
|
|
325
|
+
file: "file";
|
|
326
|
+
sparkles: "sparkles";
|
|
327
|
+
wand: "wand";
|
|
328
|
+
book: "book";
|
|
329
|
+
chat: "chat";
|
|
330
|
+
chart: "chart";
|
|
331
|
+
bolt: "bolt";
|
|
332
|
+
music: "music";
|
|
333
|
+
mic: "mic";
|
|
334
|
+
image: "image";
|
|
335
|
+
compass: "compass";
|
|
336
|
+
lightbulb: "lightbulb";
|
|
337
|
+
}>>;
|
|
338
|
+
}, z.core.$strip>>>;
|
|
270
339
|
maxTurns: z.ZodDefault<z.ZodNumber>;
|
|
271
340
|
maxBudgetUsd: z.ZodOptional<z.ZodNumber>;
|
|
272
341
|
tools: z.ZodPrefault<z.ZodObject<{
|
|
@@ -589,6 +658,14 @@ interface CreateSessionResponse {
|
|
|
589
658
|
anonymous: boolean;
|
|
590
659
|
};
|
|
591
660
|
}
|
|
661
|
+
/** A starter card on the empty chat screen: what the reader sees, and the message clicking it sends. */
|
|
662
|
+
interface StarterPrompt {
|
|
663
|
+
title: string;
|
|
664
|
+
description?: string;
|
|
665
|
+
message: string;
|
|
666
|
+
/** One of STARTER_PROMPT_ICONS; the widget maps it to a concrete icon. */
|
|
667
|
+
icon?: string;
|
|
668
|
+
}
|
|
592
669
|
/** The subset of tenant config the widget is allowed to see. */
|
|
593
670
|
interface PublicWidgetConfig {
|
|
594
671
|
tenantId: string;
|
|
@@ -600,6 +677,8 @@ interface PublicWidgetConfig {
|
|
|
600
677
|
};
|
|
601
678
|
greeting: string;
|
|
602
679
|
suggestedPrompts: string[];
|
|
680
|
+
/** Explicit starter cards (title + description + message). Take precedence over `suggestedPrompts` on the empty screen. Optional so older servers stay compatible. */
|
|
681
|
+
starterPrompts?: StarterPrompt[];
|
|
603
682
|
theme: WidgetTheme;
|
|
604
683
|
/** Whether the widget may open a session without a host-signed user token. */
|
|
605
684
|
allowAnonymous: boolean;
|
|
@@ -658,6 +737,13 @@ interface ToolDecision {
|
|
|
658
737
|
* also allows every tool on the `acme` server.
|
|
659
738
|
*/
|
|
660
739
|
declare function evaluateToolPolicy(toolName: string, policy: ToolPolicy): ToolDecision;
|
|
740
|
+
/**
|
|
741
|
+
* The agent-harness tool a skill-following agent calls to announce which
|
|
742
|
+
* reviewed workspace skill it is about to apply. It grants no permissions and
|
|
743
|
+
* does nothing on its own — it exists so a skill shows up in the transcript like
|
|
744
|
+
* any other tool call, instead of being followed invisibly.
|
|
745
|
+
*/
|
|
746
|
+
declare const SKILL_TOOL_NAME = "frankie__use_skill";
|
|
661
747
|
/** A short human label for a tool call, for the "Frankie is …" line in the UI. */
|
|
662
748
|
declare function describeTool(toolName: string, input: unknown): string;
|
|
663
749
|
|
|
@@ -724,6 +810,19 @@ declare function toolDescriptions(config: FrankieConfig, toolIds: string[]): Arr
|
|
|
724
810
|
id: string;
|
|
725
811
|
description: string;
|
|
726
812
|
}>;
|
|
813
|
+
/**
|
|
814
|
+
* Starter suggestion prompts derived from the workspace's own published,
|
|
815
|
+
* runnable skills, so an empty chat offers what this assistant can actually do
|
|
816
|
+
* instead of a blank screen. Each entry is a clean action title ("Generate a
|
|
817
|
+
* lesson"), optionally with a short subtitle after " — " when the skill's goal
|
|
818
|
+
* adds real information. The chat empty state shows the title as the card title
|
|
819
|
+
* and the subtitle beneath it, and sends only the title. Auto-generated skill
|
|
820
|
+
* names (e.g. "product · generate lesson") and their boilerplate CRUD goals are
|
|
821
|
+
* cleaned up so the cards read like real suggestions, not internal ids. Used
|
|
822
|
+
* only when the workspace hasn't authored its own `suggestedPrompts`; deduped
|
|
823
|
+
* and capped to the config limit (6).
|
|
824
|
+
*/
|
|
825
|
+
declare function suggestedPromptsFromSkills(config: FrankieConfig): string[];
|
|
727
826
|
/**
|
|
728
827
|
* Deterministic starter for the manual editor — not a claim that anything
|
|
729
828
|
* was executed, and not model-generated. Follows the same structure asked of
|
|
@@ -766,4 +865,4 @@ declare function compareApiDocuments(before: ApiDocument, after: ApiDocument): {
|
|
|
766
865
|
unchangedIds: string[];
|
|
767
866
|
};
|
|
768
867
|
|
|
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 };
|
|
868
|
+
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, SKILL_TOOL_NAME, STARTER_PROMPT_ICONS, type StarterPrompt, type StarterPromptIcon, type StopReason, type ThinkingLevel, type ToolDecision, type ToolPolicy, type ToolResultBody, type UsageSummary, type WidgetTheme, type WidgetThemeConfig, type WorkspaceSkill, activeSkills, agentConfigSchema, apiCapabilitySchema, apiMethods, apiOperations, apiSourceSchema, approvedSkillTools, assertNoCommittedFrankieKeys, authConfigSchema, brandingConfigSchema, canonicalJson, compareApiDocuments, defineFrankieConfig, describeTool, draftSkill, evaluateToolPolicy, featuresConfigSchema, frankieConfigSchema, limitsConfigSchema, matchPath, mcpServerSchema, modelChoiceSchema, modelConfigSchema, operationId, parseFrankieConfig, planHostedInstall, sdkUpdateWorkflow, skillSchema, starterPromptSchema, suggestedPromptsFromSkills, thinkingLevelSchema, toolDescriptions, toolPolicySchema, validateApiDocument, widgetThemeSchema };
|
package/dist/index.d.ts
CHANGED
|
@@ -179,10 +179,60 @@ declare const toolPolicySchema: z.ZodObject<{
|
|
|
179
179
|
deny: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
180
180
|
denyByDefault: z.ZodDefault<z.ZodBoolean>;
|
|
181
181
|
}, z.core.$strip>;
|
|
182
|
+
/**
|
|
183
|
+
* The icons a starter card may use, shared by the dashboard picker and the SDK
|
|
184
|
+
* so the choices stay in step. Each maps to a concrete icon in the widget.
|
|
185
|
+
*/
|
|
186
|
+
declare const STARTER_PROMPT_ICONS: readonly ["sparkles", "wand", "book", "chat", "chart", "bolt", "music", "mic", "image", "compass", "lightbulb", "file"];
|
|
187
|
+
type StarterPromptIcon = (typeof STARTER_PROMPT_ICONS)[number];
|
|
188
|
+
/**
|
|
189
|
+
* A starter card shown on the empty chat screen: an icon, a title and short
|
|
190
|
+
* description the reader sees, and the message that is sent as if they typed it
|
|
191
|
+
* when they click the card. Configured per workspace in the dashboard's
|
|
192
|
+
* Appearance tab.
|
|
193
|
+
*/
|
|
194
|
+
declare const starterPromptSchema: z.ZodObject<{
|
|
195
|
+
title: z.ZodString;
|
|
196
|
+
description: z.ZodOptional<z.ZodString>;
|
|
197
|
+
message: z.ZodString;
|
|
198
|
+
icon: z.ZodOptional<z.ZodEnum<{
|
|
199
|
+
file: "file";
|
|
200
|
+
sparkles: "sparkles";
|
|
201
|
+
wand: "wand";
|
|
202
|
+
book: "book";
|
|
203
|
+
chat: "chat";
|
|
204
|
+
chart: "chart";
|
|
205
|
+
bolt: "bolt";
|
|
206
|
+
music: "music";
|
|
207
|
+
mic: "mic";
|
|
208
|
+
image: "image";
|
|
209
|
+
compass: "compass";
|
|
210
|
+
lightbulb: "lightbulb";
|
|
211
|
+
}>>;
|
|
212
|
+
}, z.core.$strip>;
|
|
182
213
|
declare const agentConfigSchema: z.ZodObject<{
|
|
183
214
|
systemPrompt: z.ZodDefault<z.ZodString>;
|
|
184
215
|
greeting: z.ZodDefault<z.ZodString>;
|
|
185
216
|
suggestedPrompts: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
217
|
+
starterPrompts: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
218
|
+
title: z.ZodString;
|
|
219
|
+
description: z.ZodOptional<z.ZodString>;
|
|
220
|
+
message: z.ZodString;
|
|
221
|
+
icon: z.ZodOptional<z.ZodEnum<{
|
|
222
|
+
file: "file";
|
|
223
|
+
sparkles: "sparkles";
|
|
224
|
+
wand: "wand";
|
|
225
|
+
book: "book";
|
|
226
|
+
chat: "chat";
|
|
227
|
+
chart: "chart";
|
|
228
|
+
bolt: "bolt";
|
|
229
|
+
music: "music";
|
|
230
|
+
mic: "mic";
|
|
231
|
+
image: "image";
|
|
232
|
+
compass: "compass";
|
|
233
|
+
lightbulb: "lightbulb";
|
|
234
|
+
}>>;
|
|
235
|
+
}, z.core.$strip>>>;
|
|
186
236
|
maxTurns: z.ZodDefault<z.ZodNumber>;
|
|
187
237
|
maxBudgetUsd: z.ZodOptional<z.ZodNumber>;
|
|
188
238
|
tools: z.ZodPrefault<z.ZodObject<{
|
|
@@ -267,6 +317,25 @@ declare const frankieConfigSchema: z.ZodObject<{
|
|
|
267
317
|
systemPrompt: z.ZodDefault<z.ZodString>;
|
|
268
318
|
greeting: z.ZodDefault<z.ZodString>;
|
|
269
319
|
suggestedPrompts: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
320
|
+
starterPrompts: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
321
|
+
title: z.ZodString;
|
|
322
|
+
description: z.ZodOptional<z.ZodString>;
|
|
323
|
+
message: z.ZodString;
|
|
324
|
+
icon: z.ZodOptional<z.ZodEnum<{
|
|
325
|
+
file: "file";
|
|
326
|
+
sparkles: "sparkles";
|
|
327
|
+
wand: "wand";
|
|
328
|
+
book: "book";
|
|
329
|
+
chat: "chat";
|
|
330
|
+
chart: "chart";
|
|
331
|
+
bolt: "bolt";
|
|
332
|
+
music: "music";
|
|
333
|
+
mic: "mic";
|
|
334
|
+
image: "image";
|
|
335
|
+
compass: "compass";
|
|
336
|
+
lightbulb: "lightbulb";
|
|
337
|
+
}>>;
|
|
338
|
+
}, z.core.$strip>>>;
|
|
270
339
|
maxTurns: z.ZodDefault<z.ZodNumber>;
|
|
271
340
|
maxBudgetUsd: z.ZodOptional<z.ZodNumber>;
|
|
272
341
|
tools: z.ZodPrefault<z.ZodObject<{
|
|
@@ -589,6 +658,14 @@ interface CreateSessionResponse {
|
|
|
589
658
|
anonymous: boolean;
|
|
590
659
|
};
|
|
591
660
|
}
|
|
661
|
+
/** A starter card on the empty chat screen: what the reader sees, and the message clicking it sends. */
|
|
662
|
+
interface StarterPrompt {
|
|
663
|
+
title: string;
|
|
664
|
+
description?: string;
|
|
665
|
+
message: string;
|
|
666
|
+
/** One of STARTER_PROMPT_ICONS; the widget maps it to a concrete icon. */
|
|
667
|
+
icon?: string;
|
|
668
|
+
}
|
|
592
669
|
/** The subset of tenant config the widget is allowed to see. */
|
|
593
670
|
interface PublicWidgetConfig {
|
|
594
671
|
tenantId: string;
|
|
@@ -600,6 +677,8 @@ interface PublicWidgetConfig {
|
|
|
600
677
|
};
|
|
601
678
|
greeting: string;
|
|
602
679
|
suggestedPrompts: string[];
|
|
680
|
+
/** Explicit starter cards (title + description + message). Take precedence over `suggestedPrompts` on the empty screen. Optional so older servers stay compatible. */
|
|
681
|
+
starterPrompts?: StarterPrompt[];
|
|
603
682
|
theme: WidgetTheme;
|
|
604
683
|
/** Whether the widget may open a session without a host-signed user token. */
|
|
605
684
|
allowAnonymous: boolean;
|
|
@@ -658,6 +737,13 @@ interface ToolDecision {
|
|
|
658
737
|
* also allows every tool on the `acme` server.
|
|
659
738
|
*/
|
|
660
739
|
declare function evaluateToolPolicy(toolName: string, policy: ToolPolicy): ToolDecision;
|
|
740
|
+
/**
|
|
741
|
+
* The agent-harness tool a skill-following agent calls to announce which
|
|
742
|
+
* reviewed workspace skill it is about to apply. It grants no permissions and
|
|
743
|
+
* does nothing on its own — it exists so a skill shows up in the transcript like
|
|
744
|
+
* any other tool call, instead of being followed invisibly.
|
|
745
|
+
*/
|
|
746
|
+
declare const SKILL_TOOL_NAME = "frankie__use_skill";
|
|
661
747
|
/** A short human label for a tool call, for the "Frankie is …" line in the UI. */
|
|
662
748
|
declare function describeTool(toolName: string, input: unknown): string;
|
|
663
749
|
|
|
@@ -724,6 +810,19 @@ declare function toolDescriptions(config: FrankieConfig, toolIds: string[]): Arr
|
|
|
724
810
|
id: string;
|
|
725
811
|
description: string;
|
|
726
812
|
}>;
|
|
813
|
+
/**
|
|
814
|
+
* Starter suggestion prompts derived from the workspace's own published,
|
|
815
|
+
* runnable skills, so an empty chat offers what this assistant can actually do
|
|
816
|
+
* instead of a blank screen. Each entry is a clean action title ("Generate a
|
|
817
|
+
* lesson"), optionally with a short subtitle after " — " when the skill's goal
|
|
818
|
+
* adds real information. The chat empty state shows the title as the card title
|
|
819
|
+
* and the subtitle beneath it, and sends only the title. Auto-generated skill
|
|
820
|
+
* names (e.g. "product · generate lesson") and their boilerplate CRUD goals are
|
|
821
|
+
* cleaned up so the cards read like real suggestions, not internal ids. Used
|
|
822
|
+
* only when the workspace hasn't authored its own `suggestedPrompts`; deduped
|
|
823
|
+
* and capped to the config limit (6).
|
|
824
|
+
*/
|
|
825
|
+
declare function suggestedPromptsFromSkills(config: FrankieConfig): string[];
|
|
727
826
|
/**
|
|
728
827
|
* Deterministic starter for the manual editor — not a claim that anything
|
|
729
828
|
* was executed, and not model-generated. Follows the same structure asked of
|
|
@@ -766,4 +865,4 @@ declare function compareApiDocuments(before: ApiDocument, after: ApiDocument): {
|
|
|
766
865
|
unchangedIds: string[];
|
|
767
866
|
};
|
|
768
867
|
|
|
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 };
|
|
868
|
+
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, SKILL_TOOL_NAME, STARTER_PROMPT_ICONS, type StarterPrompt, type StarterPromptIcon, type StopReason, type ThinkingLevel, type ToolDecision, type ToolPolicy, type ToolResultBody, type UsageSummary, type WidgetTheme, type WidgetThemeConfig, type WorkspaceSkill, activeSkills, agentConfigSchema, apiCapabilitySchema, apiMethods, apiOperations, apiSourceSchema, approvedSkillTools, assertNoCommittedFrankieKeys, authConfigSchema, brandingConfigSchema, canonicalJson, compareApiDocuments, defineFrankieConfig, describeTool, draftSkill, evaluateToolPolicy, featuresConfigSchema, frankieConfigSchema, limitsConfigSchema, matchPath, mcpServerSchema, modelChoiceSchema, modelConfigSchema, operationId, parseFrankieConfig, planHostedInstall, sdkUpdateWorkflow, skillSchema, starterPromptSchema, suggestedPromptsFromSkills, thinkingLevelSchema, toolDescriptions, toolPolicySchema, validateApiDocument, widgetThemeSchema };
|
package/dist/index.js
CHANGED
|
@@ -26,12 +26,24 @@ function matches(toolName, pattern) {
|
|
|
26
26
|
if (toolName === pattern) return true;
|
|
27
27
|
return toolName.startsWith(`${pattern}__`);
|
|
28
28
|
}
|
|
29
|
+
var SKILL_TOOL_NAME = "frankie__use_skill";
|
|
29
30
|
function describeTool(toolName, input) {
|
|
31
|
+
if (toolName === SKILL_TOOL_NAME) {
|
|
32
|
+
const skill = typeof input === "object" && input !== null ? input["skill"] : void 0;
|
|
33
|
+
return typeof skill === "string" && skill.trim() ? `Using skill: ${skill.trim()}` : "Using a skill";
|
|
34
|
+
}
|
|
30
35
|
const mcp = /^mcp__([^_]+(?:_[^_]+)*)__(.+)$/.exec(toolName);
|
|
31
36
|
if (mcp) {
|
|
32
37
|
const [, server, tool] = mcp;
|
|
33
38
|
return `${humanise(tool ?? toolName)} \xB7 ${server}`;
|
|
34
39
|
}
|
|
40
|
+
if (toolName.startsWith("api__")) {
|
|
41
|
+
const rest = toolName.slice("api__".length);
|
|
42
|
+
const sep = rest.indexOf("__");
|
|
43
|
+
const operation = (sep >= 0 ? rest.slice(sep + 2) : rest).replace(/__+/g, "_");
|
|
44
|
+
const verb = /^(get|post|put|patch|delete|head|options)_(.+)$/i.exec(operation);
|
|
45
|
+
return verb ? `${verb[1].toUpperCase()} ${humanise(verb[2])}` : humanise(operation);
|
|
46
|
+
}
|
|
35
47
|
const inputRecord = typeof input === "object" && input !== null ? input : {};
|
|
36
48
|
const hint = inputRecord["path"] ?? inputRecord["url"] ?? inputRecord["query"] ?? inputRecord["command"];
|
|
37
49
|
return typeof hint === "string" ? `${humanise(toolName)}: ${truncate(hint, 60)}` : humanise(toolName);
|
|
@@ -82,6 +94,36 @@ function toolDescriptions(config, toolIds) {
|
|
|
82
94
|
}
|
|
83
95
|
return toolIds.map((id) => ({ id, description: found.get(id) ?? id }));
|
|
84
96
|
}
|
|
97
|
+
function suggestedPromptsFromSkills(config) {
|
|
98
|
+
const seen = /* @__PURE__ */ new Set();
|
|
99
|
+
const prompts = [];
|
|
100
|
+
for (const skill of activeSkills(config)) {
|
|
101
|
+
const title = cleanSkillName(skill.name);
|
|
102
|
+
if (!title) continue;
|
|
103
|
+
const key = title.toLowerCase();
|
|
104
|
+
if (seen.has(key)) continue;
|
|
105
|
+
seen.add(key);
|
|
106
|
+
const detail = summarizeGoal(skill.goal, title);
|
|
107
|
+
prompts.push(detail ? `${title} \u2014 ${detail}` : title);
|
|
108
|
+
if (prompts.length >= 6) break;
|
|
109
|
+
}
|
|
110
|
+
return prompts;
|
|
111
|
+
}
|
|
112
|
+
function cleanSkillName(name) {
|
|
113
|
+
const trimmed = name.trim();
|
|
114
|
+
const withoutSource = trimmed.replace(/^[^·/:]{1,40}?\s*[·/:]\s*/, "");
|
|
115
|
+
const cleaned = (withoutSource || trimmed).replace(/[·/_]+/g, " ").replace(/\s+/g, " ").trim();
|
|
116
|
+
return cleaned ? cleaned.charAt(0).toUpperCase() + cleaned.slice(1) : "";
|
|
117
|
+
}
|
|
118
|
+
function summarizeGoal(goal, title) {
|
|
119
|
+
let cleaned = goal.trim().replace(/^use this(?: skill)?(?: when (?:the user (?:asks?(?: you)?(?: to| for| about)?|wants?(?: to)?|needs?(?: to)?)|you (?:need|want) to)| to)\s+/i, "").replace(/\s+/g, " ").replace(/[.\s]+$/, "");
|
|
120
|
+
const restatement = cleaned.match(/^.{1,40}?\s+[—–-]\s+(.+)$/);
|
|
121
|
+
if (restatement) cleaned = restatement[1];
|
|
122
|
+
if (/^(listing|creating|reading|updating|managing)\b/i.test(cleaned) || /^(create|read|update|delete|list|manage),/i.test(cleaned)) return "";
|
|
123
|
+
if (!cleaned || cleaned.toLowerCase() === title.toLowerCase()) return "";
|
|
124
|
+
const capped = cleaned.length > 80 ? cleaned.slice(0, 80).replace(/\s+\S*$/, "") + "\u2026" : cleaned;
|
|
125
|
+
return capped.charAt(0).toUpperCase() + capped.slice(1);
|
|
126
|
+
}
|
|
85
127
|
function draftSkill(goal, tools) {
|
|
86
128
|
return [
|
|
87
129
|
`Use this when: ${goal}`,
|
|
@@ -334,12 +376,39 @@ var toolPolicySchema = z2.object({
|
|
|
334
376
|
*/
|
|
335
377
|
denyByDefault: z2.boolean().default(true)
|
|
336
378
|
});
|
|
379
|
+
var STARTER_PROMPT_ICONS = [
|
|
380
|
+
"sparkles",
|
|
381
|
+
"wand",
|
|
382
|
+
"book",
|
|
383
|
+
"chat",
|
|
384
|
+
"chart",
|
|
385
|
+
"bolt",
|
|
386
|
+
"music",
|
|
387
|
+
"mic",
|
|
388
|
+
"image",
|
|
389
|
+
"compass",
|
|
390
|
+
"lightbulb",
|
|
391
|
+
"file"
|
|
392
|
+
];
|
|
393
|
+
var starterPromptSchema = z2.object({
|
|
394
|
+
title: z2.string().trim().min(1).max(80),
|
|
395
|
+
description: z2.string().trim().max(160).optional(),
|
|
396
|
+
message: z2.string().trim().min(1).max(2e3),
|
|
397
|
+
/** One of STARTER_PROMPT_ICONS; unknown values fall back to a default icon. */
|
|
398
|
+
icon: z2.enum(STARTER_PROMPT_ICONS).optional()
|
|
399
|
+
});
|
|
337
400
|
var agentConfigSchema = z2.object({
|
|
338
401
|
/** Prepended to the runtime's own operating instructions. */
|
|
339
402
|
systemPrompt: z2.string().default(""),
|
|
340
403
|
/** First message the widget shows before the user types anything. */
|
|
341
404
|
greeting: z2.string().default("Hi! I can walk you through getting set up. What are you trying to do?"),
|
|
342
405
|
suggestedPrompts: z2.array(z2.string()).max(6).default([]),
|
|
406
|
+
/**
|
|
407
|
+
* Explicit starter cards for the empty chat screen (title + description +
|
|
408
|
+
* the message clicking sends). When set, these take precedence over
|
|
409
|
+
* `suggestedPrompts` and over any skill-derived defaults.
|
|
410
|
+
*/
|
|
411
|
+
starterPrompts: z2.array(starterPromptSchema).max(6).default([]),
|
|
343
412
|
maxTurns: z2.number().int().positive().max(50).default(12),
|
|
344
413
|
/** Hard stop on estimated spend per session. */
|
|
345
414
|
maxBudgetUsd: z2.number().positive().optional(),
|
|
@@ -490,6 +559,17 @@ async function getUserToken() {
|
|
|
490
559
|
throw new Error("The chat sign-in endpoint returned " + response.status + ".");
|
|
491
560
|
}
|
|
492
561
|
`;
|
|
562
|
+
const hostApiHeaders = auth?.client && !workspace.allowAnonymous ? `
|
|
563
|
+
headers: async () => {
|
|
564
|
+
const session = (await ${auth.client.name}?.auth.getSession())?.data.session;
|
|
565
|
+
return session?.access_token ? { Authorization: \`Bearer \${session.access_token}\` } : {};
|
|
566
|
+
},` : "";
|
|
567
|
+
const hostApi = `const hostApi = {
|
|
568
|
+
baseUrl: typeof window !== "undefined" ? window.location.origin : "",
|
|
569
|
+
credentials: "${auth?.client || workspace.allowAnonymous ? "same-origin" : "include"}" as const,${hostApiHeaders}
|
|
570
|
+
};
|
|
571
|
+
`;
|
|
572
|
+
const apiProp = " api={hostApi}";
|
|
493
573
|
let priorChat;
|
|
494
574
|
try {
|
|
495
575
|
const previous = JSON.parse(files[root + "frankie.install.json"] ?? "{}");
|
|
@@ -502,17 +582,17 @@ async function getUserToken() {
|
|
|
502
582
|
if (chatPath !== "/chat") notes.push("Existing /chat preserved. Frankie chat is available at /frankie/chat.");
|
|
503
583
|
const mount = `"use client";
|
|
504
584
|
import { usePathname } from "next/navigation";
|
|
505
|
-
${shared}${clientAuthImport}${getToken}
|
|
585
|
+
${shared}${clientAuthImport}${getToken}${hostApi}
|
|
506
586
|
export function FrankieWidgetMount() {
|
|
507
587
|
const pathname = usePathname();
|
|
508
588
|
const key = process.env.NEXT_PUBLIC_FRANKIE_KEY;
|
|
509
589
|
if (!key || pathname === ${JSON.stringify(chatPath)}) return null;
|
|
510
|
-
return <FrankieProvider publishableKey={key}${authProp}><FrankieWidget /></FrankieProvider>;
|
|
590
|
+
return <FrankieProvider publishableKey={key}${authProp}${apiProp}><FrankieWidget /></FrankieProvider>;
|
|
511
591
|
}
|
|
512
592
|
export function WorkspaceChatPage() {
|
|
513
593
|
const key = process.env.NEXT_PUBLIC_FRANKIE_KEY;
|
|
514
594
|
if (!key) return <p>Chat is not configured. Set NEXT_PUBLIC_FRANKIE_KEY in your deployment.</p>;
|
|
515
|
-
return <FrankieChatPage publishableKey={key}${authProp} />;
|
|
595
|
+
return <FrankieChatPage publishableKey={key}${authProp}${apiProp} />;
|
|
516
596
|
}
|
|
517
597
|
`;
|
|
518
598
|
const moduleName = existingMount ? "FrankieSetupChat" : "FrankieWidgetMount";
|
|
@@ -623,7 +703,7 @@ export async function GET() {
|
|
|
623
703
|
if (!operationCount) notes.push("No supported API routes detected. The OpenAPI draft has no operations; add the real schema before connecting tools.");
|
|
624
704
|
if (withheld) notes.push(`Withheld ${withheld} newly discovered write operation(s) with no detected authorization guard (no Express/Fastify middleware argument, Next.js middleware.ts matcher covering the route, or in-handler auth check). Add them to the spec yourself once they're protected.`);
|
|
625
705
|
notes.push("Generated OpenAPI includes read and write routes. Review schemas before approving tools; new connections still default to GET-only access.");
|
|
626
|
-
notes.push("
|
|
706
|
+
notes.push("No public spec endpoint is required: Frankie connects this committed spec on install and reads later changes from your repository through the GitHub connection.");
|
|
627
707
|
notes.push("The token endpoint issues a signed user JWT, but your product API must validate it and enforce user/resource permissions before exposing tools.");
|
|
628
708
|
const envPath = root + ".env.example";
|
|
629
709
|
const env = (files[envPath] ?? "").replace(/^NEXT_PUBLIC_FRANKIE_KEY=.*\n?/gm, "").replace(/^FRANKIE_JWT_SECRET=.*\n?/gm, "").trimEnd();
|
|
@@ -634,9 +714,9 @@ Workspace: ${workspace.name}
|
|
|
634
714
|
|
|
635
715
|
1. Copy NEXT_PUBLIC_FRANKIE_KEY from Frankie \u2192 Workspace \u2192 Developer details into the frontend deployment environment. Frankie deliberately leaves the value blank in this PR.
|
|
636
716
|
${workspace.allowAnonymous ? "" : "2. Add FRANKIE_JWT_SECRET from this workspace to the server hosting /api/frankie/token. Never commit the value.\n"}3. Run your package manager and commit the updated lockfile (for pnpm: pnpm install --lockfile-only). The remote GitHub installer cannot safely synthesize a lockfile.
|
|
637
|
-
4.
|
|
717
|
+
4. Nothing to expose: this PR commits your spec to the repository, Frankie connects it for you on install, and later spec changes are read from your repository through the GitHub connection \u2014 no public spec endpoint or middleware bypass is required.
|
|
638
718
|
5. Open ${chatPath}. It is created inside the detected authenticated dashboard group when one exists; add its link to the host sidebar during review.
|
|
639
|
-
6.
|
|
719
|
+
6. In Frankie \u2192 Tools & MCP, approve the operations you want and choose access limits (the spec is already connected from this PR; it includes read and write routes). After merging later spec changes, use GitHub integration \u2192 Refresh Frankie from merged spec.
|
|
640
720
|
7. Forwarding sends the Frankie-signed JWT. Your API must validate it and enforce user/resource permissions. It is not automatically interchangeable with a Firebase or OAuth access token.
|
|
641
721
|
8. Add NEXT_PUBLIC_FRANKIE_KEY to every frontend deployment environment (Preview and Production). ${workspace.allowAnonymous ? "" : "Add FRANKIE_JWT_SECRET only to the server environment running /api/frankie/token; never expose it to the browser.\n"}9. Review conversations in Workspace \u2192 Chat sessions.
|
|
642
722
|
|
|
@@ -998,6 +1078,8 @@ function compareApiDocuments(before, after) {
|
|
|
998
1078
|
}
|
|
999
1079
|
export {
|
|
1000
1080
|
FIREWORKS_MODELS,
|
|
1081
|
+
SKILL_TOOL_NAME,
|
|
1082
|
+
STARTER_PROMPT_ICONS,
|
|
1001
1083
|
activeSkills,
|
|
1002
1084
|
agentConfigSchema,
|
|
1003
1085
|
apiCapabilitySchema,
|
|
@@ -1026,6 +1108,8 @@ export {
|
|
|
1026
1108
|
planHostedInstall,
|
|
1027
1109
|
sdkUpdateWorkflow,
|
|
1028
1110
|
skillSchema,
|
|
1111
|
+
starterPromptSchema,
|
|
1112
|
+
suggestedPromptsFromSkills,
|
|
1029
1113
|
thinkingLevelSchema,
|
|
1030
1114
|
toolDescriptions,
|
|
1031
1115
|
toolPolicySchema,
|