@frankieai/server 0.2.2 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  createControlApp
4
- } from "./chunk-NSOMFNTK.js";
4
+ } from "./chunk-YDXEBJON.js";
5
5
  import {
6
6
  createFrankieApp,
7
7
  resolveStores
8
- } from "./chunk-JOADNB5J.js";
8
+ } from "./chunk-7J5Z5MIK.js";
9
9
 
10
10
  // src/control-server.ts
11
11
  import { serve } from "@hono/node-server";
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Hono } from 'hono';
2
- import { FrankieConfig, AuthConfig, WorkspaceSkill, ChatAttachment, FrankieServerEvent, McpServerConfig, ToolPolicy, ApiToolInventory, ApiSourceConfig } from '@frankieai/core';
2
+ import { FrankieConfig, AuthConfig, WorkspaceSkill, HostToolRequest, HostToolResult, ChatAttachment, FrankieServerEvent, McpServerConfig, ToolPolicy, ApiToolInventory, ApiSourceConfig } from '@frankieai/core';
3
3
  export { matchPath } from '@frankieai/core';
4
4
  import { AgentMessage, AgentTool } from '@earendil-works/pi-agent-core';
5
5
  import { JWTPayload } from 'jose';
@@ -304,6 +304,24 @@ interface RepositoryInstallRecord {
304
304
  checkedAt?: string;
305
305
  updatedAt: string;
306
306
  }
