@botmanor/fe-sdk 2026.1204.2 → 2026.1204.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.
- package/README.md +4 -0
- package/dist/index.d.ts +91 -14
- package/dist/index.js +304 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -40,6 +40,10 @@ Apollo and the fe-libs shell.
|
|
|
40
40
|
- `StewardBuilder`: create from an agent and charter, or edit a charter (`stewardId`).
|
|
41
41
|
- `StewardRunView`: steps, approvals, trust level and budget; polls while active.
|
|
42
42
|
- `ApprovalInbox`: pending steward approvals with the approval scope choice.
|
|
43
|
+
- `StewardOwnMachineDesk`: for a steward whose desk kind is `OWN_MACHINE`, the
|
|
44
|
+
owner's VibeControls machines, which ones have granted the steward, and the
|
|
45
|
+
one it works on (choose or clear). `StewardConsole` shows it on such a
|
|
46
|
+
steward; `vibecontrolsUrl` sets where the grant link points.
|
|
43
47
|
|
|
44
48
|
## Events
|
|
45
49
|
|
package/dist/index.d.ts
CHANGED
|
@@ -164,9 +164,14 @@ interface StewardConsoleProps {
|
|
|
164
164
|
*/
|
|
165
165
|
stewardId?: string;
|
|
166
166
|
onSelectSteward?: (stewardId: string) => void;
|
|
167
|
+
/**
|
|
168
|
+
* Link to VibeControls, where a machine's owner grants it to a steward
|
|
169
|
+
* (shown for a steward whose desk kind is OWN_MACHINE).
|
|
170
|
+
*/
|
|
171
|
+
vibecontrolsUrl?: string;
|
|
167
172
|
}
|
|
168
173
|
/** List stewards, or open one: its charter summary, start a run, recent runs. */
|
|
169
|
-
export declare function StewardConsole({ stewardId, onSelectSteward }: StewardConsoleProps): import("react").JSX.Element;
|
|
174
|
+
export declare function StewardConsole({ stewardId, onSelectSteward, vibecontrolsUrl }: StewardConsoleProps): import("react").JSX.Element;
|
|
170
175
|
interface StewardBuilderProps {
|
|
171
176
|
/** Start from an existing agent; omitted shows the agent picker. */
|
|
172
177
|
agentId?: string;
|
|
@@ -195,18 +200,6 @@ interface StewardRunViewProps {
|
|
|
195
200
|
* emits `run.waiting`, `run.completed` and `run.failed` as the status changes.
|
|
196
201
|
*/
|
|
197
202
|
export declare function StewardRunView({ runId, pollIntervalMs }: StewardRunViewProps): import("react").JSX.Element;
|
|
198
|
-
interface ApprovalInboxProps {
|
|
199
|
-
/** Limit to one steward; omitted shows every steward approval the viewer can decide. */
|
|
200
|
-
stewardId?: string;
|
|
201
|
-
/** Poll interval. Defaults to 15000 ms. */
|
|
202
|
-
pollIntervalMs?: number;
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* Pending steward approvals the viewer can decide, with the approval scope
|
|
206
|
-
* choice. Extends the platform tool-approval queue (`source: STEWARD`,
|
|
207
|
-
* `mine: true`) rather than a parallel one.
|
|
208
|
-
*/
|
|
209
|
-
export declare function ApprovalInbox({ stewardId, pollIntervalMs }: ApprovalInboxProps): import("react").JSX.Element;
|
|
210
203
|
/**
|
|
211
204
|
* The slice of the workspace gateway schema the SDK reads and writes. Names
|
|
212
205
|
* follow the `Botmanor*` types of the Hive production supergraph (the same
|
|
@@ -343,4 +336,88 @@ interface StewardApprovalRequest {
|
|
|
343
336
|
expiresAt: string;
|
|
344
337
|
createdAt: string;
|
|
345
338
|
}
|
|
346
|
-
|
|
339
|
+
/** The machine a steward with desk kind OWN_MACHINE works on (BOFF-18623). */
|
|
340
|
+
interface StewardOwnMachineDesk$1 {
|
|
341
|
+
id: string;
|
|
342
|
+
stewardId: string;
|
|
343
|
+
agentId: string;
|
|
344
|
+
/** READY while no run uses the machine, IN_USE while one does. */
|
|
345
|
+
state: string;
|
|
346
|
+
createdAt: string;
|
|
347
|
+
updatedAt: string;
|
|
348
|
+
}
|
|
349
|
+
/** A VibeControls machine (agent) in the workspace. */
|
|
350
|
+
interface OwnMachineCandidate {
|
|
351
|
+
id: string;
|
|
352
|
+
name: string;
|
|
353
|
+
hostname: string;
|
|
354
|
+
platform: string;
|
|
355
|
+
isActive: boolean;
|
|
356
|
+
ownerUserId: string | null;
|
|
357
|
+
lastHeartbeat: string | null;
|
|
358
|
+
}
|
|
359
|
+
/** A VibeControls grant of a machine to a steward. */
|
|
360
|
+
interface OwnMachineGrant {
|
|
361
|
+
id: string;
|
|
362
|
+
agentId: string;
|
|
363
|
+
status: "ACTIVE" | "EXPIRED" | "REVOKED";
|
|
364
|
+
expiresAt: string;
|
|
365
|
+
scopes: string[];
|
|
366
|
+
}
|
|
367
|
+
/** Where the person grants a machine to a steward, by default. */
|
|
368
|
+
export declare const DEFAULT_VIBECONTROLS_URL = "https://app.vibecontrols.com/";
|
|
369
|
+
/** Machines per page when listing the workspace's VibeControls machines. */
|
|
370
|
+
export declare const OWN_MACHINE_PAGE_SIZE = 100;
|
|
371
|
+
/** Pages read at most (10 000 machines); the list says when it stopped early. */
|
|
372
|
+
export declare const OWN_MACHINE_MAX_PAGES = 100;
|
|
373
|
+
interface StewardOwnMachineDeskProps {
|
|
374
|
+
stewardId: string;
|
|
375
|
+
/** The steward's owner: only their machines are offered. */
|
|
376
|
+
ownerActorId: string;
|
|
377
|
+
/** Link to VibeControls, where a machine's owner grants it to a steward. */
|
|
378
|
+
vibecontrolsUrl?: string;
|
|
379
|
+
/** Called after the machine is chosen or cleared. */
|
|
380
|
+
onChanged?: (desk: StewardOwnMachineDesk$1 | null) => void;
|
|
381
|
+
}
|
|
382
|
+
interface OwnMachineRow {
|
|
383
|
+
agent: OwnMachineCandidate;
|
|
384
|
+
/** The steward has an active, unexpired grant on this machine. */
|
|
385
|
+
granted: boolean;
|
|
386
|
+
/** The steward works on this machine now. */
|
|
387
|
+
chosen: boolean;
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* The owner's machines for the picker: the owner's agents, chosen one first,
|
|
391
|
+
* then granted ones, then by name. A grant counts while it is ACTIVE and not
|
|
392
|
+
* past its expiry (`now`, for tests).
|
|
393
|
+
*/
|
|
394
|
+
export declare function ownMachineRows(agents: readonly OwnMachineCandidate[], grants: readonly OwnMachineGrant[], ownerActorId: string, chosenAgentId: string | null, now?: number): OwnMachineRow[];
|
|
395
|
+
/**
|
|
396
|
+
* The desk settings of a steward whose desk kind is OWN_MACHINE, inside the
|
|
397
|
+
* SDK's themed wrapper: use it on its own. `StewardConsole` renders
|
|
398
|
+
* {@link StewardOwnMachineDeskPanel} under its own wrapper.
|
|
399
|
+
*/
|
|
400
|
+
export declare function StewardOwnMachineDesk(props: StewardOwnMachineDeskProps): import("react").JSX.Element;
|
|
401
|
+
/**
|
|
402
|
+
* The owner's VibeControls machines, which ones have granted this steward,
|
|
403
|
+
* and the one it works on. Choosing calls `setBotmanorStewardOwnMachineDesk`,
|
|
404
|
+
* clearing calls `clearBotmanorStewardOwnMachineDesk`; the service's refusals
|
|
405
|
+
* (no grant, machine in use, changed concurrently, check unavailable) are
|
|
406
|
+
* shown with the service's own message. The list refreshes when the tab gets
|
|
407
|
+
* focus again (the owner may have just granted a machine in VibeControls) and
|
|
408
|
+
* on "Refresh". The gateway stays the enforcement point.
|
|
409
|
+
*/
|
|
410
|
+
export declare function StewardOwnMachineDeskPanel({ stewardId, ownerActorId, vibecontrolsUrl, onChanged }: StewardOwnMachineDeskProps): import("react").JSX.Element;
|
|
411
|
+
interface ApprovalInboxProps {
|
|
412
|
+
/** Limit to one steward; omitted shows every steward approval the viewer can decide. */
|
|
413
|
+
stewardId?: string;
|
|
414
|
+
/** Poll interval. Defaults to 15000 ms. */
|
|
415
|
+
pollIntervalMs?: number;
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* Pending steward approvals the viewer can decide, with the approval scope
|
|
419
|
+
* choice. Extends the platform tool-approval queue (`source: STEWARD`,
|
|
420
|
+
* `mine: true`) rather than a parallel one.
|
|
421
|
+
*/
|
|
422
|
+
export declare function ApprovalInbox({ stewardId, pollIntervalMs }: ApprovalInboxProps): import("react").JSX.Element;
|
|
423
|
+
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 };
|
package/dist/index.js
CHANGED
|
@@ -373,6 +373,33 @@ const DECIDE_APPROVAL = `mutation DecideBotmanorToolApproval($id: ID!, $decision
|
|
|
373
373
|
id status grantedScope decidedAt
|
|
374
374
|
}
|
|
375
375
|
}`;
|
|
376
|
+
/**
|
|
377
|
+
* Own-machine desk (BOFF-18623, S-16145a): the VibeControls machine a steward
|
|
378
|
+
* with desk kind OWN_MACHINE works on. The machines and their grants come from
|
|
379
|
+
* the VibeControls subgraph on the same workspace gateway.
|
|
380
|
+
*/
|
|
381
|
+
const OWN_MACHINE_DESK = `id stewardId agentId state createdAt updatedAt`;
|
|
382
|
+
const GET_STEWARD_OWN_MACHINE_DESK = `query BotmanorStewardOwnMachineDesk($stewardId: ID!) {
|
|
383
|
+
botmanorStewardOwnMachineDesk(stewardId: $stewardId) { ${OWN_MACHINE_DESK} }
|
|
384
|
+
}`;
|
|
385
|
+
const SET_STEWARD_OWN_MACHINE_DESK = `mutation SetBotmanorStewardOwnMachineDesk($input: SetBotmanorStewardOwnMachineDeskInput!) {
|
|
386
|
+
setBotmanorStewardOwnMachineDesk(input: $input) { ${OWN_MACHINE_DESK} }
|
|
387
|
+
}`;
|
|
388
|
+
const CLEAR_STEWARD_OWN_MACHINE_DESK = `mutation ClearBotmanorStewardOwnMachineDesk($stewardId: ID!) {
|
|
389
|
+
clearBotmanorStewardOwnMachineDesk(stewardId: $stewardId)
|
|
390
|
+
}`;
|
|
391
|
+
/** One page of the workspace's VibeControls machines (paged by offset). */
|
|
392
|
+
const LIST_OWN_MACHINE_AGENTS = `query StewardOwnMachineAgents($pagination: PaginationInput) {
|
|
393
|
+
vibecontrolsAgents(pagination: $pagination) {
|
|
394
|
+
id name hostname platform isActive ownerUserId lastHeartbeat
|
|
395
|
+
}
|
|
396
|
+
}`;
|
|
397
|
+
/** The steward's active grants (VibeControls returns at most 100, newest first). */
|
|
398
|
+
const LIST_OWN_MACHINE_GRANTS = `query StewardOwnMachineGrants($stewardId: ID!) {
|
|
399
|
+
vibecontrolsStewardGrants(filter: { stewardId: $stewardId }) {
|
|
400
|
+
id agentId status expiresAt scopes
|
|
401
|
+
}
|
|
402
|
+
}`;
|
|
376
403
|
|
|
377
404
|
// src/graphql/hooks.ts
|
|
378
405
|
function asError(err) {
|
|
@@ -638,6 +665,265 @@ function humanize(value) {
|
|
|
638
665
|
return s.charAt(0).toUpperCase() + s.slice(1);
|
|
639
666
|
}
|
|
640
667
|
|
|
668
|
+
// src/components/StewardOwnMachineDesk.tsx
|
|
669
|
+
/** Where the person grants a machine to a steward, by default. */
|
|
670
|
+
const DEFAULT_VIBECONTROLS_URL = "https://app.vibecontrols.com/";
|
|
671
|
+
/** Machines per page when listing the workspace's VibeControls machines. */
|
|
672
|
+
const OWN_MACHINE_PAGE_SIZE = 100;
|
|
673
|
+
/** Pages read at most (10 000 machines); the list says when it stopped early. */
|
|
674
|
+
const OWN_MACHINE_MAX_PAGES = 100;
|
|
675
|
+
/**
|
|
676
|
+
* The owner's machines for the picker: the owner's agents, chosen one first,
|
|
677
|
+
* then granted ones, then by name. A grant counts while it is ACTIVE and not
|
|
678
|
+
* past its expiry (`now`, for tests).
|
|
679
|
+
*/
|
|
680
|
+
function ownMachineRows(agents, grants, ownerActorId, chosenAgentId, now = Date.now()) {
|
|
681
|
+
const granted = new Set(grants.filter((g) => g.status === "ACTIVE" && new Date(g.expiresAt).getTime() > now).map((g) => g.agentId));
|
|
682
|
+
const rank = (row) => row.chosen ? 0 : row.granted ? 1 : 2;
|
|
683
|
+
return agents.filter((a) => a.ownerUserId === ownerActorId || a.id === chosenAgentId).map((agent) => ({
|
|
684
|
+
agent,
|
|
685
|
+
granted: granted.has(agent.id),
|
|
686
|
+
chosen: agent.id === chosenAgentId
|
|
687
|
+
})).sort((a, b) => rank(a) - rank(b) || a.agent.name.localeCompare(b.agent.name));
|
|
688
|
+
}
|
|
689
|
+
/**
|
|
690
|
+
* Every VibeControls machine the viewer can see in the workspace, page by
|
|
691
|
+
* page. The agents query has no owner filter, so the owner's machines can sit
|
|
692
|
+
* on any page; reading only the first would hide them in a large workspace.
|
|
693
|
+
*/
|
|
694
|
+
function useWorkspaceMachines(nonce) {
|
|
695
|
+
const { client } = useStewardsSdk();
|
|
696
|
+
const [state, setState] = useState({
|
|
697
|
+
agents: void 0,
|
|
698
|
+
error: void 0,
|
|
699
|
+
loading: true,
|
|
700
|
+
truncated: false
|
|
701
|
+
});
|
|
702
|
+
useEffect(() => {
|
|
703
|
+
const controller = new AbortController();
|
|
704
|
+
setState((prev) => ({
|
|
705
|
+
...prev,
|
|
706
|
+
loading: true
|
|
707
|
+
}));
|
|
708
|
+
const load = async () => {
|
|
709
|
+
const agents = [];
|
|
710
|
+
for (let page = 0; page < 100; page += 1) {
|
|
711
|
+
const data = await client.request(LIST_OWN_MACHINE_AGENTS, { pagination: {
|
|
712
|
+
limit: 100,
|
|
713
|
+
offset: page * 100
|
|
714
|
+
} }, controller.signal);
|
|
715
|
+
agents.push(...data.vibecontrolsAgents);
|
|
716
|
+
if (data.vibecontrolsAgents.length < 100) return {
|
|
717
|
+
agents,
|
|
718
|
+
truncated: false
|
|
719
|
+
};
|
|
720
|
+
}
|
|
721
|
+
return {
|
|
722
|
+
agents,
|
|
723
|
+
truncated: true
|
|
724
|
+
};
|
|
725
|
+
};
|
|
726
|
+
load().then(({ agents, truncated }) => {
|
|
727
|
+
if (controller.signal.aborted) return;
|
|
728
|
+
setState({
|
|
729
|
+
agents,
|
|
730
|
+
error: void 0,
|
|
731
|
+
loading: false,
|
|
732
|
+
truncated
|
|
733
|
+
});
|
|
734
|
+
}, (err) => {
|
|
735
|
+
if (controller.signal.aborted) return;
|
|
736
|
+
setState((prev) => ({
|
|
737
|
+
...prev,
|
|
738
|
+
error: err instanceof Error ? err : new Error(String(err)),
|
|
739
|
+
loading: false
|
|
740
|
+
}));
|
|
741
|
+
});
|
|
742
|
+
return () => controller.abort();
|
|
743
|
+
}, [client, nonce]);
|
|
744
|
+
return state;
|
|
745
|
+
}
|
|
746
|
+
/**
|
|
747
|
+
* The desk settings of a steward whose desk kind is OWN_MACHINE, inside the
|
|
748
|
+
* SDK's themed wrapper: use it on its own. `StewardConsole` renders
|
|
749
|
+
* {@link StewardOwnMachineDeskPanel} under its own wrapper.
|
|
750
|
+
*/
|
|
751
|
+
function StewardOwnMachineDesk(props) {
|
|
752
|
+
const { config } = useStewardsSdk();
|
|
753
|
+
return /* @__PURE__ */ jsx(ScopedTheme, {
|
|
754
|
+
theme: config.theme,
|
|
755
|
+
label: "Own machine settings",
|
|
756
|
+
component: "steward-own-machine-desk",
|
|
757
|
+
children: /* @__PURE__ */ jsx(StewardOwnMachineDeskPanel, { ...props })
|
|
758
|
+
});
|
|
759
|
+
}
|
|
760
|
+
/**
|
|
761
|
+
* The owner's VibeControls machines, which ones have granted this steward,
|
|
762
|
+
* and the one it works on. Choosing calls `setBotmanorStewardOwnMachineDesk`,
|
|
763
|
+
* clearing calls `clearBotmanorStewardOwnMachineDesk`; the service's refusals
|
|
764
|
+
* (no grant, machine in use, changed concurrently, check unavailable) are
|
|
765
|
+
* shown with the service's own message. The list refreshes when the tab gets
|
|
766
|
+
* focus again (the owner may have just granted a machine in VibeControls) and
|
|
767
|
+
* on "Refresh". The gateway stays the enforcement point.
|
|
768
|
+
*/
|
|
769
|
+
function StewardOwnMachineDeskPanel({ stewardId, ownerActorId, vibecontrolsUrl = DEFAULT_VIBECONTROLS_URL, onChanged }) {
|
|
770
|
+
const desk = useStewardsQuery(GET_STEWARD_OWN_MACHINE_DESK, { stewardId });
|
|
771
|
+
const grants = useStewardsQuery(LIST_OWN_MACHINE_GRANTS, { stewardId });
|
|
772
|
+
const [machinesNonce, setMachinesNonce] = useState(0);
|
|
773
|
+
const machines = useWorkspaceMachines(machinesNonce);
|
|
774
|
+
const choose = useStewardsMutation(SET_STEWARD_OWN_MACHINE_DESK);
|
|
775
|
+
const clear = useStewardsMutation(CLEAR_STEWARD_OWN_MACHINE_DESK);
|
|
776
|
+
const [lastAction, setLastAction] = useState(null);
|
|
777
|
+
const actionError = lastAction === "choose" ? choose.error : lastAction === "clear" ? clear.error : void 0;
|
|
778
|
+
const refetchGrants = grants.refetch;
|
|
779
|
+
const refresh = useCallback(() => {
|
|
780
|
+
refetchGrants();
|
|
781
|
+
setMachinesNonce((n) => n + 1);
|
|
782
|
+
}, [refetchGrants]);
|
|
783
|
+
useEffect(() => {
|
|
784
|
+
if (typeof window === "undefined") return void 0;
|
|
785
|
+
const onFocus = () => refresh();
|
|
786
|
+
window.addEventListener("focus", onFocus);
|
|
787
|
+
return () => window.removeEventListener("focus", onFocus);
|
|
788
|
+
}, [refresh]);
|
|
789
|
+
const current = desk.data?.botmanorStewardOwnMachineDesk ?? null;
|
|
790
|
+
const rows = ownMachineRows(machines.agents ?? [], grants.data?.vibecontrolsStewardGrants ?? [], ownerActorId, current?.agentId ?? null);
|
|
791
|
+
const busy = choose.loading || clear.loading;
|
|
792
|
+
const listed = machines.agents !== void 0 && grants.data !== void 0;
|
|
793
|
+
const onChoose = async (agentId) => {
|
|
794
|
+
setLastAction("choose");
|
|
795
|
+
const result = await choose.mutate({ input: {
|
|
796
|
+
stewardId,
|
|
797
|
+
agentId
|
|
798
|
+
} });
|
|
799
|
+
if (!result) return;
|
|
800
|
+
desk.refetch();
|
|
801
|
+
onChanged?.(result.setBotmanorStewardOwnMachineDesk);
|
|
802
|
+
};
|
|
803
|
+
const onClear = async () => {
|
|
804
|
+
setLastAction("clear");
|
|
805
|
+
if (!await clear.mutate({ stewardId })) return;
|
|
806
|
+
desk.refetch();
|
|
807
|
+
onChanged?.(null);
|
|
808
|
+
};
|
|
809
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
810
|
+
"aria-label": "Own machine",
|
|
811
|
+
style: { marginTop: "16px" },
|
|
812
|
+
children: [
|
|
813
|
+
/* @__PURE__ */ jsx("h3", {
|
|
814
|
+
style: {
|
|
815
|
+
...headingStyle,
|
|
816
|
+
fontSize: "14px"
|
|
817
|
+
},
|
|
818
|
+
children: "Own machine"
|
|
819
|
+
}),
|
|
820
|
+
/* @__PURE__ */ jsxs(Muted, { children: [
|
|
821
|
+
"The steward works on one of your VibeControls machines. A machine can be chosen once you have granted it to this steward in",
|
|
822
|
+
" ",
|
|
823
|
+
/* @__PURE__ */ jsx("a", {
|
|
824
|
+
href: vibecontrolsUrl,
|
|
825
|
+
target: "_blank",
|
|
826
|
+
rel: "noreferrer noopener",
|
|
827
|
+
children: "VibeControls"
|
|
828
|
+
}),
|
|
829
|
+
"."
|
|
830
|
+
] }),
|
|
831
|
+
/* @__PURE__ */ jsx(CurrentMachine, {
|
|
832
|
+
loading: desk.loading && !desk.data,
|
|
833
|
+
loaded: desk.data !== void 0,
|
|
834
|
+
error: desk.error,
|
|
835
|
+
current,
|
|
836
|
+
name: rows.find((r) => r.chosen)?.agent.name,
|
|
837
|
+
busy,
|
|
838
|
+
onClear: () => void onClear()
|
|
839
|
+
}),
|
|
840
|
+
/* @__PURE__ */ jsx("p", {
|
|
841
|
+
style: { margin: "8px 0 0" },
|
|
842
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
843
|
+
onClick: refresh,
|
|
844
|
+
disabled: machines.loading || grants.loading,
|
|
845
|
+
label: "Refresh your machines",
|
|
846
|
+
children: "Refresh"
|
|
847
|
+
})
|
|
848
|
+
}),
|
|
849
|
+
/* @__PURE__ */ jsx(MachineList, {
|
|
850
|
+
loading: !listed && (machines.loading || grants.loading),
|
|
851
|
+
listed,
|
|
852
|
+
truncated: machines.truncated,
|
|
853
|
+
error: machines.error ?? grants.error,
|
|
854
|
+
rows,
|
|
855
|
+
busy,
|
|
856
|
+
onChoose: (agentId) => void onChoose(agentId)
|
|
857
|
+
}),
|
|
858
|
+
/* @__PURE__ */ jsx(ErrorNote, { error: actionError })
|
|
859
|
+
]
|
|
860
|
+
});
|
|
861
|
+
}
|
|
862
|
+
/** The machine the steward works on now, with Clear. */
|
|
863
|
+
function CurrentMachine({ loading, loaded, error, current, name, busy, onClear }) {
|
|
864
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
865
|
+
loading ? /* @__PURE__ */ jsx(Muted, { children: "Loading the desk…" }) : null,
|
|
866
|
+
/* @__PURE__ */ jsx(ErrorNote, { error }),
|
|
867
|
+
current ? /* @__PURE__ */ jsxs("p", {
|
|
868
|
+
style: { margin: "8px 0 0" },
|
|
869
|
+
children: [
|
|
870
|
+
/* @__PURE__ */ jsx(Badge, { children: humanize(current.state) }),
|
|
871
|
+
" ",
|
|
872
|
+
name ?? current.agentId,
|
|
873
|
+
" ",
|
|
874
|
+
/* @__PURE__ */ jsx(Button, {
|
|
875
|
+
kind: "danger",
|
|
876
|
+
onClick: onClear,
|
|
877
|
+
disabled: busy,
|
|
878
|
+
label: "Clear the machine",
|
|
879
|
+
children: "Clear"
|
|
880
|
+
})
|
|
881
|
+
]
|
|
882
|
+
}) : loaded ? /* @__PURE__ */ jsx(Muted, { children: "No machine chosen yet." }) : null
|
|
883
|
+
] });
|
|
884
|
+
}
|
|
885
|
+
/** The owner's machines, each with its grant and a way to choose it. */
|
|
886
|
+
function MachineList({ loading, listed, truncated, error, rows, busy, onChoose }) {
|
|
887
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
888
|
+
loading ? /* @__PURE__ */ jsx(Muted, { children: "Loading your machines…" }) : null,
|
|
889
|
+
/* @__PURE__ */ jsx(ErrorNote, { error }),
|
|
890
|
+
listed && rows.length === 0 ? /* @__PURE__ */ jsx(Muted, { children: "You have no VibeControls machines in this workspace." }) : null,
|
|
891
|
+
truncated ? /* @__PURE__ */ jsx(Muted, { children: "Only the first machines in this workspace are listed." }) : null,
|
|
892
|
+
rows.length > 0 ? /* @__PURE__ */ jsx("ul", {
|
|
893
|
+
style: listStyle,
|
|
894
|
+
"aria-label": "Your machines",
|
|
895
|
+
children: rows.map((row) => /* @__PURE__ */ jsx(MachineRow, {
|
|
896
|
+
row,
|
|
897
|
+
busy,
|
|
898
|
+
onChoose
|
|
899
|
+
}, row.agent.id))
|
|
900
|
+
}) : null
|
|
901
|
+
] });
|
|
902
|
+
}
|
|
903
|
+
function MachineRow({ row: { agent, granted, chosen }, busy, onChoose }) {
|
|
904
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
905
|
+
style: rowStyle,
|
|
906
|
+
children: [
|
|
907
|
+
/* @__PURE__ */ jsx("strong", { children: agent.name }),
|
|
908
|
+
" ",
|
|
909
|
+
/* @__PURE__ */ jsx(Muted, { children: agent.hostname }),
|
|
910
|
+
" ",
|
|
911
|
+
/* @__PURE__ */ jsx(Badge, { children: agent.isActive ? "Online" : "Offline" }),
|
|
912
|
+
" ",
|
|
913
|
+
/* @__PURE__ */ jsx(Badge, { children: granted ? "Granted" : "Not granted" }),
|
|
914
|
+
" ",
|
|
915
|
+
chosen ? /* @__PURE__ */ jsx(Badge, { children: "Chosen" }) : /* @__PURE__ */ jsx(Button, {
|
|
916
|
+
kind: "primary",
|
|
917
|
+
onClick: () => onChoose(agent.id),
|
|
918
|
+
disabled: busy || !granted,
|
|
919
|
+
label: `Use ${agent.name}`,
|
|
920
|
+
children: "Use this machine"
|
|
921
|
+
}),
|
|
922
|
+
/* @__PURE__ */ jsxs(Muted, { children: ["Last seen ", formatDate(agent.lastHeartbeat)] })
|
|
923
|
+
]
|
|
924
|
+
});
|
|
925
|
+
}
|
|
926
|
+
|
|
641
927
|
// src/components/StewardRunView.tsx
|
|
642
928
|
const WAITING_REASON = {
|
|
643
929
|
WAITING_APPROVAL: "APPROVAL",
|
|
@@ -805,7 +1091,7 @@ function RunApprovals({ approvals }) {
|
|
|
805
1091
|
|
|
806
1092
|
// src/components/StewardConsole.tsx
|
|
807
1093
|
/** List stewards, or open one: its charter summary, start a run, recent runs. */
|
|
808
|
-
function StewardConsole({ stewardId, onSelectSteward }) {
|
|
1094
|
+
function StewardConsole({ stewardId, onSelectSteward, vibecontrolsUrl }) {
|
|
809
1095
|
const { config } = useStewardsSdk();
|
|
810
1096
|
const [opened, setOpened] = useState(void 0);
|
|
811
1097
|
const current = stewardId ?? opened;
|
|
@@ -818,7 +1104,8 @@ function StewardConsole({ stewardId, onSelectSteward }) {
|
|
|
818
1104
|
children: "Steward console"
|
|
819
1105
|
}), current ? /* @__PURE__ */ jsx(StewardPanel, {
|
|
820
1106
|
stewardId: current,
|
|
821
|
-
onBack: stewardId ? void 0 : () => setOpened(void 0)
|
|
1107
|
+
onBack: stewardId ? void 0 : () => setOpened(void 0),
|
|
1108
|
+
vibecontrolsUrl
|
|
822
1109
|
}) : /* @__PURE__ */ jsx(StewardList, { onSelect: (id) => {
|
|
823
1110
|
setOpened(id);
|
|
824
1111
|
onSelectSteward?.(id);
|
|
@@ -855,7 +1142,7 @@ function StewardList({ onSelect }) {
|
|
|
855
1142
|
}) : null
|
|
856
1143
|
] });
|
|
857
1144
|
}
|
|
858
|
-
function StewardPanel({ stewardId, onBack }) {
|
|
1145
|
+
function StewardPanel({ stewardId, onBack, vibecontrolsUrl }) {
|
|
859
1146
|
const steward = useStewardsQuery(GET_STEWARD, { id: stewardId });
|
|
860
1147
|
const runs = useStewardsQuery(LIST_STEWARD_RUNS, {
|
|
861
1148
|
filter: { stewardId },
|
|
@@ -881,6 +1168,10 @@ function StewardPanel({ stewardId, onBack }) {
|
|
|
881
1168
|
notFound ? /* @__PURE__ */ jsx(Muted, { children: "This steward was not found." }) : null,
|
|
882
1169
|
detail ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
883
1170
|
/* @__PURE__ */ jsx(StewardSummary, { detail }),
|
|
1171
|
+
/* @__PURE__ */ jsx(OwnMachineSection, {
|
|
1172
|
+
detail,
|
|
1173
|
+
vibecontrolsUrl
|
|
1174
|
+
}),
|
|
884
1175
|
detail.status === "ACTIVE" ? /* @__PURE__ */ jsx(StartRunForm, {
|
|
885
1176
|
stewardId,
|
|
886
1177
|
onStarted
|
|
@@ -897,6 +1188,15 @@ function StewardPanel({ stewardId, onBack }) {
|
|
|
897
1188
|
] }) : null
|
|
898
1189
|
] });
|
|
899
1190
|
}
|
|
1191
|
+
/** The machine picker, for a steward whose desk kind is OWN_MACHINE. */
|
|
1192
|
+
function OwnMachineSection({ detail, vibecontrolsUrl }) {
|
|
1193
|
+
if (detail.defaultDeskKind !== "OWN_MACHINE") return null;
|
|
1194
|
+
return /* @__PURE__ */ jsx(StewardOwnMachineDeskPanel, {
|
|
1195
|
+
stewardId: detail.id,
|
|
1196
|
+
ownerActorId: detail.ownerActorId,
|
|
1197
|
+
...vibecontrolsUrl ? { vibecontrolsUrl } : {}
|
|
1198
|
+
});
|
|
1199
|
+
}
|
|
900
1200
|
function usageLine(detail) {
|
|
901
1201
|
const credits = detail.usageToday?.credits;
|
|
902
1202
|
const usage = credits != null ? `, ${credits} credits used today` : "";
|
|
@@ -1388,4 +1688,4 @@ function ApprovalInbox({ stewardId, pollIntervalMs = 15e3 }) {
|
|
|
1388
1688
|
});
|
|
1389
1689
|
}
|
|
1390
1690
|
|
|
1391
|
-
export { ApprovalInbox, DEFAULT_STEWARDS_THEME, StewardBuilder, StewardConsole, StewardRunView, StewardsRequestError, StewardsSdkProvider, createStewardsEventBus, themeToStyle, useStewardsEvent, useStewardsSdk };
|
|
1691
|
+
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 };
|