@botmanor/fe-sdk 2026.1205.3 → 2026.1205.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.
@@ -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;
@@ -328,6 +404,8 @@ interface OwnMachineGrant {
328
404
  status: "ACTIVE" | "EXPIRED" | "REVOKED";
329
405
  expiresAt: string;
330
406
  scopes: string[];
407
+ /** Who granted it: the grantor may revoke it as well as the machine's owner (BOFF-18818). */
408
+ grantorActorId?: string | null;
331
409
  }
332
410
  /** Where the person manages their VibeControls machines, by default. */
333
411
  export declare const DEFAULT_VIBECONTROLS_URL = "https://app.vibecontrols.com/";
@@ -371,11 +449,19 @@ interface OwnMachineRow {
371
449
  granted: boolean;
372
450
  /** The steward works on this machine now. */
373
451
  chosen: boolean;
452
+ /**
453
+ * The steward holds a live grant on a machine that is not the steward
454
+ * owner's (it was given to someone else, or is not listed): the row offers
455
+ * only Revoke, to whoever the service lets revoke it (BOFF-18818).
456
+ */
457
+ revokeOnly?: true;
374
458
  }
375
459
  /**
376
460
  * The owner's machines for the picker: the owner's agents, chosen one first,
377
461
  * then granted ones, then by name. A grant counts while it is ACTIVE and not
378
- * past its expiry (`now`, for tests).
462
+ * past its expiry (`now`, for tests). A live grant on any other machine
463
+ * follows as a revoke-only row, so the person who may revoke it still can
464
+ * (BOFF-18818); a machine the list does not hold is named by its id.
379
465
  */
380
466
  export declare function ownMachineRows(agents: readonly OwnMachineCandidate[], grants: readonly OwnMachineGrant[], ownerActorId: string, chosenAgentId: string | null, now?: number): OwnMachineRow[];
381
467
  /** The expiry to send for a grant of `days`, never past the service's 30-day limit. */
@@ -389,6 +475,14 @@ export declare function ownMachineAllowedApps(text: string): string[];
389
475
  export declare function ownMachineAppCount(text: string): number;
390
476
  /** When the earliest live grant expires (epoch ms), or null. */
391
477
  export declare function nextOwnMachineGrantExpiry(grants: readonly OwnMachineGrant[], now?: number): number | null;
478
+ /**
479
+ * May the viewer revoke a steward's grant on a machine (BOFF-18818)? The
480
+ * gateway needs agent:update, and the service then lets the grant's grantor
481
+ * or the machine's current owner revoke it, whatever they may do with the
482
+ * steward itself (botmanor-steward:update is not needed). As elsewhere here,
483
+ * data the host did not give is left to the gateway.
484
+ */
485
+ export declare function ownMachineCanRevoke(machineOwnerId: string | null | undefined, grantorActorId: string | null | undefined, access?: OwnMachineAccess): boolean;
392
486
  /** What the viewer may do with the picker, from {@link OwnMachineAccess}. */
