@mastra/client-js 1.20.0-alpha.1 → 1.20.0-alpha.10

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/types.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import type { AgentExecutionOptions, MultiPrimitiveExecutionOptions, AgentGenerateOptions, AgentStreamOptions, SerializableStructuredOutputOptions, ToolsInput, UIMessageWithMetadata, AgentInstructions } from '@mastra/core/agent';
2
2
  import type { MessageListInput } from '@mastra/core/agent/message-list';
3
+ import type { BuilderModelPolicy, DefaultModelEntry, ProviderModelEntry } from '@mastra/core/agent-builder/ee';
3
4
  import type { MastraScorerEntry, ScoreRowData } from '@mastra/core/evals';
4
- import type { CoreMessage } from '@mastra/core/llm';
5
+ import type { CoreMessage, Provider as ModelProviderId } from '@mastra/core/llm';
5
6
  import type { LogLevel } from '@mastra/core/logger';
6
7
  import type { MCPToolType, ServerInfo } from '@mastra/core/mcp';
7
8
  import type { AiMessageType, MastraMessageV1, MastraDBMessage, MemoryConfig, StorageThreadType } from '@mastra/core/memory';
@@ -370,6 +371,19 @@ export interface GetAgentResponse {
370
371
  activeVersionId?: string;
371
372
  hasDraft?: boolean;
372
373
  }
374
+ /**
375
+ * Response from the browser session probe endpoint.
376
+ *
377
+ * Use this to decide whether to open a screencast WebSocket for an agent/thread:
378
+ * - `screencastAvailable`: server has the `ws` / `@hono/node-ws` packages installed.
379
+ * When false, opening a WS will fail and trigger a reconnect loop — skip it.
380
+ * - `hasSession`: the agent has an active browser session for this thread. When
381
+ * false, the WS would just sit idle waiting for the agent to invoke a tool.
382
+ */
383
+ export interface GetAgentBrowserSessionResponse {
384
+ hasSession: boolean;
385
+ screencastAvailable: boolean;
386
+ }
373
387
  export type GenerateLegacyParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
374
388
  messages: string | string[] | CoreMessage[] | AiMessageType[] | UIMessageWithMetadata[];
375
389
  output?: T;
@@ -400,15 +414,23 @@ export type StreamParams<OUTPUT = undefined> = StreamParamsBase<OUTPUT> & {
400
414
  } : {
401
415
  structuredOutput: StructuredOutputOptions<OUTPUT>;
402
416
  });
417
+ /**
418
+ * Provider id widened to accept admin-configured custom gateway providers.
419
+ * Closed unions over the five hard-coded providers are removed in favor of the
420
+ * generated `ModelProviderId` union plus a `(string & {})` escape hatch — this
421
+ * preserves IDE autocomplete on known providers while letting custom gateway
422
+ * ids flow through (see Phase 1 of the admin model configuration plan).
423
+ */
424
+ export type AdminProviderId = ModelProviderId | (string & {});
403
425
  export type UpdateModelParams = {
404
426
  modelId: string;
405
- provider: 'openai' | 'anthropic' | 'groq' | 'xai' | 'google';
427
+ provider: AdminProviderId;
406
428
  };
