@botmanor/fe-sdk 2026.1205.3 → 2026.1205.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.
@@ -0,0 +1,9 @@
1
+
2
+ /**
3
+ * `@botmanor/fe-sdk/guided-errors` (BOFF-18785): the Stewards guided-error
4
+ * catalog as pure data and functions, with no React and no router, so fe-libs,
5
+ * microfe-stewards and every shell share one code-to-guidance map. The SDK's
6
+ * own components use it too, and the package root re-exports it.
7
+ */
8
+ import { A as isStaleStateError, B as GuidedErrorContext, C as PERMISSION_LABELS, D as describeGuidedError, E as buildGuidedError, F as GuidedEntry, G as GuidedRunSource, H as GuidedMutation, I as STOP_REASON_LABELS, K as GuidedTarget, L as GuidedAction, M as AGENT_STATUS_LABELS, N as AGENT_STATUS_SHORT_LABELS, O as guidedI18nBase, P as GUIDED_ENTRIES, R as GuidedActionKind, S as GuidedPermission, T as extractGuidedSource, U as GuidedReason, V as GuidedErrorSource, W as GuidedRunFailure, _ as GuidedTargetParams, a as GuidedPlan, b as resolveGuidedLocation, c as englishGuidedTranslate, d as guidedText, f as guidedTranslateFrom, g as GuidedShell, h as GuidedLocation, i as GuidedEnvironment, j as reasonCamel, k as isDefiniteRefusal, l as fillGuidedParams, m as DEFAULT_BOTMANOR_APP_URL, n as stepReasonCode, o as GuidedTranslate, p as planGuidedActions, r as stopReasonLabel, s as PlannedGuidedAction, t as describeRunFailure, u as guidedParams, v as botmanorPath, w as permissionLabelKey, x as GUIDED_PERMISSIONS, y as crossShellUrl, z as GuidedError } from "./guided-errors-CiQTVYn8.js";
9
+ export { AGENT_STATUS_LABELS, AGENT_STATUS_SHORT_LABELS, DEFAULT_BOTMANOR_APP_URL, GUIDED_ENTRIES, GUIDED_PERMISSIONS, type GuidedAction, type GuidedActionKind, type GuidedEntry, type GuidedEnvironment, type GuidedError, type GuidedErrorContext, type GuidedErrorSource, type GuidedLocation, type GuidedMutation, type GuidedPermission, type GuidedPlan, type GuidedReason, type GuidedRunFailure, type GuidedRunSource, type GuidedShell, type GuidedTarget, type GuidedTargetParams, type GuidedTranslate, PERMISSION_LABELS, type PlannedGuidedAction, STOP_REASON_LABELS, botmanorPath, buildGuidedError, crossShellUrl, describeGuidedError, describeRunFailure, englishGuidedTranslate, extractGuidedSource, fillGuidedParams, guidedI18nBase, guidedParams, guidedText, guidedTranslateFrom, isDefiniteRefusal, isStaleStateError, permissionLabelKey, planGuidedActions, reasonCamel, resolveGuidedLocation, stepReasonCode, stopReasonLabel };
@@ -0,0 +1,4 @@
1
+ "use client";
2
+ import { C as GUIDED_ENTRIES, D as permissionLabelKey, E as PERMISSION_LABELS, S as AGENT_STATUS_SHORT_LABELS, T as GUIDED_PERMISSIONS, _ as isDefiniteRefusal, a as fillGuidedParams, b as extractGuidedSource, c as guidedTranslateFrom, d as botmanorPath, f as crossShellUrl, g as guidedI18nBase, h as describeGuidedError, i as englishGuidedTranslate, l as planGuidedActions, m as buildGuidedError, n as stepReasonCode, o as guidedParams, p as resolveGuidedLocation, r as stopReasonLabel, s as guidedText, t as describeRunFailure, u as DEFAULT_BOTMANOR_APP_URL, v as isStaleStateError, w as STOP_REASON_LABELS, x as AGENT_STATUS_LABELS, y as reasonCamel } from "./guided-errors-D5vT9owt.js";
3
+
4
+ export { AGENT_STATUS_LABELS, AGENT_STATUS_SHORT_LABELS, DEFAULT_BOTMANOR_APP_URL, GUIDED_ENTRIES, GUIDED_PERMISSIONS, PERMISSION_LABELS, STOP_REASON_LABELS, botmanorPath, buildGuidedError, crossShellUrl, describeGuidedError, describeRunFailure, englishGuidedTranslate, extractGuidedSource, fillGuidedParams, guidedI18nBase, guidedParams, guidedText, guidedTranslateFrom, isDefiniteRefusal, isStaleStateError, permissionLabelKey, planGuidedActions, reasonCamel, resolveGuidedLocation, stepReasonCode, stopReasonLabel };
package/dist/index.d.ts CHANGED
@@ -10,16 +10,39 @@
10
10
  * `onTokenExpired`, and every event is passed through `onEvent`.