307
+ /**
308
+ * A Vercel integration installed for this workspace. The access token is a
309
+ * secret like `jwtSecret`: stored here, never returned by the public shape.
310
+ */
311
+ interface VercelLinkRecord {
312
+ /** Token minted by the integration's OAuth exchange. Integration tokens don't expire. */
313
+ accessToken: string;
314
+ /** Vercel's id for this installation (`configurationId`), for support and uninstall. */
315
+ installationId: string;
316
+ /** Set when the integration was installed on a team rather than a personal account. */
317
+ teamId?: string;
318
+ /** The Vercel project linked to this workspace's repository, once matched. */
319
+ projectId?: string;
320
+ projectName?: string;
321
+ connectedAt: string;
322
+ }
323
+ /** `VercelLinkRecord` with the token stripped — what the dashboard sees. */
324
+ type PublicVercelLink = Omit<VercelLinkRecord, "accessToken">;
307
325
  interface TenantRecord {
308
326
  apiSpecSync?: Record<string, {
309
327
  repository: string;
@@ -327,6 +345,8 @@ interface TenantRecord {
327
345
  locked?: boolean;
328
346
  /** Durable repository-install state surfaced in the dashboard and setup chat. */
329
347
  repositoryInstall?: RepositoryInstallRecord;
348
+ /** Deployment provider connection, when the workspace has connected Vercel. */
349
+ vercel?: VercelLinkRecord;
330
350
  createdAt: string;
331
351
  updatedAt: string;
332
352
  }
@@ -342,6 +362,8 @@ interface PublicTenant {
342
362
  publishableKey: string;
343
363
  allowedOrigins: string[];
344
364
  allowAnonymous: boolean;
365
+ /** How the hosted MCP treats a caller's bearer: verify it as a JWT, or forward it opaquely. */
366
+ userCredential: "jwt" | "opaque";
345
367
  connection: "knowledge" | "mcp" | "openapi";
346
368
  mcpServers: string[];
347
369
  apis: string[];
@@ -349,6 +371,8 @@ interface PublicTenant {
349
371
  connections: Array<{
350
372
  kind: "mcp" | "openapi";
351
373
  name: string;
374
+ /** Friendly label for the dashboard; `name` remains the stable identifier. */
375
+ displayName?: string;
352
376
  /** OpenAPI spec URL/path. */
353
377
  spec?: string;
354
378
  /** MCP server URL. */
@@ -369,7 +393,11 @@ interface PublicTenant {
369
393
  }>;
370
394
  selectedTools?: string[];
371
395
  exposeAsMcp?: boolean;
396
+ /** Where the source's operations run: "server" (Frankie's server) or "client" (the user's browser). */
397
+ execution?: "server" | "client";
372
398
  forwardsToken: boolean;
399
+ /** The header the user's credential is forwarded to your API as (empty when none). */
400
+ forwardTokenAs?: string;
373
401
  /** Security scheme names with a credential configured (OpenAPI only). Never the values themselves. */
374
402
  securedSchemes?: string[];
375
403
  /** Whether this source is currently enabled for chat. */
@@ -381,10 +409,18 @@ interface PublicTenant {
381
409
  locked: boolean;
382
410
  /** A submitted or in-progress SDK installation for this workspace. */
383
411
  repositoryInstall?: RepositoryInstallRecord;
412
+ /** The connected Vercel installation and matched project — never its token. */
413
+ vercel?: PublicVercelLink;
384
414
  /** The customer's brand theme for the widget, so the dashboard can edit it. */
385
415
  theme: TenantRecord["config"]["theme"];
386
416
  /** Opt-in chat capabilities (attachments, model picker) for the dashboard to edit. */
387
417
  features: TenantRecord["config"]["features"];
418
+ /** Editable chat copy: the greeting and the starter cards shown on the empty screen. */
419
+ agent: {
420
+ greeting: string;
421
+ suggestedPrompts: string[];
422
+ starterPrompts: TenantRecord["config"]["agent"]["starterPrompts"];
423
+ };
388
424
  createdAt: string;
389
425
  updatedAt: string;
390
426
  }
@@ -593,7 +629,21 @@ declare class PostgresSessionStore implements SessionStore {
593
629
 
594
630
  interface SkillGenerationInput {
595
631
  goal: string;
632
+ /** Approved tool identifiers this skill may use. Validated against on return. */
596
633
  tools: string[];
634
+ /**
635
+ * What each tool in `tools` actually does (method/path/summary, or an MCP
636
+ * tool's own description) — see `toolDescriptions()` in @frankieai/core.
637
+ * Without this the model has nothing to write concrete steps from but a
638
+ * bare identifier like `api__product__listItems`. Optional so older
639
+ * callers (and tests) that only have bare ids still work; the resulting
640
+ * draft is just less specific.
641
+ */
642
+ toolDetails?: Array<{
643
+ id: string;
644
+ description: string;
645
+ }>;
646
+ /** Present when refining an existing skill rather than starting fresh. */
597
647
  instructions?: string;
598
648
  }
599
649
  declare function generateSkill(resolved: ResolvedConfig, input: SkillGenerationInput): Promise<WorkspaceSkill>;
@@ -629,6 +679,22 @@ interface ControlOptions {
629
679
  */
630
680
  declare function createControlApp(options: ControlOptions): Hono;
631
681
 
682
+ /**
683
+ * The per-turn handle an API tool uses to run itself in the user's browser
684
+ * instead of on Frankie's server. `available` says whether a live widget
685
+ * channel is bound for this session — false over the hosted MCP endpoint or any
686
+ * headless caller, where a browser-scoped call is impossible.
687
+ */
688
+ interface ClientToolBridge {
689
+ readonly available: boolean;
690
+ /**
691
+ * Ask the browser to perform one HTTP call and resolve with its outcome.
692
+ * Rejects if no channel is bound, the turn is aborted, or the browser does
693
+ * not answer before `timeoutMs`.
694
+ */
695
+ execute(name: string, request: HostToolRequest, signal?: AbortSignal): Promise<HostToolResult>;
696
+ }
697
+
632
698
  interface RunTurnParams {
633
699
  config: FrankieConfig;
634
700
  session: ChatSession;
@@ -642,6 +708,8 @@ interface RunTurnParams {
642
708
  modelOverride?: Model<Api>;
643
709
  /** Files attached to this turn, already validated against the feature flags. */
644
710
  attachments?: ChatAttachment[];
711
+ /** Browser channel for API sources marked `execution: "client"`, when a widget is connected. */
712
+ clientBridge?: ClientToolBridge;
645
713
  signal: AbortSignal;
646
714
  /** Called with the full transcript once the turn settles, to persist it. */
647
715
  onTranscript?: (messages: AgentMessage[]) => void;
@@ -694,6 +762,13 @@ interface BuildApiToolsOptions {
694
762
  session: ChatSession;
695
763
  policy: ToolPolicy;
696
764
  fetchImpl?: typeof fetch;
765
+ /**
766
+ * Bridge to the user's browser for sources marked `execution: "client"`. When
767
+ * absent (headless callers, the hosted MCP endpoint), a client-mode operation
768
+ * has no way to run and reports that clearly instead of falling back to a
769
+ * server-side call the user's session would not authorize.
770
+ */
771
+ clientBridge?: ClientToolBridge;
697
772
  onWarning?: (message: string, detail: Record<string, unknown>) => void;
698
773
  }
699
774
  interface ApiToolSet {
@@ -731,6 +806,8 @@ interface CollectToolsOptions {
731
806
  fetchImpl?: typeof fetch;
732
807
  /** Base URL of the account API for the built-in workspaceAdmin tools. */
733
808
  accountApiUrl?: string;
809
+ /** Browser channel for API sources marked `execution: "client"`. */
810
+ clientBridge?: ClientToolBridge;
734
811
  onWarning?: (message: string, detail: Record<string, unknown>) => void;
735
812
  }
736
813
  interface CollectedTools {
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createControlApp
3
- } from "./chunk-NSOMFNTK.js";
3
+ } from "./chunk-YDXEBJON.js";
4
4
  import {
5
5
  ConfigError,
6
6
  applyEnvOverrides,
@@ -42,7 +42,7 @@ import {
42
42
  runTurn,
43
43
  safeEqual,
44
44
  toPublicTenant
45
- } from "./chunk-JOADNB5J.js";
45
+ } from "./chunk-7J5Z5MIK.js";
46
46
  export {
47
47
  API_TOOL_PREFIX,
48
48
  AuthError,
package/dist/server.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  ModelResolutionError,
8
8
  createFrankieApp,
9
9
  resolveStores
10
- } from "./chunk-JOADNB5J.js";
10
+ } from "./chunk-7J5Z5MIK.js";
11
11
 
12
12
  // src/server.ts
13
13
  import { serve } from "@hono/node-server";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frankieai/server",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "Frankie cloud agent server — auth, sessions, MCP wiring and streaming for the embedded onboarding agent.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -28,7 +28,7 @@
28
28
  "yaml": "^2.9.0",
29
29
  "zod": "^4.0.0",
30
30
  "pg": "^8.13.0",
31
- "@frankieai/core": "0.2.2"
31
+ "@frankieai/core": "0.2.4"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@types/node": "^22.10.0",