407
429
  export type UpdateModelInModelListParams = {
408
430
  modelConfigId: string;
409
431
  model?: {
410
432
  modelId: string;
411
- provider: 'openai' | 'anthropic' | 'groq' | 'xai' | 'google';
433
+ provider: AdminProviderId;
412
434
  };
413
435
  maxRetries?: number;
414
436
  enabled?: boolean;
@@ -935,6 +957,26 @@ export type StoredWorkspaceRef = {
935
957
  type: 'inline';
936
958
  config: Record<string, unknown>;
937
959
  };
960
+ export interface StoredBrowserConfig {
961
+ provider: string;
962
+ headless?: boolean;
963
+ viewport?: {
964
+ width: number;
965
+ height: number;
966
+ };
967
+ timeout?: number;
968
+ screencast?: {
969
+ format?: 'jpeg' | 'png';
970
+ quality?: number;
971
+ maxWidth?: number;
972
+ maxHeight?: number;
973
+ everyNthFrame?: number;
974
+ };
975
+ }
976
+ export type StoredBrowserRef = {
977
+ type: 'inline';
978
+ config: StoredBrowserConfig;
979
+ };
938
980
  export type StoredAgentRule = Rule;
939
981
  export type StoredAgentRuleGroup = RuleGroup;
940
982
  export type ConditionalVariant<T> = StorageConditionalVariant<T>;
@@ -947,6 +989,7 @@ export interface StoredAgentResponse {
947
989
  status: string;
948
990
  activeVersionId?: string;
949
991
  authorId?: string;
992
+ visibility?: 'private' | 'public';
950
993
  metadata?: Record<string, unknown>;
951
994
  createdAt: string;
952
995
  updatedAt: string;
@@ -970,7 +1013,10 @@ export interface StoredAgentResponse {
970
1013
  scorers?: ConditionalField<Record<string, StoredAgentScorerConfig>>;
971
1014
  skills?: ConditionalField<Record<string, StoredAgentSkillConfig>>;
972
1015
  workspace?: ConditionalField<StoredWorkspaceRef>;
1016
+ browser?: ConditionalField<StoredBrowserRef> | boolean | null;
973
1017
  requestContextSchema?: Record<string, unknown>;
1018
+ isFavorited?: boolean;
1019
+ favoriteCount?: number;
974
1020
  }
975
1021
  /**
976
1022
  * Parameters for listing stored agents
@@ -982,8 +1028,26 @@ export interface ListStoredAgentsParams {
982
1028
  field?: 'createdAt' | 'updatedAt';
983
1029
  direction?: 'ASC' | 'DESC';
984
1030
  };
1031
+ status?: 'draft' | 'published' | 'archived';
985
1032
  authorId?: string;
1033
+ /**
1034
+ * Restrict the list to public records. Only `'public'` is accepted by the
1035
+ * server filter; private records are surfaced via the default scope-aware
1036
+ * filter (caller's own rows + legacy unowned).
1037
+ */
1038
+ visibility?: 'public';
986
1039
  metadata?: Record<string, unknown>;
1040
+ /** When true, only return agents favorited by the caller (or by `pinFavoritedFor`). */
1041
+ favoritedOnly?: boolean;
1042
+ /** When set, sort favorited-first for this user id. Required for `favoritedOnly`. */
1043
+ pinFavoritedFor?: string;
1044
+ }
1045
+ /**
1046
+ * Response from favorite / unfavorite mutations.
1047
+ */
1048
+ export interface FavoriteToggleResponse {
1049
+ favorited: boolean;
1050
+ favoriteCount: number;
987
1051
  }
988
1052
  /**
989
1053
  * Response for listing stored agents
@@ -1007,6 +1071,8 @@ export interface CloneAgentParams {
1007
1071
  metadata?: Record<string, unknown>;
1008
1072
  /** Author identifier for the cloned agent. */
1009
1073
  authorId?: string;
1074
+ /** Visibility of the cloned agent. Defaults to 'private'. */
1075
+ visibility?: 'private' | 'public';
1010
1076
  /** Request context for resolving dynamic agent configuration (instructions, model, tools, etc.) */
1011
1077
  requestContext?: RequestContext | Record<string, any>;
1012
1078
  }
