@botmanor/fe-sdk 2026.1205.4 → 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.
- package/dist/index.d.ts +19 -1
- package/dist/index.js +48 -13
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -404,6 +404,8 @@ interface OwnMachineGrant {
|
|
|
404
404
|
status: "ACTIVE" | "EXPIRED" | "REVOKED";
|
|
405
405
|
expiresAt: string;
|
|
406
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;
|
|
407
409
|
}
|
|
408
410
|
/** Where the person manages their VibeControls machines, by default. */
|
|
409
411
|
export declare const DEFAULT_VIBECONTROLS_URL = "https://app.vibecontrols.com/";
|
|
@@ -447,11 +449,19 @@ interface OwnMachineRow {
|
|
|
447
449
|
granted: boolean;
|
|
448
450
|
/** The steward works on this machine now. */
|
|
449
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;
|
|
450
458
|
}
|
|
451
459
|
/**
|
|
452
460
|
* The owner's machines for the picker: the owner's agents, chosen one first,
|
|
453
461
|
* then granted ones, then by name. A grant counts while it is ACTIVE and not
|
|
454
|
-
* 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.
|
|
455
465
|
*/
|
|
456
466
|
export declare function ownMachineRows(agents: readonly OwnMachineCandidate[], grants: readonly OwnMachineGrant[], ownerActorId: string, chosenAgentId: string | null, now?: number): OwnMachineRow[];
|
|
457
467
|
/** The expiry to send for a grant of `days`, never past the service's 30-day limit. */
|
|
@@ -465,6 +475,14 @@ export declare function ownMachineAllowedApps(text: string): string[];
|
|
|
465
475
|
export declare function ownMachineAppCount(text: string): number;
|
|
466
476
|
/** When the earliest live grant expires (epoch ms), or null. */
|
|
467
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;
|
|
468
486
|
/** What the viewer may do with the picker, from {@link OwnMachineAccess}. */
|
|
469
487
|
export declare function ownMachineAbilities(ownerActorId: string, access?: OwnMachineAccess): {
|
|
470
488
|
manage: boolean;
|
package/dist/index.js
CHANGED
|
@@ -459,7 +459,7 @@ const LIST_OWN_MACHINE_AGENTS = `query StewardOwnMachineAgents($pagination: Pagi
|
|
|
459
459
|
id name hostname platform isActive ownerUserId lastHeartbeat
|
|
460
460
|
}
|
|
461
461
|
}`;
|
|
462
|
-
const OWN_MACHINE_GRANT = `id agentId status expiresAt scopes`;
|
|
462
|
+
const OWN_MACHINE_GRANT = `id agentId status expiresAt scopes grantorActorId`;
|
|
463
463
|
/**
|
|
464
464
|
* The steward's active grants (VibeControls returns at most 100, newest
|
|
465
465
|
* first). Pass `agentId` to look one machine up when the list may be cut off.
|
|
@@ -1235,16 +1235,32 @@ function isLive(grant, now) {
|
|
|
1235
1235
|
/**
|
|
1236
1236
|
* The owner's machines for the picker: the owner's agents, chosen one first,
|
|
1237
1237
|
* then granted ones, then by name. A grant counts while it is ACTIVE and not
|
|
1238
|
-
* past its expiry (`now`, for tests).
|
|
1238
|
+
* past its expiry (`now`, for tests). A live grant on any other machine
|
|
1239
|
+
* follows as a revoke-only row, so the person who may revoke it still can
|
|
1240
|
+
* (BOFF-18818); a machine the list does not hold is named by its id.
|
|
1239
1241
|
*/
|
|
1240
1242
|
function ownMachineRows(agents, grants, ownerActorId, chosenAgentId, now = Date.now()) {
|
|
1241
1243
|
const granted = new Set(grants.filter((g) => isLive(g, now)).map((g) => g.agentId));
|
|
1242
|
-
const rank = (row) => row.chosen ? 0 : row.granted ? 1 : 2;
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1244
|
+
const rank = (row) => row.revokeOnly ? 3 : row.chosen ? 0 : row.granted ? 1 : 2;
|
|
1245
|
+
const listed = new Set(agents.map((a) => a.id));
|
|
1246
|
+
const unlisted = [...granted].filter((id) => !listed.has(id)).map((id) => ({
|
|
1247
|
+
id,
|
|
1248
|
+
name: `Machine ${id.slice(0, 8)}`,
|
|
1249
|
+
hostname: "",
|
|
1250
|
+
platform: "",
|
|
1251
|
+
isActive: false,
|
|
1252
|
+
ownerUserId: null,
|
|
1253
|
+
lastHeartbeat: null
|
|
1254
|
+
}));
|
|
1255
|
+
return [...agents, ...unlisted].filter((a) => a.ownerUserId === ownerActorId || a.id === chosenAgentId || granted.has(a.id)).map((agent) => {
|
|
1256
|
+
const row = {
|
|
1257
|
+
agent,
|
|
1258
|
+
granted: granted.has(agent.id),
|
|
1259
|
+
chosen: agent.id === chosenAgentId
|
|
1260
|
+
};
|
|
1261
|
+
if (agent.ownerUserId !== ownerActorId && !row.chosen) row.revokeOnly = true;
|
|
1262
|
+
return row;
|
|
1263
|
+
}).sort((a, b) => rank(a) - rank(b) || a.agent.name.localeCompare(b.agent.name));
|
|
1248
1264
|
}
|
|
1249
1265
|
/** The expiry to send for a grant of `days`, never past the service's 30-day limit. */
|
|
1250
1266
|
function ownMachineGrantExpiry(days, now = Date.now()) {
|
|
@@ -1276,6 +1292,21 @@ function nextOwnMachineGrantExpiry(grants, now = Date.now()) {
|
|
|
1276
1292
|
}
|
|
1277
1293
|
return next;
|
|
1278
1294
|
}
|
|
1295
|
+
/**
|
|
1296
|
+
* May the viewer revoke a steward's grant on a machine (BOFF-18818)? The
|
|
1297
|
+
* gateway needs agent:update, and the service then lets the grant's grantor
|
|
1298
|
+
* or the machine's current owner revoke it, whatever they may do with the
|
|
1299
|
+
* steward itself (botmanor-steward:update is not needed). As elsewhere here,
|
|
1300
|
+
* data the host did not give is left to the gateway.
|
|
1301
|
+
*/
|
|
1302
|
+
function ownMachineCanRevoke(machineOwnerId, grantorActorId, access = {}) {
|
|
1303
|
+
if (access.canGrantMachines === false) return false;
|
|
1304
|
+
const viewer = access.viewerActorId;
|
|
1305
|
+
if (viewer === void 0) return true;
|
|
1306
|
+
if (!viewer) return false;
|
|
1307
|
+
if (!machineOwnerId) return true;
|
|
1308
|
+
return viewer === machineOwnerId || viewer === grantorActorId;
|
|
1309
|
+
}
|
|
1279
1310
|
/** What the viewer may do with the picker, from {@link OwnMachineAccess}. */
|
|
1280
1311
|
function ownMachineAbilities(ownerActorId, access = {}) {
|
|
1281
1312
|
const manage = (access.viewerActorId === void 0 || access.viewerActorId === ownerActorId) && access.canUpdateSteward !== false;
|
|
@@ -1642,6 +1673,8 @@ function StewardOwnMachineDeskPanel({ stewardId, ownerActorId, vibecontrolsUrl =
|
|
|
1642
1673
|
busy,
|
|
1643
1674
|
canChoose: abilities.manage,
|
|
1644
1675
|
canGrant: abilities.grant,
|
|
1676
|
+
canCheck: abilities.grant || abilities.manage || access?.canGrantMachines !== false,
|
|
1677
|
+
canRevoke: (agent) => ownMachineCanRevoke(agent.ownerUserId, grants.find((g) => g.agentId === agent.id && isLive(g, Date.now()))?.grantorActorId, access),
|
|
1645
1678
|
onCheck: (agentId) => void onCheck(agentId),
|
|
1646
1679
|
onChoose: (agentId) => void onChoose(agentId),
|
|
1647
1680
|
onGrant: (agentId) => void onGrant(agentId),
|
|
@@ -1752,7 +1785,7 @@ function MachineList({ loading, listed, truncated, error, rows, ...actions }) {
|
|
|
1752
1785
|
}) : null
|
|
1753
1786
|
] });
|
|
1754
1787
|
}
|
|
1755
|
-
function MachineRow({ row: { agent, granted, chosen }, unchecked, ownerActorId, onCheck, busy, canChoose, canGrant, onChoose, onGrant, onRevoke }) {
|
|
1788
|
+
function MachineRow({ row: { agent, granted, chosen, revokeOnly }, unchecked, ownerActorId, onCheck, busy, canChoose, canGrant, canCheck, canRevoke, onChoose, onGrant, onRevoke }) {
|
|
1756
1789
|
const unknown = !granted && unchecked.has(agent.id);
|
|
1757
1790
|
return /* @__PURE__ */ jsxs("li", {
|
|
1758
1791
|
style: rowStyle,
|
|
@@ -1767,7 +1800,9 @@ function MachineRow({ row: { agent, granted, chosen }, unchecked, ownerActorId,
|
|
|
1767
1800
|
" ",
|
|
1768
1801
|
chosen ? /* @__PURE__ */ jsx(Badge, { children: "Chosen" }) : null,
|
|
1769
1802
|
" ",
|
|
1770
|
-
|
|
1803
|
+
revokeOnly ? /* @__PURE__ */ jsx(Badge, { children: "Not the steward owner's machine" }) : null,
|
|
1804
|
+
" ",
|
|
1805
|
+
canCheck && unknown ? /* @__PURE__ */ jsx(Button, {
|
|
1771
1806
|
onClick: () => onCheck(agent.id),
|
|
1772
1807
|
disabled: busy,
|
|
1773
1808
|
label: `Check the grant on ${agent.name}`,
|
|
@@ -1781,7 +1816,7 @@ function MachineRow({ row: { agent, granted, chosen }, unchecked, ownerActorId,
|
|
|
1781
1816
|
children: "Grant to this steward"
|
|
1782
1817
|
}) : null,
|
|
1783
1818
|
" ",
|
|
1784
|
-
canChoose && granted && !chosen ? /* @__PURE__ */ jsx(Button, {
|
|
1819
|
+
canChoose && granted && !chosen && !revokeOnly ? /* @__PURE__ */ jsx(Button, {
|
|
1785
1820
|
kind: "primary",
|
|
1786
1821
|
onClick: () => onChoose(agent.id),
|
|
1787
1822
|
disabled: busy,
|
|
@@ -1789,7 +1824,7 @@ function MachineRow({ row: { agent, granted, chosen }, unchecked, ownerActorId,
|
|
|
1789
1824
|
children: "Use this machine"
|
|
1790
1825
|
}) : null,
|
|
1791
1826
|
" ",
|
|
1792
|
-
|
|
1827
|
+
granted && canRevoke(agent) ? /* @__PURE__ */ jsx(Button, {
|
|
1793
1828
|
onClick: () => onRevoke(agent.id),
|
|
1794
1829
|
disabled: busy,
|
|
1795
1830
|
label: `Revoke the grant on ${agent.name}`,
|
|
@@ -3026,4 +3061,4 @@ function ApprovalInbox({ stewardId, pollIntervalMs = 15e3 }) {
|
|
|
3026
3061
|
});
|
|
3027
3062
|
}
|
|
3028
3063
|
|
|
3029
|
-
export { AGENT_STATUS_LABELS, AGENT_STATUS_SHORT_LABELS, ApprovalInbox, DEFAULT_BOTMANOR_APP_URL, DEFAULT_STEWARDS_THEME, DEFAULT_VIBECONTROLS_URL, GUIDED_ENTRIES, GUIDED_PERMISSIONS, GuidedErrorNote, OWN_MACHINE_GRANT_DAYS, OWN_MACHINE_MAX_PAGES, OWN_MACHINE_PAGE_SIZE, PERMISSION_LABELS, STOP_REASON_LABELS, StewardBuilder, StewardConsole, StewardOwnMachineDesk, StewardOwnMachineDeskPanel, StewardRunView, StewardsRequestError, StewardsSdkProvider, agentPickerLabel, botmanorPath, buildGuidedError, cloudDeskAvailability, createStewardsEventBus, crossShellUrl, describeGuidedError, describeRunFailure, englishGuidedTranslate, extractGuidedSource, fillGuidedParams, guidedI18nBase, guidedParams, guidedText, guidedTranslateFrom, isDefiniteRefusal, isStaleStateError, nextOwnMachineGrantExpiry, ownMachineAbilities, ownMachineAllowedApps, ownMachineAppCount, ownMachineGrantExpiry, ownMachineRows, permissionLabelKey, pickableAgents, planGuidedActions, reasonCamel, resolveGuidedLocation, stepReasonCode, stopReasonLabel, themeToStyle, useStewardsEvent, useStewardsSdk };
|
|
3064
|
+
export { AGENT_STATUS_LABELS, AGENT_STATUS_SHORT_LABELS, ApprovalInbox, DEFAULT_BOTMANOR_APP_URL, DEFAULT_STEWARDS_THEME, DEFAULT_VIBECONTROLS_URL, GUIDED_ENTRIES, GUIDED_PERMISSIONS, GuidedErrorNote, OWN_MACHINE_GRANT_DAYS, OWN_MACHINE_MAX_PAGES, OWN_MACHINE_PAGE_SIZE, PERMISSION_LABELS, STOP_REASON_LABELS, StewardBuilder, StewardConsole, StewardOwnMachineDesk, StewardOwnMachineDeskPanel, StewardRunView, StewardsRequestError, StewardsSdkProvider, agentPickerLabel, botmanorPath, buildGuidedError, cloudDeskAvailability, createStewardsEventBus, crossShellUrl, describeGuidedError, describeRunFailure, englishGuidedTranslate, extractGuidedSource, fillGuidedParams, guidedI18nBase, guidedParams, guidedText, guidedTranslateFrom, isDefiniteRefusal, isStaleStateError, nextOwnMachineGrantExpiry, ownMachineAbilities, ownMachineAllowedApps, ownMachineAppCount, ownMachineCanRevoke, ownMachineGrantExpiry, ownMachineRows, permissionLabelKey, pickableAgents, planGuidedActions, reasonCamel, resolveGuidedLocation, stepReasonCode, stopReasonLabel, themeToStyle, useStewardsEvent, useStewardsSdk };
|