@bikdotai/bik-component-library 0.0.830 → 0.0.831-beta.1
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/cjs/components/agent-builder/AgentBuilder.js +1 -1
- package/dist/cjs/components/agent-builder/AgentBuilder.js.map +1 -1
- package/dist/cjs/components/agent-builder/AgentBuilder.styled.js +17 -65
- package/dist/cjs/components/agent-builder/AgentBuilder.styled.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/ConfigToolPanel.js +41 -0
- package/dist/cjs/components/agent-builder/components/ConfigToolPanel.js.map +1 -0
- package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js +5 -5
- package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/DrawerHeaderText.js +15 -0
- package/dist/cjs/components/agent-builder/components/DrawerHeaderText.js.map +1 -0
- package/dist/cjs/components/agent-builder/components/MentionEditor.js +1 -1
- package/dist/cjs/components/agent-builder/components/MentionEditor.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/MentionField.js +1 -1
- package/dist/cjs/components/agent-builder/components/MentionField.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/MentionPicker.js +20 -20
- package/dist/cjs/components/agent-builder/components/MentionPicker.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/RestApiToolPanel.js +23 -0
- package/dist/cjs/components/agent-builder/components/RestApiToolPanel.js.map +1 -0
- package/dist/cjs/components/agent-builder/components/SelectableListSection.js +5 -5
- package/dist/cjs/components/agent-builder/components/SelectableListSection.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/ToolInstructionsField.js +5 -0
- package/dist/cjs/components/agent-builder/components/ToolInstructionsField.js.map +1 -0
- package/dist/cjs/components/agent-builder/constants/tools.js +2 -0
- package/dist/cjs/components/agent-builder/constants/tools.js.map +1 -0
- package/dist/cjs/components/agent-builder/context/AgentBuilderContext.js +1 -1
- package/dist/cjs/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
- package/dist/cjs/components/agent-builder/steps/Step3HowItResponds.js +1 -1
- package/dist/cjs/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
- package/dist/cjs/components/agent-builder/utils/mentionSerialization.js +3 -3
- package/dist/cjs/components/agent-builder/utils/mentionSerialization.js.map +1 -1
- package/dist/cjs/components/agent-builder/utils/sourceIcons.js +1 -1
- package/dist/cjs/components/agent-builder/utils/sourceIcons.js.map +1 -1
- package/dist/cjs/components/side-modal/SideModal.style.js +11 -10
- package/dist/cjs/components/side-modal/SideModal.style.js.map +1 -1
- package/dist/cjs/editor/extensions/mention/MentionExtension.js +1 -1
- package/dist/cjs/editor/extensions/mention/MentionExtension.js.map +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/esm/components/agent-builder/AgentBuilder.js +100 -96
- package/dist/esm/components/agent-builder/AgentBuilder.js.map +1 -1
- package/dist/esm/components/agent-builder/AgentBuilder.model.d.ts +144 -1
- package/dist/esm/components/agent-builder/AgentBuilder.styled.d.ts +0 -21
- package/dist/esm/components/agent-builder/AgentBuilder.styled.js +42 -111
- package/dist/esm/components/agent-builder/AgentBuilder.styled.js.map +1 -1
- package/dist/esm/components/agent-builder/components/ConfigToolPanel.d.ts +33 -0
- package/dist/esm/components/agent-builder/components/ConfigToolPanel.js +251 -0
- package/dist/esm/components/agent-builder/components/ConfigToolPanel.js.map +1 -0
- package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.d.ts +9 -1
- package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js +318 -219
- package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
- package/dist/esm/components/agent-builder/components/DrawerHeaderText.d.ts +33 -0
- package/dist/esm/components/agent-builder/components/DrawerHeaderText.js +42 -0
- package/dist/esm/components/agent-builder/components/DrawerHeaderText.js.map +1 -0
- package/dist/esm/components/agent-builder/components/MentionEditor.d.ts +6 -0
- package/dist/esm/components/agent-builder/components/MentionEditor.js +38 -30
- package/dist/esm/components/agent-builder/components/MentionEditor.js.map +1 -1
- package/dist/esm/components/agent-builder/components/MentionField.js +76 -51
- package/dist/esm/components/agent-builder/components/MentionField.js.map +1 -1
- package/dist/esm/components/agent-builder/components/MentionPicker.d.ts +7 -0
- package/dist/esm/components/agent-builder/components/MentionPicker.js +162 -145
- package/dist/esm/components/agent-builder/components/MentionPicker.js.map +1 -1
- package/dist/esm/components/agent-builder/components/RestApiToolPanel.d.ts +27 -0
- package/dist/esm/components/agent-builder/components/RestApiToolPanel.js +270 -0
- package/dist/esm/components/agent-builder/components/RestApiToolPanel.js.map +1 -0
- package/dist/esm/components/agent-builder/components/SelectableListSection.d.ts +14 -0
- package/dist/esm/components/agent-builder/components/SelectableListSection.js +166 -140
- package/dist/esm/components/agent-builder/components/SelectableListSection.js.map +1 -1
- package/dist/esm/components/agent-builder/components/ToolInstructionsField.d.ts +19 -0
- package/dist/esm/components/agent-builder/components/ToolInstructionsField.js +66 -0
- package/dist/esm/components/agent-builder/components/ToolInstructionsField.js.map +1 -0
- package/dist/esm/components/agent-builder/constants/tools.d.ts +77 -0
- package/dist/esm/components/agent-builder/constants/tools.js +34 -0
- package/dist/esm/components/agent-builder/constants/tools.js.map +1 -0
- package/dist/esm/components/agent-builder/context/AgentBuilderContext.d.ts +19 -1
- package/dist/esm/components/agent-builder/context/AgentBuilderContext.js +169 -140
- package/dist/esm/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
- package/dist/esm/components/agent-builder/index.d.ts +2 -1
- package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js +241 -141
- package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
- package/dist/esm/components/agent-builder/utils/mentionSerialization.d.ts +18 -3
- package/dist/esm/components/agent-builder/utils/mentionSerialization.js +81 -62
- package/dist/esm/components/agent-builder/utils/mentionSerialization.js.map +1 -1
- package/dist/esm/components/agent-builder/utils/sourceIcons.d.ts +15 -9
- package/dist/esm/components/agent-builder/utils/sourceIcons.js +16 -8
- package/dist/esm/components/agent-builder/utils/sourceIcons.js.map +1 -1
- package/dist/esm/components/side-modal/SideModal.style.js +1 -0
- package/dist/esm/components/side-modal/SideModal.style.js.map +1 -1
- package/dist/esm/editor/extensions/mention/MentionExtension.js +60 -57
- package/dist/esm/editor/extensions/mention/MentionExtension.js.map +1 -1
- package/dist/esm/index.js +97 -95
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { FunctionComponent, SVGAttributes } from 'react';
|
|
2
|
+
import { ConfigToolKey } from '../AgentBuilder.model';
|
|
3
|
+
/**
|
|
4
|
+
* Static tool-related constants for the builder's Step 3 (tools & sub-agents):
|
|
5
|
+
* the reference-picker category tabs and the per-source display labels. Kept here
|
|
6
|
+
* (rather than inline in the picker / serialization utils) so the labels a user
|
|
7
|
+
* sees are all in one obvious place.
|
|
8
|
+
*/
|
|
9
|
+
/** A reference-picker category tab. */
|
|
10
|
+
export type Category = 'tool' | 'subagent';
|
|
11
|
+
/** Category tabs shown at the root of the `@` reference picker. */
|
|
12
|
+
export declare const CATEGORIES: {
|
|
13
|
+
key: Category;
|
|
14
|
+
label: string;
|
|
15
|
+
}[];
|
|
16
|
+
/**
|
|
17
|
+
* Every tool "source" the builder renders an icon / label / picker entry for.
|
|
18
|
+
* Enum VALUES are the backend's canonical read-only `source` wire strings
|
|
19
|
+
* (`app/agents/config/schema.py` → `ToolSource`, derived from `tool_key`): the
|
|
20
|
+
* configurable tools are `email_handover` / `rest_api` / `slack`, every native
|
|
21
|
+
* tool is `manifest`. `shopify` / `integration` are legacy bik-models sources
|
|
22
|
+
* kept for back-compat (the backend now collapses natives to `manifest`).
|
|
23
|
+
* Dynamic/unknown sources are looked up leniently — see `toolSourceLabel` and
|
|
24
|
+
* `sourceIcon`.
|
|
25
|
+
*/
|
|
26
|
+
export declare enum ToolSource {
|
|
27
|
+
Manifest = "manifest",
|
|
28
|
+
Shopify = "shopify",
|
|
29
|
+
Integration = "integration",
|
|
30
|
+
RestApi = "rest_api",
|
|
31
|
+
EmailHandover = "email_handover",
|
|
32
|
+
Slack = "slack"
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Display labels for the known tool sources — the CATEGORY/integration name, used
|
|
36
|
+
* for the picker's source headers (drill-in groups), the empty-state source
|
|
37
|
+
* buttons and the mention-chip prefix. A source is a category ("Slack") you drill
|
|
38
|
+
* into; the specific addable action inside it ("Send Slack message") is
|
|
39
|
+
* `TOOL_ACTION_LABELS`. Unknown sources fall back to the raw key (see
|
|
40
|
+
* `toolSourceLabel`).
|
|
41
|
+
*/
|
|
42
|
+
export declare const TOOL_SOURCE_LABELS: Record<ToolSource, string>;
|
|
43
|
+
/**
|
|
44
|
+
* The addable action inside a configurable/rest source — shown as the "add" row
|
|
45
|
+
* in the `@` picker (below any existing instances) and the empty-state button.
|
|
46
|
+
* Distinct from `TOOL_SOURCE_LABELS`, which names the category the action lives in
|
|
47
|
+
* (e.g. category "Slack" → action "Send Slack message").
|
|
48
|
+
*/
|
|
49
|
+
export declare const TOOL_ACTION_LABELS: Partial<Record<ToolSource, string>>;
|
|
50
|
+
/** A tool source's brand-glyph component. */
|
|
51
|
+
export type IconComp = FunctionComponent<SVGAttributes<SVGElement>>;
|
|
52
|
+
/** Brand glyph for a tool source, with its own size so each keeps its aspect ratio. */
|
|
53
|
+
export interface SourceIcon {
|
|
54
|
+
Icon: IconComp;
|
|
55
|
+
w: number;
|
|
56
|
+
h: number;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* A built-in "tool" that opens a config drawer (Rest API / email handover /
|
|
60
|
+
* Slack) rather than inserting a mention. Surfaced as an empty-state source
|
|
61
|
+
* button in the Tools section and as a row in the `@`-picker Tools view; picking
|
|
62
|
+
* it opens the drawer and never writes into the instructions text.
|
|
63
|
+
*/
|
|
64
|
+
export interface ToolAction {
|
|
65
|
+
source: ToolSource;
|
|
66
|
+
label: string;
|
|
67
|
+
icon?: SourceIcon;
|
|
68
|
+
/** Open this tool's config drawer. */
|
|
69
|
+
onSelect: () => void;
|
|
70
|
+
}
|
|
71
|
+
/** Sources of the built-in drawer tools, in display order. */
|
|
72
|
+
export declare const TOOL_ACTION_SOURCES: ToolSource[];
|
|
73
|
+
/**
|
|
74
|
+
* Drawer sources rendered by the shared dynamic panel (`ConfigToolPanel`), each
|
|
75
|
+
* mapped to its backend `tool_key`. Rest API is absent — it has a bespoke panel.
|
|
76
|
+
*/
|
|
77
|
+
export declare const CONFIG_TOOL_SOURCES: Partial<Record<ToolSource, ConfigToolKey>>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const s = [
|
|
2
|
+
{ key: "tool", label: "Tools" },
|
|
3
|
+
{ key: "subagent", label: "Sub-agent" }
|
|
4
|
+
];
|
|
5
|
+
var e = /* @__PURE__ */ ((a) => (a.Manifest = "manifest", a.Shopify = "shopify", a.Integration = "integration", a.RestApi = "rest_api", a.EmailHandover = "email_handover", a.Slack = "slack", a))(e || {});
|
|
6
|
+
const n = {
|
|
7
|
+
manifest: "Manifest",
|
|
8
|
+
shopify: "Shopify",
|
|
9
|
+
integration: "Integration",
|
|
10
|
+
rest_api: "Rest API",
|
|
11
|
+
email_handover: "Email",
|
|
12
|
+
slack: "Slack"
|
|
13
|
+
}, t = {
|
|
14
|
+
rest_api: "REST API",
|
|
15
|
+
email_handover: "Handover to email",
|
|
16
|
+
slack: "Send Slack message"
|
|
17
|
+
}, i = [
|
|
18
|
+
"rest_api",
|
|
19
|
+
"email_handover",
|
|
20
|
+
"slack"
|
|
21
|
+
/* Slack */
|
|
22
|
+
], _ = {
|
|
23
|
+
email_handover: "send_email",
|
|
24
|
+
slack: "send_slack_message"
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
s as CATEGORIES,
|
|
28
|
+
_ as CONFIG_TOOL_SOURCES,
|
|
29
|
+
t as TOOL_ACTION_LABELS,
|
|
30
|
+
i as TOOL_ACTION_SOURCES,
|
|
31
|
+
n as TOOL_SOURCE_LABELS,
|
|
32
|
+
e as ToolSource
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.js","sources":["../../../../../src/components/agent-builder/constants/tools.ts"],"sourcesContent":["import type { FunctionComponent, SVGAttributes } from 'react';\nimport type { ConfigToolKey } from '../AgentBuilder.model';\n\n/**\n * Static tool-related constants for the builder's Step 3 (tools & sub-agents):\n * the reference-picker category tabs and the per-source display labels. Kept here\n * (rather than inline in the picker / serialization utils) so the labels a user\n * sees are all in one obvious place.\n */\n\n/** A reference-picker category tab. */\nexport type Category = 'tool' | 'subagent';\n\n/** Category tabs shown at the root of the `@` reference picker. */\nexport const CATEGORIES: { key: Category; label: string }[] = [\n\t{ key: 'tool', label: 'Tools' },\n\t{ key: 'subagent', label: 'Sub-agent' },\n];\n\n/**\n * Every tool \"source\" the builder renders an icon / label / picker entry for.\n * Enum VALUES are the backend's canonical read-only `source` wire strings\n * (`app/agents/config/schema.py` → `ToolSource`, derived from `tool_key`): the\n * configurable tools are `email_handover` / `rest_api` / `slack`, every native\n * tool is `manifest`. `shopify` / `integration` are legacy bik-models sources\n * kept for back-compat (the backend now collapses natives to `manifest`).\n * Dynamic/unknown sources are looked up leniently — see `toolSourceLabel` and\n * `sourceIcon`.\n */\nexport enum ToolSource {\n\tManifest = 'manifest',\n\tShopify = 'shopify',\n\tIntegration = 'integration',\n\tRestApi = 'rest_api',\n\tEmailHandover = 'email_handover',\n\tSlack = 'slack',\n}\n\n/**\n * Display labels for the known tool sources — the CATEGORY/integration name, used\n * for the picker's source headers (drill-in groups), the empty-state source\n * buttons and the mention-chip prefix. A source is a category (\"Slack\") you drill\n * into; the specific addable action inside it (\"Send Slack message\") is\n * `TOOL_ACTION_LABELS`. Unknown sources fall back to the raw key (see\n * `toolSourceLabel`).\n */\nexport const TOOL_SOURCE_LABELS: Record<ToolSource, string> = {\n\t[ToolSource.Manifest]: 'Manifest',\n\t[ToolSource.Shopify]: 'Shopify',\n\t[ToolSource.Integration]: 'Integration',\n\t[ToolSource.RestApi]: 'Rest API',\n\t[ToolSource.EmailHandover]: 'Email',\n\t[ToolSource.Slack]: 'Slack',\n};\n\n/**\n * The addable action inside a configurable/rest source — shown as the \"add\" row\n * in the `@` picker (below any existing instances) and the empty-state button.\n * Distinct from `TOOL_SOURCE_LABELS`, which names the category the action lives in\n * (e.g. category \"Slack\" → action \"Send Slack message\").\n */\nexport const TOOL_ACTION_LABELS: Partial<Record<ToolSource, string>> = {\n\t[ToolSource.RestApi]: 'REST API',\n\t[ToolSource.EmailHandover]: 'Handover to email',\n\t[ToolSource.Slack]: 'Send Slack message',\n};\n\n/** A tool source's brand-glyph component. */\nexport type IconComp = FunctionComponent<SVGAttributes<SVGElement>>;\n\n/** Brand glyph for a tool source, with its own size so each keeps its aspect ratio. */\nexport interface SourceIcon {\n\tIcon: IconComp;\n\tw: number;\n\th: number;\n}\n\n/**\n * A built-in \"tool\" that opens a config drawer (Rest API / email handover /\n * Slack) rather than inserting a mention. Surfaced as an empty-state source\n * button in the Tools section and as a row in the `@`-picker Tools view; picking\n * it opens the drawer and never writes into the instructions text.\n */\nexport interface ToolAction {\n\tsource: ToolSource;\n\tlabel: string;\n\ticon?: SourceIcon;\n\t/** Open this tool's config drawer. */\n\tonSelect: () => void;\n}\n\n/** Sources of the built-in drawer tools, in display order. */\nexport const TOOL_ACTION_SOURCES: ToolSource[] = [\n\tToolSource.RestApi,\n\tToolSource.EmailHandover,\n\tToolSource.Slack,\n];\n\n/**\n * Drawer sources rendered by the shared dynamic panel (`ConfigToolPanel`), each\n * mapped to its backend `tool_key`. Rest API is absent — it has a bespoke panel.\n */\nexport const CONFIG_TOOL_SOURCES: Partial<Record<ToolSource, ConfigToolKey>> = {\n\t[ToolSource.EmailHandover]: 'send_email',\n\t[ToolSource.Slack]: 'send_slack_message',\n};\n"],"names":["CATEGORIES","ToolSource","TOOL_SOURCE_LABELS","TOOL_ACTION_LABELS","TOOL_ACTION_SOURCES","CONFIG_TOOL_SOURCES"],"mappings":"AAcO,MAAMA,IAAiD;AAAA,EAC7D,EAAE,KAAK,QAAQ,OAAO,QAAA;AAAA,EACtB,EAAE,KAAK,YAAY,OAAO,YAAA;AAC3B;AAYO,IAAKC,sBAAAA,OACXA,EAAA,WAAW,YACXA,EAAA,UAAU,WACVA,EAAA,cAAc,eACdA,EAAA,UAAU,YACVA,EAAA,gBAAgB,kBAChBA,EAAA,QAAQ,SANGA,IAAAA,KAAA,CAAA,CAAA;AAiBL,MAAMC,IAAiD;AAAA,EAC5D,UAAsB;AAAA,EACtB,SAAqB;AAAA,EACrB,aAAyB;AAAA,EACzB,UAAqB;AAAA,EACrB,gBAA2B;AAAA,EAC3B,OAAmB;AACrB,GAQaC,IAA0D;AAAA,EACrE,UAAqB;AAAA,EACrB,gBAA2B;AAAA,EAC3B,OAAmB;AACrB,GA2BaC,IAAoC;AAAA,EAChD;AAAA,EACA;AAAA,EACA;AAAA;AACD,GAMaC,IAAkE;AAAA,EAC7E,gBAA2B;AAAA,EAC3B,OAAmB;AACrB;"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ApplicationType } from '@bikdotai/bik-models/growth';
|
|
2
2
|
import { default as React } from 'react';
|
|
3
|
-
import { AgentTool, AgentValue, IntentOption, ModelOption, StepKey, StepValidation, SubAgentDraft, SubAgentRef } from '../AgentBuilder.model';
|
|
3
|
+
import { AgentTool, AgentValue, ConfigToolKey, IntentOption, ModelOption, ParamsBlob, StepKey, StepValidation, SubAgentDraft, SubAgentRef } from '../AgentBuilder.model';
|
|
4
4
|
import { AgentCharLimits } from '../constants/charLimits';
|
|
5
|
+
import { ToolSource } from '../constants/tools';
|
|
5
6
|
/** Mention-capable text fields in Step 3 (both store firebase token text). */
|
|
6
7
|
export type MentionFieldKey = 'instructions' | 'guardrail';
|
|
7
8
|
type MentionInsertFn = (kind: 'tool' | 'subagent', id: string, label?: string) => void;
|
|
@@ -63,6 +64,11 @@ export interface AgentBuilderContextShape {
|
|
|
63
64
|
availableSubAgents: SubAgentRef[];
|
|
64
65
|
availableIntents: IntentOption[];
|
|
65
66
|
availableModels: ModelOption[];
|
|
67
|
+
/**
|
|
68
|
+
* Backend templates for the shared-drawer tools (email / Slack), keyed by
|
|
69
|
+
* `tool_key`. A present key drives its dynamic form + enables its tool action.
|
|
70
|
+
*/
|
|
71
|
+
configToolTemplates?: Partial<Record<ConfigToolKey, ParamsBlob>>;
|
|
66
72
|
/** Host application context (e.g. MANIFEST) — drives tool-chip labelling. */
|
|
67
73
|
applicationType?: ApplicationType;
|
|
68
74
|
/** Resolved per-field character limits (consumer overrides merged over defaults). */
|
|
@@ -78,12 +84,22 @@ export interface AgentBuilderContextShape {
|
|
|
78
84
|
registerSubAgentCreator: (fn: (() => void) | null) => void;
|
|
79
85
|
/** Open the create-sub-agent drawer (no-op until Step 3 registers it). */
|
|
80
86
|
requestCreateSubAgent: () => void;
|
|
87
|
+
/**
|
|
88
|
+
* Step 3 registers its "open the drawer for this built-in tool action"
|
|
89
|
+
* (Rest API / email handover / Slack) handler here so the `@` reference picker
|
|
90
|
+
* can trigger it. Pass `null` to unregister.
|
|
91
|
+
*/
|
|
92
|
+
registerToolActionHandler: (fn: ((source: ToolSource) => void) | null) => void;
|
|
93
|
+
/** Open a built-in tool action's drawer (no-op until Step 3 registers it). */
|
|
94
|
+
requestToolAction: (source: ToolSource) => void;
|
|
81
95
|
/** Fetch a sub-agent's editable data (Configure). Omit to hide Configure. */
|
|
82
96
|
onFetchSubAgent?: (id: string) => Promise<SubAgentDraft>;
|
|
83
97
|
/** Persist edits to an existing sub-agent. */
|
|
84
98
|
onUpdateSubAgent?: (id: string, draft: SubAgentDraft) => Promise<SubAgentRef>;
|
|
85
99
|
/** Optional "Improve with AI" for the drawer's instructions / guardrails. */
|
|
86
100
|
onImproveSubAgent?: (kind: 'instructions' | 'guardrail', text: string) => Promise<string>;
|
|
101
|
+
/** Optional "Improve with AI" for the Rest API / email-handover tool drawers. */
|
|
102
|
+
onImproveToolInstructions?: (text: string) => Promise<string>;
|
|
87
103
|
}
|
|
88
104
|
export declare const useAgentBuilderContext: () => AgentBuilderContextShape;
|
|
89
105
|
interface ProviderProps {
|
|
@@ -95,6 +111,7 @@ interface ProviderProps {
|
|
|
95
111
|
availableSubAgents: SubAgentRef[];
|
|
96
112
|
availableIntents: IntentOption[];
|
|
97
113
|
availableModels: ModelOption[];
|
|
114
|
+
configToolTemplates?: Partial<Record<ConfigToolKey, ParamsBlob>>;
|
|
98
115
|
validation?: Partial<StepValidation>;
|
|
99
116
|
applicationType?: ApplicationType;
|
|
100
117
|
charLimits?: Partial<AgentCharLimits>;
|
|
@@ -103,6 +120,7 @@ interface ProviderProps {
|
|
|
103
120
|
onFetchSubAgent?: (id: string) => Promise<SubAgentDraft>;
|
|
104
121
|
onUpdateSubAgent?: (id: string, draft: SubAgentDraft) => Promise<SubAgentRef>;
|
|
105
122
|
onImproveSubAgent?: (kind: 'instructions' | 'guardrail', text: string) => Promise<string>;
|
|
123
|
+
onImproveToolInstructions?: (text: string) => Promise<string>;
|
|
106
124
|
children: React.ReactNode;
|
|
107
125
|
}
|
|
108
126
|
export declare const AgentBuilderProvider: React.FC<ProviderProps>;
|
|
@@ -1,187 +1,216 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { AGENT_CHAR_LIMITS as
|
|
4
|
-
import { getStepIndex as
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
if (!
|
|
1
|
+
import { jsx as ft } from "react/jsx-runtime";
|
|
2
|
+
import mt, { useState as S, useRef as u, useCallback as e, useMemo as h, useContext as pt } from "react";
|
|
3
|
+
import { AGENT_CHAR_LIMITS as xt } from "../constants/charLimits.js";
|
|
4
|
+
import { getStepIndex as Rt, STEP_KEYS as A } from "../constants/steps.js";
|
|
5
|
+
const ct = mt.createContext(null), ht = () => {
|
|
6
|
+
const t = pt(ct);
|
|
7
|
+
if (!t)
|
|
8
8
|
throw new Error(
|
|
9
9
|
"useAgentBuilderContext must be used within an AgentBuilderProvider"
|
|
10
10
|
);
|
|
11
|
-
return
|
|
12
|
-
},
|
|
13
|
-
const
|
|
11
|
+
return t;
|
|
12
|
+
}, At = (t, r) => {
|
|
13
|
+
const d = t.trigger.mode === "custom_intent" ? (t.trigger.custom_intent ?? "").trim().length > 0 : t.trigger.intents.length > 0;
|
|
14
14
|
return {
|
|
15
|
-
about:
|
|
16
|
-
trigger:
|
|
15
|
+
about: t.name.trim().length > 0 && t.name.length <= r.name && t.description.length <= r.description,
|
|
16
|
+
trigger: d,
|
|
17
17
|
// At least one of Instructions / Guardrails must be filled.
|
|
18
|
-
response:
|
|
18
|
+
response: t.instructions.trim().length > 0 || (t.guardrail ?? "").trim().length > 0,
|
|
19
19
|
// Optional until specced further — never blocks go-live.
|
|
20
20
|
handover: !0
|
|
21
21
|
};
|
|
22
|
-
},
|
|
23
|
-
value:
|
|
24
|
-
onChange:
|
|
25
|
-
activeStep:
|
|
26
|
-
onStepChange:
|
|
27
|
-
availableTools:
|
|
28
|
-
availableSubAgents:
|
|
29
|
-
availableIntents:
|
|
22
|
+
}, Bt = ({
|
|
23
|
+
value: t,
|
|
24
|
+
onChange: r,
|
|
25
|
+
activeStep: d,
|
|
26
|
+
onStepChange: B,
|
|
27
|
+
availableTools: f,
|
|
28
|
+
availableSubAgents: m,
|
|
29
|
+
availableIntents: F,
|
|
30
30
|
availableModels: P,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
configToolTemplates: E,
|
|
32
|
+
validation: $,
|
|
33
|
+
applicationType: a,
|
|
34
|
+
charLimits: w,
|
|
35
|
+
disableStepNavigation: H = !0,
|
|
36
|
+
onCreateSubAgent: I,
|
|
36
37
|
onFetchSubAgent: L,
|
|
37
38
|
onUpdateSubAgent: V,
|
|
38
39
|
onImproveSubAgent: b,
|
|
39
|
-
|
|
40
|
+
onImproveToolInstructions: j,
|
|
41
|
+
children: it
|
|
40
42
|
}) => {
|
|
41
|
-
const [
|
|
42
|
-
|
|
43
|
-
const [y, K] =
|
|
44
|
-
(
|
|
45
|
-
|
|
43
|
+
const [ut, lt] = S("about"), p = d ?? ut, c = Rt(p), q = u(t);
|
|
44
|
+
q.current = t;
|
|
45
|
+
const [y, K] = S(0), T = u({}), G = u("instructions"), N = e(
|
|
46
|
+
(n, o) => {
|
|
47
|
+
o ? T.current[n] = o : delete T.current[n];
|
|
46
48
|
},
|
|
47
49
|
[]
|
|
48
|
-
),
|
|
49
|
-
|
|
50
|
-
}, []),
|
|
51
|
-
|
|
52
|
-
}, []),
|
|
53
|
-
|
|
54
|
-
}, []),
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
g === void 0 && rt(t), F?.(t);
|
|
50
|
+
), U = e((n) => {
|
|
51
|
+
G.current = n;
|
|
52
|
+
}, []), Y = u(null), z = e((n) => {
|
|
53
|
+
Y.current = n;
|
|
54
|
+
}, []), D = e(() => {
|
|
55
|
+
Y.current?.();
|
|
56
|
+
}, []), J = u(
|
|
57
|
+
null
|
|
58
|
+
), Q = e(
|
|
59
|
+
(n) => {
|
|
60
|
+
J.current = n;
|
|
60
61
|
},
|
|
61
|
-
[
|
|
62
|
-
),
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
[
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
62
|
+
[]
|
|
63
|
+
), W = e((n) => {
|
|
64
|
+
J.current?.(n);
|
|
65
|
+
}, []), X = e((n, o, i) => {
|
|
66
|
+
const g = T.current;
|
|
67
|
+
(g[G.current] ?? g.instructions)?.(n, o, i);
|
|
68
|
+
}, []), [Z, _] = S(null), x = u(null), k = u(0), l = e(
|
|
69
|
+
(n) => {
|
|
70
|
+
d === void 0 && lt(n), B?.(n);
|
|
71
|
+
},
|
|
72
|
+
[d, B]
|
|
73
|
+
), C = e(() => {
|
|
74
|
+
const n = A[Math.min(c + 1, A.length - 1)];
|
|
75
|
+
l(n);
|
|
76
|
+
}, [c, l]), O = e(() => {
|
|
77
|
+
const n = A[Math.max(c - 1, 0)];
|
|
78
|
+
l(n);
|
|
79
|
+
}, [c, l]), v = e(
|
|
80
|
+
(n) => r(n),
|
|
81
|
+
[r]
|
|
82
|
+
), tt = e(
|
|
83
|
+
(n, o) => r({ [n]: o }),
|
|
84
|
+
[r]
|
|
85
|
+
), nt = e(
|
|
86
|
+
(n, o) => {
|
|
87
|
+
const i = q.current;
|
|
88
|
+
n === "tool" ? i.tools.includes(o) || r({ tools: [...i.tools, o] }) : i.subagents.includes(o) || r({ subagents: [...i.subagents, o] });
|
|
78
89
|
},
|
|
79
|
-
[
|
|
80
|
-
),
|
|
81
|
-
(
|
|
82
|
-
const i =
|
|
83
|
-
|
|
84
|
-
tools:
|
|
85
|
-
subagents:
|
|
86
|
-
|
|
87
|
-
|
|
90
|
+
[r]
|
|
91
|
+
), ot = e(
|
|
92
|
+
(n, o) => {
|
|
93
|
+
const i = n === "tool" ? `{{tool:${o}}}` : `{{subagent:${o}}}`, g = (s) => s.split(i).join("");
|
|
94
|
+
x.current = {
|
|
95
|
+
tools: t.tools,
|
|
96
|
+
subagents: t.subagents,
|
|
97
|
+
configTools: t.configTools,
|
|
98
|
+
restApiTools: t.restApiTools,
|
|
99
|
+
instructions: t.instructions,
|
|
100
|
+
guardrail: t.guardrail
|
|
88
101
|
};
|
|
89
|
-
const
|
|
90
|
-
instructions:
|
|
91
|
-
guardrail:
|
|
92
|
-
...
|
|
102
|
+
const rt = {
|
|
103
|
+
instructions: g(t.instructions),
|
|
104
|
+
guardrail: g(t.guardrail ?? ""),
|
|
105
|
+
...n === "tool" ? {
|
|
106
|
+
// A tool id may be a catalog tool OR an inline custom tool — drop
|
|
107
|
+
// it from whichever list holds it (the others are no-op filters).
|
|
108
|
+
tools: t.tools.filter((s) => s !== o),
|
|
109
|
+
configTools: (t.configTools ?? []).filter((s) => s.id !== o),
|
|
110
|
+
restApiTools: (t.restApiTools ?? []).filter(
|
|
111
|
+
(s) => s.id !== o
|
|
112
|
+
)
|
|
113
|
+
} : { subagents: t.subagents.filter((s) => s !== o) }
|
|
93
114
|
};
|
|
94
|
-
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
id:
|
|
98
|
-
message: `${
|
|
115
|
+
r(rt), K((s) => s + 1);
|
|
116
|
+
const gt = n === "tool" ? f.find((s) => s.tool_id === o)?.display_name ?? (t.restApiTools ?? []).find((s) => s.id === o)?.name ?? "Tool" : m.find((s) => s.id === o)?.name ?? "Sub-agent";
|
|
117
|
+
k.current += 1, _({
|
|
118
|
+
id: k.current,
|
|
119
|
+
message: `${n === "tool" ? "Tool" : "Sub-agent"} "${gt}" removed`
|
|
99
120
|
});
|
|
100
121
|
},
|
|
101
|
-
[
|
|
102
|
-
),
|
|
103
|
-
|
|
104
|
-
}, [
|
|
105
|
-
() => ({ ...
|
|
106
|
-
[
|
|
107
|
-
),
|
|
108
|
-
() => ({ ...
|
|
109
|
-
[
|
|
110
|
-
),
|
|
122
|
+
[f, m, t, r]
|
|
123
|
+
), st = e(() => {
|
|
124
|
+
x.current && (r(x.current), x.current = null, K((n) => n + 1)), _(null);
|
|
125
|
+
}, [r]), et = e(() => _(null), []), R = h(
|
|
126
|
+
() => ({ ...xt, ...w }),
|
|
127
|
+
[w]
|
|
128
|
+
), M = h(
|
|
129
|
+
() => ({ ...At(t, R), ...$ }),
|
|
130
|
+
[t, R, $]
|
|
131
|
+
), dt = h(
|
|
111
132
|
() => ({
|
|
112
|
-
value:
|
|
113
|
-
patch:
|
|
114
|
-
updateField:
|
|
115
|
-
addReference:
|
|
116
|
-
removeReference:
|
|
133
|
+
value: t,
|
|
134
|
+
patch: v,
|
|
135
|
+
updateField: tt,
|
|
136
|
+
addReference: nt,
|
|
137
|
+
removeReference: ot,
|
|
117
138
|
mentionResetKey: y,
|
|
118
|
-
insertMention:
|
|
119
|
-
registerMentionField:
|
|
120
|
-
notifyMentionFocus:
|
|
121
|
-
undoToast:
|
|
122
|
-
undoRemoval:
|
|
123
|
-
dismissUndo:
|
|
124
|
-
activeStep:
|
|
139
|
+
insertMention: X,
|
|
140
|
+
registerMentionField: N,
|
|
141
|
+
notifyMentionFocus: U,
|
|
142
|
+
undoToast: Z,
|
|
143
|
+
undoRemoval: st,
|
|
144
|
+
dismissUndo: et,
|
|
145
|
+
activeStep: p,
|
|
125
146
|
activeIndex: c,
|
|
126
|
-
goToStep:
|
|
127
|
-
goNext:
|
|
128
|
-
goPrev:
|
|
147
|
+
goToStep: l,
|
|
148
|
+
goNext: C,
|
|
149
|
+
goPrev: O,
|
|
129
150
|
isFirstStep: c === 0,
|
|
130
|
-
isLastStep: c ===
|
|
131
|
-
validation:
|
|
132
|
-
isActiveStepValid:
|
|
133
|
-
availableTools:
|
|
134
|
-
availableSubAgents:
|
|
135
|
-
availableIntents:
|
|
151
|
+
isLastStep: c === A.length - 1,
|
|
152
|
+
validation: M,
|
|
153
|
+
isActiveStepValid: M[p],
|
|
154
|
+
availableTools: f,
|
|
155
|
+
availableSubAgents: m,
|
|
156
|
+
availableIntents: F,
|
|
136
157
|
availableModels: P,
|
|
137
|
-
|
|
158
|
+
configToolTemplates: E,
|
|
159
|
+
applicationType: a,
|
|
138
160
|
charLimits: R,
|
|
139
|
-
disableStepNavigation:
|
|
140
|
-
onCreateSubAgent:
|
|
141
|
-
registerSubAgentCreator:
|
|
142
|
-
requestCreateSubAgent:
|
|
161
|
+
disableStepNavigation: H,
|
|
162
|
+
onCreateSubAgent: I,
|
|
163
|
+
registerSubAgentCreator: z,
|
|
164
|
+
requestCreateSubAgent: D,
|
|
165
|
+
registerToolActionHandler: Q,
|
|
166
|
+
requestToolAction: W,
|
|
143
167
|
onFetchSubAgent: L,
|
|
144
168
|
onUpdateSubAgent: V,
|
|
145
|
-
onImproveSubAgent: b
|
|
169
|
+
onImproveSubAgent: b,
|
|
170
|
+
onImproveToolInstructions: j
|
|
146
171
|
}),
|
|
147
172
|
[
|
|
148
|
-
|
|
173
|
+
t,
|
|
174
|
+
v,
|
|
175
|
+
tt,
|
|
176
|
+
nt,
|
|
177
|
+
ot,
|
|
178
|
+
y,
|
|
149
179
|
X,
|
|
180
|
+
N,
|
|
181
|
+
U,
|
|
150
182
|
Z,
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
z,
|
|
155
|
-
G,
|
|
156
|
-
H,
|
|
157
|
-
D,
|
|
158
|
-
O,
|
|
159
|
-
v,
|
|
160
|
-
x,
|
|
183
|
+
st,
|
|
184
|
+
et,
|
|
185
|
+
p,
|
|
161
186
|
c,
|
|
162
|
-
u,
|
|
163
|
-
Q,
|
|
164
|
-
W,
|
|
165
|
-
a,
|
|
166
187
|
l,
|
|
188
|
+
C,
|
|
189
|
+
O,
|
|
190
|
+
M,
|
|
167
191
|
f,
|
|
168
|
-
|
|
192
|
+
m,
|
|
193
|
+
F,
|
|
169
194
|
P,
|
|
170
195
|
E,
|
|
196
|
+
a,
|
|
171
197
|
R,
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
198
|
+
H,
|
|
199
|
+
I,
|
|
200
|
+
z,
|
|
201
|
+
D,
|
|
202
|
+
Q,
|
|
203
|
+
W,
|
|
176
204
|
L,
|
|
177
205
|
V,
|
|
178
|
-
b
|
|
206
|
+
b,
|
|
207
|
+
j
|
|
179
208
|
]
|
|
180
209
|
);
|
|
181
|
-
return /* @__PURE__ */
|
|
210
|
+
return /* @__PURE__ */ ft(ct.Provider, { value: dt, children: it });
|
|
182
211
|
};
|
|
183
212
|
export {
|
|
184
|
-
|
|
185
|
-
|
|
213
|
+
Bt as AgentBuilderProvider,
|
|
214
|
+
ht as useAgentBuilderContext
|
|
186
215
|
};
|
|
187
216
|
//# sourceMappingURL=AgentBuilderContext.js.map
|