@@ -1018,6 +1084,8 @@ export interface CreateStoredAgentParams {
1018
1084
  /** Unique identifier for the agent. If not provided, derived from name via slugify. */
1019
1085
  id?: string;
1020
1086
  authorId?: string;
1087
+ /** Visibility of the agent. Defaults to 'private'. */
1088
+ visibility?: 'private' | 'public';
1021
1089
  metadata?: Record<string, unknown>;
1022
1090
  name: string;
1023
1091
  description?: string;
@@ -1039,6 +1107,8 @@ export interface CreateStoredAgentParams {
1039
1107
  scorers?: ConditionalField<Record<string, StoredAgentScorerConfig>>;
1040
1108
  skills?: ConditionalField<Record<string, StoredAgentSkillConfig>>;
1041
1109
  workspace?: ConditionalField<StoredWorkspaceRef>;
1110
+ /** Browser config. `true` = use admin default, `false` = no browser. */
1111
+ browser?: ConditionalField<StoredBrowserRef> | boolean | null;
1042
1112
  requestContextSchema?: Record<string, unknown>;
1043
1113
  }
1044
1114
  /**
@@ -1046,6 +1116,8 @@ export interface CreateStoredAgentParams {
1046
1116
  */
1047
1117
  export interface UpdateStoredAgentParams {
1048
1118
  authorId?: string;
1119
+ /** Visibility of the agent. */
1120
+ visibility?: 'private' | 'public';
1049
1121
  metadata?: Record<string, unknown>;
1050
1122
  name?: string;
1051
1123
  description?: string;
@@ -1067,6 +1139,8 @@ export interface UpdateStoredAgentParams {
1067
1139
  scorers?: ConditionalField<Record<string, StoredAgentScorerConfig>>;
1068
1140
  skills?: ConditionalField<Record<string, StoredAgentSkillConfig>>;
1069
1141
  workspace?: ConditionalField<StoredWorkspaceRef>;
1142
+ /** Browser config. `true` = use admin default, `false` = no browser. */
1143
+ browser?: ConditionalField<StoredBrowserRef> | boolean | null;
1070
1144
  requestContextSchema?: Record<string, unknown>;
1071
1145
  /** Optional message describing the changes for the auto-created version */
1072
1146
  changeMessage?: string;
@@ -1408,7 +1482,7 @@ export type ListAgentsModelProvidersResponse = GeneratedResponse<'GET /agents/pr
1408
1482
  export interface Provider {
1409
1483
  id: string;
1410
1484
  name: string;
1411
- envVar: string;
1485
+ envVar: string | string[];
1412
1486
  connected: boolean;
1413
1487
  docUrl?: string;
1414
1488
  models: string[];
@@ -1610,6 +1684,7 @@ export interface StoredSkillResponse {
1610
1684
  id: string;
1611
1685
  status: string;
1612
1686
  authorId?: string;
1687
+ visibility?: 'private' | 'public';
1613
1688
  metadata?: Record<string, unknown>;
1614
1689
  createdAt: string;
1615
1690
  updatedAt: string;
@@ -1618,6 +1693,8 @@ export interface StoredSkillResponse {
1618
1693
  instructions: string;
1619
1694
  license?: string;
1620
1695
  files?: StoredSkillFileNode[];
1696
+ isFavorited?: boolean;
1697
+ favoriteCount?: number;
1621
1698
  }
1622
1699
  /**
1623
1700
  * Parameters for listing stored skills
@@ -1630,7 +1707,17 @@ export interface ListStoredSkillsParams {
1630
1707
  direction?: 'ASC' | 'DESC';
1631
1708
  };
1632
1709
  authorId?: string;
1710
+ /**
1711
+ * Restrict the list to public records. Only `'public'` is accepted by the
1712
+ * server filter; private records are surfaced via the default scope-aware
1713
+ * filter (caller's own rows + legacy unowned).
1714
+ */
1715
+ visibility?: 'public';
1633
1716
  metadata?: Record<string, unknown>;
1717
+ /** When true, only return skills favorited by the caller (or by `pinFavoritedFor`). */
1718
+ favoritedOnly?: boolean;
1719
+ /** When set, sort favorited-first for this user id. Required for `favoritedOnly`. */
1720
+ pinFavoritedFor?: string;
1634
1721
  }
1635
1722
  /**
1636
1723
  * Response for listing stored skills
@@ -1648,6 +1735,8 @@ export interface ListStoredSkillsResponse {
1648
1735
  export interface CreateStoredSkillParams {
1649
1736
  id?: string;
1650
1737
  authorId?: string;
1738
+ /** Visibility of the skill. Defaults to 'private'. */
1739
+ visibility?: 'private' | 'public';
1651
1740
  metadata?: Record<string, unknown>;
1652
1741
  name: string;
1653
1742
  /** Required by the server: description of what the skill does and when to use it. */
@@ -1661,6 +1750,8 @@ export interface CreateStoredSkillParams {
1661
1750
  */
1662
1751
  export interface UpdateStoredSkillParams {
1663
1752
  authorId?: string;
1753
+ /** Visibility of the skill. */
1754
+ visibility?: 'private' | 'public';
1664
1755
  metadata?: Record<string, unknown>;
1665
1756
  name?: string;
1666
1757
  description?: string;
@@ -1675,6 +1766,74 @@ export interface DeleteStoredSkillResponse {
1675
1766
  success: boolean;
1676
1767
  message: string;
1677
1768
  }
1769
+ /**
1770
+ * Filesystem configuration in a stored workspace
1771
+ */
1772
+ export interface StoredFilesystemConfig {
1773
+ provider: string;
1774
+ config: Record<string, unknown>;
1775
+ readOnly?: boolean;
1776
+ }
1777
+ /**
1778
+ * Sandbox configuration in a stored workspace
1779
+ */
1780
+ export interface StoredSandboxConfig {
1781
+ provider: string;
1782
+ config: Record<string, unknown>;
1783
+ }
1784
+ /**
1785
+ * Stored workspace data returned from API
1786
+ */
1787
+ export interface StoredWorkspaceResponse {
1788
+ id: string;
1789
+ status: string;
1790
+ activeVersionId?: string;
1791
+ authorId?: string;
1792
+ metadata?: Record<string, unknown>;
1793
+ createdAt: string;
1794
+ updatedAt: string;
1795
+ name: string;
1796
+ description?: string;
1797
+ filesystem?: StoredFilesystemConfig;
1798
+ sandbox?: StoredSandboxConfig;
1799
+ mounts?: Record<string, StoredFilesystemConfig>;
1800
+ skills?: string[];
1801
+ tools?: {
1802
+ enabled?: boolean;
1803
+ requireApproval?: boolean;
1804
+ tools?: Record<string, {
1805
+ enabled?: boolean;
1806
+ requireApproval?: boolean;
1807
+ }>;
1808
+ };
1809
+ autoSync?: boolean;
1810
+ operationTimeout?: number;
1811
+ /** Whether this workspace is registered at runtime (only present in list responses) */
1812
+ runtimeRegistered?: boolean;
1813
+ }
1814
+ /**
1815
+ * Parameters for listing stored workspaces
1816
+ */
1817
+ export interface ListStoredWorkspacesParams {
1818
+ page?: number;
1819
+ perPage?: number;
1820
+ orderBy?: {
1821
+ field?: 'createdAt' | 'updatedAt';
1822
+ direction?: 'ASC' | 'DESC';
1823
+ };
1824
+ authorId?: string;
1825
+ metadata?: Record<string, unknown>;
1826
+ }
1827
+ /**
1828
+ * Response for listing stored workspaces
1829
+ */
1830
+ export interface ListStoredWorkspacesResponse {
1831
+ workspaces: StoredWorkspaceResponse[];
1832
+ total: number;
1833
+ page: number;
1834
+ perPage: number | false;
1835
+ hasMore: boolean;
1836
+ }
1678
1837
  /**
1679
1838
  * Processor phase types
1680
1839
  */
@@ -2026,6 +2185,7 @@ export interface DatasetItemVersionResponse {
2026
2185
  datasetVersion: number;
2027
2186
  input: unknown;
2028
2187
  groundTruth?: unknown;
2188
+ expectedTrajectory?: unknown;
2029
2189
  metadata?: Record<string, unknown>;
2030
2190
  validTo: number | null;
2031
2191
  isDeleted: boolean;
@@ -2244,5 +2404,193 @@ export interface ExperimentReviewCounts {
2244
2404
  reviewed: number;
2245
2405
  complete: number;
2246
2406
  }
2247
- export {};
2407
+ /**
2408
+ * Agent feature flags for the builder.
2409
+ *
2410
+ * The `GET /editor/builder/settings` response always carries a fully-resolved
2411
+ * object. On admin input, omitted keys default to `true` (default-on / allowlist
2412
+ * model — admins opt out by setting a key to `false`). Special case: `browser`
2413
+ * is only `true` when `configuration.agent.browser` is provided.
2414
+ *
2415
+ * Clients should still use strict `=== true` checks.
2416
+ */
2417
+ export interface BuilderAgentFeatures {
2418
+ tools?: boolean;
2419
+ agents?: boolean;
2420
+ workflows?: boolean;
2421
+ scorers?: boolean;
2422
+ skills?: boolean;
2423
+ memory?: boolean;
2424
+ variables?: boolean;
2425
+ favorites?: boolean;
2426
+ avatarUpload?: boolean;
2427
+ browser?: boolean;
2428
+ /**
2429
+ * Whether the model picker is visible in the Agent Builder.
2430
+ * Omitted/`false` ⇒ picker hidden (locked mode); admin's `models.default` is applied.
2431
+ */
2432
+ model?: boolean;
2433
+ }
2434
+ /**
2435
+ * Re-exported from `@mastra/core/agent-builder/ee` so SDK consumers don't need
2436
+ * a second import for admin model configuration types. Owned by core.
2437
+ */
2438
+ export type { BuilderModelPolicy, DefaultModelEntry, ProviderModelEntry, ModelProviderId };
2439
+ /**
2440
+ * Response from GET /editor/builder/settings
2441
+ */
2442
+ export interface BuilderSettingsResponse {
2443
+ enabled: boolean;
2444
+ features?: {
2445
+ agent?: BuilderAgentFeatures;
2446
+ };
2447
+ configuration?: {
2448
+ agent?: Record<string, unknown>;
2449
+ };
2450
+ /**
2451
+ * Server-derived model policy. Always present; `{ active: false }` when no
2452
+ * builder is configured. UI consumers should read this directly rather than
2453
+ * re-deriving from `features` / `configuration`.
2454
+ */
2455
+ modelPolicy?: BuilderModelPolicy;
2456
+ /**
2457
+ * Resolved picker visibility for tools, agents, and workflows. Present when
2458
+ * the builder is enabled. Each `visible*` field is `null` when unrestricted
2459
+ * (show all registered entries) and `string[]` otherwise — making the
2460
+ * empty-vs-unrestricted distinction explicit so the UI never has to
2461
+ * disambiguate.
2462
+ */
2463
+ picker?: BuilderPickerResponse;
2464
+ /**
2465
+ * Non-fatal warnings produced by builder config validation (e.g. allowlist
2466
+ * entries with unknown providers that aren't tagged `kind: 'custom'`, or
2467
+ * picker allowlist entries that don't match a registered ID).
2468
+ * Only present when there is at least one warning.
2469
+ */
2470
+ modelPolicyWarnings?: string[];
2471
+ }
2472
+ /**
2473
+ * Resolved picker visibility section returned in {@link BuilderSettingsResponse}.
2474
+ *
2475
+ * Per kind:
2476
+ * - `null` ⇒ unrestricted (show all registered entries).
2477
+ * - `string[]` ⇒ explicit allowlist (may be empty to show none).
2478
+ */
2479
+ export interface BuilderPickerResponse {
2480
+ visibleTools: string[] | null;
2481
+ visibleAgents: string[] | null;
2482
+ visibleWorkflows: string[] | null;
2483
+ }
2484
+ /**
2485
+ * Response from GET /editor/builder/infrastructure
2486
+ *
2487
+ * Agent Builder infrastructure configuration plus lightweight runtime resolution state.
2488
+ */
2489
+ export interface InfrastructureStatusResponse {
2490
+ channels: {
2491
+ providers: Array<{
2492
+ id: string;
2493
+ name: string;
2494
+ isConfigured: boolean;
2495
+ routeCount: number;
2496
+ }>;
2497
+ };
2498
+ browser: {
2499
+ type: string | null;
2500
+ provider: string | null;
2501
+ env: string | null;
2502
+ registered: boolean;
2503
+ availableProviders: string[];
2504
+ config: Array<{
2505
+ key: string;
2506
+ value: string;
2507
+ }>;
2508
+ };
2509
+ workspace: {
2510
+ type: string | null;
2511
+ workspaceId: string | null;
2512
+ name: string | null;
2513
+ source: string | null;
2514
+ registered: boolean;
2515
+ hasFilesystem: boolean;
2516
+ hasSandbox: boolean;
2517
+ filesystemProvider: string | null;
2518
+ sandboxProvider: string | null;
2519
+ config: Array<{
2520
+ key: string;
2521
+ value: string;
2522
+ }>;
2523
+ };
2524
+ registries: {
2525
+ skillsSh: {
2526
+ enabled: boolean;
2527
+ };
2528
+ };
2529
+ }
2530
+ /**
2531
+ * One known skill registry surfaced from the Agent Builder config.
2532
+ */
2533
+ export interface BuilderRegistryDescriptor {
2534
+ id: string;
2535
+ enabled: boolean;
2536
+ label: string;
2537
+ }
2538
+ /**
2539
+ * Response from `GET /editor/builder/registries`.
2540
+ */
2541
+ export interface ListBuilderRegistriesResponse {
2542
+ registries: BuilderRegistryDescriptor[];
2543
+ }
2544
+ /**
2545
+ * Single skill summary returned from a registry search/popular endpoint.
2546
+ * Wire shape matches the upstream skills.sh proxy.
2547
+ */
2548
+ export interface BuilderRegistrySkillSummary {
2549
+ id: string;
2550
+ name: string;
2551
+ installs: number;
2552
+ /** Repository identifier in `owner/repo` or `owner/repo/path` form. */
2553
+ topSource: string;
2554
+ }
2555
+ /**
2556
+ * Response from `GET /editor/builder/registries/:registryId/search`.
2557
+ */
2558
+ export interface BuilderRegistrySearchResponse {
2559
+ query: string;
2560
+ searchType: string;
2561
+ skills: BuilderRegistrySkillSummary[];
2562
+ count: number;
2563
+ }
2564
+ /**
2565
+ * Response from `GET /editor/builder/registries/:registryId/popular`.
2566
+ */
2567
+ export interface BuilderRegistryPopularResponse {
2568
+ skills: BuilderRegistrySkillSummary[];
2569
+ count: number;
2570
+ limit: number;
2571
+ offset: number;
2572
+ }
2573
+ /**
2574
+ * Response from `GET /editor/builder/registries/:registryId/preview`.
2575
+ */
2576
+ export interface BuilderRegistryPreviewResponse {
2577
+ content: string;
2578
+ }
2579
+ /**
2580
+ * Body for `POST /editor/builder/registries/:registryId/install`.
2581
+ */
2582
+ export interface BuilderRegistryInstallBody {
2583
+ owner: string;
2584
+ repo: string;
2585
+ skillName: string;
2586
+ visibility?: 'private' | 'public';
2587
+ }
2588
+ /**
2589
+ * Response from `POST /editor/builder/registries/:registryId/install`.
2590
+ */
2591
+ export interface BuilderRegistryInstallResponse {
2592
+ storedSkillId: string;
2593
+ name: string;
2594
+ filesWritten: number;
2595
+ }
2248
2596
  //# sourceMappingURL=types.d.ts.map