@burdenoff/microfe-botmanor 2026.1201.1 → 2026.1201.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.
@@ -3,7 +3,7 @@ import { useCallback as t, useEffect as n, useState as r } from "react";
3
3
  import { gql as i } from "@apollo/client";
4
4
  import { useGatewayClient as a } from "@burdenoff/fe-libs/shared/graphql";
5
5
  // src/botlit/hooks/useToolApprovals.ts
6
- var o = "\n id\n agentId\n agentName\n connectionId\n connectionName\n toolName\n riskLevel\n arguments\n reasons\n mode\n status\n requestedById\n userMessage\n approverRoles\n approverUserIds\n originExecutionId\n expiresAt\n deciderId\n decisionNote\n decidedAt\n resumeStatus\n resumeExecutionId\n resumeError\n resultPreview\n createdAt\n", s = i`
6
+ var o = "\n id\n agentId\n agentName\n connectionId\n connectionName\n toolName\n riskLevel\n arguments\n reasons\n mode\n status\n requestedById\n userMessage\n approverRoles\n approverUserIds\n originExecutionId\n expiresAt\n deciderId\n decisionNote\n decidedAt\n resumeStatus\n resumeExecutionId\n resumeError\n resultPreview\n createdAt\n source\n stewardId\n stewardRunId\n argumentsHash\n destination\n purpose\n requestedScope\n grantedScope\n charterCitation\n reviewerVerdict\n reviewerNote\n batchKey\n consumedAt\n createdRuleId\n fixedDefault\n", s = i`
7
7
  query ListBotmanorToolApprovals(
8
8
  $filter: BotmanorToolApprovalFilterInput
9
9
  $pagination: PaginationInput
@@ -17,61 +17,79 @@ var o = "\n id\n agentId\n agentName\n connectionId\n connectionName\n too
17
17
  $id: ID!
18
18
  $decision: BotmanorToolApprovalDecision!
19
19
  $note: String
20
+ $scope: BotmanorApprovalScope
20
21
  ) {
21
- decideBotmanorToolApproval(id: $id, decision: $decision, note: $note) {
22
+ decideBotmanorToolApproval(id: $id, decision: $decision, note: $note, scope: $scope) {
22
23
  ${o}
23
24
  }
24
25
  }
25
26
  `;
26
- function l(e, t) {
27
+ function l(e) {
28
+ return {
29
+ status: e.status || void 0,
30
+ agentId: e.agentId || void 0,
31
+ source: e.source || void 0,
32
+ stewardId: e.stewardId || void 0,
33
+ mine: e.mine ? !0 : void 0
34
+ };
35
+ }
36
+ function u(e, t) {
27
37
  return e instanceof Error ? e : Error(t);
28
38
  }
29
- function u(i) {
30
- let o = a("workspace"), { workspaceId: c } = e(), [u, d] = r([]), [f, p] = r(!0), [m, h] = r(), { status: g, agentId: _ } = i, v = t(async () => {
31
- if (!c) d([]), p(!1);
39
+ function d(i, o = {}) {
40
+ let c = a("workspace"), { workspaceId: d } = e(), [f, p] = r([]), [m, h] = r(!0), [g, _] = r(), { status: v, agentId: y, source: b, stewardId: x, mine: S } = i, { limit: C = 50, enabled: w = !0 } = o, T = t(async () => {
41
+ if (!d || !w) p([]), h(!1);
32
42
  else {
33
- p(!0), h(void 0);
43
+ h(!0), _(void 0);
34
44
  try {
35
- let e = await o.query({
45
+ let e = await c.query({
36
46
  query: s,
37
47
  variables: {
38
- filter: {
39
- status: g || void 0,
40
- agentId: _ || void 0
41
- },
48
+ filter: l({
49
+ status: v,
50
+ agentId: y,
51
+ source: b,
52
+ stewardId: x,
53
+ mine: S
54
+ }),
42
55
  pagination: {
43
- limit: 50,
56
+ limit: C,
44
57
  offset: 0
45
58
  }
46
59
  },
47
60
  fetchPolicy: "network-only"
48
61
  });
49
- d(e.data?.listBotmanorToolApprovals ?? []);
62
+ p(e.data?.listBotmanorToolApprovals ?? []);
50
63
  } catch (e) {
51
- h(l(e, "Failed to load tool approvals"));
64
+ _(u(e, "Failed to load tool approvals"));
52
65
  } finally {
53
- p(!1);
66
+ h(!1);
54
67
  }
55
68
  }
56
69
  }, [
57
- _,
58
- o,
59
- g,
60
- c
70
+ y,
71
+ c,
72
+ w,
73
+ C,
74
+ S,
75
+ b,
76
+ v,
77
+ x,
78
+ d
61
79
  ]);
62
80
  return n(() => {
63
- v();
64
- }, [v]), {
65
- data: u,
66
- loading: f,
67
- error: m,
68
- refetch: v
81
+ T();
82
+ }, [T]), {
83
+ data: f,
84
+ loading: m,
85
+ error: g,
86
+ refetch: T
69
87
  };
70
88
  }
71
- function d() {
89
+ function f() {
72
90
  let e = a("workspace"), [n, i] = r(null);
73
91
  return {
74
- decide: t(async (t, n, r) => {
92
+ decide: t(async (t, n, r, a) => {
75
93
  i(t);
76
94
  try {
77
95
  let i = (await e.mutate({
@@ -79,13 +97,14 @@ function d() {
79
97
  variables: {
80
98
  id: t,
81
99
  decision: n,
82
- note: r?.trim() || void 0
100
+ note: r?.trim() || void 0,
101
+ scope: a
83
102
  }
84
103
  })).data?.decideBotmanorToolApproval;
85
104
  if (!i) throw Error("Failed to record the decision");
86
105
  return i;
87
106
  } catch (e) {
88
- throw l(e, "Failed to record the decision");
107
+ throw u(e, "Failed to record the decision");
89
108
  } finally {
90
109
  i(null);
91
110
  }
@@ -93,6 +112,6 @@ function d() {
93
112
  pendingId: n
94
113
  };
95
114
  }
96
- export { d as useDecideToolApproval, u as useToolApprovals };
115
+ export { l as toFilterInput, f as useDecideToolApproval, d as useToolApprovals };
97
116
 
98
117
  //# sourceMappingURL=useToolApprovals.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useToolApprovals.js","names":["TOOL_APPROVAL_FIELDS","LIST_DOCUMENT","DECIDE_DOCUMENT","toError","error","fallback","useToolApprovals","client","useGatewayClient","useBotlit","data","setData","useState","loading","setLoading","setError","filter","refetch","useCallback","workspaceId","result","status","agentId","queryError","useEffect","useDecideToolApproval","pendingId","setPendingId","id","record","note","mutationError"],"sources":["../../../src/botlit/hooks/useToolApprovals.ts"],"sourcesContent":["/**\n * Tool approval hooks (BOFF-15360).\n *\n * A TOOL policy can hold risky tool calls for a human decision. The agent\n * answers without the call; approvers see it in the approvals queue and\n * approve (the call runs and the agent posts its answer in the same\n * conversation) or deny it with a reason. These hooks wrap the\n * `*BotmanorToolApproval*` fields of wspace-botmanor-svc.\n */\nimport { gql, type ApolloClient } from '@apollo/client';\nimport { useCallback, useEffect, useState } from 'react';\nimport { useGatewayClient } from '@burdenoff/fe-libs/shared/graphql';\n\nimport { useBotlit } from '../providers/BotlitProvider';\n\nconst TOOL_APPROVAL_FIELDS = `\n id\n agentId\n agentName\n connectionId\n connectionName\n toolName\n riskLevel\n arguments\n reasons\n mode\n status\n requestedById\n userMessage\n approverRoles\n approverUserIds\n originExecutionId\n expiresAt\n deciderId\n decisionNote\n decidedAt\n resumeStatus\n resumeExecutionId\n resumeError\n resultPreview\n createdAt\n`;\n\nconst LIST_DOCUMENT = gql`\n query ListBotmanorToolApprovals(\n $filter: BotmanorToolApprovalFilterInput\n $pagination: PaginationInput\n ) {\n listBotmanorToolApprovals(filter: $filter, pagination: $pagination) {\n ${TOOL_APPROVAL_FIELDS}\n }\n }\n`;\n\nconst DECIDE_DOCUMENT = gql`\n mutation DecideBotmanorToolApproval(\n $id: ID!\n $decision: BotmanorToolApprovalDecision!\n $note: String\n ) {\n decideBotmanorToolApproval(id: $id, decision: $decision, note: $note) {\n ${TOOL_APPROVAL_FIELDS}\n }\n }\n`;\n\nexport type ToolApprovalStatus = 'PENDING' | 'APPROVED' | 'DENIED' | 'EXPIRED' | 'CANCELLED';\nexport type ToolApprovalDecision = 'APPROVE' | 'DENY';\n\nexport interface ToolApprovalRecord {\n id: string;\n agentId: string;\n agentName?: string | null;\n connectionId: string;\n connectionName: string;\n toolName: string;\n riskLevel: string;\n arguments: unknown;\n reasons: string[];\n mode: 'APPROVER' | 'REQUESTER' | string;\n status: ToolApprovalStatus;\n requestedById: string;\n userMessage?: string | null;\n approverRoles: string[];\n approverUserIds: string[];\n originExecutionId?: string | null;\n expiresAt: string;\n deciderId?: string | null;\n decisionNote?: string | null;\n decidedAt?: string | null;\n resumeStatus?: 'RUNNING' | 'COMPLETED' | 'FAILED' | string | null;\n resumeExecutionId?: string | null;\n resumeError?: string | null;\n resultPreview?: string | null;\n createdAt: string;\n}\n\nfunction toError(error: unknown, fallback: string): Error {\n return error instanceof Error ? error : new Error(fallback);\n}\n\n/** Tool approval requests in the workspace, newest first. */\nexport function useToolApprovals(filter: { status?: ToolApprovalStatus; agentId?: string }) {\n const client = useGatewayClient('workspace') as ApolloClient;\n const { workspaceId } = useBotlit();\n const [data, setData] = useState<ToolApprovalRecord[]>([]);\n // True until the first read settles, so the page shows its loading state\n // instead of flashing the empty message before the effect runs.\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | undefined>();\n const { status, agentId } = filter;\n\n const refetch = useCallback(async () => {\n if (!workspaceId) {\n setData([]);\n setLoading(false);\n return;\n }\n setLoading(true);\n setError(undefined);\n try {\n const result = await client.query<{ listBotmanorToolApprovals: ToolApprovalRecord[] }>({\n query: LIST_DOCUMENT,\n variables: {\n filter: { status: status || undefined, agentId: agentId || undefined },\n pagination: { limit: 50, offset: 0 },\n },\n fetchPolicy: 'network-only',\n });\n setData(result.data?.listBotmanorToolApprovals ?? []);\n } catch (queryError) {\n setError(toError(queryError, 'Failed to load tool approvals'));\n } finally {\n setLoading(false);\n }\n }, [agentId, client, status, workspaceId]);\n\n useEffect(() => {\n void refetch();\n }, [refetch]);\n\n return { data, loading, error, refetch };\n}\n\n/** Approve or deny a pending tool call. */\nexport function useDecideToolApproval() {\n const client = useGatewayClient('workspace') as ApolloClient;\n const [pendingId, setPendingId] = useState<string | null>(null);\n\n const decide = useCallback(\n async (\n id: string,\n decision: ToolApprovalDecision,\n note?: string\n ): Promise<ToolApprovalRecord> => {\n setPendingId(id);\n try {\n const result = await client.mutate<{ decideBotmanorToolApproval: ToolApprovalRecord }>({\n mutation: DECIDE_DOCUMENT,\n variables: { id, decision, note: note?.trim() || undefined },\n });\n const record = result.data?.decideBotmanorToolApproval;\n if (!record) throw new Error('Failed to record the decision');\n return record;\n } catch (mutationError) {\n throw toError(mutationError, 'Failed to record the decision');\n } finally {\n setPendingId(null);\n }\n },\n [client]\n );\n\n return { decide, pendingId };\n}\n"],"mappings":";;;;;AAeA,IAAMA,IAAuB,2WA4BvBC,IAAgB,CAAG;;;;;;QAMjBD,EAAqB;;;GAKvBE,IAAkB,CAAG;;;;;;;QAOnBF,EAAqB;;;;AAoC7B,SAASG,EAAQ,GAAgB,GAAyB;CACxD,OAAOC,aAAiB,QAAQA,IAAY,MAAMC,CAAQ;AAC5D;AAGA,SAAgBC,EAAiB,GAA2D;CAC1F,IAAMC,IAASC,EAAiB,WAAW,GACrC,EAAE,mBAAgBC,EAAU,GAC5B,CAACC,GAAMC,KAAWC,EAA+B,CAAC,CAAC,GAGnD,CAACC,GAASC,KAAcF,EAAS,EAAI,GACrC,CAACR,GAAOW,KAAYH,EAA4B,GAChD,EAAE,WAAQ,eAAYI,GAEtBC,IAAUC,EAAY,YAAY;EACtC,IAAI,CAACC,GAEH,AADAR,EAAQ,CAAC,CAAC,GACVG,EAAW,EAAK;OAGlB;GACA,AADAA,EAAW,EAAI,GACfC,EAAS,KAAA,CAAS;GAClB,IAAI;IACF,IAAMK,IAAS,MAAMb,EAAO,MAA2D;KACrF,OAAON;KACP,WAAW;MACT,QAAQ;OAAE,QAAQoB,KAAU,KAAA;OAAW,SAASC,KAAW,KAAA;MAAU;MACrE,YAAY;OAAE,OAAO;OAAI,QAAQ;MAAE;KACrC;KACA,aAAa;IACf,CAAC;IACD,EAAQF,EAAO,MAAM,6BAA6B,CAAC,CAAC;GACtD,SAASG,GAAY;IACnB,EAASpB,EAAQoB,GAAY,+BAA+B,CAAC;GAC/D,UAAU;IACR,EAAW,EAAK;GAClB;EAhBe;CAiBjB,GAAG;EAACD;EAASf;EAAQc;EAAQF;CAAW,CAAC;CAMzC,OAJAK,QAAgB;EACd,EAAa;CACf,GAAG,CAACP,CAAO,CAAC,GAEL;EAAE;EAAM;EAAS;EAAO;CAAQ;AACzC;AAGA,SAAgBQ,IAAwB;CACtC,IAAMlB,IAASC,EAAiB,WAAW,GACrC,CAACkB,GAAWC,KAAgBf,EAAwB,IAAI;CA0B9D,OAAO;EAAE,QAxBMM,EACb,OACE,GACA,GACA,MACgC;GAChC,EAAaU,CAAE;GACf,IAAI;IAKF,IAAMC,KAAS,MAJMtB,EAAO,OAA2D;KACrF,UAAUL;KACV,WAAW;MAAE;MAAI;MAAU,MAAM4B,GAAM,KAAK,KAAK,KAAA;KAAU;IAC7D,CAAC,EAAA,CACqB,MAAM;IAC5B,IAAI,CAACD,GAAQ,MAAU,MAAM,+BAA+B;IAC5D,OAAOA;GACT,SAASE,GAAe;IACtB,MAAM5B,EAAQ4B,GAAe,+BAA+B;GAC9D,UAAU;IACR,EAAa,IAAI;GACnB;EACF,GACA,CAACxB,CAAM,CAGA;EAAQ;CAAU;AAC7B"}
1
+ {"version":3,"file":"useToolApprovals.js","names":["TOOL_APPROVAL_FIELDS","LIST_DOCUMENT","DECIDE_DOCUMENT","toFilterInput","filter","toError","error","fallback","useToolApprovals","client","useGatewayClient","useBotlit","data","setData","useState","loading","setLoading","setError","options","refetch","useCallback","workspaceId","enabled","result","queryError","agentId","limit","mine","source","status","stewardId","useEffect","useDecideToolApproval","pendingId","setPendingId","id","record","note","mutationError"],"sources":["../../../src/botlit/hooks/useToolApprovals.ts"],"sourcesContent":["/**\n * Tool approval hooks (BOFF-15360).\n *\n * A TOOL policy can hold risky tool calls for a human decision. The agent\n * answers without the call; approvers see it in the approvals queue and\n * approve (the call runs and the agent posts its answer in the same\n * conversation) or deny it with a reason. These hooks wrap the\n * `*BotmanorToolApproval*` fields of wspace-botmanor-svc.\n */\nimport { gql, type ApolloClient } from '@apollo/client';\nimport { useCallback, useEffect, useState } from 'react';\nimport { useGatewayClient } from '@burdenoff/fe-libs/shared/graphql';\n\nimport { useBotlit } from '../providers/BotlitProvider';\n\nconst TOOL_APPROVAL_FIELDS = `\n id\n agentId\n agentName\n connectionId\n connectionName\n toolName\n riskLevel\n arguments\n reasons\n mode\n status\n requestedById\n userMessage\n approverRoles\n approverUserIds\n originExecutionId\n expiresAt\n deciderId\n decisionNote\n decidedAt\n resumeStatus\n resumeExecutionId\n resumeError\n resultPreview\n createdAt\n source\n stewardId\n stewardRunId\n argumentsHash\n destination\n purpose\n requestedScope\n grantedScope\n charterCitation\n reviewerVerdict\n reviewerNote\n batchKey\n consumedAt\n createdRuleId\n fixedDefault\n`;\n\nconst LIST_DOCUMENT = gql`\n query ListBotmanorToolApprovals(\n $filter: BotmanorToolApprovalFilterInput\n $pagination: PaginationInput\n ) {\n listBotmanorToolApprovals(filter: $filter, pagination: $pagination) {\n ${TOOL_APPROVAL_FIELDS}\n }\n }\n`;\n\nconst DECIDE_DOCUMENT = gql`\n mutation DecideBotmanorToolApproval(\n $id: ID!\n $decision: BotmanorToolApprovalDecision!\n $note: String\n $scope: BotmanorApprovalScope\n ) {\n decideBotmanorToolApproval(id: $id, decision: $decision, note: $note, scope: $scope) {\n ${TOOL_APPROVAL_FIELDS}\n }\n }\n`;\n\nexport type ToolApprovalStatus = 'PENDING' | 'APPROVED' | 'DENIED' | 'EXPIRED' | 'CANCELLED';\nexport type ToolApprovalDecision = 'APPROVE' | 'DENY';\nexport type ToolApprovalSource = 'AGENT_CHAT' | 'STEWARD';\nexport type ToolApprovalScope = 'ONCE' | 'RUN' | 'DUTY' | 'TIME_LIMITED' | 'STANDING';\n\nexport interface ToolApprovalFilter {\n status?: ToolApprovalStatus;\n agentId?: string;\n source?: ToolApprovalSource;\n stewardId?: string;\n /** Only the requests the caller can act on (their steward approvals inbox). */\n mine?: boolean;\n}\n\nexport interface ToolApprovalListOptions {\n /** Page size; the inbox raises it to load more. */\n limit?: number;\n /** When false the query is not sent and the result stays empty. */\n enabled?: boolean;\n}\n\nexport const TOOL_APPROVALS_PAGE_SIZE = 50;\n\n/** The filter input the service takes; empty values are left out. */\nexport function toFilterInput(filter: ToolApprovalFilter): Record<string, unknown> {\n return {\n status: filter.status || undefined,\n agentId: filter.agentId || undefined,\n source: filter.source || undefined,\n stewardId: filter.stewardId || undefined,\n mine: filter.mine ? true : undefined,\n };\n}\n\nexport interface ToolApprovalRecord {\n id: string;\n agentId: string;\n agentName?: string | null;\n connectionId: string;\n connectionName: string;\n toolName: string;\n riskLevel: string;\n arguments: unknown;\n reasons: string[];\n mode: 'APPROVER' | 'REQUESTER' | string;\n status: ToolApprovalStatus;\n requestedById: string;\n userMessage?: string | null;\n approverRoles: string[];\n approverUserIds: string[];\n originExecutionId?: string | null;\n expiresAt: string;\n deciderId?: string | null;\n decisionNote?: string | null;\n decidedAt?: string | null;\n resumeStatus?: 'RUNNING' | 'COMPLETED' | 'FAILED' | string | null;\n resumeExecutionId?: string | null;\n resumeError?: string | null;\n resultPreview?: string | null;\n createdAt: string;\n source?: ToolApprovalSource | null;\n stewardId?: string | null;\n stewardRunId?: string | null;\n argumentsHash?: string | null;\n destination?: string | null;\n purpose?: string | null;\n requestedScope?: ToolApprovalScope | null;\n grantedScope?: ToolApprovalScope | null;\n /** The reviewer's verified quote of the owner's own words. */\n charterCitation?: string | null;\n reviewerVerdict?: string | null;\n reviewerNote?: string | null;\n batchKey?: string | null;\n consumedAt?: string | null;\n createdRuleId?: string | null;\n /** Set for calls that always go to a person (password, payment, one-time code, external message). */\n fixedDefault?: string | null;\n}\n\nfunction toError(error: unknown, fallback: string): Error {\n return error instanceof Error ? error : new Error(fallback);\n}\n\n/** Tool approval requests in the workspace, newest first. */\nexport function useToolApprovals(\n filter: ToolApprovalFilter,\n options: ToolApprovalListOptions = {}\n) {\n const client = useGatewayClient('workspace') as ApolloClient;\n const { workspaceId } = useBotlit();\n const [data, setData] = useState<ToolApprovalRecord[]>([]);\n // True until the first read settles, so the page shows its loading state\n // instead of flashing the empty message before the effect runs.\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | undefined>();\n const { status, agentId, source, stewardId, mine } = filter;\n const { limit = TOOL_APPROVALS_PAGE_SIZE, enabled = true } = options;\n\n const refetch = useCallback(async () => {\n if (!workspaceId || !enabled) {\n setData([]);\n setLoading(false);\n return;\n }\n setLoading(true);\n setError(undefined);\n try {\n const result = await client.query<{ listBotmanorToolApprovals: ToolApprovalRecord[] }>({\n query: LIST_DOCUMENT,\n variables: {\n filter: toFilterInput({ status, agentId, source, stewardId, mine }),\n pagination: { limit, offset: 0 },\n },\n fetchPolicy: 'network-only',\n });\n setData(result.data?.listBotmanorToolApprovals ?? []);\n } catch (queryError) {\n setError(toError(queryError, 'Failed to load tool approvals'));\n } finally {\n setLoading(false);\n }\n }, [agentId, client, enabled, limit, mine, source, status, stewardId, workspaceId]);\n\n useEffect(() => {\n void refetch();\n }, [refetch]);\n\n return { data, loading, error, refetch };\n}\n\n/** Approve or deny a pending tool call. */\nexport function useDecideToolApproval() {\n const client = useGatewayClient('workspace') as ApolloClient;\n const [pendingId, setPendingId] = useState<string | null>(null);\n\n const decide = useCallback(\n async (\n id: string,\n decision: ToolApprovalDecision,\n note?: string,\n scope?: ToolApprovalScope\n ): Promise<ToolApprovalRecord> => {\n setPendingId(id);\n try {\n const result = await client.mutate<{ decideBotmanorToolApproval: ToolApprovalRecord }>({\n mutation: DECIDE_DOCUMENT,\n variables: { id, decision, note: note?.trim() || undefined, scope },\n });\n const record = result.data?.decideBotmanorToolApproval;\n if (!record) throw new Error('Failed to record the decision');\n return record;\n } catch (mutationError) {\n throw toError(mutationError, 'Failed to record the decision');\n } finally {\n setPendingId(null);\n }\n },\n [client]\n );\n\n return { decide, pendingId };\n}\n"],"mappings":";;;;;AAeA,IAAMA,IAAuB,glBA2CvBC,IAAgB,CAAG;;;;;;QAMjBD,EAAqB;;;GAKvBE,IAAkB,CAAG;;;;;;;;QAQnBF,EAAqB;;;;AA6B7B,SAAgBG,EAAc,GAAqD;CACjF,OAAO;EACL,QAAQC,EAAO,UAAU,KAAA;EACzB,SAASA,EAAO,WAAW,KAAA;EAC3B,QAAQA,EAAO,UAAU,KAAA;EACzB,WAAWA,EAAO,aAAa,KAAA;EAC/B,MAAMA,EAAO,OAAO,KAAO,KAAA;CAC7B;AACF;AA+CA,SAASC,EAAQ,GAAgB,GAAyB;CACxD,OAAOC,aAAiB,QAAQA,IAAY,MAAMC,CAAQ;AAC5D;AAGA,SAAgBC,EACd,GACA,IAAmC,CAAC,GACpC;CACA,IAAMC,IAASC,EAAiB,WAAW,GACrC,EAAE,mBAAgBC,EAAU,GAC5B,CAACC,GAAMC,KAAWC,EAA+B,CAAC,CAAC,GAGnD,CAACC,GAASC,KAAcF,EAAS,EAAI,GACrC,CAACR,GAAOW,KAAYH,EAA4B,GAChD,EAAE,WAAQ,YAAS,WAAQ,cAAW,YAASV,GAC/C,EAAE,WAAA,IAAkC,aAAU,OAASc,GAEvDC,IAAUC,EAAY,YAAY;EACtC,IAAI,CAACC,KAAe,CAACC,GAEnB,AADAT,EAAQ,CAAC,CAAC,GACVG,EAAW,EAAK;OAGlB;GACA,AADAA,EAAW,EAAI,GACfC,EAAS,KAAA,CAAS;GAClB,IAAI;IACF,IAAMM,IAAS,MAAMd,EAAO,MAA2D;KACrF,OAAOR;KACP,WAAW;MACT,QAAQE,EAAc;OAAE;OAAQ;OAAS;OAAQ;OAAW;MAAK,CAAC;MAClE,YAAY;OAAE;OAAO,QAAQ;MAAE;KACjC;KACA,aAAa;IACf,CAAC;IACD,EAAQoB,EAAO,MAAM,6BAA6B,CAAC,CAAC;GACtD,SAASC,GAAY;IACnB,EAASnB,EAAQmB,GAAY,+BAA+B,CAAC;GAC/D,UAAU;IACR,EAAW,EAAK;GAClB;EAhBe;CAiBjB,GAAG;EAACC;EAAShB;EAAQa;EAASI;EAAOC;EAAMC;EAAQC;EAAQC;EAAWT;CAAW,CAAC;CAMlF,OAJAU,QAAgB;EACd,EAAa;CACf,GAAG,CAACZ,CAAO,CAAC,GAEL;EAAE;EAAM;EAAS;EAAO;CAAQ;AACzC;AAGA,SAAgBa,IAAwB;CACtC,IAAMvB,IAASC,EAAiB,WAAW,GACrC,CAACuB,GAAWC,KAAgBpB,EAAwB,IAAI;CA2B9D,OAAO;EAAE,QAzBMM,EACb,OACE,GACA,GACA,GACA,MACgC;GAChC,EAAae,CAAE;GACf,IAAI;IAKF,IAAMC,KAAS,MAJM3B,EAAO,OAA2D;KACrF,UAAUP;KACV,WAAW;MAAE;MAAI;MAAU,MAAMmC,GAAM,KAAK,KAAK,KAAA;MAAW;KAAM;IACpE,CAAC,EAAA,CACqB,MAAM;IAC5B,IAAI,CAACD,GAAQ,MAAU,MAAM,+BAA+B;IAC5D,OAAOA;GACT,SAASE,GAAe;IACtB,MAAMjC,EAAQiC,GAAe,+BAA+B;GAC9D,UAAU;IACR,EAAa,IAAI;GACnB;EACF,GACA,CAAC7B,CAAM,CAGA;EAAQ;CAAU;AAC7B"}
@@ -2,273 +2,292 @@ import { useTr as e } from "../../shared/hooks/useTr.js";
2
2
  import { PageLayout as t } from "../components/PageLayout.js";
3
3
  import { Card as n, CardContent as r, CardHeader as i, CardTitle as a } from "../components/Card.js";
4
4
  import { BOTMANOR_PERMISSIONS as o } from "../permissions/botmanorPermissions.js";
5
- import { BotmanorPermissionGate as s } from "../permissions/useBotmanorPermissions.js";
6
- import { Button as c } from "../components/Button.js";
7
- import { Badge as l } from "../components/Badge.js";
8
- import { ErrorState as u } from "../components/ErrorState.js";
9
- import { useDecideToolApproval as d, useToolApprovals as f } from "../hooks/useToolApprovals.js";
10
- import { useBotlit as p } from "../providers/BotlitProvider.js";
11
- import { formatRelativeTime as m } from "../utils/formatters.js";
5
+ import { BotmanorPermissionGate as s, useBotmanorPermissionDecision as c } from "../permissions/useBotmanorPermissions.js";
6
+ import { Button as l } from "../components/Button.js";
7
+ import { Badge as u } from "../components/Badge.js";
8
+ import { ErrorState as d } from "../components/ErrorState.js";
9
+ import { EmptyState as f } from "../components/EmptyState.js";
10
+ import { StewardApprovalsInbox as p } from "../components/StewardApprovalsInbox.js";
11
+ import { useDecideToolApproval as m, useToolApprovals as h } from "../hooks/useToolApprovals.js";
12
+ import { useBotlit as g } from "../providers/BotlitProvider.js";
13
+ import { formatRelativeTime as _ } from "../utils/formatters.js";
12
14
  import "../permissions/index.js";
13
- import { useState as h } from "react";
14
- import { PagePurpose as g, ResponsiveDialog as _, ResponsiveDialogContent as v, ResponsiveDialogDescription as y, ResponsiveDialogFooter as b, ResponsiveDialogHeader as x, ResponsiveDialogTitle as S, Textarea as C } from "@burdenoff/fe-libs/ui";
15
- import { jsx as w, jsxs as T } from "react/jsx-runtime";
16
- import { ArrowLeft as E, CheckCircle2 as D, ShieldAlert as O, XCircle as k } from "lucide-react";
17
- import { toast as A } from "sonner";
15
+ import { useState as v } from "react";
16
+ import { PagePurpose as y, ResponsiveDialog as b, ResponsiveDialogContent as x, ResponsiveDialogDescription as S, ResponsiveDialogFooter as C, ResponsiveDialogHeader as w, ResponsiveDialogTitle as T, Textarea as E } from "@burdenoff/fe-libs/ui";
17
+ import { jsx as D, jsxs as O } from "react/jsx-runtime";
18
+ import { useFeatureFlag as k } from "@burdenoff/fe-libs/shared/feature-flags";
19
+ import { ArrowLeft as A, CheckCircle2 as j, ShieldAlert as M, XCircle as N } from "lucide-react";
20
+ import { toast as P } from "sonner";
18
21
  // src/botlit/pages/ToolApprovalsPage.tsx
19
- function j(e) {
22
+ function F(e) {
20
23
  return e === "PENDING" ? "warning" : e === "APPROVED" ? "success" : e === "DENIED" ? "destructive" : "outline";
21
24
  }
22
- function M(e) {
25
+ function I(e) {
23
26
  try {
24
27
  return JSON.stringify(e ?? {}, null, 2);
25
28
  } catch {
26
29
  return String(e);
27
30
  }
28
31
  }
29
- var N = ({ request: t }) => {
32
+ var L = ({ request: t }) => {
30
33
  let n = e();
31
- return /* @__PURE__ */ T("div", {
34
+ return /* @__PURE__ */ O("div", {
32
35
  className: "space-y-2 text-sm",
33
36
  children: [
34
- t.userMessage && /* @__PURE__ */ T("p", {
37
+ t.userMessage && /* @__PURE__ */ O("p", {
35
38
  className: "break-words",
36
- children: [/* @__PURE__ */ T("span", {
39
+ children: [/* @__PURE__ */ O("span", {
37
40
  className: "text-text-secondary",
38
41
  children: [n("botlit.toolApprovals.userAsked", "User asked:"), " "]
39
42
  }), t.userMessage]
40
43
  }),
41
- /* @__PURE__ */ w("div", {
44
+ /* @__PURE__ */ D("div", {
42
45
  className: "flex flex-wrap gap-1",
43
- children: t.reasons.map((e) => /* @__PURE__ */ w(l, {
46
+ children: t.reasons.map((e) => /* @__PURE__ */ D(u, {
44
47
  variant: "outline",
45
48
  children: e
46
49
  }, e))
47
50
  }),
48
- /* @__PURE__ */ w("pre", {
51
+ /* @__PURE__ */ D("pre", {
49
52
  className: "text-xs bg-bg-sunken rounded-md p-2 overflow-x-auto max-h-48 whitespace-pre-wrap break-all",
50
- children: M(t.arguments)
53
+ children: I(t.arguments)
51
54
  })
52
55
  ]
53
56
  });
54
- }, P = () => {
55
- let M = e(), { navigateTo: P, currentUser: F } = p(), I = f({ status: "PENDING" }), L = f({}), { decide: R, pendingId: z } = d(), [B, V] = h(null), [H, U] = h(""), W = L.data.filter((e) => e.status !== "PENDING").slice(0, 20), G = (e) => e && e === F?.id ? M("botlit.toolApprovals.you", "you") : e ?? "—", K = () => {
57
+ }, R = () => {
58
+ let c = e(), { navigateTo: f, currentUser: p } = g(), k = h({
59
+ status: "PENDING",
60
+ source: "AGENT_CHAT"
61
+ }), I = h({ source: "AGENT_CHAT" }), { decide: R, pendingId: z } = m(), [B, V] = v(null), [H, U] = v(""), W = I.data.filter((e) => e.status !== "PENDING").slice(0, 20), G = (e) => e && e === p?.id ? c("botlit.toolApprovals.you", "you") : e ?? "—", K = () => {
56
62
  V(null), U("");
57
63
  }, q = async () => {
58
64
  if (B) try {
59
- await R(B.request.id, B.decision, H), A.success(B.decision === "APPROVE" ? M("botlit.toolApprovals.toast.approved", "Approved — the tool is running and the agent will answer in the conversation") : M("botlit.toolApprovals.toast.denied", "Denied — the user is told it was not run")), K(), await Promise.all([I.refetch(), L.refetch()]);
65
+ await R(B.request.id, B.decision, H), P.success(B.decision === "APPROVE" ? c("botlit.toolApprovals.toast.approved", "Approved — the tool is running and the agent will answer in the conversation") : c("botlit.toolApprovals.toast.denied", "Denied — the user is told it was not run")), K(), await Promise.all([k.refetch(), I.refetch()]);
60
66
  } catch (e) {
61
- A.error(e instanceof Error ? e.message : M("botlit.toolApprovals.toast.error", "Could not record the decision"));
67
+ P.error(e instanceof Error ? e.message : c("botlit.toolApprovals.toast.error", "Could not record the decision"));
62
68
  }
63
69
  };
64
- return /* @__PURE__ */ T(t, {
65
- title: /* @__PURE__ */ T("div", {
70
+ return /* @__PURE__ */ O(t, {
71
+ title: /* @__PURE__ */ O("div", {
66
72
  className: "flex items-center gap-3",
67
- children: [/* @__PURE__ */ w(c, {
73
+ children: [/* @__PURE__ */ D(l, {
68
74
  variant: "ghost",
69
75
  size: "icon",
70
- onClick: () => P("policies"),
71
- children: /* @__PURE__ */ w(E, { size: 20 })
72
- }), /* @__PURE__ */ w("span", { children: M("botlit.toolApprovals.title", "Tool approvals") })]
76
+ onClick: () => f("policies"),
77
+ children: /* @__PURE__ */ D(A, { size: 20 })
78
+ }), /* @__PURE__ */ D("span", { children: c("botlit.toolApprovals.title", "Tool approvals") })]
73
79
  }),
74
- description: M("botlit.toolApprovals.description", "Approve or deny risky tool calls your TOOL policies hold for a human"),
75
- children: [/* @__PURE__ */ T("div", {
80
+ description: c("botlit.toolApprovals.description", "Approve or deny risky tool calls your TOOL policies hold for a human"),
81
+ children: [/* @__PURE__ */ O("div", {
76
82
  className: "space-y-6",
77
83
  children: [
78
- /* @__PURE__ */ w(g, {
79
- icon: /* @__PURE__ */ w(O, { size: 18 }),
80
- children: M("botlit.toolApprovals.purpose", "When a TOOL policy marks a tool, an MCP server or a risk level as needing approval, the agent does not run the call. It tells the user the call is waiting, and the request appears here. Approving runs the call and the agent posts its answer in the same conversation. Denying tells the user it was not run. Requests expire at the time shown.")
84
+ /* @__PURE__ */ D(y, {
85
+ icon: /* @__PURE__ */ D(M, { size: 18 }),
86
+ children: c("botlit.toolApprovals.purpose", "When a TOOL policy marks a tool, an MCP server or a risk level as needing approval, the agent does not run the call. It tells the user the call is waiting, and the request appears here. Approving runs the call and the agent posts its answer in the same conversation. Denying tells the user it was not run. Requests expire at the time shown.")
81
87
  }),
82
- /* @__PURE__ */ T(n, { children: [/* @__PURE__ */ w(i, { children: /* @__PURE__ */ w(a, { children: M("botlit.toolApprovals.pending.title", "Waiting for a decision") }) }), /* @__PURE__ */ w(r, { children: I.error ? /* @__PURE__ */ w(u, {
83
- resource: M("botlit.toolApprovals.resource", "tool approvals"),
84
- error: I.error,
85
- onRetry: () => void I.refetch()
86
- }) : I.loading && I.data.length === 0 ? /* @__PURE__ */ w("div", { className: "h-24 bg-bg-sunken motion-safe:animate-vc-shimmer rounded-lg" }) : I.data.length === 0 ? /* @__PURE__ */ w("p", {
88
+ /* @__PURE__ */ O(n, { children: [/* @__PURE__ */ D(i, { children: /* @__PURE__ */ D(a, { children: c("botlit.toolApprovals.pending.title", "Waiting for a decision") }) }), /* @__PURE__ */ D(r, { children: k.error ? /* @__PURE__ */ D(d, {
89
+ resource: c("botlit.toolApprovals.resource", "tool approvals"),
90
+ error: k.error,
91
+ onRetry: () => void k.refetch()
92
+ }) : k.loading && k.data.length === 0 ? /* @__PURE__ */ D("div", { className: "h-24 bg-bg-sunken motion-safe:animate-vc-shimmer rounded-lg" }) : k.data.length === 0 ? /* @__PURE__ */ D("p", {
87
93
  className: "text-sm text-text-secondary",
88
- children: M("botlit.toolApprovals.pending.empty", "No tool calls are waiting for approval.")
89
- }) : /* @__PURE__ */ w("ul", {
94
+ children: c("botlit.toolApprovals.pending.empty", "No tool calls are waiting for approval.")
95
+ }) : /* @__PURE__ */ D("ul", {
90
96
  className: "space-y-3",
91
97
  "data-testid": "tool-approvals-pending",
92
- children: I.data.map((e) => /* @__PURE__ */ T("li", {
98
+ children: k.data.map((e) => /* @__PURE__ */ O("li", {
93
99
  className: "p-4 border border-border-subtle rounded-lg space-y-3",
94
100
  "data-testid": `tool-approval-${e.id}`,
95
101
  children: [
96
- /* @__PURE__ */ T("div", {
102
+ /* @__PURE__ */ O("div", {
97
103
  className: "flex items-center gap-2 flex-wrap",
98
104
  children: [
99
- /* @__PURE__ */ w("button", {
105
+ /* @__PURE__ */ D("button", {
100
106
  type: "button",
101
107
  className: "font-medium text-primary hover:underline",
102
- onClick: () => P(`agents/${e.agentId}`),
108
+ onClick: () => f(`agents/${e.agentId}`),
103
109
  children: e.agentName ?? e.agentId
104
110
  }),
105
- /* @__PURE__ */ T("span", {
111
+ /* @__PURE__ */ O("span", {
106
112
  className: "text-sm",
107
113
  children: [
108
- M("botlit.toolApprovals.wantsToRun", "wants to run"),
114
+ c("botlit.toolApprovals.wantsToRun", "wants to run"),
109
115
  " ",
110
- /* @__PURE__ */ w("code", {
116
+ /* @__PURE__ */ D("code", {
111
117
  className: "font-mono",
112
118
  children: e.toolName
113
119
  }),
114
120
  " ",
115
- M("botlit.toolApprovals.on", "on"),
121
+ c("botlit.toolApprovals.on", "on"),
116
122
  " ",
117
123
  e.connectionName
118
124
  ]
119
125
  }),
120
- /* @__PURE__ */ w(l, {
126
+ /* @__PURE__ */ D(u, {
121
127
  variant: e.riskLevel === "HIGH" ? "destructive" : "warning",
122
128
  children: e.riskLevel
123
129
  }),
124
- e.mode === "REQUESTER" && /* @__PURE__ */ w(l, {
130
+ e.mode === "REQUESTER" && /* @__PURE__ */ D(u, {
125
131
  variant: "outline",
126
- children: M("botlit.toolApprovals.requesterMode", "Requester confirms")
132
+ children: c("botlit.toolApprovals.requesterMode", "Requester confirms")
127
133
  })
128
134
  ]
129
135
  }),
130
- /* @__PURE__ */ T("p", {
136
+ /* @__PURE__ */ O("p", {
131
137
  className: "text-xs text-text-secondary",
132
138
  children: [
133
- M("botlit.toolApprovals.requested", "Requested"),
139
+ c("botlit.toolApprovals.requested", "Requested"),
134
140
  " ",
135
- m(e.createdAt),
141
+ _(e.createdAt),
136
142
  " ·",
137
143
  " ",
138
- M("botlit.toolApprovals.expires", "expires"),
144
+ c("botlit.toolApprovals.expires", "expires"),
139
145
  " ",
140
- m(e.expiresAt)
146
+ _(e.expiresAt)
141
147
  ]
142
148
  }),
143
- /* @__PURE__ */ w(N, { request: e }),
144
- /* @__PURE__ */ T("div", {
149
+ /* @__PURE__ */ D(L, { request: e }),
150
+ /* @__PURE__ */ O("div", {
145
151
  className: "flex gap-2",
146
- children: [/* @__PURE__ */ w(s, {
152
+ children: [/* @__PURE__ */ D(s, {
147
153
  permission: o.AGENT_APPROVE,
148
- children: /* @__PURE__ */ w(c, {
154
+ children: /* @__PURE__ */ D(l, {
149
155
  size: "sm",
150
- leftIcon: /* @__PURE__ */ w(D, { size: 14 }),
156
+ leftIcon: /* @__PURE__ */ D(j, { size: 14 }),
151
157
  isLoading: z === e.id && B?.decision === "APPROVE",
152
158
  onClick: () => V({
153
159
  decision: "APPROVE",
154
160
  request: e
155
161
  }),
156
- children: M("botlit.toolApprovals.approve", "Approve")
162
+ children: c("botlit.toolApprovals.approve", "Approve")
157
163
  })
158
- }), /* @__PURE__ */ w(s, {
164
+ }), /* @__PURE__ */ D(s, {
159
165
  permission: o.AGENT_APPROVE,
160
- children: /* @__PURE__ */ w(c, {
166
+ children: /* @__PURE__ */ D(l, {
161
167
  size: "sm",
162
168
  variant: "destructive",
163
- leftIcon: /* @__PURE__ */ w(k, { size: 14 }),
169
+ leftIcon: /* @__PURE__ */ D(N, { size: 14 }),
164
170
  onClick: () => V({
165
171
  decision: "DENY",
166
172
  request: e
167
173
  }),
168
- children: M("botlit.toolApprovals.deny", "Deny")
174
+ children: c("botlit.toolApprovals.deny", "Deny")
169
175
  })
170
176
  })]
171
177
  })
172
178
  ]
173
179
  }, e.id))
174
180
  }) })] }),
175
- /* @__PURE__ */ T(n, { children: [/* @__PURE__ */ w(i, { children: /* @__PURE__ */ w(a, { children: M("botlit.toolApprovals.history.title", "Recent decisions") }) }), /* @__PURE__ */ w(r, { children: L.error ? /* @__PURE__ */ w(u, {
176
- resource: M("botlit.toolApprovals.resource", "tool approvals"),
177
- error: L.error,
178
- onRetry: () => void L.refetch()
179
- }) : L.loading && W.length === 0 ? /* @__PURE__ */ w("div", { className: "h-16 bg-bg-sunken motion-safe:animate-vc-shimmer rounded-lg" }) : W.length === 0 ? /* @__PURE__ */ w("p", {
181
+ /* @__PURE__ */ O(n, { children: [/* @__PURE__ */ D(i, { children: /* @__PURE__ */ D(a, { children: c("botlit.toolApprovals.history.title", "Recent decisions") }) }), /* @__PURE__ */ D(r, { children: I.error ? /* @__PURE__ */ D(d, {
182
+ resource: c("botlit.toolApprovals.resource", "tool approvals"),
183
+ error: I.error,
184
+ onRetry: () => void I.refetch()
185
+ }) : I.loading && W.length === 0 ? /* @__PURE__ */ D("div", { className: "h-16 bg-bg-sunken motion-safe:animate-vc-shimmer rounded-lg" }) : W.length === 0 ? /* @__PURE__ */ D("p", {
180
186
  className: "text-sm text-text-secondary",
181
- children: M("botlit.toolApprovals.history.empty", "No decisions yet.")
182
- }) : /* @__PURE__ */ w("ul", {
187
+ children: c("botlit.toolApprovals.history.empty", "No decisions yet.")
188
+ }) : /* @__PURE__ */ D("ul", {
183
189
  className: "space-y-2",
184
190
  "data-testid": "tool-approvals-history",
185
- children: W.map((e) => /* @__PURE__ */ T("li", {
191
+ children: W.map((e) => /* @__PURE__ */ O("li", {
186
192
  className: "p-3 border border-border-subtle rounded-lg text-sm space-y-1",
187
193
  children: [
188
- /* @__PURE__ */ T("div", {
194
+ /* @__PURE__ */ O("div", {
189
195
  className: "flex items-center gap-2 flex-wrap",
190
196
  children: [
191
- /* @__PURE__ */ w("span", {
197
+ /* @__PURE__ */ D("span", {
192
198
  className: "font-medium",
193
199
  children: e.agentName ?? e.agentId
194
200
  }),
195
- /* @__PURE__ */ w("code", {
201
+ /* @__PURE__ */ D("code", {
196
202
  className: "font-mono",
197
203
  children: e.toolName
198
204
  }),
199
- /* @__PURE__ */ w(l, {
200
- variant: j(e.status),
205
+ /* @__PURE__ */ D(u, {
206
+ variant: F(e.status),
201
207
  children: e.status
202
208
  }),
203
- e.resumeStatus && /* @__PURE__ */ T(l, {
209
+ e.resumeStatus && /* @__PURE__ */ O(u, {
204
210
  variant: e.resumeStatus === "FAILED" ? "destructive" : "outline",
205
211
  children: [
206
- M("botlit.toolApprovals.run", "Run"),
212
+ c("botlit.toolApprovals.run", "Run"),
207
213
  ": ",
208
214
  e.resumeStatus
209
215
  ]
210
216
  }),
211
- /* @__PURE__ */ T("span", {
217
+ /* @__PURE__ */ O("span", {
212
218
  className: "text-text-secondary",
213
219
  children: [
214
- M("botlit.toolApprovals.by", "by"),
220
+ c("botlit.toolApprovals.by", "by"),
215
221
  " ",
216
222
  G(e.deciderId),
217
223
  " ",
218
- e.decidedAt ? m(e.decidedAt) : ""
224
+ e.decidedAt ? _(e.decidedAt) : ""
219
225
  ]
220
226
  })
221
227
  ]
222
228
  }),
223
- e.decisionNote && /* @__PURE__ */ w("p", {
229
+ e.decisionNote && /* @__PURE__ */ D("p", {
224
230
  className: "break-words",
225
231
  children: e.decisionNote
226
232
  }),
227
- e.resumeError && /* @__PURE__ */ w("p", {
233
+ e.resumeError && /* @__PURE__ */ D("p", {
228
234
  className: "break-words text-status-error-text",
229
235
  children: e.resumeError
230
236
  }),
231
- e.resumeExecutionId && /* @__PURE__ */ w("button", {
237
+ e.resumeExecutionId && /* @__PURE__ */ D("button", {
232
238
  type: "button",
233
239
  className: "text-primary hover:underline",
234
- onClick: () => P(`executions/${e.resumeExecutionId}`),
235
- children: M("botlit.toolApprovals.viewRun", "View the resumed run")
240
+ onClick: () => f(`executions/${e.resumeExecutionId}`),
241
+ children: c("botlit.toolApprovals.viewRun", "View the resumed run")
236
242
  })
237
243
  ]
238
244
  }, e.id))
239
245
  }) })] })
240
246
  ]
241
- }), /* @__PURE__ */ w(_, {
247
+ }), /* @__PURE__ */ D(b, {
242
248
  open: B !== null,
243
249
  onOpenChange: (e) => {
244
250
  e || K();
245
251
  },
246
- children: /* @__PURE__ */ T(v, { children: [
247
- /* @__PURE__ */ T(x, { children: [/* @__PURE__ */ w(S, { children: B?.decision === "APPROVE" ? M("botlit.toolApprovals.dialog.approveTitle", "Approve and run this tool call") : M("botlit.toolApprovals.dialog.denyTitle", "Deny this tool call") }), /* @__PURE__ */ w(y, { children: B?.decision === "APPROVE" ? M("botlit.toolApprovals.dialog.approveDescription", "The tool runs now with the arguments shown, and the agent posts its answer in the conversation.") : M("botlit.toolApprovals.dialog.denyDescription", "The tool is not run. The user is told the request was declined, with your reason.") })] }),
248
- B && /* @__PURE__ */ w(N, { request: B.request }),
249
- /* @__PURE__ */ w(C, {
250
- "aria-label": M("botlit.toolApprovals.dialog.noteLabel", "Reason"),
252
+ children: /* @__PURE__ */ O(x, { children: [
253
+ /* @__PURE__ */ O(w, { children: [/* @__PURE__ */ D(T, { children: B?.decision === "APPROVE" ? c("botlit.toolApprovals.dialog.approveTitle", "Approve and run this tool call") : c("botlit.toolApprovals.dialog.denyTitle", "Deny this tool call") }), /* @__PURE__ */ D(S, { children: B?.decision === "APPROVE" ? c("botlit.toolApprovals.dialog.approveDescription", "The tool runs now with the arguments shown, and the agent posts its answer in the conversation.") : c("botlit.toolApprovals.dialog.denyDescription", "The tool is not run. The user is told the request was declined, with your reason.") })] }),
254
+ B && /* @__PURE__ */ D(L, { request: B.request }),
255
+ /* @__PURE__ */ D(E, {
256
+ "aria-label": c("botlit.toolApprovals.dialog.noteLabel", "Reason"),
251
257
  value: H,
252
258
  maxLength: 2e3,
253
259
  onChange: (e) => U(e.target.value),
254
- placeholder: B?.decision === "DENY" ? M("botlit.toolApprovals.dialog.reasonRequired", "Reason (required)") : M("botlit.toolApprovals.dialog.reasonOptional", "Note (optional)"),
260
+ placeholder: B?.decision === "DENY" ? c("botlit.toolApprovals.dialog.reasonRequired", "Reason (required)") : c("botlit.toolApprovals.dialog.reasonOptional", "Note (optional)"),
255
261
  rows: 3
256
262
  }),
257
- /* @__PURE__ */ T(b, { children: [/* @__PURE__ */ w(c, {
263
+ /* @__PURE__ */ O(C, { children: [/* @__PURE__ */ D(l, {
258
264
  variant: "outline",
259
265
  onClick: K,
260
- children: M("botlit.common.cancel", "Cancel")
261
- }), /* @__PURE__ */ w(c, {
266
+ children: c("botlit.common.cancel", "Cancel")
267
+ }), /* @__PURE__ */ D(l, {
262
268
  variant: B?.decision === "DENY" ? "destructive" : "default",
263
269
  isLoading: z !== null,
264
270
  disabled: B?.decision === "DENY" && H.trim().length === 0,
265
271
  onClick: () => void q(),
266
- children: B?.decision === "APPROVE" ? M("botlit.toolApprovals.approve", "Approve") : M("botlit.toolApprovals.deny", "Deny")
272
+ children: B?.decision === "APPROVE" ? c("botlit.toolApprovals.approve", "Approve") : c("botlit.toolApprovals.deny", "Deny")
267
273
  })] })
268
274
  ] })
269
275
  })]
270
276
  });
271
- };
272
- export { P as ToolApprovalsPage, j as toolApprovalStatusVariant };
277
+ }, z = () => {
278
+ let n = e(), { navigateTo: r } = g(), i = c(o.POLICY_READ);
279
+ return /* @__PURE__ */ D(t, {
280
+ title: n("botlit.stewardApprovals.title", "Approvals"),
281
+ description: n("botlit.stewardApprovals.description", "Tool calls waiting for a person, from agent chats and stewards."),
282
+ children: i === "allowed" ? /* @__PURE__ */ D(p, { onOpenAgent: (e) => r(`agents/${e}`) }) : i === "denied" ? /* @__PURE__ */ D("div", {
283
+ "data-testid": "approvals-forbidden",
284
+ children: /* @__PURE__ */ D(f, {
285
+ title: n("botlit.stewardApprovals.noAccess.title", "You cannot view approvals"),
286
+ description: n("botlit.stewardApprovals.noAccess.description", "Ask a workspace admin for access to tool approvals.")
287
+ })
288
+ }) : /* @__PURE__ */ D("div", { className: "h-48 rounded-lg bg-bg-sunken motion-safe:animate-vc-shimmer" })
289
+ });
290
+ }, B = () => k("botmanor.stewards", !1) ? /* @__PURE__ */ D(z, {}) : /* @__PURE__ */ D(R, {});
291
+ export { B as ToolApprovalsPage, F as toolApprovalStatusVariant };
273
292
 
274
293
  //# sourceMappingURL=ToolApprovalsPage.js.map