11
11
  */
12
12
  import { CSSProperties, ReactNode } from "react";
13
+ import { A as isStaleStateError, B as GuidedErrorContext, C as PERMISSION_LABELS, D as describeGuidedError, E as buildGuidedError, F as GuidedEntry, G as GuidedRunSource, H as GuidedMutation, I as STOP_REASON_LABELS, K as GuidedTarget, L as GuidedAction, M as AGENT_STATUS_LABELS, N as AGENT_STATUS_SHORT_LABELS, O as guidedI18nBase, P as GUIDED_ENTRIES, R as GuidedActionKind, S as GuidedPermission, T as extractGuidedSource, U as GuidedReason, V as GuidedErrorSource, W as GuidedRunFailure, _ as GuidedTargetParams, a as GuidedPlan, b as resolveGuidedLocation, c as englishGuidedTranslate, d as guidedText, f as guidedTranslateFrom, g as GuidedShell, h as GuidedLocation, i as GuidedEnvironment, j as reasonCamel, k as isDefiniteRefusal, l as fillGuidedParams, m as DEFAULT_BOTMANOR_APP_URL, n as stepReasonCode, o as GuidedTranslate, p as planGuidedActions, r as stopReasonLabel, s as PlannedGuidedAction, t as describeRunFailure, u as guidedParams, v as botmanorPath, w as permissionLabelKey, x as GUIDED_PERMISSIONS, y as crossShellUrl, z as GuidedError } from "./guided-errors-CiQTVYn8.js";
13
14
  /** Failure from the gateway: a transport status or a GraphQL error code. */
14
15
  export declare class StewardsRequestError extends Error {
15
16
  readonly code: string;
16
17
  readonly status?: number;
17
- /** The plan quota a `QUOTA_EXHAUSTED` refusal names, e.g. `botmanor.stewards.runs`. */
18
+ /**
19
+ * The plan quota a `QUOTA_EXHAUSTED` refusal names, e.g.
20
+ * `botmanor.stewards.runs` (`extensions.quotaKey`, or the older `quotaName`).
21
+ */
18
22
  readonly quotaName?: string;
19
- constructor(message: string, code: string, status?: number, quotaName?: string);
23
+ /**
24
+ * The GraphQL error's whole `extensions` object: `reason`, `i18nKey` and the
25
+ * context fields the guided-error catalog reads (BOFF-18785). Empty for a
26
+ * transport failure.
27
+ */
28
+ readonly extensions: Readonly<Record<string, unknown>>;
29
+ constructor(message: string, code: string, status?: number, quotaName?: string, extensions?: Readonly<Record<string, unknown>>);
30
+ /** `extensions.reason`, the catalog's guided code, when the service sent one. */
31
+ get reason(): string | undefined;
32
+ /** `extensions.i18nKey`, the service's translation key, when it sent one. */
33
+ get i18nKey(): string | undefined;
34
+ }
35
+ /** Per-request options. */
36
+ interface StewardsRequestOptions {
37
+ /**
38
+ * Do not report a failure through `reportFailure` (the `request.failed`
39
+ * event). For optional reads whose failure the surface handles quietly,
40
+ * such as a plan check the viewer may not be allowed to make.
41
+ */
42
+ silent?: boolean;
20
43
  }