393
487
  export declare function ownMachineAbilities(ownerActorId: string, access?: OwnMachineAccess): {
394
488
  manage: boolean;
@@ -443,6 +537,23 @@ interface StewardBuilderProps {
443
537
  /** Called with the steward's id once its charter is saved. */
444
538
  onSaved?: (stewardId: string) => void;
445
539
  }
540
+ /** What the picker says next to an agent's name. */
541
+ export declare function agentPickerLabel(agent: Pick<AgentCandidate, "name" | "status">, alreadySteward: boolean): string;
542
+ /**
543
+ * The picker's agents, sorted so published agents come first: active, draft
544
+ * and paused agents only (training, archived and deleted agents cannot become
545
+ * a steward), each marked when it is already a steward.
546
+ */
547
+ export declare function pickableAgents(agents: readonly AgentCandidate[], stewardAgentIds: ReadonlySet<string>): {
548
+ agent: AgentCandidate;
549
+ alreadySteward: boolean;
550
+ }[];
551
+ /**
552
+ * What the desk picker says about desks that use the plan's desk minutes
553
+ * (browser and cloud), from the plan: `notInPlan` (no assignment), `usedUp`,
554
+ * `available`, or `unknown` when the viewer may not check the plan.
555
+ */
556
+ export declare function cloudDeskAvailability(check: DeskMinutesCheck | null | undefined): "notInPlan" | "usedUp" | "available" | "unknown";
446
557
  /**
447
558
  * Create a steward from an agent and a charter, or edit an existing charter:
448
559
  * the charter text, the autonomy level and a daily credit budget. Duties and
@@ -454,13 +565,24 @@ interface StewardRunViewProps {
454
565
  runId: string;
455
566
  /** Poll interval while the run is active. Defaults to 3000 ms. */
456
567
  pollIntervalMs?: number;
568
+ /**
569
+ * Offered as "Run again" when a failed run's guidance says so (the host
570
+ * opens its prompt box). Omitted, the guidance has no Run again button.
571
+ */
572
+ onRunAgain?: () => void;
573
+ /** The steward changed through an inline fix (activated, its agent published). */
574
+ onStewardChanged?: () => void;
575
+ /** The steward's desk kind, which tells a cloud desk failure from an offline machine. */
576
+ deskKind?: string;
577
+ /** The host's update restriction: false offers no "Activate steward" fix. */
578
+ canUpdateSteward?: boolean;
457
579
  }
458
580
  /**
459
581
  * One run: its steps, approvals, trust level and budget. Polls the gateway
460
582
  * while the run is active (the embed session is not a subscription actor) and
461
583
  * emits `run.waiting`, `run.completed` and `run.failed` as the status changes.
462
584
  */
463
- export declare function StewardRunView({ runId, pollIntervalMs }: StewardRunViewProps): import("react").JSX.Element;
585
+ export declare function StewardRunView({ runId, pollIntervalMs, onRunAgain, onStewardChanged, deskKind, canUpdateSteward }: StewardRunViewProps): import("react").JSX.Element;
464
586
  interface ApprovalInboxProps {
465
587
  /** Limit to one steward; omitted shows every steward approval the viewer can decide. */
466
588
  stewardId?: string;
@@ -473,4 +595,36 @@ interface ApprovalInboxProps {
473
595
  * `mine: true`) rather than a parallel one.
474
596
  */
475
597
  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 };
598
+ interface GuidedErrorNoteProps {
599
+ /** The failed operation's error. */
600
+ error?: Error | undefined;
601
+ /** Guidance already described (a run's failure), in place of `error`. */
602
+ guided?: GuidedError | undefined;
603
+ /** What the surface knows about the steward and its agent. */
604
+ context?: GuidedErrorContext;
605
+ /**
606
+ * Runs the failed operation again. Offered as "Try again" where the catalog
607
+ * says so, and run once after an inline fix (such as publishing the agent)
608
+ * succeeds.
609
+ */
610
+ onRetry?: () => unknown;
611
+ /** Called after an inline fix succeeded (before the retry). */
612
+ onFixed?: (mutation: GuidedMutation) => void;
613
+ /**
614
+ * `error` (default) for a failed operation; `info` for guidance shown
615
+ * before anything fails (a draft agent next to the Activate button).
616
+ */
617
+ tone?: "error" | "info";
618
+ /**
619
+ * Whether the steward may be activated from this note (the host's update
620
+ * restriction). Default true; the gateway still decides.
621
+ */
622
+ canActivateSteward?: boolean;
623
+ }
624
+ /**
625
+ * An error, explained (BOFF-18785): what happened, why, the next step, up to
626
+ * two actions the viewer may take, and who can fix it when they cannot. A
627
+ * local validation error (no code) reads as its own message, as before.
628
+ */
629
+ export declare function GuidedErrorNote({ error, guided: given, context, onRetry, onFixed, tone, canActivateSteward }: GuidedErrorNoteProps): import("react").JSX.Element | null;
630
+ 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 };