@burdenoff/microfe-botmanor 2026.1118.8 → 2026.1119.2
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/botlit/components/A2ATrustBadge.d.ts +9 -0
- package/dist/botlit/components/A2ATrustBadge.js +55 -0
- package/dist/botlit/components/A2ATrustBadge.js.map +1 -0
- package/dist/botlit/components/AgentFallbackModelsPicker.d.ts +22 -0
- package/dist/botlit/components/AgentFallbackModelsPicker.js +109 -0
- package/dist/botlit/components/AgentFallbackModelsPicker.js.map +1 -0
- package/dist/botlit/components/ExecutionModelFallback.d.ts +25 -0
- package/dist/botlit/components/ExecutionModelFallback.js +114 -0
- package/dist/botlit/components/ExecutionModelFallback.js.map +1 -0
- package/dist/botlit/hooks/useA2A.d.ts +107 -9
- package/dist/botlit/hooks/useA2A.js +215 -80
- package/dist/botlit/hooks/useA2A.js.map +1 -1
- package/dist/botlit/hooks/useAgents.d.ts +3 -0
- package/dist/botlit/hooks/useAgents.js +5 -0
- package/dist/botlit/hooks/useAgents.js.map +1 -1
- package/dist/botlit/pages/A2AAgentDetailPage.js +715 -503
- package/dist/botlit/pages/A2AAgentDetailPage.js.map +1 -1
- package/dist/botlit/pages/A2ARegistryPage.js +278 -179
- package/dist/botlit/pages/A2ARegistryPage.js.map +1 -1
- package/dist/botlit/pages/AgentBuilderPage.js +409 -392
- package/dist/botlit/pages/AgentBuilderPage.js.map +1 -1
- package/dist/botlit/pages/ExecutionDetailPage.js +135 -133
- package/dist/botlit/pages/ExecutionDetailPage.js.map +1 -1
- package/dist/botlit/pages/ExecutionsPage.js +1 -1
- package/dist/botlit/pages/InstalledPackagesPage.js +154 -154
- package/dist/botlit/pages/InstalledPackagesPage.js.map +1 -1
- package/dist/botlit/pages/PromptStudioPage.js +172 -172
- package/dist/botlit/pages/PromptStudioPage.js.map +1 -1
- package/dist/botlit/pages/StorePage.js +8 -8
- package/dist/botlit/pages/StorePage.js.map +1 -1
- package/dist/generated/wspace-operations.d.ts +4 -0
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/generated/wspace-types.d.ts +20 -0
- package/dist/generated/wspace-types.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { TrustLevel } from '../types';
|
|
3
|
+
export declare const A2A_TRUST_LEVELS: readonly TrustLevel[];
|
|
4
|
+
export declare function toTrustLevel(value: string | null | undefined): TrustLevel;
|
|
5
|
+
/** Translated name of a trust level. */
|
|
6
|
+
export declare function useTrustLevelLabel(): (level: TrustLevel) => string;
|
|
7
|
+
export declare const A2ATrustBadge: FC<{
|
|
8
|
+
level: string;
|
|
9
|
+
}>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { useTr as e } from "../../shared/hooks/useTr.js";
|
|
2
|
+
import { Badge as t } from "./Badge.js";
|
|
3
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
4
|
+
import { AlertCircle as i, CheckCircle as a, Shield as o } from "lucide-react";
|
|
5
|
+
// src/botlit/components/A2ATrustBadge.tsx
|
|
6
|
+
var s = [
|
|
7
|
+
"UNVERIFIED",
|
|
8
|
+
"VERIFIED_PUBLISHER",
|
|
9
|
+
"INTERNAL"
|
|
10
|
+
];
|
|
11
|
+
function c(e) {
|
|
12
|
+
return s.includes(e) ? e : "UNVERIFIED";
|
|
13
|
+
}
|
|
14
|
+
function l() {
|
|
15
|
+
let t = e();
|
|
16
|
+
return (e) => {
|
|
17
|
+
switch (e) {
|
|
18
|
+
case "INTERNAL": return t("botlit.a2aRegistry.trustBadge.internal", "Internal");
|
|
19
|
+
case "VERIFIED_PUBLISHER": return t("botlit.a2aRegistry.trustBadge.verified", "Verified publisher");
|
|
20
|
+
default: return t("botlit.a2aRegistry.trustBadge.unverified", "Unverified");
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
var u = ({ level: e }) => {
|
|
25
|
+
let s = l(), u = c(e);
|
|
26
|
+
switch (u) {
|
|
27
|
+
case "INTERNAL": return /* @__PURE__ */ r(t, {
|
|
28
|
+
variant: "success",
|
|
29
|
+
className: "flex items-center gap-1",
|
|
30
|
+
children: [/* @__PURE__ */ n(o, {
|
|
31
|
+
size: 12,
|
|
32
|
+
"aria-hidden": "true"
|
|
33
|
+
}), s(u)]
|
|
34
|
+
});
|
|
35
|
+
case "VERIFIED_PUBLISHER": return /* @__PURE__ */ r(t, {
|
|
36
|
+
variant: "default",
|
|
37
|
+
className: "flex items-center gap-1",
|
|
38
|
+
children: [/* @__PURE__ */ n(a, {
|
|
39
|
+
size: 12,
|
|
40
|
+
"aria-hidden": "true"
|
|
41
|
+
}), s(u)]
|
|
42
|
+
});
|
|
43
|
+
default: return /* @__PURE__ */ r(t, {
|
|
44
|
+
variant: "outline",
|
|
45
|
+
className: "flex items-center gap-1",
|
|
46
|
+
children: [/* @__PURE__ */ n(i, {
|
|
47
|
+
size: 12,
|
|
48
|
+
"aria-hidden": "true"
|
|
49
|
+
}), s(u)]
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
export { u as A2ATrustBadge, s as A2A_TRUST_LEVELS, c as toTrustLevel, l as useTrustLevelLabel };
|
|
54
|
+
|
|
55
|
+
//# sourceMappingURL=A2ATrustBadge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"A2ATrustBadge.js","names":["A2A_TRUST_LEVELS","toTrustLevel","value","useTrustLevelLabel","useTr","level","A2ATrustBadge","label","trust","Badge","Shield","CheckCircle","AlertCircle"],"sources":["../../../src/botlit/components/A2ATrustBadge.tsx"],"sourcesContent":["/**\n * A2A trust level badge and labels (BOFF-12507)\n * @module botlit/components\n *\n * One translated label per trust level, shared by the registry list and the\n * entry page, so the same level never reads differently on two pages.\n */\n\nimport type { FC } from 'react';\nimport { AlertCircle, CheckCircle, Shield } from 'lucide-react';\nimport { useTr } from '../../shared/hooks/useTr';\nimport type { TrustLevel } from '../types';\nimport { Badge } from './Badge';\n\nexport const A2A_TRUST_LEVELS: readonly TrustLevel[] = [\n 'UNVERIFIED',\n 'VERIFIED_PUBLISHER',\n 'INTERNAL',\n];\n\nexport function toTrustLevel(value: string | null | undefined): TrustLevel {\n return A2A_TRUST_LEVELS.includes(value as TrustLevel) ? (value as TrustLevel) : 'UNVERIFIED';\n}\n\n/** Translated name of a trust level. */\nexport function useTrustLevelLabel(): (level: TrustLevel) => string {\n const t = useTr();\n return (level) => {\n switch (level) {\n case 'INTERNAL':\n return t('botlit.a2aRegistry.trustBadge.internal', 'Internal');\n case 'VERIFIED_PUBLISHER':\n return t('botlit.a2aRegistry.trustBadge.verified', 'Verified publisher');\n default:\n return t('botlit.a2aRegistry.trustBadge.unverified', 'Unverified');\n }\n };\n}\n\nexport const A2ATrustBadge: FC<{ level: string }> = ({ level }) => {\n const label = useTrustLevelLabel();\n const trust = toTrustLevel(level);\n switch (trust) {\n case 'INTERNAL':\n return (\n <Badge variant=\"success\" className=\"flex items-center gap-1\">\n <Shield size={12} aria-hidden=\"true\" />\n {label(trust)}\n </Badge>\n );\n case 'VERIFIED_PUBLISHER':\n return (\n <Badge variant=\"default\" className=\"flex items-center gap-1\">\n <CheckCircle size={12} aria-hidden=\"true\" />\n {label(trust)}\n </Badge>\n );\n default:\n return (\n <Badge variant=\"outline\" className=\"flex items-center gap-1\">\n <AlertCircle size={12} aria-hidden=\"true\" />\n {label(trust)}\n </Badge>\n );\n }\n};\n"],"mappings":";;;;;AAcA,IAAaA,IAA0C;CACrD;CACA;CACA;AACF;AAEA,SAAgBC,EAAa,GAA8C;CACzE,OAAOD,EAAiB,SAASE,CAAmB,IAAKA,IAAuB;AAClF;AAGA,SAAgBC,IAAoD;CAClE,IAAM,IAAIC,EAAM;CAChB,QAAQ,MAAU;EAChB,QAAQC,GAAR;GACE,KAAK,YACH,OAAO,EAAE,0CAA0C,UAAU;GAC/D,KAAK,sBACH,OAAO,EAAE,0CAA0C,oBAAoB;GACzE,SACE,OAAO,EAAE,4CAA4C,YAAY;EACrE;CACF;AACF;AAEA,IAAaC,KAAwC,EAAE,eAAY;CACjE,IAAMC,IAAQJ,EAAmB,GAC3BK,IAAQP,EAAaI,CAAK;CAChC,QAAQG,GAAR;EACE,KAAK,YACH,OACE,kBAACC,GAAD;GAAO,SAAQ;GAAU,WAAU;GAAnC,UAAA,CACE,kBAACC,GAAD;IAAQ,MAAM;IAAI,eAAY;GAAQ,CAAA,GACrCH,EAAMC,CAAK,CACP;;EAEX,KAAK,sBACH,OACE,kBAACC,GAAD;GAAO,SAAQ;GAAU,WAAU;GAAnC,UAAA,CACE,kBAACE,GAAD;IAAa,MAAM;IAAI,eAAY;GAAQ,CAAA,GAC1CJ,EAAMC,CAAK,CACP;;EAEX,SACE,OACE,kBAACC,GAAD;GAAO,SAAQ;GAAU,WAAU;GAAnC,UAAA,CACE,kBAACG,GAAD;IAAa,MAAM;IAAI,eAAY;GAAQ,CAAA,GAC1CL,EAAMC,CAAK,CACP;;CAEb;AACF"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
/** Most fallback models an agent may have (the service enforces the same cap). */
|
|
3
|
+
export declare const MAX_FALLBACK_MODELS = 3;
|
|
4
|
+
export interface FallbackModelOption {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
modelId: string;
|
|
8
|
+
providerName?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface AgentFallbackModelsPickerProps {
|
|
11
|
+
/** Selected fallback model ids, in the order they are tried. */
|
|
12
|
+
value: string[];
|
|
13
|
+
onChange: (next: string[]) => void;
|
|
14
|
+
/** Answer models the workspace has configured. */
|
|
15
|
+
models: FallbackModelOption[];
|
|
16
|
+
/** The agent's primary model, which cannot also be a fallback. */
|
|
17
|
+
primaryModelId: string;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
/** Id prefix for the add-select (labels need a stable id). */
|
|
20
|
+
idPrefix: string;
|
|
21
|
+
}
|
|
22
|
+
export declare const AgentFallbackModelsPicker: FC<AgentFallbackModelsPickerProps>;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { useTr as e } from "../../shared/hooks/useTr.js";
|
|
2
|
+
import { Button as t } from "./Button.js";
|
|
3
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
4
|
+
import { ArrowDown as i, ArrowUp as a, X as o } from "lucide-react";
|
|
5
|
+
var s = "flex h-10 w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm", c = ({ value: c, onChange: l, models: u, primaryModelId: d, disabled: f, idPrefix: p }) => {
|
|
6
|
+
let m = e(), h = c.filter((e) => e !== d), g = u.filter((e) => e.id !== d && !h.includes(e.id)), _ = (e) => {
|
|
7
|
+
let t = u.find((t) => t.id === e);
|
|
8
|
+
return t ? t.providerName ? `${t.name} (${t.modelId}) · ${t.providerName}` : `${t.name} (${t.modelId})` : m("botlit.agentBuilder.fallback.unavailable", "Unavailable model ({{id}})", { id: e });
|
|
9
|
+
}, v = (e, t) => {
|
|
10
|
+
let n = [...h], [r] = n.splice(e, 1);
|
|
11
|
+
r !== void 0 && (n.splice(e + t, 0, r), l(n));
|
|
12
|
+
}, y = `${p}-fallback-add`;
|
|
13
|
+
return /* @__PURE__ */ r("section", {
|
|
14
|
+
"aria-labelledby": `${p}-fallback-title`,
|
|
15
|
+
className: "space-y-3",
|
|
16
|
+
children: [
|
|
17
|
+
/* @__PURE__ */ r("div", { children: [/* @__PURE__ */ n("h4", {
|
|
18
|
+
id: `${p}-fallback-title`,
|
|
19
|
+
className: "text-sm font-medium",
|
|
20
|
+
children: m("botlit.agentBuilder.fallback.title", "Fallback models")
|
|
21
|
+
}), /* @__PURE__ */ n("p", {
|
|
22
|
+
className: "text-sm text-text-secondary",
|
|
23
|
+
children: m("botlit.agentBuilder.fallback.help", "If the primary model’s provider fails (error, timeout, rate limit or outage), the turn is retried on these models in order. Any provider can be used; workspace model and data policies still apply. Each run records which model answered.")
|
|
24
|
+
})] }),
|
|
25
|
+
h.length > 0 ? /* @__PURE__ */ n("ol", {
|
|
26
|
+
className: "space-y-2",
|
|
27
|
+
"aria-label": m("botlit.agentBuilder.fallback.listLabel", "Fallback order"),
|
|
28
|
+
children: h.map((e, s) => /* @__PURE__ */ r("li", {
|
|
29
|
+
className: "flex items-center gap-2 rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm",
|
|
30
|
+
children: [
|
|
31
|
+
/* @__PURE__ */ r("span", {
|
|
32
|
+
className: "w-5 shrink-0 tabular-nums text-text-secondary",
|
|
33
|
+
children: [s + 1, "."]
|
|
34
|
+
}),
|
|
35
|
+
/* @__PURE__ */ n("span", {
|
|
36
|
+
className: "min-w-0 flex-1 truncate",
|
|
37
|
+
children: _(e)
|
|
38
|
+
}),
|
|
39
|
+
/* @__PURE__ */ n(t, {
|
|
40
|
+
type: "button",
|
|
41
|
+
variant: "ghost",
|
|
42
|
+
size: "icon",
|
|
43
|
+
disabled: f || s === 0,
|
|
44
|
+
"aria-label": m("botlit.agentBuilder.fallback.moveUp", "Move {{name}} up", { name: _(e) }),
|
|
45
|
+
onClick: () => v(s, -1),
|
|
46
|
+
children: /* @__PURE__ */ n(a, {
|
|
47
|
+
size: 16,
|
|
48
|
+
"aria-hidden": "true"
|
|
49
|
+
})
|
|
50
|
+
}),
|
|
51
|
+
/* @__PURE__ */ n(t, {
|
|
52
|
+
type: "button",
|
|
53
|
+
variant: "ghost",
|
|
54
|
+
size: "icon",
|
|
55
|
+
disabled: f || s === h.length - 1,
|
|
56
|
+
"aria-label": m("botlit.agentBuilder.fallback.moveDown", "Move {{name}} down", { name: _(e) }),
|
|
57
|
+
onClick: () => v(s, 1),
|
|
58
|
+
children: /* @__PURE__ */ n(i, {
|
|
59
|
+
size: 16,
|
|
60
|
+
"aria-hidden": "true"
|
|
61
|
+
})
|
|
62
|
+
}),
|
|
63
|
+
/* @__PURE__ */ n(t, {
|
|
64
|
+
type: "button",
|
|
65
|
+
variant: "ghost",
|
|
66
|
+
size: "icon",
|
|
67
|
+
disabled: f,
|
|
68
|
+
"aria-label": m("botlit.agentBuilder.fallback.remove", "Remove {{name}}", { name: _(e) }),
|
|
69
|
+
onClick: () => l(h.filter((t) => t !== e)),
|
|
70
|
+
children: /* @__PURE__ */ n(o, {
|
|
71
|
+
size: 16,
|
|
72
|
+
"aria-hidden": "true"
|
|
73
|
+
})
|
|
74
|
+
})
|
|
75
|
+
]
|
|
76
|
+
}, e))
|
|
77
|
+
}) : /* @__PURE__ */ n("p", {
|
|
78
|
+
className: "text-sm text-text-secondary",
|
|
79
|
+
children: m("botlit.agentBuilder.fallback.none", "No fallback models. A provider failure fails the turn.")
|
|
80
|
+
}),
|
|
81
|
+
h.length < 3 && /* @__PURE__ */ r("div", {
|
|
82
|
+
className: "space-y-1",
|
|
83
|
+
children: [/* @__PURE__ */ n("label", {
|
|
84
|
+
htmlFor: y,
|
|
85
|
+
className: "text-sm text-text-secondary",
|
|
86
|
+
children: m("botlit.agentBuilder.fallback.add", "Add a fallback model")
|
|
87
|
+
}), /* @__PURE__ */ r("select", {
|
|
88
|
+
id: y,
|
|
89
|
+
className: s,
|
|
90
|
+
disabled: f || g.length === 0,
|
|
91
|
+
value: "",
|
|
92
|
+
onChange: (e) => {
|
|
93
|
+
e.target.value && l([...h, e.target.value]);
|
|
94
|
+
},
|
|
95
|
+
children: [/* @__PURE__ */ n("option", {
|
|
96
|
+
value: "",
|
|
97
|
+
children: g.length === 0 ? m("botlit.agentBuilder.fallback.noneAvailable", "No other answer model is configured") : m("botlit.agentBuilder.fallback.choose", "Choose a model…")
|
|
98
|
+
}), g.map((e) => /* @__PURE__ */ n("option", {
|
|
99
|
+
value: e.id,
|
|
100
|
+
children: _(e.id)
|
|
101
|
+
}, e.id))]
|
|
102
|
+
})]
|
|
103
|
+
})
|
|
104
|
+
]
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
export { c as AgentFallbackModelsPicker };
|
|
108
|
+
|
|
109
|
+
//# sourceMappingURL=AgentFallbackModelsPicker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentFallbackModelsPicker.js","names":["SELECT_CLASS","AgentFallbackModelsPicker","tr","useTr","selected","value","id","primaryModelId","available","models","model","labelOf","entry","move","next","item","index","by","onChange","selectId","idPrefix","Button","disabled","ArrowUp","ArrowDown","X","event"],"sources":["../../../src/botlit/components/AgentFallbackModelsPicker.tsx"],"sourcesContent":["/**\n * Ordered fallback models of an agent (BOFF-15360).\n *\n * When the primary model's provider fails (an error, a timeout, a rate limit\n * or a 5xx), the turn retries on these models in order. Any provider may be\n * chosen; the workspace's model allowlist and DATA sharing/region rules still\n * apply to each one at run time.\n * @module botlit/components\n */\nimport type { FC } from 'react';\nimport { ArrowDown, ArrowUp, X } from 'lucide-react';\nimport { useTr } from '../../shared/hooks/useTr';\nimport { Button } from './Button';\n\n/** Most fallback models an agent may have (the service enforces the same cap). */\nexport const MAX_FALLBACK_MODELS = 3;\n\nexport interface FallbackModelOption {\n id: string;\n name: string;\n modelId: string;\n providerName?: string;\n}\n\nexport interface AgentFallbackModelsPickerProps {\n /** Selected fallback model ids, in the order they are tried. */\n value: string[];\n onChange: (next: string[]) => void;\n /** Answer models the workspace has configured. */\n models: FallbackModelOption[];\n /** The agent's primary model, which cannot also be a fallback. */\n primaryModelId: string;\n disabled?: boolean;\n /** Id prefix for the add-select (labels need a stable id). */\n idPrefix: string;\n}\n\nconst SELECT_CLASS =\n 'flex h-10 w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm';\n\nexport const AgentFallbackModelsPicker: FC<AgentFallbackModelsPickerProps> = ({\n value,\n onChange,\n models,\n primaryModelId,\n disabled,\n idPrefix,\n}) => {\n const tr = useTr();\n const selected = value.filter((id) => id !== primaryModelId);\n const available = models.filter(\n (model) => model.id !== primaryModelId && !selected.includes(model.id)\n );\n const labelOf = (id: string): string => {\n const model = models.find((entry) => entry.id === id);\n if (!model)\n return tr('botlit.agentBuilder.fallback.unavailable', 'Unavailable model ({{id}})', { id });\n return model.providerName\n ? `${model.name} (${model.modelId}) · ${model.providerName}`\n : `${model.name} (${model.modelId})`;\n };\n const move = (index: number, by: -1 | 1) => {\n const next = [...selected];\n const [item] = next.splice(index, 1);\n if (item === undefined) return;\n next.splice(index + by, 0, item);\n onChange(next);\n };\n const selectId = `${idPrefix}-fallback-add`;\n\n return (\n <section aria-labelledby={`${idPrefix}-fallback-title`} className=\"space-y-3\">\n <div>\n <h4 id={`${idPrefix}-fallback-title`} className=\"text-sm font-medium\">\n {tr('botlit.agentBuilder.fallback.title', 'Fallback models')}\n </h4>\n <p className=\"text-sm text-text-secondary\">\n {tr(\n 'botlit.agentBuilder.fallback.help',\n 'If the primary model’s provider fails (error, timeout, rate limit or outage), the turn is retried on these models in order. Any provider can be used; workspace model and data policies still apply. Each run records which model answered.'\n )}\n </p>\n </div>\n\n {selected.length > 0 ? (\n <ol\n className=\"space-y-2\"\n aria-label={tr('botlit.agentBuilder.fallback.listLabel', 'Fallback order')}\n >\n {selected.map((id, index) => (\n <li\n key={id}\n className=\"flex items-center gap-2 rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm\"\n >\n <span className=\"w-5 shrink-0 tabular-nums text-text-secondary\">{index + 1}.</span>\n <span className=\"min-w-0 flex-1 truncate\">{labelOf(id)}</span>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n disabled={disabled || index === 0}\n aria-label={tr('botlit.agentBuilder.fallback.moveUp', 'Move {{name}} up', {\n name: labelOf(id),\n })}\n onClick={() => move(index, -1)}\n >\n <ArrowUp size={16} aria-hidden=\"true\" />\n </Button>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n disabled={disabled || index === selected.length - 1}\n aria-label={tr('botlit.agentBuilder.fallback.moveDown', 'Move {{name}} down', {\n name: labelOf(id),\n })}\n onClick={() => move(index, 1)}\n >\n <ArrowDown size={16} aria-hidden=\"true\" />\n </Button>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n disabled={disabled}\n aria-label={tr('botlit.agentBuilder.fallback.remove', 'Remove {{name}}', {\n name: labelOf(id),\n })}\n onClick={() => onChange(selected.filter((entry) => entry !== id))}\n >\n <X size={16} aria-hidden=\"true\" />\n </Button>\n </li>\n ))}\n </ol>\n ) : (\n <p className=\"text-sm text-text-secondary\">\n {tr(\n 'botlit.agentBuilder.fallback.none',\n 'No fallback models. A provider failure fails the turn.'\n )}\n </p>\n )}\n\n {selected.length < MAX_FALLBACK_MODELS && (\n <div className=\"space-y-1\">\n <label htmlFor={selectId} className=\"text-sm text-text-secondary\">\n {tr('botlit.agentBuilder.fallback.add', 'Add a fallback model')}\n </label>\n <select\n id={selectId}\n className={SELECT_CLASS}\n disabled={disabled || available.length === 0}\n value=\"\"\n onChange={(event) => {\n if (event.target.value) onChange([...selected, event.target.value]);\n }}\n >\n <option value=\"\">\n {available.length === 0\n ? tr(\n 'botlit.agentBuilder.fallback.noneAvailable',\n 'No other answer model is configured'\n )\n : tr('botlit.agentBuilder.fallback.choose', 'Choose a model…')}\n </option>\n {available.map((model) => (\n <option key={model.id} value={model.id}>\n {labelOf(model.id)}\n </option>\n ))}\n </select>\n </div>\n )}\n </section>\n );\n};\n"],"mappings":";;;;AAqCA,IAAMA,IACJ,4FAEWC,KAAiE,EAC5E,UACA,aACA,WACA,mBACA,aACA,kBACI;CACJ,IAAMC,IAAKC,EAAM,GACXC,IAAWC,EAAM,QAAQ,MAAOC,MAAOC,CAAc,GACrDC,IAAYC,EAAO,QACtB,MAAUC,EAAM,OAAOH,KAAkB,CAACH,EAAS,SAASM,EAAM,EAAE,CACvE,GACMC,KAAW,MAAuB;EACtC,IAAMD,IAAQD,EAAO,MAAM,MAAUG,EAAM,OAAON,CAAE;EAGpD,OAFKI,IAEEA,EAAM,eACT,GAAGA,EAAM,KAAK,IAAIA,EAAM,QAAQ,MAAMA,EAAM,iBAC5C,GAAGA,EAAM,KA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CAAA;;EAEA;;AAEb"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
export interface ModelAttemptRecord {
|
|
3
|
+
llmModelId?: string;
|
|
4
|
+
modelId: string;
|
|
5
|
+
providerType: string;
|
|
6
|
+
outcome: 'served' | 'failed' | 'skipped';
|
|
7
|
+
reason?: string;
|
|
8
|
+
detail?: string;
|
|
9
|
+
durationMs?: number;
|
|
10
|
+
}
|
|
11
|
+
export interface ModelFallbackRecord {
|
|
12
|
+
configured: string[];
|
|
13
|
+
servedBy: {
|
|
14
|
+
llmModelId?: string;
|
|
15
|
+
modelId: string;
|
|
16
|
+
providerType: string;
|
|
17
|
+
} | null;
|
|
18
|
+
fellBack: boolean;
|
|
19
|
+
attempts: ModelAttemptRecord[];
|
|
20
|
+
}
|
|
21
|
+
/** The record in an execution's metadata, or null when it has none (or a malformed one). */
|
|
22
|
+
export declare function readModelFallback(metadata: unknown): ModelFallbackRecord | null;
|
|
23
|
+
export declare const ExecutionModelFallback: FC<{
|
|
24
|
+
metadata: unknown;
|
|
25
|
+
}>;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { useTr as e } from "../../shared/hooks/useTr.js";
|
|
2
|
+
import { Badge as t } from "./Badge.js";
|
|
3
|
+
import { Card as n, CardContent as r, CardDescription as i, CardHeader as a, CardTitle as o } from "./Card.js";
|
|
4
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
5
|
+
import { ArrowRightLeft as l } from "lucide-react";
|
|
6
|
+
// src/botlit/components/ExecutionModelFallback.tsx
|
|
7
|
+
var u = /* @__PURE__ */ new Set([
|
|
8
|
+
"served",
|
|
9
|
+
"failed",
|
|
10
|
+
"skipped"
|
|
11
|
+
]);
|
|
12
|
+
function d(e) {
|
|
13
|
+
if (!e || typeof e != "object") return null;
|
|
14
|
+
let t = e.modelFallback;
|
|
15
|
+
if (!t || typeof t != "object") return null;
|
|
16
|
+
let { attempts: n, servedBy: r, fellBack: i, configured: a } = t;
|
|
17
|
+
return Array.isArray(n) ? {
|
|
18
|
+
configured: Array.isArray(a) ? a.filter((e) => typeof e == "string") : [],
|
|
19
|
+
servedBy: r && typeof r == "object" && typeof r.modelId == "string" ? r : null,
|
|
20
|
+
fellBack: i === !0,
|
|
21
|
+
attempts: n.filter((e) => !!e && typeof e == "object" && typeof e.modelId == "string" && u.has(e.outcome))
|
|
22
|
+
} : null;
|
|
23
|
+
}
|
|
24
|
+
var f = {
|
|
25
|
+
served: "success",
|
|
26
|
+
failed: "destructive",
|
|
27
|
+
skipped: "secondary"
|
|
28
|
+
}, p = ({ metadata: u }) => {
|
|
29
|
+
let p = e(), m = d(u);
|
|
30
|
+
if (!m) return null;
|
|
31
|
+
let h = (e) => {
|
|
32
|
+
switch (e) {
|
|
33
|
+
case "timeout": return p("botlit.execution.fallback.reason.timeout", "Timed out");
|
|
34
|
+
case "rate_limited": return p("botlit.execution.fallback.reason.rateLimited", "Rate limited");
|
|
35
|
+
case "server_error": return p("botlit.execution.fallback.reason.serverError", "Provider error (5xx)");
|
|
36
|
+
case "unreachable": return p("botlit.execution.fallback.reason.unreachable", "Provider unreachable");
|
|
37
|
+
case "provider_rejected": return p("botlit.execution.fallback.reason.rejected", "Provider rejected the credentials or model");
|
|
38
|
+
case "not_retryable": return p("botlit.execution.fallback.reason.notRetryable", "Not retried (request or policy error)");
|
|
39
|
+
case "model_unavailable": return p("botlit.execution.fallback.reason.modelUnavailable", "Skipped: model inactive or deleted");
|
|
40
|
+
case "provider_unavailable": return p("botlit.execution.fallback.reason.providerUnavailable", "Skipped: provider inactive");
|
|
41
|
+
case "credentials_missing": return p("botlit.execution.fallback.reason.credentialsMissing", "Skipped: no credentials");
|
|
42
|
+
case "tool_calling_unsupported": return p("botlit.execution.fallback.reason.noTools", "Skipped: cannot call this agent’s tools");
|
|
43
|
+
case "model_not_allowed": return p("botlit.execution.fallback.reason.modelNotAllowed", "Skipped: not on the model allowlist");
|
|
44
|
+
case "data_policy": return p("botlit.execution.fallback.reason.dataPolicy", "Skipped: data policy (sharing or region)");
|
|
45
|
+
default: return e ?? "";
|
|
46
|
+
}
|
|
47
|
+
}, g = m.servedBy ? m.fellBack ? p("botlit.execution.fallback.fellBack", "Answered by fallback model {{model}} ({{provider}}).", {
|
|
48
|
+
model: m.servedBy.modelId,
|
|
49
|
+
provider: m.servedBy.providerType
|
|
50
|
+
}) : p("botlit.execution.fallback.primary", "Answered by the primary model {{model}} ({{provider}}).", {
|
|
51
|
+
model: m.servedBy.modelId,
|
|
52
|
+
provider: m.servedBy.providerType
|
|
53
|
+
}) : p("botlit.execution.fallback.exhausted", "No model could answer this run.");
|
|
54
|
+
return /* @__PURE__ */ c(n, { children: [/* @__PURE__ */ c(a, { children: [/* @__PURE__ */ c(o, {
|
|
55
|
+
className: "flex items-center gap-2",
|
|
56
|
+
children: [/* @__PURE__ */ s(l, {
|
|
57
|
+
size: 18,
|
|
58
|
+
"aria-hidden": "true"
|
|
59
|
+
}), p("botlit.execution.fallback.title", "Model fallback")]
|
|
60
|
+
}), /* @__PURE__ */ s(i, { children: g })] }), /* @__PURE__ */ s(r, { children: /* @__PURE__ */ s("ol", {
|
|
61
|
+
className: "space-y-2",
|
|
62
|
+
"aria-label": p("botlit.execution.fallback.attempts", "Model attempts"),
|
|
63
|
+
children: m.attempts.map((e, n) => /* @__PURE__ */ c("li", {
|
|
64
|
+
className: "flex flex-wrap items-start gap-2 rounded-md bg-bg-sunken p-3 text-sm",
|
|
65
|
+
children: [
|
|
66
|
+
/* @__PURE__ */ c("span", {
|
|
67
|
+
className: "w-5 shrink-0 tabular-nums text-text-secondary",
|
|
68
|
+
children: [n + 1, "."]
|
|
69
|
+
}),
|
|
70
|
+
/* @__PURE__ */ c("div", {
|
|
71
|
+
className: "min-w-0 flex-1",
|
|
72
|
+
children: [
|
|
73
|
+
/* @__PURE__ */ c("p", {
|
|
74
|
+
className: "font-medium break-all",
|
|
75
|
+
children: [
|
|
76
|
+
e.modelId || e.llmModelId,
|
|
77
|
+
" ",
|
|
78
|
+
e.providerType && /* @__PURE__ */ c("span", {
|
|
79
|
+
className: "text-text-secondary",
|
|
80
|
+
children: [
|
|
81
|
+
"(",
|
|
82
|
+
e.providerType,
|
|
83
|
+
")"
|
|
84
|
+
]
|
|
85
|
+
})
|
|
86
|
+
]
|
|
87
|
+
}),
|
|
88
|
+
e.outcome !== "served" && e.reason && /* @__PURE__ */ s("p", {
|
|
89
|
+
className: "text-text-secondary",
|
|
90
|
+
children: h(e.reason)
|
|
91
|
+
}),
|
|
92
|
+
e.detail && /* @__PURE__ */ s("p", {
|
|
93
|
+
className: "font-mono text-xs text-text-secondary break-all",
|
|
94
|
+
children: e.detail
|
|
95
|
+
})
|
|
96
|
+
]
|
|
97
|
+
}),
|
|
98
|
+
/* @__PURE__ */ c("div", {
|
|
99
|
+
className: "flex items-center gap-2",
|
|
100
|
+
children: [typeof e.durationMs == "number" && /* @__PURE__ */ c("span", {
|
|
101
|
+
className: "tabular-nums text-text-secondary",
|
|
102
|
+
children: [e.durationMs, " ms"]
|
|
103
|
+
}), /* @__PURE__ */ s(t, {
|
|
104
|
+
variant: f[e.outcome],
|
|
105
|
+
children: e.outcome === "served" ? p("botlit.execution.fallback.served", "Served") : e.outcome === "failed" ? p("botlit.execution.fallback.failed", "Failed") : p("botlit.execution.fallback.skipped", "Skipped")
|
|
106
|
+
})]
|
|
107
|
+
})
|
|
108
|
+
]
|
|
109
|
+
}, `${e.llmModelId ?? e.modelId}-${n}`))
|
|
110
|
+
}) })] });
|
|
111
|
+
};
|
|
112
|
+
export { p as ExecutionModelFallback, d as readModelFallback };
|
|
113
|
+
|
|
114
|
+
//# sourceMappingURL=ExecutionModelFallback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExecutionModelFallback.js","names":["OUTCOMES","readModelFallback","metadata","record","attempts","configured","id","servedBy","fellBack","attempt","OUTCOME_VARIANT","ExecutionModelFallback","tr","useTr","reasonLabel","reason","summary","Card","CardHeader","CardTitle","ArrowRightLeft","CardDescription","CardContent","index","Badge"],"sources":["../../../src/botlit/components/ExecutionModelFallback.tsx"],"sourcesContent":["/**\n * Which model served a run, and every model it tried (BOFF-15360).\n *\n * Reads `Execution.metadata.modelFallback`, which the service records for an\n * agent with fallback models: the primary first, then each fallback that was\n * tried or skipped (and why), and the model that answered.\n * @module botlit/components\n */\nimport type { FC } from 'react';\nimport { ArrowRightLeft } from 'lucide-react';\nimport { useTr } from '../../shared/hooks/useTr';\nimport { Badge } from './Badge';\nimport { Card, CardContent, CardDescription, CardHeader, CardTitle } from './Card';\n\nexport interface ModelAttemptRecord {\n llmModelId?: string;\n modelId: string;\n providerType: string;\n outcome: 'served' | 'failed' | 'skipped';\n reason?: string;\n detail?: string;\n durationMs?: number;\n}\n\nexport interface ModelFallbackRecord {\n configured: string[];\n servedBy: { llmModelId?: string; modelId: string; providerType: string } | null;\n fellBack: boolean;\n attempts: ModelAttemptRecord[];\n}\n\nconst OUTCOMES = new Set(['served', 'failed', 'skipped']);\n\n/** The record in an execution's metadata, or null when it has none (or a malformed one). */\nexport function readModelFallback(metadata: unknown): ModelFallbackRecord | null {\n if (!metadata || typeof metadata !== 'object') return null;\n const record = (metadata as { modelFallback?: unknown }).modelFallback;\n if (!record || typeof record !== 'object') return null;\n const { attempts, servedBy, fellBack, configured } = record as Partial<ModelFallbackRecord>;\n if (!Array.isArray(attempts)) return null;\n return {\n configured: Array.isArray(configured) ? configured.filter((id) => typeof id === 'string') : [],\n servedBy:\n servedBy && typeof servedBy === 'object' && typeof servedBy.modelId === 'string'\n ? servedBy\n : null,\n fellBack: fellBack === true,\n attempts: attempts.filter(\n (attempt): attempt is ModelAttemptRecord =>\n !!attempt &&\n typeof attempt === 'object' &&\n typeof attempt.modelId === 'string' &&\n OUTCOMES.has(attempt.outcome)\n ),\n };\n}\n\nconst OUTCOME_VARIANT = {\n served: 'success',\n failed: 'destructive',\n skipped: 'secondary',\n} as const;\n\nexport const ExecutionModelFallback: FC<{ metadata: unknown }> = ({ metadata }) => {\n const tr = useTr();\n const record = readModelFallback(metadata);\n if (!record) return null;\n\n const reasonLabel = (reason: string | undefined): string => {\n switch (reason) {\n case 'timeout':\n return tr('botlit.execution.fallback.reason.timeout', 'Timed out');\n case 'rate_limited':\n return tr('botlit.execution.fallback.reason.rateLimited', 'Rate limited');\n case 'server_error':\n return tr('botlit.execution.fallback.reason.serverError', 'Provider error (5xx)');\n case 'unreachable':\n return tr('botlit.execution.fallback.reason.unreachable', 'Provider unreachable');\n case 'provider_rejected':\n return tr(\n 'botlit.execution.fallback.reason.rejected',\n 'Provider rejected the credentials or model'\n );\n case 'not_retryable':\n return tr(\n 'botlit.execution.fallback.reason.notRetryable',\n 'Not retried (request or policy error)'\n );\n case 'model_unavailable':\n return tr(\n 'botlit.execution.fallback.reason.modelUnavailable',\n 'Skipped: model inactive or deleted'\n );\n case 'provider_unavailable':\n return tr(\n 'botlit.execution.fallback.reason.providerUnavailable',\n 'Skipped: provider inactive'\n );\n case 'credentials_missing':\n return tr('botlit.execution.fallback.reason.credentialsMissing', 'Skipped: no credentials');\n case 'tool_calling_unsupported':\n return tr(\n 'botlit.execution.fallback.reason.noTools',\n 'Skipped: cannot call this agent’s tools'\n );\n case 'model_not_allowed':\n return tr(\n 'botlit.execution.fallback.reason.modelNotAllowed',\n 'Skipped: not on the model allowlist'\n );\n case 'data_policy':\n return tr(\n 'botlit.execution.fallback.reason.dataPolicy',\n 'Skipped: data policy (sharing or region)'\n );\n default:\n return reason ?? '';\n }\n };\n\n const summary = record.servedBy\n ? record.fellBack\n ? tr(\n 'botlit.execution.fallback.fellBack',\n 'Answered by fallback model {{model}} ({{provider}}).',\n {\n model: record.servedBy.modelId,\n provider: record.servedBy.providerType,\n }\n )\n : tr(\n 'botlit.execution.fallback.primary',\n 'Answered by the primary model {{model}} ({{provider}}).',\n {\n model: record.servedBy.modelId,\n provider: record.servedBy.providerType,\n }\n )\n : tr('botlit.execution.fallback.exhausted', 'No model could answer this run.');\n\n return (\n <Card>\n <CardHeader>\n <CardTitle className=\"flex items-center gap-2\">\n <ArrowRightLeft size={18} aria-hidden=\"true\" />\n {tr('botlit.execution.fallback.title', 'Model fallback')}\n </CardTitle>\n <CardDescription>{summary}</CardDescription>\n </CardHeader>\n <CardContent>\n <ol\n className=\"space-y-2\"\n aria-label={tr('botlit.execution.fallback.attempts', 'Model attempts')}\n >\n {record.attempts.map((attempt, index) => (\n <li\n key={`${attempt.llmModelId ?? attempt.modelId}-${index}`}\n className=\"flex flex-wrap items-start gap-2 rounded-md bg-bg-sunken p-3 text-sm\"\n >\n <span className=\"w-5 shrink-0 tabular-nums text-text-secondary\">{index + 1}.</span>\n <div className=\"min-w-0 flex-1\">\n <p className=\"font-medium break-all\">\n {attempt.modelId || attempt.llmModelId}{' '}\n {attempt.providerType && (\n <span className=\"text-text-secondary\">({attempt.providerType})</span>\n )}\n </p>\n {attempt.outcome !== 'served' && attempt.reason && (\n <p className=\"text-text-secondary\">{reasonLabel(attempt.reason)}</p>\n )}\n {attempt.detail && (\n <p className=\"font-mono text-xs text-text-secondary break-all\">\n {attempt.detail}\n </p>\n )}\n </div>\n <div className=\"flex items-center gap-2\">\n {typeof attempt.durationMs === 'number' && (\n <span className=\"tabular-nums text-text-secondary\">{attempt.durationMs} ms</span>\n )}\n <Badge variant={OUTCOME_VARIANT[attempt.outcome]}>\n {attempt.outcome === 'served'\n ? tr('botlit.execution.fallback.served', 'Served')\n : attempt.outcome === 'failed'\n ? tr('botlit.execution.fallback.failed', 'Failed')\n : tr('botlit.execution.fallback.skipped', 'Skipped')}\n </Badge>\n </div>\n </li>\n ))}\n </ol>\n </CardContent>\n </Card>\n );\n};\n"],"mappings":";;;;;;AA+BA,IAAMA,oBAAW,IAAI,IAAI;CAAC;CAAU;CAAU;AAAS,CAAC;AAGxD,SAAgBC,EAAkB,GAA+C;CAC/E,IAAI,CAACC,KAAY,OAAOA,KAAa,UAAU,OAAO;CACtD,IAAMC,IA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ACG,OAAOA,EAAQ,cAAe,YAC7B,kBAAC,QAAD;MAAM,WAAU;MAAhB,UAAA,CAAoDA,EAAQ,YAAW,KAAS;KAElF,CAAA,GAAA,kBAACe,GAAD;MAAO,SAASd,EAAgBD,EAAQ;MACrC,UAAAA,EAAQ,YAAY,WACjBG,EAAG,oCAAoC,QAAQ,IAC/CH,EAAQ,YAAY,WAClBG,EAAG,oCAAoC,QAAQ,IAC/CA,EAAG,qCAAqC,SAAS;KAClD,CAAA,CACJ;;GACH;EAhCG,GAAA,GAAGH,EAAQ,cAAcA,EAAQ,QAAQ,GAAGc,GAgC/C,CACL;CACC,CAAA,EACO,CAAA,CACT,EAAA,CAAA;AAEV"}
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import { CreateA2ARegistryEntryInput, UpdateA2ARegistryEntryInput } from '../../generated/wspace-types';
|
|
2
2
|
import { A2AAgentFilter } from '../types';
|
|
3
3
|
import { GraphQLInput } from './internal/mutationInput';
|
|
4
|
-
import { QueryResult } from './internal/workspaceGateway';
|
|
4
|
+
import { PaginatedQueryResult, QueryResult } from './internal/workspaceGateway';
|
|
5
|
+
/** Page size for the registry list; further pages load on demand (BOFF-12509). */
|
|
6
|
+
export declare const A2A_LIST_PAGE_SIZE = 50;
|
|
7
|
+
/** Field limits for a registry entry (BOFF-12508). The name column is VARCHAR(255). */
|
|
8
|
+
export declare const A2A_NAME_MAX = 255;
|
|
9
|
+
export declare const A2A_DESCRIPTION_MAX = 2000;
|
|
10
|
+
export declare const A2A_URL_MAX = 2048;
|
|
11
|
+
/** The service refuses an agent card larger than 1 MiB. */
|
|
12
|
+
export declare const A2A_AGENT_CARD_MAX_BYTES: number;
|
|
5
13
|
export interface A2AAgentRecord {
|
|
6
14
|
id: string;
|
|
7
15
|
name: string;
|
|
@@ -29,9 +37,15 @@ export interface UpdateA2AAgentVariables {
|
|
|
29
37
|
agentId: string;
|
|
30
38
|
input: GraphQLInput<UpdateA2ARegistryEntryInput>;
|
|
31
39
|
}
|
|
40
|
+
/** One validation problem, as a translation key plus its English fallback. */
|
|
41
|
+
export interface A2AValidationIssue {
|
|
42
|
+
key: string;
|
|
43
|
+
fallback: string;
|
|
44
|
+
params?: Record<string, string | number>;
|
|
45
|
+
}
|
|
32
46
|
export interface AgentCardValidation {
|
|
33
47
|
valid: boolean;
|
|
34
|
-
errors:
|
|
48
|
+
errors: A2AValidationIssue[];
|
|
35
49
|
}
|
|
36
50
|
/**
|
|
37
51
|
* The agent-card fields the UI renders. `agentCard` is a free-form `JSON`
|
|
@@ -61,19 +75,71 @@ export interface A2AAgentCardSkill {
|
|
|
61
75
|
tags: string[];
|
|
62
76
|
examples: string[];
|
|
63
77
|
}
|
|
64
|
-
/**
|
|
78
|
+
/**
|
|
79
|
+
* The permissions the service checks on a registry entry's entitlements
|
|
80
|
+
* (`A2AEntitlementService`): a connection needs `agent:delegate` or
|
|
81
|
+
* `task:create`, and a task sent to the entry needs `task:create`.
|
|
82
|
+
*/
|
|
83
|
+
export declare const A2A_ENTITLEMENT_PERMISSIONS: readonly ["agent:delegate", "task:create"];
|
|
84
|
+
export type A2AEntitlementPermission = (typeof A2A_ENTITLEMENT_PERMISSIONS)[number];
|
|
85
|
+
/**
|
|
86
|
+
* One row of the `entitlements` JSON in the shape the service enforces
|
|
87
|
+
* (BOFF-12506): a permission, an optional list of local sender agents it is
|
|
88
|
+
* limited to, and an optional validity window. A row without a permission is
|
|
89
|
+
* ignored by the service, so it is flagged `recognised: false` instead of
|
|
90
|
+
* being shown as if it granted anything.
|
|
91
|
+
*/
|
|
65
92
|
export interface A2AEntitlementView {
|
|
66
93
|
id: string;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
94
|
+
recognised: boolean;
|
|
95
|
+
permission: string;
|
|
96
|
+
/** Local agents that may use this grant; empty means every agent in the workspace. */
|
|
97
|
+
agentIds: string[];
|
|
98
|
+
validFrom?: string;
|
|
99
|
+
validUntil?: string;
|
|
100
|
+
/**
|
|
101
|
+
* Fields the service stores but does not enforce on an A2A call (bucket, app
|
|
102
|
+
* and knowledge-base scope, rate limits). Kept on save, listed read-only.
|
|
103
|
+
*/
|
|
104
|
+
unenforced: string[];
|
|
105
|
+
}
|
|
106
|
+
/** Editable form of one entitlement. Dates are `YYYY-MM-DD` (empty = open-ended). */
|
|
107
|
+
export interface A2AEntitlementDraft {
|
|
108
|
+
permission: A2AEntitlementPermission;
|
|
109
|
+
agentIds: string[];
|
|
110
|
+
validFrom: string;
|
|
111
|
+
validUntil: string;
|
|
112
|
+
/** The original JSON row, so fields the editor does not show survive a save. */
|
|
113
|
+
original?: Record<string, unknown>;
|
|
72
114
|
}
|
|
73
115
|
/** Reads the renderable view of an A2A agent card out of its JSON document. */
|
|
74
116
|
export declare function readAgentCard(card: Record<string, unknown> | undefined): A2AAgentCardView;
|
|
75
117
|
/** Reads the entitlement rows out of the `entitlements` JSON column. */
|
|
76
118
|
export declare function readEntitlements(entitlements: Record<string, unknown> | unknown[] | null | undefined): A2AEntitlementView[];
|
|
119
|
+
/**
|
|
120
|
+
* Editable drafts for the entitlements the service recognises. Rows it ignores
|
|
121
|
+
* (no permission, or a permission it never checks) are not editable here;
|
|
122
|
+
* `toEntitlementsInput` keeps them untouched.
|
|
123
|
+
*/
|
|
124
|
+
export declare function toEntitlementDrafts(entitlements: Record<string, unknown> | unknown[] | null | undefined): A2AEntitlementDraft[];
|
|
125
|
+
/**
|
|
126
|
+
* Rows of the stored JSON the editor does not manage, so a save from the
|
|
127
|
+
* editor does not silently drop them.
|
|
128
|
+
*/
|
|
129
|
+
export declare function unmanagedEntitlements(entitlements: Record<string, unknown> | unknown[] | null | undefined): Record<string, unknown>[];
|
|
130
|
+
/**
|
|
131
|
+
* Serialises edited entitlements to the JSON the service enforces. A newly
|
|
132
|
+
* chosen start date begins at 00:00 UTC and an end date runs to the end of
|
|
133
|
+
* that UTC day; an unchanged stored timestamp is kept as it was.
|
|
134
|
+
*/
|
|
135
|
+
export declare function toEntitlementsInput(drafts: A2AEntitlementDraft[], unmanaged?: Record<string, unknown>[]): Record<string, unknown>[];
|
|
136
|
+
/** Per-draft validation: an end date must not come before the start date. */
|
|
137
|
+
export declare function entitlementDraftError(draft: A2AEntitlementDraft): 'validityOrder' | undefined;
|
|
138
|
+
/**
|
|
139
|
+
* True when at least one entitlement, valid now, lets a connection be made —
|
|
140
|
+
* the service refuses every connection to an entry without one (default deny).
|
|
141
|
+
*/
|
|
142
|
+
export declare function entitlementsAllowConnections(entitlements: Record<string, unknown> | unknown[] | null | undefined, now?: number): boolean;
|
|
77
143
|
/** Number of skills the registered agent card advertises. */
|
|
78
144
|
export declare function a2aAgentSkillCount(agent: Pick<A2AAgentRecord, 'agentCard'>): number;
|
|
79
145
|
/**
|
|
@@ -81,6 +147,31 @@ export declare function a2aAgentSkillCount(agent: Pick<A2AAgentRecord, 'agentCar
|
|
|
81
147
|
* the document the caller supplies — it does NOT contact the remote agent.
|
|
82
148
|
*/
|
|
83
149
|
export declare function validateAgentCard(card: Record<string, unknown> | undefined): AgentCardValidation;
|
|
150
|
+
/** True for an absolute `https://` URL with a host. */
|
|
151
|
+
export declare function isHttpsUrl(value: string): boolean;
|
|
152
|
+
/** The registry form as the page edits it. */
|
|
153
|
+
export interface A2ARegistryFormValues {
|
|
154
|
+
name: string;
|
|
155
|
+
description: string;
|
|
156
|
+
wellKnownUrl: string;
|
|
157
|
+
agentCardJson: string;
|
|
158
|
+
}
|
|
159
|
+
export type A2ARegistryFormField = 'name' | 'description' | 'wellKnownUrl' | 'agentCardJson';
|
|
160
|
+
/** Parses the edited agent card; returns undefined when the JSON is malformed. */
|
|
161
|
+
export declare function parseAgentCardJson(json: string): Record<string, unknown> | undefined;
|
|
162
|
+
/**
|
|
163
|
+
* The name the entry is saved with: the typed name, or the card's own name
|
|
164
|
+
* when the field is left empty (BOFF-12510), so the list and the card agree
|
|
165
|
+
* unless the user deliberately overrides it.
|
|
166
|
+
*/
|
|
167
|
+
export declare function effectiveEntryName(values: A2ARegistryFormValues): string;
|
|
168
|
+
/** The description the entry is saved with (typed, else the card's). */
|
|
169
|
+
export declare function effectiveEntryDescription(values: A2ARegistryFormValues): string;
|
|
170
|
+
/**
|
|
171
|
+
* Field-level validation for the register/edit form (BOFF-12508). Returns at
|
|
172
|
+
* most one issue per field, so each can be shown inline next to its input.
|
|
173
|
+
*/
|
|
174
|
+
export declare function validateRegistryForm(values: A2ARegistryFormValues): Partial<Record<A2ARegistryFormField, A2AValidationIssue>>;
|
|
84
175
|
export declare const a2aKeys: {
|
|
85
176
|
all: readonly ["a2a"];
|
|
86
177
|
lists: () => readonly ["a2a", "list"];
|
|
@@ -88,7 +179,14 @@ export declare const a2aKeys: {
|
|
|
88
179
|
details: () => readonly ["a2a", "detail"];
|
|
89
180
|
detail: (id: string) => readonly ["a2a", "detail", string];
|
|
90
181
|
};
|
|
91
|
-
|
|
182
|
+
/**
|
|
183
|
+
* The registry list, one page at a time (BOFF-12509). Status, trust level,
|
|
184
|
+
* visibility and bucket filter on the server. The service has no free-text
|
|
185
|
+
* filter, so `search` narrows the rows loaded so far; the page keeps loading
|
|
186
|
+
* further pages while a search is active, so a match is never hidden behind
|
|
187
|
+
* an unloaded page.
|
|
188
|
+
*/
|
|
189
|
+
export declare function useA2AAgents(filter?: A2AAgentFilter): PaginatedQueryResult<A2AAgentRecord[]>;
|
|
92
190
|
export declare function useA2AAgent(agentId: string | undefined): QueryResult<A2AAgentRecord | null>;
|
|
93
191
|
export declare function useRegisterA2AAgent(): readonly [(input: RegisterA2AAgentVariables) => Promise<A2AAgentRecord>, import('./internal/workspaceGateway').MutationState<A2AAgentRecord>];
|
|
94
192
|
export declare function useUpdateA2AAgent(): readonly [(input: UpdateA2AAgentVariables) => Promise<A2AAgentRecord>, import('./internal/workspaceGateway').MutationState<A2AAgentRecord>];
|