21
44
  interface StewardsClient {
22
- request<T>(document: string, variables?: Record<string, unknown>, signal?: AbortSignal): Promise<T>;
45
+ request<T>(document: string, variables?: Record<string, unknown>, signal?: AbortSignal, options?: StewardsRequestOptions): Promise<T>;
23
46
  }
24
47
  /**
25
48
  * Stewards SDK events. Names follow the devportal outbound-webhook subjects
@@ -67,6 +90,12 @@ interface StewardsEventMap {
67
90
  message: string;
68
91
  status?: number;
69
92
  quotaName?: string;
93
+ /** The catalog's guided code (`extensions.reason`), when the service sent one. */
94
+ reason?: string;
95
+ /** The service's translation key (`extensions.i18nKey`), when it sent one. */
96
+ i18nKey?: string;
97
+ /** The GraphQL error's whole `extensions`, for hosts that read more context. */
98
+ extensions?: Readonly<Record<string, unknown>>;
70
99
  };
71
100
  }
72
101
  type StewardsEventType = keyof StewardsEventMap;
@@ -142,6 +171,33 @@ interface StewardsSdkConfig {
142
171
  /** Every SDK event, for hosts that prefer one callback to `useStewardsEvent`. */
143
172
  onEvent?: (event: StewardsEvent) => void;
144
173
  theme?: Partial<StewardsTheme>;
174
+ /**
175
+ * Where a guided-error action goes (BOFF-18785): an address inside the host
176
+ * (`/stewards/…`, sent to `navigate`) or an absolute URL in another app
177
+ * shell. `undefined` hides the action (it becomes "ask an admin" text).
178
+ * Omitted, actions link to BotManor's own pages on app.botmanor.com.
179
+ */
180
+ resolveTarget?: (target: GuidedTarget, params: GuidedTargetParams) => string | undefined;
181
+ /** In-app navigation for an address `resolveTarget` returned. Omitted, the page loads it. */
182
+ navigate?: (href: string) => void;
183
+ /**
184
+ * Whether the viewer holds a permission, to offer only the fixes the
185
+ * gateway would allow. `undefined` means not known: the action is offered
186
+ * and the gateway decides.
187
+ */
188
+ hasPermission?: (permission: string) => boolean | undefined;
189
+ /** The viewer's actor id, for fixes only a steward's or machine's owner can make. */
190
+ viewerActorId?: string | null;
191
+ /** A person's display name for an actor id ("Ask Priya to …"); omitted, the role is named. */
192
+ resolveActorName?: (actorId: string) => string | undefined;
193
+ /** Translator for guided-error copy (`guidedErrors.*` keys); omitted, English. */
194
+ translate?: GuidedTranslate;
195
+ /**
196
+ * Opens the host's upgrade dialog for a guided "Upgrade plan" action.
197
+ * Omitted, the action goes to the `BILLING_PLANS` target when the host
198
+ * resolves it, and is hidden otherwise.
199
+ */
200
+ onUpgrade?: (guided: GuidedError) => void;
145
201
  }
