@botmanor/fe-sdk 2026.1205.1 → 2026.1205.3
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.d.ts +98 -53
- package/dist/index.js +594 -128
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -165,49 +165,6 @@ export declare function StewardsSdkProvider({ children, ...config }: StewardsSdk
|
|
|
165
165
|
export declare function useStewardsSdk(): StewardsSdkContextValue;
|
|
166
166
|
/** Subscribe to one SDK event for the lifetime of the calling component. */
|
|
167
167
|
export declare function useStewardsEvent<K extends StewardsEventType>(type: K, handler: (payload: StewardsEventMap[K]) => void): void;
|
|
168
|
-
interface StewardConsoleProps {
|
|
169
|
-
/**
|
|
170
|
-
* The steward to show. Omitted lists the workspace's stewards and lets the
|
|
171
|
-
* viewer open one (the host can follow along through `onSelectSteward`).
|
|
172
|
-
*/
|
|
173
|
-
stewardId?: string;
|
|
174
|
-
onSelectSteward?: (stewardId: string) => void;
|
|
175
|
-
/**
|
|
176
|
-
* Link to VibeControls, where a machine's owner grants it to a steward
|
|
177
|
-
* (shown for a steward whose desk kind is OWN_MACHINE).
|
|
178
|
-
*/
|
|
179
|
-
vibecontrolsUrl?: string;
|
|
180
|
-
}
|
|
181
|
-
/** List stewards, or open one: its charter summary, start a run, recent runs. */
|
|
182
|
-
export declare function StewardConsole({ stewardId, onSelectSteward, vibecontrolsUrl }: StewardConsoleProps): import("react").JSX.Element;
|
|
183
|
-
interface StewardBuilderProps {
|
|
184
|
-
/** Start from an existing agent; omitted shows the agent picker. */
|
|
185
|
-
agentId?: string;
|
|
186
|
-
/** Edit the charter of this steward instead of creating one. */
|
|
187
|
-
stewardId?: string;
|
|
188
|
-
/** Called with the new steward's id once it is created. */
|
|
189
|
-
onCreated?: (stewardId: string) => void;
|
|
190
|
-
/** Called with the steward's id once its charter is saved. */
|
|
191
|
-
onSaved?: (stewardId: string) => void;
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* Create a steward from an agent and a charter, or edit an existing charter:
|
|
195
|
-
* the charter text, the autonomy level and a daily credit budget. Duties and
|
|
196
|
-
* playbooks live in the full Stewards app.
|
|
197
|
-
*/
|
|
198
|
-
export declare function StewardBuilder(props: StewardBuilderProps): import("react").JSX.Element;
|
|
199
|
-
interface StewardRunViewProps {
|
|
200
|
-
/** The run to show. */
|
|
201
|
-
runId: string;
|
|
202
|
-
/** Poll interval while the run is active. Defaults to 3000 ms. */
|
|
203
|
-
pollIntervalMs?: number;
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* One run: its steps, approvals, trust level and budget. Polls the gateway
|
|
207
|
-
* while the run is active (the embed session is not a subscription actor) and
|
|
208
|
-
* emits `run.waiting`, `run.completed` and `run.failed` as the status changes.
|
|
209
|
-
*/
|
|
210
|
-
export declare function StewardRunView({ runId, pollIntervalMs }: StewardRunViewProps): import("react").JSX.Element;
|
|
211
168
|
/**
|
|
212
169
|
* The slice of the workspace gateway schema the SDK reads and writes. Names
|
|
213
170
|
* follow the `Botmanor*` types of the Hive production supergraph (the same
|
|
@@ -372,18 +329,39 @@ interface OwnMachineGrant {
|
|
|
372
329
|
expiresAt: string;
|
|
373
330
|
scopes: string[];
|
|
374
331
|
}
|
|
375
|
-
/** Where the person
|
|
332
|
+
/** Where the person manages their VibeControls machines, by default. */
|
|
376
333
|
export declare const DEFAULT_VIBECONTROLS_URL = "https://app.vibecontrols.com/";
|
|
377
334
|
/** Machines per page when listing the workspace's VibeControls machines. */
|
|
378
335
|
export declare const OWN_MACHINE_PAGE_SIZE = 100;
|
|
379
336
|
/** Pages read at most (10 000 machines); the list says when it stopped early. */
|
|
380
337
|
export declare const OWN_MACHINE_MAX_PAGES = 100;
|
|
338
|
+
/** The grant lengths the owner can pick, in days. */
|
|
339
|
+
export declare const OWN_MACHINE_GRANT_DAYS: readonly [1, 7, 30];
|
|
340
|
+
type OwnMachineGrantDays = (typeof OWN_MACHINE_GRANT_DAYS)[number];
|
|
341
|
+
/**
|
|
342
|
+
* What the host knows about the viewer, so the picker offers only what the
|
|
343
|
+
* gateway would allow. Every field is optional: an omitted one is not checked
|
|
344
|
+
* here and the gateway decides (an embed without permission data keeps
|
|
345
|
+
* working). The gateway stays the enforcement point either way.
|
|
346
|
+
*/
|
|
347
|
+
interface OwnMachineAccess {
|
|
348
|
+
/** The signed-in person. Choosing, clearing and granting are the steward owner's only. */
|
|
349
|
+
viewerActorId?: string | null;
|
|
350
|
+
/** botmanor-steward:update, on a steward that is not archived. */
|
|
351
|
+
canUpdateSteward?: boolean;
|
|
352
|
+
/** agent:read: list the workspace's machines and the steward's grants. */
|
|
353
|
+
canReadMachines?: boolean;
|
|
354
|
+
/** agent:update: grant a machine to the steward, or revoke the grant. */
|
|
355
|
+
canGrantMachines?: boolean;
|
|
356
|
+
}
|
|
381
357
|
interface StewardOwnMachineDeskProps {
|
|
382
358
|
stewardId: string;
|
|
383
359
|
/** The steward's owner: only their machines are offered. */
|
|
384
360
|
ownerActorId: string;
|
|
385
|
-
/** Link to VibeControls, where a
|
|
361
|
+
/** Link to VibeControls, where a person manages their machines. Pass the current environment's app. */
|
|
386
362
|
vibecontrolsUrl?: string;
|
|
363
|
+
/** What the viewer may do; see {@link OwnMachineAccess}. */
|
|
364
|
+
access?: OwnMachineAccess;
|
|
387
365
|
/** Called after the machine is chosen or cleared. */
|
|
388
366
|
onChanged?: (desk: StewardOwnMachineDesk$1 | null) => void;
|
|
389
367
|
}
|
|
@@ -400,6 +378,23 @@ interface OwnMachineRow {
|
|
|
400
378
|
* past its expiry (`now`, for tests).
|
|
401
379
|
*/
|
|
402
380
|
export declare function ownMachineRows(agents: readonly OwnMachineCandidate[], grants: readonly OwnMachineGrant[], ownerActorId: string, chosenAgentId: string | null, now?: number): OwnMachineRow[];
|
|
381
|
+
/** The expiry to send for a grant of `days`, never past the service's 30-day limit. */
|
|
382
|
+
export declare function ownMachineGrantExpiry(days: OwnMachineGrantDays, now?: number): string;
|
|
383
|
+
/**
|
|
384
|
+
* The app names to send on a grant: one per line, trimmed, lower-cased
|
|
385
|
+
* (VibeControls compares lower-case names), de-duplicated and capped at 64.
|
|
386
|
+
*/
|
|
387
|
+
export declare function ownMachineAllowedApps(text: string): string[];
|
|
388
|
+
/** How many distinct app names the text holds, before the 64-name cap. */
|
|
389
|
+
export declare function ownMachineAppCount(text: string): number;
|
|
390
|
+
/** When the earliest live grant expires (epoch ms), or null. */
|
|
391
|
+
export declare function nextOwnMachineGrantExpiry(grants: readonly OwnMachineGrant[], now?: number): number | null;
|
|
392
|
+
/** What the viewer may do with the picker, from {@link OwnMachineAccess}. */
|
|
393
|
+
export declare function ownMachineAbilities(ownerActorId: string, access?: OwnMachineAccess): {
|
|
394
|
+
manage: boolean;
|
|
395
|
+
read: boolean;
|
|
396
|
+
grant: boolean;
|
|
397
|
+
};
|
|
403
398
|
/**
|
|
404
399
|
* The desk settings of a steward whose desk kind is OWN_MACHINE, inside the
|
|
405
400
|
* SDK's themed wrapper: use it on its own. `StewardConsole` renders
|
|
@@ -408,14 +403,64 @@ export declare function ownMachineRows(agents: readonly OwnMachineCandidate[], g
|
|
|
408
403
|
export declare function StewardOwnMachineDesk(props: StewardOwnMachineDeskProps): import("react").JSX.Element;
|
|
409
404
|
/**
|
|
410
405
|
* The owner's VibeControls machines, which ones have granted this steward,
|
|
411
|
-
* and the one it works on.
|
|
412
|
-
*
|
|
413
|
-
*
|
|
414
|
-
*
|
|
415
|
-
*
|
|
416
|
-
*
|
|
406
|
+
* and the one it works on. The owner can grant a machine to the steward
|
|
407
|
+
* (`grantVibecontrolsAgentToSteward`), revoke the grant, choose a granted
|
|
408
|
+
* machine (`setBotmanorStewardOwnMachineDesk`) or clear the choice
|
|
409
|
+
* (`clearBotmanorStewardOwnMachineDesk`). Controls follow `access`; the
|
|
410
|
+
* service's refusals (no grant, machine in use, changed concurrently, check
|
|
411
|
+
* unavailable) are shown with the service's own message. Refresh and the tab
|
|
412
|
+
* regaining focus reload the desk, the machines and the grants, and a row
|
|
413
|
+
* re-renders when its grant expires. The gateway stays the enforcement point.
|
|
417
414
|
*/
|
|
418
|
-
export declare function StewardOwnMachineDeskPanel({ stewardId, ownerActorId, vibecontrolsUrl, onChanged }: StewardOwnMachineDeskProps): import("react").JSX.Element;
|
|
415
|
+
export declare function StewardOwnMachineDeskPanel({ stewardId, ownerActorId, vibecontrolsUrl, access, onChanged }: StewardOwnMachineDeskProps): import("react").JSX.Element;
|
|
416
|
+
interface StewardConsoleProps {
|
|
417
|
+
/**
|
|
418
|
+
* The steward to show. Omitted lists the workspace's stewards and lets the
|
|
419
|
+
* viewer open one (the host can follow along through `onSelectSteward`).
|
|
420
|
+
*/
|
|
421
|
+
stewardId?: string;
|
|
422
|
+
onSelectSteward?: (stewardId: string) => void;
|
|
423
|
+
/**
|
|
424
|
+
* Link to VibeControls, where a machine's owner grants it to a steward
|
|
425
|
+
* (shown for a steward whose desk kind is OWN_MACHINE).
|
|
426
|
+
*/
|
|
427
|
+
vibecontrolsUrl?: string;
|
|
428
|
+
/**
|
|
429
|
+
* What the viewer may do with an own-machine steward's machine (ownership
|
|
430
|
+
* and permissions). Omitted fields are left to the gateway.
|
|
431
|
+
*/
|
|
432
|
+
ownMachineAccess?: OwnMachineAccess;
|
|
433
|
+
}
|
|
434
|
+
/** List stewards, or open one: its charter summary, start a run, recent runs. */
|
|
435
|
+
export declare function StewardConsole({ stewardId, onSelectSteward, vibecontrolsUrl, ownMachineAccess }: StewardConsoleProps): import("react").JSX.Element;
|
|
436
|
+
interface StewardBuilderProps {
|
|
437
|
+
/** Start from an existing agent; omitted shows the agent picker. */
|
|
438
|
+
agentId?: string;
|
|
439
|
+
/** Edit the charter of this steward instead of creating one. */
|
|
440
|
+
stewardId?: string;
|
|
441
|
+
/** Called with the new steward's id once it is created. */
|
|
442
|
+
onCreated?: (stewardId: string) => void;
|
|
443
|
+
/** Called with the steward's id once its charter is saved. */
|
|
444
|
+
onSaved?: (stewardId: string) => void;
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* Create a steward from an agent and a charter, or edit an existing charter:
|
|
448
|
+
* the charter text, the autonomy level and a daily credit budget. Duties and
|
|
449
|
+
* playbooks live in the full Stewards app.
|
|
450
|
+
*/
|
|
451
|
+
export declare function StewardBuilder(props: StewardBuilderProps): import("react").JSX.Element;
|
|
452
|
+
interface StewardRunViewProps {
|
|
453
|
+
/** The run to show. */
|
|
454
|
+
runId: string;
|
|
455
|
+
/** Poll interval while the run is active. Defaults to 3000 ms. */
|
|
456
|
+
pollIntervalMs?: number;
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
459
|
+
* One run: its steps, approvals, trust level and budget. Polls the gateway
|
|
460
|
+
* while the run is active (the embed session is not a subscription actor) and
|
|
461
|
+
* emits `run.waiting`, `run.completed` and `run.failed` as the status changes.
|
|
462
|
+
*/
|
|
463
|
+
export declare function StewardRunView({ runId, pollIntervalMs }: StewardRunViewProps): import("react").JSX.Element;
|
|
419
464
|
interface ApprovalInboxProps {
|
|
420
465
|
/** Limit to one steward; omitted shows every steward approval the viewer can decide. */
|
|
421
466
|
stewardId?: string;
|
|
@@ -428,4 +473,4 @@ interface ApprovalInboxProps {
|
|
|
428
473
|
* `mine: true`) rather than a parallel one.
|
|
429
474
|
*/
|
|
430
475
|
export declare function ApprovalInbox({ stewardId, pollIntervalMs }: ApprovalInboxProps): import("react").JSX.Element;
|
|
431
|
-
export type { ApprovalInboxProps, OwnMachineCandidate, OwnMachineGrant, OwnMachineRow, StewardApprovalRequest, StewardBuilderProps, StewardConsoleProps, StewardDetail, StewardListItem, StewardOwnMachineDeskProps, StewardOwnMachineDesk$1 as StewardOwnMachineDeskRecord, StewardRunDetail, StewardRunSummary, StewardRunViewProps, StewardsClient, StewardsEvent, StewardsEventBus, StewardsEventMap, StewardsEventType, StewardsSdkConfig, StewardsSdkContextValue, StewardsTheme };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { createContext, use, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
2
|
+
import { createContext, use, useCallback, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
3
3
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
// src/graphql/client.ts
|
|
@@ -372,6 +372,9 @@ const CREATE_STEWARD = `mutation CreateBotmanorSteward($input: CreateBotmanorSte
|
|
|
372
372
|
const UPDATE_STEWARD_CHARTER = `mutation UpdateBotmanorStewardCharter($id: ID!, $input: UpdateBotmanorStewardCharterInput!) {
|
|
373
373
|
updateBotmanorStewardCharter(id: $id, input: $input) { ${STEWARD_DETAIL} }
|
|
374
374
|
}`;
|
|
375
|
+
const SET_STEWARD_STATUS = `mutation SetBotmanorStewardStatus($id: ID!, $status: BotmanorStewardStatus!) {
|
|
376
|
+
setBotmanorStewardStatus(id: $id, status: $status) { id status }
|
|
377
|
+
}`;
|
|
375
378
|
const LIST_AGENT_CANDIDATES = `query ListStewardAgentCandidates($filters: BotmanorAgentFilterInput) {
|
|
376
379
|
listBotmanorAgents(filters: $filters) { id name description status capabilities }
|
|
377
380
|
}`;
|
|
@@ -407,11 +410,20 @@ const LIST_OWN_MACHINE_AGENTS = `query StewardOwnMachineAgents($pagination: Pagi
|
|
|
407
410
|
id name hostname platform isActive ownerUserId lastHeartbeat
|
|
408
411
|
}
|
|
409
412
|
}`;
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
413
|
+
const OWN_MACHINE_GRANT = `id agentId status expiresAt scopes`;
|
|
414
|
+
/**
|
|
415
|
+
* The steward's active grants (VibeControls returns at most 100, newest
|
|
416
|
+
* first). Pass `agentId` to look one machine up when the list may be cut off.
|
|
417
|
+
*/
|
|
418
|
+
const LIST_OWN_MACHINE_GRANTS = `query StewardOwnMachineGrants($stewardId: ID!, $agentId: ID) {
|
|
419
|
+
vibecontrolsStewardGrants(filter: { stewardId: $stewardId, agentId: $agentId }) { ${OWN_MACHINE_GRANT} }
|
|
420
|
+
}`;
|
|
421
|
+
/** Only the machine's owner can grant it; granting again extends the same grant. */
|
|
422
|
+
const GRANT_OWN_MACHINE = `mutation GrantStewardOwnMachine($input: GrantVibecontrolsAgentToStewardInput!) {
|
|
423
|
+
grantVibecontrolsAgentToSteward(input: $input) { ${OWN_MACHINE_GRANT} }
|
|
424
|
+
}`;
|
|
425
|
+
const REVOKE_OWN_MACHINE_GRANT = `mutation RevokeStewardOwnMachineGrant($id: ID!) {
|
|
426
|
+
revokeVibecontrolsStewardGrant(id: $id) { ${OWN_MACHINE_GRANT} }
|
|
415
427
|
}`;
|
|
416
428
|
|
|
417
429
|
// src/graphql/hooks.ts
|
|
@@ -679,19 +691,34 @@ function humanize(value) {
|
|
|
679
691
|
}
|
|
680
692
|
|
|
681
693
|
// src/components/StewardOwnMachineDesk.tsx
|
|
682
|
-
/** Where the person
|
|
694
|
+
/** Where the person manages their VibeControls machines, by default. */
|
|
683
695
|
const DEFAULT_VIBECONTROLS_URL = "https://app.vibecontrols.com/";
|
|
684
696
|
/** Machines per page when listing the workspace's VibeControls machines. */
|
|
685
697
|
const OWN_MACHINE_PAGE_SIZE = 100;
|
|
686
698
|
/** Pages read at most (10 000 machines); the list says when it stopped early. */
|
|
687
699
|
const OWN_MACHINE_MAX_PAGES = 100;
|
|
700
|
+
/** The owner's machines looked up one by one when the grant list may miss them. */
|
|
701
|
+
const OWN_MACHINE_GRANT_LOOKUPS = 50;
|
|
702
|
+
/** The grant lengths the owner can pick, in days. */
|
|
703
|
+
const OWN_MACHINE_GRANT_DAYS = [
|
|
704
|
+
1,
|
|
705
|
+
7,
|
|
706
|
+
30
|
|
707
|
+
];
|
|
708
|
+
/** VibeControls accepts at most this many app names on a grant. */
|
|
709
|
+
const OWN_MACHINE_MAX_APPS = 64;
|
|
710
|
+
const DAY_MS = 864e5;
|
|
711
|
+
/** A grant counts while it is ACTIVE and not past its expiry. */
|
|
712
|
+
function isLive(grant, now) {
|
|
713
|
+
return grant.status === "ACTIVE" && new Date(grant.expiresAt).getTime() > now;
|
|
714
|
+
}
|
|
688
715
|
/**
|
|
689
716
|
* The owner's machines for the picker: the owner's agents, chosen one first,
|
|
690
717
|
* then granted ones, then by name. A grant counts while it is ACTIVE and not
|
|
691
718
|
* past its expiry (`now`, for tests).
|
|
692
719
|
*/
|
|
693
720
|
function ownMachineRows(agents, grants, ownerActorId, chosenAgentId, now = Date.now()) {
|
|
694
|
-
const granted = new Set(grants.filter((g) =>
|
|
721
|
+
const granted = new Set(grants.filter((g) => isLive(g, now)).map((g) => g.agentId));
|
|
695
722
|
const rank = (row) => row.chosen ? 0 : row.granted ? 1 : 2;
|
|
696
723
|
return agents.filter((a) => a.ownerUserId === ownerActorId || a.id === chosenAgentId).map((agent) => ({
|
|
697
724
|
agent,
|
|
@@ -699,62 +726,191 @@ function ownMachineRows(agents, grants, ownerActorId, chosenAgentId, now = Date.
|
|
|
699
726
|
chosen: agent.id === chosenAgentId
|
|
700
727
|
})).sort((a, b) => rank(a) - rank(b) || a.agent.name.localeCompare(b.agent.name));
|
|
701
728
|
}
|
|
729
|
+
/** The expiry to send for a grant of `days`, never past the service's 30-day limit. */
|
|
730
|
+
function ownMachineGrantExpiry(days, now = Date.now()) {
|
|
731
|
+
return new Date(now + Math.min(days * DAY_MS, 25917e5)).toISOString();
|
|
732
|
+
}
|
|
733
|
+
/**
|
|
734
|
+
* The app names to send on a grant: one per line, trimmed, lower-cased
|
|
735
|
+
* (VibeControls compares lower-case names), de-duplicated and capped at 64.
|
|
736
|
+
*/
|
|
737
|
+
function ownMachineAllowedApps(text) {
|
|
738
|
+
const seen = /* @__PURE__ */ new Set();
|
|
739
|
+
for (const line of text.split(/\r?\n/)) {
|
|
740
|
+
const name = line.trim().toLowerCase();
|
|
741
|
+
if (name) seen.add(name);
|
|
742
|
+
}
|
|
743
|
+
return [...seen].slice(0, 64);
|
|
744
|
+
}
|
|
745
|
+
/** How many distinct app names the text holds, before the 64-name cap. */
|
|
746
|
+
function ownMachineAppCount(text) {
|
|
747
|
+
return new Set(text.split(/\r?\n/).map((line) => line.trim().toLowerCase()).filter(Boolean)).size;
|
|
748
|
+
}
|
|
749
|
+
/** When the earliest live grant expires (epoch ms), or null. */
|
|
750
|
+
function nextOwnMachineGrantExpiry(grants, now = Date.now()) {
|
|
751
|
+
let next = null;
|
|
752
|
+
for (const g of grants) {
|
|
753
|
+
if (!isLive(g, now)) continue;
|
|
754
|
+
const at = new Date(g.expiresAt).getTime();
|
|
755
|
+
if (next === null || at < next) next = at;
|
|
756
|
+
}
|
|
757
|
+
return next;
|
|
758
|
+
}
|
|
759
|
+
/** What the viewer may do with the picker, from {@link OwnMachineAccess}. */
|
|
760
|
+
function ownMachineAbilities(ownerActorId, access = {}) {
|
|
761
|
+
const manage = (access.viewerActorId === void 0 || access.viewerActorId === ownerActorId) && access.canUpdateSteward !== false;
|
|
762
|
+
return {
|
|
763
|
+
manage,
|
|
764
|
+
read: access.canReadMachines !== false,
|
|
765
|
+
grant: manage && access.canGrantMachines !== false
|
|
766
|
+
};
|
|
767
|
+
}
|
|
768
|
+
const EMPTY_MACHINES = {
|
|
769
|
+
agents: void 0,
|
|
770
|
+
grants: void 0,
|
|
771
|
+
error: void 0,
|
|
772
|
+
loading: false,
|
|
773
|
+
truncated: false,
|
|
774
|
+
unchecked: /* @__PURE__ */ new Set()
|
|
775
|
+
};
|
|
776
|
+
/** Grant lookups sent at once. */
|
|
777
|
+
const GRANT_LOOKUP_CONCURRENCY = 8;
|
|
702
778
|
/**
|
|
703
779
|
* Every VibeControls machine the viewer can see in the workspace, page by
|
|
704
|
-
* page. The agents query has no owner filter,
|
|
705
|
-
*
|
|
780
|
+
* page, and the steward's live grants. The agents query has no owner filter,
|
|
781
|
+
* so the owner's machines can sit on any page. The grants list is capped by
|
|
782
|
+
* the service before it drops expired rows, so a shorter list can still miss
|
|
783
|
+
* a live grant: each of the owner's machines without a live grant in the list
|
|
784
|
+
* is looked up on its own (at most OWN_MACHINE_GRANT_LOOKUPS). Data is keyed
|
|
785
|
+
* by gateway, workspace, steward and owner, so another scope's machines and
|
|
786
|
+
* grants are never shown or acted on; a superseded load is aborted.
|
|
706
787
|
*/
|
|
707
|
-
function
|
|
708
|
-
const { client } = useStewardsSdk();
|
|
709
|
-
const
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
788
|
+
function useOwnMachineData(stewardId, ownerActorId, viewerActorId, enabled) {
|
|
789
|
+
const { client, config: { gatewayUrl, workspaceId } } = useStewardsSdk();
|
|
790
|
+
const scope = JSON.stringify([
|
|
791
|
+
gatewayUrl,
|
|
792
|
+
workspaceId,
|
|
793
|
+
stewardId,
|
|
794
|
+
ownerActorId,
|
|
795
|
+
viewerActorId ?? null
|
|
796
|
+
]);
|
|
797
|
+
const [nonce, setNonce] = useState(0);
|
|
798
|
+
const [state, setState] = useState(void 0);
|
|
799
|
+
const reload = useCallback(() => {
|
|
800
|
+
if (!enabled) return;
|
|
801
|
+
setState((prev) => prev ? {
|
|
718
802
|
...prev,
|
|
719
803
|
loading: true
|
|
720
|
-
})
|
|
804
|
+
} : prev);
|
|
805
|
+
setNonce((n) => n + 1);
|
|
806
|
+
}, [enabled]);
|
|
807
|
+
useEffect(() => {
|
|
808
|
+
if (!enabled) return void 0;
|
|
809
|
+
const controller = new AbortController();
|
|
810
|
+
const grantsOf = async (agentId) => (await client.request(LIST_OWN_MACHINE_GRANTS, {
|
|
811
|
+
stewardId,
|
|
812
|
+
...agentId ? { agentId } : {}
|
|
813
|
+
}, controller.signal)).vibecontrolsStewardGrants;
|
|
721
814
|
const load = async () => {
|
|
722
815
|
const agents = [];
|
|
816
|
+
let truncated = true;
|
|
723
817
|
for (let page = 0; page < 100; page += 1) {
|
|
724
818
|
const data = await client.request(LIST_OWN_MACHINE_AGENTS, { pagination: {
|
|
725
819
|
limit: 100,
|
|
726
820
|
offset: page * 100
|
|
727
821
|
} }, controller.signal);
|
|
728
822
|
agents.push(...data.vibecontrolsAgents);
|
|
729
|
-
if (data.vibecontrolsAgents.length < 100)
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
}
|
|
823
|
+
if (data.vibecontrolsAgents.length < 100) {
|
|
824
|
+
truncated = false;
|
|
825
|
+
break;
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
const grants = [...await grantsOf()];
|
|
829
|
+
const now = Date.now();
|
|
830
|
+
const live = new Set(grants.filter((g) => isLive(g, now)).map((g) => g.agentId));
|
|
831
|
+
const missing = agents.filter((a) => a.ownerUserId === ownerActorId && !live.has(a.id)).map((a) => a.id);
|
|
832
|
+
const checked = missing.slice(0, 50);
|
|
833
|
+
const unchecked = new Set(missing.slice(50));
|
|
834
|
+
for (let i = 0; i < checked.length; i += GRANT_LOOKUP_CONCURRENCY) {
|
|
835
|
+
const ids = checked.slice(i, i + GRANT_LOOKUP_CONCURRENCY);
|
|
836
|
+
const batch = await Promise.allSettled(ids.map((id) => grantsOf(id)));
|
|
837
|
+
if (controller.signal.aborted) break;
|
|
838
|
+
batch.forEach((result, n) => {
|
|
839
|
+
if (result.status === "fulfilled") grants.push(...result.value);
|
|
840
|
+
else unchecked.add(ids[n]);
|
|
841
|
+
});
|
|
733
842
|
}
|
|
734
843
|
return {
|
|
735
844
|
agents,
|
|
736
|
-
|
|
845
|
+
grants,
|
|
846
|
+
truncated,
|
|
847
|
+
unchecked
|
|
737
848
|
};
|
|
738
849
|
};
|
|
739
|
-
load().then(({ agents, truncated }) => {
|
|
850
|
+
load().then(({ agents, grants, truncated, unchecked }) => {
|
|
740
851
|
if (controller.signal.aborted) return;
|
|
741
852
|
setState({
|
|
853
|
+
scope,
|
|
742
854
|
agents,
|
|
855
|
+
grants,
|
|
743
856
|
error: void 0,
|
|
744
857
|
loading: false,
|
|
745
|
-
truncated
|
|
858
|
+
truncated,
|
|
859
|
+
unchecked
|
|
746
860
|
});
|
|
747
861
|
}, (err) => {
|
|
748
862
|
if (controller.signal.aborted) return;
|
|
749
|
-
setState(
|
|
750
|
-
...
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
})
|
|
863
|
+
setState({
|
|
864
|
+
...EMPTY_MACHINES,
|
|
865
|
+
scope,
|
|
866
|
+
error: err instanceof Error ? err : new Error(String(err))
|
|
867
|
+
});
|
|
754
868
|
});
|
|
755
869
|
return () => controller.abort();
|
|
756
|
-
}, [
|
|
757
|
-
|
|
870
|
+
}, [
|
|
871
|
+
client,
|
|
872
|
+
scope,
|
|
873
|
+
stewardId,
|
|
874
|
+
ownerActorId,
|
|
875
|
+
enabled,
|
|
876
|
+
nonce
|
|
877
|
+
]);
|
|
878
|
+
const checkAgent = useCallback(async (agentId) => {
|
|
879
|
+
const found = (await client.request(LIST_OWN_MACHINE_GRANTS, {
|
|
880
|
+
stewardId,
|
|
881
|
+
agentId
|
|
882
|
+
})).vibecontrolsStewardGrants;
|
|
883
|
+
setState((prev) => {
|
|
884
|
+
if (!prev || prev.scope !== scope) return prev;
|
|
885
|
+
const unchecked = new Set(prev.unchecked);
|
|
886
|
+
unchecked.delete(agentId);
|
|
887
|
+
return {
|
|
888
|
+
...prev,
|
|
889
|
+
grants: [...prev.grants ?? [], ...found],
|
|
890
|
+
unchecked
|
|
891
|
+
};
|
|
892
|
+
});
|
|
893
|
+
}, [
|
|
894
|
+
client,
|
|
895
|
+
stewardId,
|
|
896
|
+
scope
|
|
897
|
+
]);
|
|
898
|
+
if (!enabled) return {
|
|
899
|
+
...EMPTY_MACHINES,
|
|
900
|
+
reload,
|
|
901
|
+
checkAgent
|
|
902
|
+
};
|
|
903
|
+
if (!state || state.scope !== scope) return {
|
|
904
|
+
...EMPTY_MACHINES,
|
|
905
|
+
loading: true,
|
|
906
|
+
reload,
|
|
907
|
+
checkAgent
|
|
908
|
+
};
|
|
909
|
+
return {
|
|
910
|
+
...state,
|
|
911
|
+
reload,
|
|
912
|
+
checkAgent
|
|
913
|
+
};
|
|
758
914
|
}
|
|
759
915
|
/**
|
|
760
916
|
* The desk settings of a steward whose desk kind is OWN_MACHINE, inside the
|
|
@@ -772,27 +928,54 @@ function StewardOwnMachineDesk(props) {
|
|
|
772
928
|
}
|
|
773
929
|
/**
|
|
774
930
|
* The owner's VibeControls machines, which ones have granted this steward,
|
|
775
|
-
* and the one it works on.
|
|
776
|
-
*
|
|
777
|
-
*
|
|
778
|
-
*
|
|
779
|
-
*
|
|
780
|
-
*
|
|
931
|
+
* and the one it works on. The owner can grant a machine to the steward
|
|
932
|
+
* (`grantVibecontrolsAgentToSteward`), revoke the grant, choose a granted
|
|
933
|
+
* machine (`setBotmanorStewardOwnMachineDesk`) or clear the choice
|
|
934
|
+
* (`clearBotmanorStewardOwnMachineDesk`). Controls follow `access`; the
|
|
935
|
+
* service's refusals (no grant, machine in use, changed concurrently, check
|
|
936
|
+
* unavailable) are shown with the service's own message. Refresh and the tab
|
|
937
|
+
* regaining focus reload the desk, the machines and the grants, and a row
|
|
938
|
+
* re-renders when its grant expires. The gateway stays the enforcement point.
|
|
781
939
|
*/
|
|
782
|
-
function StewardOwnMachineDeskPanel({ stewardId, ownerActorId, vibecontrolsUrl = DEFAULT_VIBECONTROLS_URL, onChanged }) {
|
|
940
|
+
function StewardOwnMachineDeskPanel({ stewardId, ownerActorId, vibecontrolsUrl = DEFAULT_VIBECONTROLS_URL, access, onChanged }) {
|
|
941
|
+
const abilities = ownMachineAbilities(ownerActorId, access);
|
|
942
|
+
const { client, config } = useStewardsSdk();
|
|
783
943
|
const desk = useStewardsQuery(GET_STEWARD_OWN_MACHINE_DESK, { stewardId });
|
|
784
|
-
const
|
|
785
|
-
const [machinesNonce, setMachinesNonce] = useState(0);
|
|
786
|
-
const machines = useWorkspaceMachines(machinesNonce);
|
|
944
|
+
const machines = useOwnMachineData(stewardId, ownerActorId, access?.viewerActorId, abilities.read);
|
|
787
945
|
const choose = useStewardsMutation(SET_STEWARD_OWN_MACHINE_DESK);
|
|
788
946
|
const clear = useStewardsMutation(CLEAR_STEWARD_OWN_MACHINE_DESK);
|
|
947
|
+
const grant = useStewardsMutation(GRANT_OWN_MACHINE);
|
|
948
|
+
const revoke = useStewardsMutation(REVOKE_OWN_MACHINE_GRANT);
|
|
949
|
+
const [grantDays, setGrantDays] = useState(7);
|
|
950
|
+
const [appsText, setAppsText] = useState("");
|
|
789
951
|
const [lastAction, setLastAction] = useState(null);
|
|
790
|
-
const
|
|
791
|
-
const
|
|
952
|
+
const [grantNotice, setGrantNotice] = useState(void 0);
|
|
953
|
+
const [granting, setGranting] = useState(false);
|
|
954
|
+
const scopeRef = useRef("");
|
|
955
|
+
useEffect(() => {
|
|
956
|
+
scopeRef.current = JSON.stringify([
|
|
957
|
+
config.gatewayUrl,
|
|
958
|
+
config.workspaceId,
|
|
959
|
+
stewardId,
|
|
960
|
+
ownerActorId,
|
|
961
|
+
access?.viewerActorId ?? null,
|
|
962
|
+
abilities.grant
|
|
963
|
+
]);
|
|
964
|
+
});
|
|
965
|
+
useEffect(() => () => {
|
|
966
|
+
scopeRef.current = "";
|
|
967
|
+
}, []);
|
|
968
|
+
const actionError = lastAction ? lastAction === "check" ? grantNotice : lastAction === "grant" ? grantNotice ?? grant.error : {
|
|
969
|
+
choose,
|
|
970
|
+
clear,
|
|
971
|
+
revoke
|
|
972
|
+
}[lastAction].error : void 0;
|
|
973
|
+
const refetchDesk = desk.refetch;
|
|
974
|
+
const reloadMachines = machines.reload;
|
|
792
975
|
const refresh = useCallback(() => {
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
}, [
|
|
976
|
+
refetchDesk();
|
|
977
|
+
reloadMachines();
|
|
978
|
+
}, [refetchDesk, reloadMachines]);
|
|
796
979
|
useEffect(() => {
|
|
797
980
|
if (typeof window === "undefined") return void 0;
|
|
798
981
|
const onFocus = () => refresh();
|
|
@@ -800,24 +983,86 @@ function StewardOwnMachineDeskPanel({ stewardId, ownerActorId, vibecontrolsUrl =
|
|
|
800
983
|
return () => window.removeEventListener("focus", onFocus);
|
|
801
984
|
}, [refresh]);
|
|
802
985
|
const current = desk.data?.botmanorStewardOwnMachineDesk ?? null;
|
|
803
|
-
const
|
|
804
|
-
const
|
|
805
|
-
const
|
|
986
|
+
const grants = machines.grants ?? [];
|
|
987
|
+
const rows = ownMachineRows(machines.agents ?? [], grants, ownerActorId, current?.agentId ?? null);
|
|
988
|
+
const [expiryTick, setExpiryTick] = useState(0);
|
|
989
|
+
const nextExpiry = nextOwnMachineGrantExpiry(grants);
|
|
990
|
+
useEffect(() => {
|
|
991
|
+
if (nextExpiry === null) return void 0;
|
|
992
|
+
const delay = Math.min(Math.max(nextExpiry - Date.now(), 0) + 1e3, 2 ** 31 - 1);
|
|
993
|
+
const id = setTimeout(() => setExpiryTick((n) => n + 1), delay);
|
|
994
|
+
return () => clearTimeout(id);
|
|
995
|
+
}, [nextExpiry, expiryTick]);
|
|
996
|
+
const deskBusy = choose.loading || clear.loading;
|
|
997
|
+
const busy = deskBusy || granting || grant.loading || revoke.loading || machines.loading;
|
|
998
|
+
const listed = machines.agents !== void 0 && machines.grants !== void 0;
|
|
806
999
|
const onChoose = async (agentId) => {
|
|
807
1000
|
setLastAction("choose");
|
|
808
1001
|
const result = await choose.mutate({ input: {
|
|
809
1002
|
stewardId,
|
|
810
1003
|
agentId
|
|
811
1004
|
} });
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
onChanged?.(result.setBotmanorStewardOwnMachineDesk);
|
|
1005
|
+
refresh();
|
|
1006
|
+
if (result) onChanged?.(result.setBotmanorStewardOwnMachineDesk);
|
|
815
1007
|
};
|
|
816
1008
|
const onClear = async () => {
|
|
817
1009
|
setLastAction("clear");
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
onChanged?.(null);
|
|
1010
|
+
const result = await clear.mutate({ stewardId });
|
|
1011
|
+
refresh();
|
|
1012
|
+
if (result) onChanged?.(null);
|
|
1013
|
+
};
|
|
1014
|
+
const onGrant = async (agentId) => {
|
|
1015
|
+
if (granting) return;
|
|
1016
|
+
setGranting(true);
|
|
1017
|
+
setLastAction("grant");
|
|
1018
|
+
setGrantNotice(void 0);
|
|
1019
|
+
const startedIn = scopeRef.current;
|
|
1020
|
+
if (ownMachineAppCount(appsText) > 64) {
|
|
1021
|
+
setGrantNotice(/* @__PURE__ */ new Error(`A grant allows at most ${64} apps. Shorten the list and grant again.`));
|
|
1022
|
+
setGranting(false);
|
|
1023
|
+
return;
|
|
1024
|
+
}
|
|
1025
|
+
try {
|
|
1026
|
+
const existing = (await client.request(LIST_OWN_MACHINE_GRANTS, {
|
|
1027
|
+
stewardId,
|
|
1028
|
+
agentId
|
|
1029
|
+
})).vibecontrolsStewardGrants;
|
|
1030
|
+
if (!startedIn || scopeRef.current !== startedIn) return;
|
|
1031
|
+
if (existing.some((g) => g.status === "ACTIVE")) {
|
|
1032
|
+
setGrantNotice(/* @__PURE__ */ new Error("This machine already has a live grant for this steward. Revoke it first to change its apps or length."));
|
|
1033
|
+
return;
|
|
1034
|
+
}
|
|
1035
|
+
await grant.mutate({ input: {
|
|
1036
|
+
stewardId,
|
|
1037
|
+
agentId,
|
|
1038
|
+
allowedApps: ownMachineAllowedApps(appsText),
|
|
1039
|
+
expiresAt: ownMachineGrantExpiry(grantDays)
|
|
1040
|
+
} });
|
|
1041
|
+
} catch (err) {
|
|
1042
|
+
setGrantNotice(err instanceof Error ? err : new Error(String(err)));
|
|
1043
|
+
} finally {
|
|
1044
|
+
setGranting(false);
|
|
1045
|
+
refresh();
|
|
1046
|
+
}
|
|
1047
|
+
};
|
|
1048
|
+
const checkAgent = machines.checkAgent;
|
|
1049
|
+
const onCheck = async (agentId) => {
|
|
1050
|
+
setLastAction("check");
|
|
1051
|
+
setGrantNotice(void 0);
|
|
1052
|
+
try {
|
|
1053
|
+
await checkAgent(agentId);
|
|
1054
|
+
} catch (err) {
|
|
1055
|
+
setGrantNotice(err instanceof Error ? err : new Error(String(err)));
|
|
1056
|
+
}
|
|
1057
|
+
};
|
|
1058
|
+
const onRevoke = async (agentId) => {
|
|
1059
|
+
const now = Date.now();
|
|
1060
|
+
const live = grants.find((g) => g.agentId === agentId && isLive(g, now));
|
|
1061
|
+
if (live) {
|
|
1062
|
+
setLastAction("revoke");
|
|
1063
|
+
await revoke.mutate({ id: live.id });
|
|
1064
|
+
}
|
|
1065
|
+
refresh();
|
|
821
1066
|
};
|
|
822
1067
|
return /* @__PURE__ */ jsxs("section", {
|
|
823
1068
|
"aria-label": "Own machine",
|
|
@@ -831,8 +1076,7 @@ function StewardOwnMachineDeskPanel({ stewardId, ownerActorId, vibecontrolsUrl =
|
|
|
831
1076
|
children: "Own machine"
|
|
832
1077
|
}),
|
|
833
1078
|
/* @__PURE__ */ jsxs(Muted, { children: [
|
|
834
|
-
"The steward works on one of your VibeControls machines.
|
|
835
|
-
" ",
|
|
1079
|
+
abilities.manage ? "The steward works on one of your VibeControls machines. Grant a machine to this steward, then choose it. Your machines are also managed in " : "The steward works on one of its owner's VibeControls machines. Only the steward's owner can grant or choose a machine. Machines are managed in ",
|
|
836
1080
|
/* @__PURE__ */ jsx("a", {
|
|
837
1081
|
href: vibecontrolsUrl,
|
|
838
1082
|
target: "_blank",
|
|
@@ -847,33 +1091,103 @@ function StewardOwnMachineDeskPanel({ stewardId, ownerActorId, vibecontrolsUrl =
|
|
|
847
1091
|
error: desk.error,
|
|
848
1092
|
current,
|
|
849
1093
|
name: rows.find((r) => r.chosen)?.agent.name,
|
|
850
|
-
|
|
1094
|
+
canClear: abilities.manage,
|
|
1095
|
+
busy: deskBusy,
|
|
851
1096
|
onClear: () => void onClear()
|
|
852
1097
|
}),
|
|
853
1098
|
/* @__PURE__ */ jsx("p", {
|
|
854
1099
|
style: { margin: "8px 0 0" },
|
|
855
1100
|
children: /* @__PURE__ */ jsx(Button, {
|
|
856
1101
|
onClick: refresh,
|
|
857
|
-
disabled: machines.loading ||
|
|
1102
|
+
disabled: machines.loading || desk.loading,
|
|
858
1103
|
label: "Refresh your machines",
|
|
859
1104
|
children: "Refresh"
|
|
860
1105
|
})
|
|
861
1106
|
}),
|
|
862
|
-
/* @__PURE__ */ jsx(
|
|
863
|
-
|
|
1107
|
+
abilities.grant ? /* @__PURE__ */ jsx(GrantOptions, {
|
|
1108
|
+
stewardId,
|
|
1109
|
+
days: grantDays,
|
|
1110
|
+
onDays: setGrantDays,
|
|
1111
|
+
appsText,
|
|
1112
|
+
onAppsText: setAppsText
|
|
1113
|
+
}) : null,
|
|
1114
|
+
abilities.read ? /* @__PURE__ */ jsx(MachineList, {
|
|
1115
|
+
loading: !listed && machines.loading,
|
|
864
1116
|
listed,
|
|
865
1117
|
truncated: machines.truncated,
|
|
866
|
-
error: machines.error
|
|
1118
|
+
error: machines.error,
|
|
867
1119
|
rows,
|
|
1120
|
+
unchecked: machines.unchecked,
|
|
1121
|
+
ownerActorId,
|
|
868
1122
|
busy,
|
|
869
|
-
|
|
870
|
-
|
|
1123
|
+
canChoose: abilities.manage,
|
|
1124
|
+
canGrant: abilities.grant,
|
|
1125
|
+
onCheck: (agentId) => void onCheck(agentId),
|
|
1126
|
+
onChoose: (agentId) => void onChoose(agentId),
|
|
1127
|
+
onGrant: (agentId) => void onGrant(agentId),
|
|
1128
|
+
onRevoke: (agentId) => void onRevoke(agentId)
|
|
1129
|
+
}) : /* @__PURE__ */ jsx(Muted, { children: "Your role cannot see VibeControls machines in this workspace." }),
|
|
871
1130
|
/* @__PURE__ */ jsx(ErrorNote, { error: actionError })
|
|
872
1131
|
]
|
|
873
1132
|
});
|
|
874
1133
|
}
|
|
875
|
-
/**
|
|
876
|
-
function
|
|
1134
|
+
/** How long a new grant lasts, and the apps it allows. */
|
|
1135
|
+
function GrantOptions({ stewardId, days, onDays, appsText, onAppsText }) {
|
|
1136
|
+
const instance = useId();
|
|
1137
|
+
const daysId = `own-machine-days-${stewardId}-${instance}`;
|
|
1138
|
+
const appsId = `own-machine-apps-${stewardId}-${instance}`;
|
|
1139
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1140
|
+
style: {
|
|
1141
|
+
display: "grid",
|
|
1142
|
+
gap: "4px",
|
|
1143
|
+
marginTop: "8px"
|
|
1144
|
+
},
|
|
1145
|
+
children: [
|
|
1146
|
+
/* @__PURE__ */ jsx("label", {
|
|
1147
|
+
htmlFor: daysId,
|
|
1148
|
+
style: {
|
|
1149
|
+
fontSize: "13px",
|
|
1150
|
+
fontWeight: 500
|
|
1151
|
+
},
|
|
1152
|
+
children: "A new grant lasts"
|
|
1153
|
+
}),
|
|
1154
|
+
/* @__PURE__ */ jsx("select", {
|
|
1155
|
+
id: daysId,
|
|
1156
|
+
value: days,
|
|
1157
|
+
onChange: (e) => {
|
|
1158
|
+
const next = OWN_MACHINE_GRANT_DAYS.find((d) => d === Number(e.target.value));
|
|
1159
|
+
if (next) onDays(next);
|
|
1160
|
+
},
|
|
1161
|
+
style: {
|
|
1162
|
+
...fieldStyle,
|
|
1163
|
+
width: "auto"
|
|
1164
|
+
},
|
|
1165
|
+
children: OWN_MACHINE_GRANT_DAYS.map((d) => /* @__PURE__ */ jsx("option", {
|
|
1166
|
+
value: d,
|
|
1167
|
+
children: d === 1 ? "1 day" : `${d} days`
|
|
1168
|
+
}, d))
|
|
1169
|
+
}),
|
|
1170
|
+
/* @__PURE__ */ jsx("label", {
|
|
1171
|
+
htmlFor: appsId,
|
|
1172
|
+
style: {
|
|
1173
|
+
fontSize: "13px",
|
|
1174
|
+
fontWeight: 500
|
|
1175
|
+
},
|
|
1176
|
+
children: "Apps the steward may use on a granted machine"
|
|
1177
|
+
}),
|
|
1178
|
+
/* @__PURE__ */ jsx("textarea", {
|
|
1179
|
+
id: appsId,
|
|
1180
|
+
value: appsText,
|
|
1181
|
+
onChange: (e) => onAppsText(e.target.value),
|
|
1182
|
+
rows: 3,
|
|
1183
|
+
style: fieldStyle
|
|
1184
|
+
}),
|
|
1185
|
+
/* @__PURE__ */ jsx(Muted, { children: "One app name or platform id per line (for example a macOS bundle id). Desktop actions in other apps are refused; browser and workspace-folder actions are not limited by this list." })
|
|
1186
|
+
]
|
|
1187
|
+
});
|
|
1188
|
+
}
|
|
1189
|
+
/** The machine the steward works on now, with Clear for the owner. */
|
|
1190
|
+
function CurrentMachine({ loading, loaded, error, current, name, canClear, busy, onClear }) {
|
|
877
1191
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
878
1192
|
loading ? /* @__PURE__ */ jsx(Muted, { children: "Loading the desk…" }) : null,
|
|
879
1193
|
/* @__PURE__ */ jsx(ErrorNote, { error }),
|
|
@@ -884,19 +1198,19 @@ function CurrentMachine({ loading, loaded, error, current, name, busy, onClear }
|
|
|
884
1198
|
" ",
|
|
885
1199
|
name ?? current.agentId,
|
|
886
1200
|
" ",
|
|
887
|
-
/* @__PURE__ */ jsx(Button, {
|
|
1201
|
+
canClear ? /* @__PURE__ */ jsx(Button, {
|
|
888
1202
|
kind: "danger",
|
|
889
1203
|
onClick: onClear,
|
|
890
1204
|
disabled: busy,
|
|
891
1205
|
label: "Clear the machine",
|
|
892
1206
|
children: "Clear"
|
|
893
|
-
})
|
|
1207
|
+
}) : null
|
|
894
1208
|
]
|
|
895
1209
|
}) : loaded ? /* @__PURE__ */ jsx(Muted, { children: "No machine chosen yet." }) : null
|
|
896
1210
|
] });
|
|
897
1211
|
}
|
|
898
|
-
/** The owner's machines, each with its grant and
|
|
899
|
-
function MachineList({ loading, listed, truncated, error, rows,
|
|
1212
|
+
/** The owner's machines, each with its grant and what the viewer may do. */
|
|
1213
|
+
function MachineList({ loading, listed, truncated, error, rows, ...actions }) {
|
|
900
1214
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
901
1215
|
loading ? /* @__PURE__ */ jsx(Muted, { children: "Loading your machines…" }) : null,
|
|
902
1216
|
/* @__PURE__ */ jsx(ErrorNote, { error }),
|
|
@@ -907,13 +1221,13 @@ function MachineList({ loading, listed, truncated, error, rows, busy, onChoose }
|
|
|
907
1221
|
"aria-label": "Your machines",
|
|
908
1222
|
children: rows.map((row) => /* @__PURE__ */ jsx(MachineRow, {
|
|
909
1223
|
row,
|
|
910
|
-
|
|
911
|
-
onChoose
|
|
1224
|
+
...actions
|
|
912
1225
|
}, row.agent.id))
|
|
913
1226
|
}) : null
|
|
914
1227
|
] });
|
|
915
1228
|
}
|
|
916
|
-
function MachineRow({ row: { agent, granted, chosen }, busy, onChoose }) {
|
|
1229
|
+
function MachineRow({ row: { agent, granted, chosen }, unchecked, ownerActorId, onCheck, busy, canChoose, canGrant, onChoose, onGrant, onRevoke }) {
|
|
1230
|
+
const unknown = !granted && unchecked.has(agent.id);
|
|
917
1231
|
return /* @__PURE__ */ jsxs("li", {
|
|
918
1232
|
style: rowStyle,
|
|
919
1233
|
children: [
|
|
@@ -921,17 +1235,40 @@ function MachineRow({ row: { agent, granted, chosen }, busy, onChoose }) {
|
|
|
921
1235
|
" ",
|
|
922
1236
|
/* @__PURE__ */ jsx(Muted, { children: agent.hostname }),
|
|
923
1237
|
" ",
|
|
924
|
-
/* @__PURE__ */ jsx(Badge, { children: agent.isActive ? "
|
|
1238
|
+
/* @__PURE__ */ jsx(Badge, { children: agent.isActive ? "Active" : "Inactive" }),
|
|
1239
|
+
" ",
|
|
1240
|
+
/* @__PURE__ */ jsx(Badge, { children: granted ? "Granted" : unknown ? "Grant not checked" : "Not granted" }),
|
|
1241
|
+
" ",
|
|
1242
|
+
chosen ? /* @__PURE__ */ jsx(Badge, { children: "Chosen" }) : null,
|
|
925
1243
|
" ",
|
|
926
|
-
/* @__PURE__ */ jsx(
|
|
1244
|
+
(canGrant || canChoose) && unknown ? /* @__PURE__ */ jsx(Button, {
|
|
1245
|
+
onClick: () => onCheck(agent.id),
|
|
1246
|
+
disabled: busy,
|
|
1247
|
+
label: `Check the grant on ${agent.name}`,
|
|
1248
|
+
children: "Check grant"
|
|
1249
|
+
}) : null,
|
|
927
1250
|
" ",
|
|
928
|
-
|
|
1251
|
+
canGrant && !granted && !unknown && agent.ownerUserId === ownerActorId ? /* @__PURE__ */ jsx(Button, {
|
|
1252
|
+
onClick: () => onGrant(agent.id),
|
|
1253
|
+
disabled: busy,
|
|
1254
|
+
label: `Grant ${agent.name} to this steward`,
|
|
1255
|
+
children: "Grant to this steward"
|
|
1256
|
+
}) : null,
|
|
1257
|
+
" ",
|
|
1258
|
+
canChoose && granted && !chosen ? /* @__PURE__ */ jsx(Button, {
|
|
929
1259
|
kind: "primary",
|
|
930
1260
|
onClick: () => onChoose(agent.id),
|
|
931
|
-
disabled: busy
|
|
1261
|
+
disabled: busy,
|
|
932
1262
|
label: `Use ${agent.name}`,
|
|
933
1263
|
children: "Use this machine"
|
|
934
|
-
}),
|
|
1264
|
+
}) : null,
|
|
1265
|
+
" ",
|
|
1266
|
+
canGrant && granted ? /* @__PURE__ */ jsx(Button, {
|
|
1267
|
+
onClick: () => onRevoke(agent.id),
|
|
1268
|
+
disabled: busy,
|
|
1269
|
+
label: `Revoke the grant on ${agent.name}`,
|
|
1270
|
+
children: "Revoke grant"
|
|
1271
|
+
}) : null,
|
|
935
1272
|
/* @__PURE__ */ jsxs(Muted, { children: ["Last seen ", formatDate(agent.lastHeartbeat)] })
|
|
936
1273
|
]
|
|
937
1274
|
});
|
|
@@ -1104,7 +1441,7 @@ function RunApprovals({ approvals }) {
|
|
|
1104
1441
|
|
|
1105
1442
|
// src/components/StewardConsole.tsx
|
|
1106
1443
|
/** List stewards, or open one: its charter summary, start a run, recent runs. */
|
|
1107
|
-
function StewardConsole({ stewardId, onSelectSteward, vibecontrolsUrl }) {
|
|
1444
|
+
function StewardConsole({ stewardId, onSelectSteward, vibecontrolsUrl, ownMachineAccess }) {
|
|
1108
1445
|
const { config } = useStewardsSdk();
|
|
1109
1446
|
const [opened, setOpened] = useState(void 0);
|
|
1110
1447
|
const current = stewardId ?? opened;
|
|
@@ -1118,7 +1455,8 @@ function StewardConsole({ stewardId, onSelectSteward, vibecontrolsUrl }) {
|
|
|
1118
1455
|
}), current ? /* @__PURE__ */ jsx(StewardPanel, {
|
|
1119
1456
|
stewardId: current,
|
|
1120
1457
|
onBack: stewardId ? void 0 : () => setOpened(void 0),
|
|
1121
|
-
vibecontrolsUrl
|
|
1458
|
+
vibecontrolsUrl,
|
|
1459
|
+
ownMachineAccess
|
|
1122
1460
|
}) : /* @__PURE__ */ jsx(StewardList, { onSelect: (id) => {
|
|
1123
1461
|
setOpened(id);
|
|
1124
1462
|
onSelectSteward?.(id);
|
|
@@ -1155,14 +1493,23 @@ function StewardList({ onSelect }) {
|
|
|
1155
1493
|
}) : null
|
|
1156
1494
|
] });
|
|
1157
1495
|
}
|
|
1158
|
-
function StewardPanel({ stewardId, onBack, vibecontrolsUrl }) {
|
|
1496
|
+
function StewardPanel({ stewardId, onBack, vibecontrolsUrl, ownMachineAccess }) {
|
|
1159
1497
|
const steward = useStewardsQuery(GET_STEWARD, { id: stewardId });
|
|
1160
1498
|
const runs = useStewardsQuery(LIST_STEWARD_RUNS, {
|
|
1161
1499
|
filter: { stewardId },
|
|
1162
1500
|
pagination: { limit: 10 }
|
|
1163
1501
|
}, { pollMs: (d) => d.listBotmanorStewardRuns.some((r) => !isTerminalRunStatus(r.status)) ? 5e3 : false });
|
|
1164
1502
|
const [selectedRun, setSelectedRun] = useState(void 0);
|
|
1165
|
-
const
|
|
1503
|
+
const [confirmed, setConfirmed] = useState(void 0);
|
|
1504
|
+
const latestAnswer = useRef(steward.data);
|
|
1505
|
+
latestAnswer.current = steward.data;
|
|
1506
|
+
const loaded = steward.data?.getBotmanorSteward ?? void 0;
|
|
1507
|
+
const override = confirmed && confirmed.stewardId === stewardId && loaded?.id === stewardId && steward.data === confirmed.answer ? confirmed.status : void 0;
|
|
1508
|
+
if (confirmed && !override) setConfirmed(void 0);
|
|
1509
|
+
const detail = loaded && override ? {
|
|
1510
|
+
...loaded,
|
|
1511
|
+
status: override
|
|
1512
|
+
} : loaded;
|
|
1166
1513
|
const notFound = !steward.loading && !steward.error && !detail;
|
|
1167
1514
|
const onStarted = (runId) => {
|
|
1168
1515
|
setSelectedRun(runId);
|
|
@@ -1181,9 +1528,23 @@ function StewardPanel({ stewardId, onBack, vibecontrolsUrl }) {
|
|
|
1181
1528
|
notFound ? /* @__PURE__ */ jsx(Muted, { children: "This steward was not found." }) : null,
|
|
1182
1529
|
detail ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1183
1530
|
/* @__PURE__ */ jsx(StewardSummary, { detail }),
|
|
1531
|
+
/* @__PURE__ */ jsx(StatusActions, {
|
|
1532
|
+
detail,
|
|
1533
|
+
canUpdate: ownMachineAccess?.canUpdateSteward !== false,
|
|
1534
|
+
onChanged: (id, status) => {
|
|
1535
|
+
if (id !== stewardId) return;
|
|
1536
|
+
setConfirmed({
|
|
1537
|
+
stewardId: id,
|
|
1538
|
+
status,
|
|
1539
|
+
answer: latestAnswer.current
|
|
1540
|
+
});
|
|
1541
|
+
steward.refetch();
|
|
1542
|
+
}
|
|
1543
|
+
}),
|
|
1184
1544
|
/* @__PURE__ */ jsx(OwnMachineSection, {
|
|
1185
1545
|
detail,
|
|
1186
|
-
vibecontrolsUrl
|
|
1546
|
+
vibecontrolsUrl,
|
|
1547
|
+
access: ownMachineAccess
|
|
1187
1548
|
}),
|
|
1188
1549
|
detail.status === "ACTIVE" ? /* @__PURE__ */ jsx(StartRunForm, {
|
|
1189
1550
|
stewardId,
|
|
@@ -1201,12 +1562,59 @@ function StewardPanel({ stewardId, onBack, vibecontrolsUrl }) {
|
|
|
1201
1562
|
] }) : null
|
|
1202
1563
|
] });
|
|
1203
1564
|
}
|
|
1565
|
+
/** The status a steward moves to from each status, with its button label (archiving stays in BotManor). */
|
|
1566
|
+
const NEXT_STATUS = {
|
|
1567
|
+
DRAFT: {
|
|
1568
|
+
to: "ACTIVE",
|
|
1569
|
+
label: "Activate steward"
|
|
1570
|
+
},
|
|
1571
|
+
ACTIVE: {
|
|
1572
|
+
to: "PAUSED",
|
|
1573
|
+
label: "Pause steward"
|
|
1574
|
+
},
|
|
1575
|
+
PAUSED: {
|
|
1576
|
+
to: "ACTIVE",
|
|
1577
|
+
label: "Resume steward"
|
|
1578
|
+
}
|
|
1579
|
+
};
|
|
1580
|
+
/**
|
|
1581
|
+
* Activate a new (draft) steward, or pause and resume one (BOFF-18393). A
|
|
1582
|
+
* steward created here starts as a draft, and only an active steward can run,
|
|
1583
|
+
* so without this a person had to leave the app to finish setting it up.
|
|
1584
|
+
* Shown to a viewer with botmanor-steward:update (`canUpdateSteward`); without
|
|
1585
|
+
* an access answer the gateway decides.
|
|
1586
|
+
*/
|
|
1587
|
+
function StatusActions({ detail, canUpdate, onChanged }) {
|
|
1588
|
+
const change = useStewardsMutation(SET_STEWARD_STATUS);
|
|
1589
|
+
const next = NEXT_STATUS[detail.status];
|
|
1590
|
+
if (!next || !canUpdate) return null;
|
|
1591
|
+
const onClick = async () => {
|
|
1592
|
+
const result = await change.mutate({
|
|
1593
|
+
id: detail.id,
|
|
1594
|
+
status: next.to
|
|
1595
|
+
});
|
|
1596
|
+
if (result) onChanged(result.setBotmanorStewardStatus.id, result.setBotmanorStewardStatus.status);
|
|
1597
|
+
};
|
|
1598
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1599
|
+
style: { margin: "8px 0 0" },
|
|
1600
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
1601
|
+
onClick: () => void onClick(),
|
|
1602
|
+
disabled: change.loading,
|
|
1603
|
+
children: next.label
|
|
1604
|
+
}), /* @__PURE__ */ jsx(ErrorNote, { error: change.error })]
|
|
1605
|
+
});
|
|
1606
|
+
}
|
|
1204
1607
|
/** The machine picker, for a steward whose desk kind is OWN_MACHINE. */
|
|
1205
|
-
function OwnMachineSection({ detail, vibecontrolsUrl }) {
|
|
1608
|
+
function OwnMachineSection({ detail, vibecontrolsUrl, access }) {
|
|
1206
1609
|
if (detail.defaultDeskKind !== "OWN_MACHINE") return null;
|
|
1610
|
+
const effective = detail.status === "ARCHIVED" ? {
|
|
1611
|
+
...access,
|
|
1612
|
+
canUpdateSteward: false
|
|
1613
|
+
} : access ?? {};
|
|
1207
1614
|
return /* @__PURE__ */ jsx(StewardOwnMachineDeskPanel, {
|
|
1208
1615
|
stewardId: detail.id,
|
|
1209
1616
|
ownerActorId: detail.ownerActorId,
|
|
1617
|
+
access: effective,
|
|
1210
1618
|
...vibecontrolsUrl ? { vibecontrolsUrl } : {}
|
|
1211
1619
|
});
|
|
1212
1620
|
}
|
|
@@ -1345,6 +1753,25 @@ function parseCredits(raw) {
|
|
|
1345
1753
|
return Number.isFinite(n) && n >= 0 ? n : null;
|
|
1346
1754
|
}
|
|
1347
1755
|
/**
|
|
1756
|
+
* The daily budget to send when a charter is edited, or `undefined` to leave
|
|
1757
|
+
* it as it is. The service replaces the whole daily budget, so the other daily
|
|
1758
|
+
* limits (steps, desk minutes, wall time, connector spend) set elsewhere are
|
|
1759
|
+
* carried over, and a cleared credit field drops only the credit cap
|
|
1760
|
+
* (BOFF-18393). Nothing is sent when the credit cap did not change.
|
|
1761
|
+
*/
|
|
1762
|
+
function charterBudgetUpdate(current, credits) {
|
|
1763
|
+
if ((current?.credits ?? void 0) === credits) return void 0;
|
|
1764
|
+
const kept = {};
|
|
1765
|
+
if (current?.deskMinutes != null) kept.deskMinutes = current.deskMinutes;
|
|
1766
|
+
if (current?.steps != null) kept.steps = current.steps;
|
|
1767
|
+
if (current?.wallSeconds != null) kept.wallSeconds = current.wallSeconds;
|
|
1768
|
+
if (current?.connectorSpendMinor != null) kept.connectorSpendMinor = current.connectorSpendMinor;
|
|
1769
|
+
return credits === void 0 ? kept : {
|
|
1770
|
+
...kept,
|
|
1771
|
+
credits
|
|
1772
|
+
};
|
|
1773
|
+
}
|
|
1774
|
+
/**
|
|
1348
1775
|
* Create a steward from an agent and a charter, or edit an existing charter:
|
|
1349
1776
|
* the charter text, the autonomy level and a daily credit budget. Duties and
|
|
1350
1777
|
* playbooks live in the full Stewards app.
|
|
@@ -1504,70 +1931,109 @@ function EditForm({ stewardId, onSaved }) {
|
|
|
1504
1931
|
if (!detail?.charter) return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ErrorNote, { error: steward.error }), steward.error ? null : /* @__PURE__ */ jsx(Muted, { children: "This steward was not found." })] });
|
|
1505
1932
|
return /* @__PURE__ */ jsx(EditCharter, {
|
|
1506
1933
|
detail,
|
|
1507
|
-
onSaved
|
|
1508
|
-
|
|
1934
|
+
onSaved,
|
|
1935
|
+
onReload: steward.refetch,
|
|
1936
|
+
reloading: steward.loading,
|
|
1937
|
+
reloadError: steward.error
|
|
1938
|
+
}, detail.charter.charterVersion);
|
|
1509
1939
|
}
|
|
1510
|
-
function EditCharter({ detail, onSaved }) {
|
|
1940
|
+
function EditCharter({ detail, onSaved, onReload, reloading, reloadError }) {
|
|
1511
1941
|
const charter = detail.charter;
|
|
1512
1942
|
const update = useStewardsMutation(UPDATE_STEWARD_CHARTER);
|
|
1943
|
+
const [baseline, setBaseline] = useState({
|
|
1944
|
+
budget: charter?.budgetPerDay ?? null,
|
|
1945
|
+
version: charter?.charterVersion
|
|
1946
|
+
});
|
|
1513
1947
|
const [charterText, setCharterText] = useState(charter?.charterText ?? "");
|
|
1514
1948
|
const [autonomy, setAutonomy] = useState(charter?.autonomyLevel ?? "ASK");
|
|
1515
1949
|
const [credits, setCredits] = useState(charter?.budgetPerDay?.credits != null ? String(charter.budgetPerDay.credits) : "");
|
|
1516
1950
|
const [validation, setValidation] = useState();
|
|
1517
1951
|
const [saved, setSaved] = useState(false);
|
|
1952
|
+
const [conflict, setConflict] = useState(false);
|
|
1953
|
+
if (update.error instanceof StewardsRequestError && update.error.code === "CONFLICT" && !conflict) setConflict(true);
|
|
1518
1954
|
const onSubmit = async (e) => {
|
|
1519
1955
|
e.preventDefault();
|
|
1520
1956
|
const parsed = parseCredits(credits);
|
|
1521
1957
|
if (charterText.trim() === "") return setValidation("The charter cannot be empty.");
|
|
1522
1958
|
if (parsed === null) return setValidation("The daily budget must be a number, 0 or more.");
|
|
1523
1959
|
setValidation(void 0);
|
|
1524
|
-
|
|
1960
|
+
setSaved(false);
|
|
1961
|
+
const budgetPerDay = charterBudgetUpdate(baseline.budget, parsed);
|
|
1962
|
+
const result = await update.mutate({
|
|
1525
1963
|
id: detail.id,
|
|
1526
1964
|
input: {
|
|
1527
1965
|
charterText: charterText.trim(),
|
|
1528
1966
|
autonomyLevel: autonomy,
|
|
1529
|
-
...
|
|
1967
|
+
...budgetPerDay !== void 0 ? { budgetPerDay } : {},
|
|
1968
|
+
...baseline.version !== void 0 ? { expectedCharterVersion: baseline.version } : {}
|
|
1530
1969
|
}
|
|
1531
|
-
})
|
|
1970
|
+
});
|
|
1971
|
+
if (result) {
|
|
1972
|
+
const after = result.updateBotmanorStewardCharter?.charter;
|
|
1973
|
+
if (after) setBaseline({
|
|
1974
|
+
budget: after.budgetPerDay ?? null,
|
|
1975
|
+
version: after.charterVersion
|
|
1976
|
+
});
|
|
1532
1977
|
setSaved(true);
|
|
1533
1978
|
onSaved?.(detail.id);
|
|
1534
1979
|
}
|
|
1535
1980
|
};
|
|
1536
|
-
return /* @__PURE__ */
|
|
1981
|
+
return /* @__PURE__ */ jsx("form", {
|
|
1537
1982
|
onSubmit: (e) => void onSubmit(e),
|
|
1538
1983
|
noValidate: true,
|
|
1539
|
-
children:
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1984
|
+
children: /* @__PURE__ */ jsxs("fieldset", {
|
|
1985
|
+
disabled: reloading,
|
|
1986
|
+
style: {
|
|
1987
|
+
border: 0,
|
|
1988
|
+
margin: 0,
|
|
1989
|
+
padding: 0,
|
|
1990
|
+
minWidth: 0
|
|
1991
|
+
},
|
|
1992
|
+
children: [
|
|
1993
|
+
/* @__PURE__ */ jsx(CharterFields, {
|
|
1994
|
+
idPrefix: "edit",
|
|
1995
|
+
charterText,
|
|
1996
|
+
setCharterText: (v) => {
|
|
1997
|
+
setSaved(false);
|
|
1998
|
+
setCharterText(v);
|
|
1999
|
+
},
|
|
2000
|
+
autonomy,
|
|
2001
|
+
setAutonomy: (v) => {
|
|
2002
|
+
setSaved(false);
|
|
2003
|
+
setAutonomy(v);
|
|
2004
|
+
},
|
|
2005
|
+
credits,
|
|
2006
|
+
setCredits: (v) => {
|
|
2007
|
+
setSaved(false);
|
|
2008
|
+
setCredits(v);
|
|
2009
|
+
}
|
|
2010
|
+
}),
|
|
2011
|
+
validation ? /* @__PURE__ */ jsx(ErrorNote, { error: new Error(validation) }) : null,
|
|
2012
|
+
/* @__PURE__ */ jsx(ErrorNote, { error: update.error }),
|
|
2013
|
+
conflict ? /* @__PURE__ */ jsxs("div", {
|
|
2014
|
+
style: { margin: "8px 0 0" },
|
|
2015
|
+
children: [
|
|
2016
|
+
/* @__PURE__ */ jsx(Muted, { children: "This charter was changed elsewhere. Reload it to edit the latest version; your unsaved changes here are discarded." }),
|
|
2017
|
+
/* @__PURE__ */ jsx(ErrorNote, { error: reloadError }),
|
|
2018
|
+
/* @__PURE__ */ jsx(Button, {
|
|
2019
|
+
type: "button",
|
|
2020
|
+
onClick: onReload,
|
|
2021
|
+
children: "Reload charter"
|
|
2022
|
+
})
|
|
2023
|
+
]
|
|
2024
|
+
}) : null,
|
|
2025
|
+
saved ? /* @__PURE__ */ jsx(Muted, { children: "Charter saved." }) : null,
|
|
2026
|
+
/* @__PURE__ */ jsx("p", {
|
|
2027
|
+
style: { margin: "16px 0 0" },
|
|
2028
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
2029
|
+
type: "submit",
|
|
2030
|
+
kind: "primary",
|
|
2031
|
+
disabled: update.loading || conflict,
|
|
2032
|
+
children: "Save charter"
|
|
2033
|
+
})
|
|
1568
2034
|
})
|
|
1569
|
-
|
|
1570
|
-
|
|
2035
|
+
]
|
|
2036
|
+
})
|
|
1571
2037
|
});
|
|
1572
2038
|
}
|
|
1573
2039
|
|
|
@@ -1701,4 +2167,4 @@ function ApprovalInbox({ stewardId, pollIntervalMs = 15e3 }) {
|
|
|
1701
2167
|
});
|
|
1702
2168
|
}
|
|
1703
2169
|
|
|
1704
|
-
export { ApprovalInbox, DEFAULT_STEWARDS_THEME, DEFAULT_VIBECONTROLS_URL, OWN_MACHINE_MAX_PAGES, OWN_MACHINE_PAGE_SIZE, StewardBuilder, StewardConsole, StewardOwnMachineDesk, StewardOwnMachineDeskPanel, StewardRunView, StewardsRequestError, StewardsSdkProvider, createStewardsEventBus, ownMachineRows, themeToStyle, useStewardsEvent, useStewardsSdk };
|
|
2170
|
+
export { ApprovalInbox, DEFAULT_STEWARDS_THEME, DEFAULT_VIBECONTROLS_URL, OWN_MACHINE_GRANT_DAYS, OWN_MACHINE_MAX_PAGES, OWN_MACHINE_PAGE_SIZE, StewardBuilder, StewardConsole, StewardOwnMachineDesk, StewardOwnMachineDeskPanel, StewardRunView, StewardsRequestError, StewardsSdkProvider, createStewardsEventBus, nextOwnMachineGrantExpiry, ownMachineAbilities, ownMachineAllowedApps, ownMachineAppCount, ownMachineGrantExpiry, ownMachineRows, themeToStyle, useStewardsEvent, useStewardsSdk };
|