146
202
  interface StewardsSdkContextValue {
147
203
  config: StewardsSdkConfig;
@@ -195,6 +251,7 @@ interface StewardListItem {
195
251
  agent: {
196
252
  id: string;
197
253
  name: string;
254
+ status?: string | null;
198
255
  } | null;
199
256
  status: StewardStatus;
200
257
  defaultDeskKind: StewardDeskKind;
@@ -217,6 +274,8 @@ interface StewardDetail {
217
274
  id: string;
218
275
  name: string;
219
276
  capabilities: string[];
277
+ status?: string | null;
278
+ llmModelId?: string | null;
220
279
  } | null;
221
280
  ownerActorId: string;
222
281
  status: StewardStatus;
@@ -301,6 +360,23 @@ interface StewardApprovalRequest {
301
360
  expiresAt: string;
302
361
  createdAt: string;
303
362
  }
363
+ interface AgentCandidate {
364
+ id: string;
365
+ name: string;
366
+ description: string | null;
367
+ status: string;
368
+ capabilities: string[];
369
+ /** The agent's AI model; an agent without one cannot be published. */
370
+ llmModelId?: string | null;
371
+ }
372
+ /** `checkWorkspaceQuota` for the plan's desk minutes. */
373
+ interface DeskMinutesCheck {
374
+ allowed: boolean;
375
+ /** Null when the plan has no desk minutes at all. */
376
+ assignmentId: string | null;
377
+ limitLeft: number | null;
378
+ noLimit: boolean;
379
+ }
304
380
  /** The machine a steward with desk kind OWN_MACHINE works on (BOFF-18623). */
305
381
  interface StewardOwnMachineDesk$1 {
306
382
  id: string;
@@ -443,6 +519,23 @@ interface StewardBuilderProps {
443
519
  /** Called with the steward's id once its charter is saved. */
444
520
  onSaved?: (stewardId: string) => void;
445
521
  }
522
+ /** What the picker says next to an agent's name. */
523
+ export declare function agentPickerLabel(agent: Pick<AgentCandidate, "name" | "status">, alreadySteward: boolean): string;
524
+ /**
525
+ * The picker's agents, sorted so published agents come first: active, draft
526
+ * and paused agents only (training, archived and deleted agents cannot become
527
+ * a steward), each marked when it is already a steward.
528
+ */
529
+ export declare function pickableAgents(agents: readonly AgentCandidate[], stewardAgentIds: ReadonlySet<string>): {
530
+ agent: AgentCandidate;
531
+ alreadySteward: boolean;
532
+ }[];
533
+ /**
534
+ * What the desk picker says about desks that use the plan's desk minutes
535
+ * (browser and cloud), from the plan: `notInPlan` (no assignment), `usedUp`,
536
+ * `available`, or `unknown` when the viewer may not check the plan.
537
+ */
538
+ export declare function cloudDeskAvailability(check: DeskMinutesCheck | null | undefined): "notInPlan" | "usedUp" | "available" | "unknown";
446
539
  /**
447
540
  * Create a steward from an agent and a charter, or edit an existing charter:
448
541
  * the charter text, the autonomy level and a daily credit budget. Duties and
@@ -454,13 +547,24 @@ interface StewardRunViewProps {
454
547
  runId: string;
455
548
  /** Poll interval while the run is active. Defaults to 3000 ms. */
456
549
  pollIntervalMs?: number;
550
+ /**
551
+ * Offered as "Run again" when a failed run's guidance says so (the host
552
+ * opens its prompt box). Omitted, the guidance has no Run again button.
553
+ */
554
+ onRunAgain?: () => void;
555
+ /** The steward changed through an inline fix (activated, its agent published). */
556
+ onStewardChanged?: () => void;
557
+ /** The steward's desk kind, which tells a cloud desk failure from an offline machine. */
558
+ deskKind?: string;
559
+ /** The host's update restriction: false offers no "Activate steward" fix. */
560
+ canUpdateSteward?: boolean;
457
561
  }
458
562
  /**
459
563
  * One run: its steps, approvals, trust level and budget. Polls the gateway
460
564
  * while the run is active (the embed session is not a subscription actor) and
461
565
  * emits `run.waiting`, `run.completed` and `run.failed` as the status changes.
462
566
  */
463
- export declare function StewardRunView({ runId, pollIntervalMs }: StewardRunViewProps): import("react").JSX.Element;
567
+ export declare function StewardRunView({ runId, pollIntervalMs, onRunAgain, onStewardChanged, deskKind, canUpdateSteward }: StewardRunViewProps): import("react").JSX.Element;
464
568
  interface ApprovalInboxProps {
465
569
  /** Limit to one steward; omitted shows every steward approval the viewer can decide. */
466
570
  stewardId?: string;
@@ -473,4 +577,36 @@ interface ApprovalInboxProps {
473
577
  * `mine: true`) rather than a parallel one.
474
578
  */
475
579
  export declare function ApprovalInbox({ stewardId, pollIntervalMs }: ApprovalInboxProps): import("react").JSX.Element;
476
- export type { ApprovalInboxProps, OwnMachineAccess, OwnMachineCandidate, OwnMachineGrant, OwnMachineGrantDays, OwnMachineRow, StewardApprovalRequest, StewardBuilderProps, StewardConsoleProps, StewardDetail, StewardListItem, StewardOwnMachineDeskProps, StewardOwnMachineDesk$1 as StewardOwnMachineDeskRecord, StewardRunDetail, StewardRunSummary, StewardRunViewProps, StewardsClient, StewardsEvent, StewardsEventBus, StewardsEventMap, StewardsEventType, StewardsSdkConfig, StewardsSdkContextValue, StewardsTheme };
580
+ interface GuidedErrorNoteProps {
581
+ /** The failed operation's error. */
582
+ error?: Error | undefined;
583
+ /** Guidance already described (a run's failure), in place of `error`. */
584
+ guided?: GuidedError | undefined;
585
+ /** What the surface knows about the steward and its agent. */
586
+ context?: GuidedErrorContext;
587
+ /**
588
+ * Runs the failed operation again. Offered as "Try again" where the catalog
589
+ * says so, and run once after an inline fix (such as publishing the agent)
590
+ * succeeds.
591
+ */
592
+ onRetry?: () => unknown;
593
+ /** Called after an inline fix succeeded (before the retry). */
594
+ onFixed?: (mutation: GuidedMutation) => void;
595
+ /**
596
+ * `error` (default) for a failed operation; `info` for guidance shown
597
+ * before anything fails (a draft agent next to the Activate button).
598
+ */
599
+ tone?: "error" | "info";
600
+ /**
601
+ * Whether the steward may be activated from this note (the host's update
602
+ * restriction). Default true; the gateway still decides.
603
+ */
604
+ canActivateSteward?: boolean;
605
+ }
606
+ /**
607
+ * An error, explained (BOFF-18785): what happened, why, the next step, up to
608
+ * two actions the viewer may take, and who can fix it when they cannot. A
609
+ * local validation error (no code) reads as its own message, as before.
610
+ */
611
+ export declare function GuidedErrorNote({ error, guided: given, context, onRetry, onFixed, tone, canActivateSteward }: GuidedErrorNoteProps): import("react").JSX.Element | null;
612
+ export { AGENT_STATUS_LABELS, AGENT_STATUS_SHORT_LABELS, type AgentCandidate, type ApprovalInboxProps, DEFAULT_BOTMANOR_APP_URL, type DeskMinutesCheck, GUIDED_ENTRIES, GUIDED_PERMISSIONS, type GuidedAction, type GuidedActionKind, type GuidedEntry, type GuidedEnvironment, type GuidedError, type GuidedErrorContext, type GuidedErrorNoteProps, type GuidedErrorSource, type GuidedLocation, type GuidedMutation, type GuidedPermission, type GuidedPlan, type GuidedReason, type GuidedRunFailure, type GuidedRunSource, type GuidedShell, type GuidedTarget, type GuidedTargetParams, type GuidedTranslate, type OwnMachineAccess, type OwnMachineCandidate, type OwnMachineGrant, type OwnMachineGrantDays, type OwnMachineRow, PERMISSION_LABELS, type PlannedGuidedAction, STOP_REASON_LABELS, type StewardApprovalRequest, type StewardBuilderProps, type StewardConsoleProps, type StewardDetail, type StewardListItem, type StewardOwnMachineDeskProps, type StewardOwnMachineDesk$1 as StewardOwnMachineDeskRecord, type StewardRunDetail, type StewardRunSummary, type StewardRunViewProps, type StewardsClient, type StewardsEvent, type StewardsEventBus, type StewardsEventMap, type StewardsEventType, type StewardsRequestOptions, type StewardsSdkConfig, type StewardsSdkContextValue, type StewardsTheme, botmanorPath, buildGuidedError, crossShellUrl, describeGuidedError, describeRunFailure, englishGuidedTranslate, extractGuidedSource, fillGuidedParams, guidedI18nBase, guidedParams, guidedText, guidedTranslateFrom, isDefiniteRefusal, isStaleStateError, permissionLabelKey, planGuidedActions, reasonCamel, resolveGuidedLocation, stepReasonCode, stopReasonLabel };