@agent-native/core 0.123.0 → 0.123.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/corpus/README.md +1 -1
- package/corpus/core/CHANGELOG.md +16 -0
- package/corpus/core/package.json +1 -1
- package/corpus/core/src/cli/templates-meta.ts +12 -0
- package/corpus/templates/crm/.agents/skills/agent-native-docs/SKILL.md +115 -0
- package/corpus/templates/crm/.agents/skills/agent-native-toolkit/SKILL.md +177 -0
- package/corpus/templates/crm/.agents/skills/crm/SKILL.md +205 -0
- package/corpus/templates/crm/.agents/skills/customizing-agent-native/SKILL.md +220 -0
- package/corpus/templates/crm/.agents/skills/feature-flags/SKILL.md +169 -0
- package/corpus/templates/crm/.agents/skills/sharing/SKILL.md +228 -0
- package/corpus/templates/crm/.agents/skills/storing-data/SKILL.md +178 -0
- package/corpus/templates/crm/.agents/skills/upgrade-agent-native/SKILL.md +122 -0
- package/corpus/templates/crm/.env.example +5 -0
- package/corpus/templates/crm/AGENTS.md +82 -0
- package/corpus/templates/crm/CHANGELOG.md +25 -0
- package/corpus/templates/crm/DEVELOPING.md +66 -0
- package/corpus/templates/crm/README.md +122 -0
- package/corpus/templates/crm/_gitignore +12 -0
- package/corpus/templates/crm/actions/_crm-action-utils.ts +98 -0
- package/corpus/templates/crm/actions/_crm-attribute-utils.ts +219 -0
- package/corpus/templates/crm/actions/_crm-dashboard.ts +69 -0
- package/corpus/templates/crm/actions/_crm-data-program-actions.ts +15 -0
- package/corpus/templates/crm/actions/_crm-list-utils.ts +775 -0
- package/corpus/templates/crm/actions/_crm-signal-utils.ts +79 -0
- package/corpus/templates/crm/actions/add-crm-record-to-list.ts +164 -0
- package/corpus/templates/crm/actions/apply-crm-proposals.ts +291 -0
- package/corpus/templates/crm/actions/archive-crm-attribute.ts +69 -0
- package/corpus/templates/crm/actions/attach-call-evidence.ts +170 -0
- package/corpus/templates/crm/actions/configure-crm-connection.ts +126 -0
- package/corpus/templates/crm/actions/configure-native-crm.ts +44 -0
- package/corpus/templates/crm/actions/create-crm-attribute.ts +350 -0
- package/corpus/templates/crm/actions/create-crm-list.ts +194 -0
- package/corpus/templates/crm/actions/create-crm-record.ts +148 -0
- package/corpus/templates/crm/actions/create-crm-signal-tracker.ts +58 -0
- package/corpus/templates/crm/actions/delete-crm-saved-view.ts +68 -0
- package/corpus/templates/crm/actions/delete-staged-dataset.ts +14 -0
- package/corpus/templates/crm/actions/estimate-crm-enrichment.ts +229 -0
- package/corpus/templates/crm/actions/find-crm-duplicates.ts +87 -0
- package/corpus/templates/crm/actions/get-crm-automation-recipe.ts +36 -0
- package/corpus/templates/crm/actions/get-crm-dashboard-panel.ts +35 -0
- package/corpus/templates/crm/actions/get-crm-dashboard.ts +14 -0
- package/corpus/templates/crm/actions/get-crm-overview.ts +13 -0
- package/corpus/templates/crm/actions/get-crm-pipeline-data.ts +61 -0
- package/corpus/templates/crm/actions/get-crm-record-page.ts +287 -0
- package/corpus/templates/crm/actions/get-crm-record.ts +75 -0
- package/corpus/templates/crm/actions/get-crm-workspace.ts +364 -0
- package/corpus/templates/crm/actions/install-crm-pipeline-dashboard.ts +81 -0
- package/corpus/templates/crm/actions/list-crm-attributes.ts +71 -0
- package/corpus/templates/crm/actions/list-crm-connections.ts +68 -0
- package/corpus/templates/crm/actions/list-crm-dashboard-revisions.ts +15 -0
- package/corpus/templates/crm/actions/list-crm-dashboards.ts +15 -0
- package/corpus/templates/crm/actions/list-crm-enrichment-slots.ts +28 -0
- package/corpus/templates/crm/actions/list-crm-list-entries.ts +192 -0
- package/corpus/templates/crm/actions/list-crm-lists.ts +80 -0
- package/corpus/templates/crm/actions/list-crm-proposals.ts +55 -0
- package/corpus/templates/crm/actions/list-crm-record-field-history.ts +201 -0
- package/corpus/templates/crm/actions/list-crm-record-values.ts +200 -0
- package/corpus/templates/crm/actions/list-crm-records.ts +103 -0
- package/corpus/templates/crm/actions/list-crm-saved-views.ts +66 -0
- package/corpus/templates/crm/actions/list-crm-signal-hits.ts +43 -0
- package/corpus/templates/crm/actions/list-crm-signal-trackers.ts +32 -0
- package/corpus/templates/crm/actions/list-crm-tasks.ts +22 -0
- package/corpus/templates/crm/actions/list-staged-datasets.ts +14 -0
- package/corpus/templates/crm/actions/list-workspace-connections.ts +47 -0
- package/corpus/templates/crm/actions/manage-crm-attribute-option.ts +272 -0
- package/corpus/templates/crm/actions/manage-crm-signal-tracker.ts +87 -0
- package/corpus/templates/crm/actions/manage-crm-task.ts +132 -0
- package/corpus/templates/crm/actions/merge-crm-records.ts +691 -0
- package/corpus/templates/crm/actions/navigate.ts +54 -0
- package/corpus/templates/crm/actions/provider-api-catalog.ts +22 -0
- package/corpus/templates/crm/actions/provider-api-docs.ts +54 -0
- package/corpus/templates/crm/actions/provider-api-request.ts +92 -0
- package/corpus/templates/crm/actions/query-staged-dataset.ts +44 -0
- package/corpus/templates/crm/actions/record-crm-call-insight.ts +160 -0
- package/corpus/templates/crm/actions/record-crm-smart-signal.ts +150 -0
- package/corpus/templates/crm/actions/remove-crm-list-entry.ts +79 -0
- package/corpus/templates/crm/actions/restore-crm-dashboard-revision.ts +23 -0
- package/corpus/templates/crm/actions/review-crm-signal.ts +31 -0
- package/corpus/templates/crm/actions/run-crm-attribute-fill.ts +443 -0
- package/corpus/templates/crm/actions/run-crm-enrichment.ts +647 -0
- package/corpus/templates/crm/actions/run-crm-saved-view-program.ts +103 -0
- package/corpus/templates/crm/actions/run-crm-signal-trackers.ts +265 -0
- package/corpus/templates/crm/actions/run.ts +7 -0
- package/corpus/templates/crm/actions/save-crm-dashboard.ts +51 -0
- package/corpus/templates/crm/actions/save-crm-saved-view.ts +296 -0
- package/corpus/templates/crm/actions/sync-crm.ts +146 -0
- package/corpus/templates/crm/actions/update-crm-attribute.ts +111 -0
- package/corpus/templates/crm/actions/update-crm-list-entry.ts +102 -0
- package/corpus/templates/crm/actions/update-crm-list.ts +97 -0
- package/corpus/templates/crm/actions/update-crm-record.ts +543 -0
- package/corpus/templates/crm/actions/view-screen.ts +324 -0
- package/corpus/templates/crm/agent-native.app-skill.json +69 -0
- package/corpus/templates/crm/app/components/crm/CreateCrmRecordDialog.tsx +158 -0
- package/corpus/templates/crm/app/components/crm/CrmDashboardPanel.tsx +78 -0
- package/corpus/templates/crm/app/components/crm/CrmSignalsPanel.tsx +220 -0
- package/corpus/templates/crm/app/components/crm/IntelligenceSettings.tsx +414 -0
- package/corpus/templates/crm/app/components/crm/RecordActions.tsx +648 -0
- package/corpus/templates/crm/app/components/crm/RecordGrid.tsx +488 -0
- package/corpus/templates/crm/app/components/crm/RecordWorkspace.tsx +232 -0
- package/corpus/templates/crm/app/components/crm/SavedViewDataProgram.tsx +93 -0
- package/corpus/templates/crm/app/components/crm/Surface.tsx +97 -0
- package/corpus/templates/crm/app/components/crm/WorkOverview.tsx +180 -0
- package/corpus/templates/crm/app/components/crm/board/CrmBoard.tsx +988 -0
- package/corpus/templates/crm/app/components/crm/board/board-model.ts +399 -0
- package/corpus/templates/crm/app/components/crm/board/entry-filter.ts +150 -0
- package/corpus/templates/crm/app/components/crm/board/view-draft.ts +227 -0
- package/corpus/templates/crm/app/components/crm/grid/CrmGrid.tsx +1033 -0
- package/corpus/templates/crm/app/components/crm/grid/GridCell.tsx +620 -0
- package/corpus/templates/crm/app/components/crm/grid/clipboard.ts +84 -0
- package/corpus/templates/crm/app/components/crm/grid/model.ts +304 -0
- package/corpus/templates/crm/app/components/crm/grid/navigation.ts +220 -0
- package/corpus/templates/crm/app/components/crm/grid/query.ts +214 -0
- package/corpus/templates/crm/app/components/crm/record/AttributePanel.tsx +192 -0
- package/corpus/templates/crm/app/components/crm/record/FieldHistory.tsx +179 -0
- package/corpus/templates/crm/app/components/crm/record/RecordHeader.tsx +103 -0
- package/corpus/templates/crm/app/components/crm/record/RecordLists.tsx +235 -0
- package/corpus/templates/crm/app/components/crm/record/RecordTabs.tsx +206 -0
- package/corpus/templates/crm/app/components/crm/record/field-editors.tsx +245 -0
- package/corpus/templates/crm/app/components/crm/record/record-data.ts +603 -0
- package/corpus/templates/crm/app/components/crm/settings/AdvancedSettings.tsx +49 -0
- package/corpus/templates/crm/app/components/crm/settings/AttributeOptionsEditor.tsx +441 -0
- package/corpus/templates/crm/app/components/crm/settings/ConnectionSettings.tsx +169 -0
- package/corpus/templates/crm/app/components/crm/settings/FieldsSettings.tsx +935 -0
- package/corpus/templates/crm/app/components/crm/settings/ListsSettings.tsx +339 -0
- package/corpus/templates/crm/app/components/crm/settings/settings-admin.ts +377 -0
- package/corpus/templates/crm/app/components/crm/shared/AttributeValueParts.tsx +69 -0
- package/corpus/templates/crm/app/components/crm/shared/attribute-value.ts +591 -0
- package/corpus/templates/crm/app/components/layout/CrmCommandMenu.tsx +556 -0
- package/corpus/templates/crm/app/components/layout/CrmLayout.tsx +130 -0
- package/corpus/templates/crm/app/components/layout/CrmSidebar.tsx +407 -0
- package/corpus/templates/crm/app/components/layout/command-palette-search.ts +126 -0
- package/corpus/templates/crm/app/components/layout/crm-ui-intents.ts +41 -0
- package/corpus/templates/crm/app/components/layout/sidebar-collapse.ts +40 -0
- package/corpus/templates/crm/app/components/layout/sidebar-lists.ts +109 -0
- package/corpus/templates/crm/app/components/ui/alert-dialog.tsx +1 -0
- package/corpus/templates/crm/app/components/ui/badge.tsx +1 -0
- package/corpus/templates/crm/app/components/ui/button.tsx +1 -0
- package/corpus/templates/crm/app/components/ui/card.tsx +1 -0
- package/corpus/templates/crm/app/components/ui/checkbox.tsx +1 -0
- package/corpus/templates/crm/app/components/ui/dialog.tsx +1 -0
- package/corpus/templates/crm/app/components/ui/dropdown-menu.tsx +1 -0
- package/corpus/templates/crm/app/components/ui/hover-card.tsx +1 -0
- package/corpus/templates/crm/app/components/ui/input.tsx +1 -0
- package/corpus/templates/crm/app/components/ui/label.tsx +1 -0
- package/corpus/templates/crm/app/components/ui/popover.tsx +1 -0
- package/corpus/templates/crm/app/components/ui/select.tsx +1 -0
- package/corpus/templates/crm/app/components/ui/sheet.tsx +1 -0
- package/corpus/templates/crm/app/components/ui/skeleton.tsx +1 -0
- package/corpus/templates/crm/app/components/ui/switch.tsx +1 -0
- package/corpus/templates/crm/app/components/ui/table.tsx +1 -0
- package/corpus/templates/crm/app/components/ui/tabs.tsx +1 -0
- package/corpus/templates/crm/app/components/ui/textarea.tsx +1 -0
- package/corpus/templates/crm/app/components/ui/toolkit-provider.tsx +17 -0
- package/corpus/templates/crm/app/components/ui/tooltip.tsx +1 -0
- package/corpus/templates/crm/app/design-system.ts +3 -0
- package/corpus/templates/crm/app/entry.client.tsx +19 -0
- package/corpus/templates/crm/app/entry.server.tsx +10 -0
- package/corpus/templates/crm/app/global.css +167 -0
- package/corpus/templates/crm/app/hooks/use-keyboard-shortcuts.ts +206 -0
- package/corpus/templates/crm/app/hooks/use-navigation-state.ts +48 -0
- package/corpus/templates/crm/app/i18n/en-US.ts +684 -0
- package/corpus/templates/crm/app/i18n/index.ts +34 -0
- package/corpus/templates/crm/app/lib/dashboard.ts +13 -0
- package/corpus/templates/crm/app/lib/navigation.ts +17 -0
- package/corpus/templates/crm/app/lib/tab-id.ts +1 -0
- package/corpus/templates/crm/app/lib/types.ts +172 -0
- package/corpus/templates/crm/app/lib/utils.ts +1 -0
- package/corpus/templates/crm/app/root.tsx +93 -0
- package/corpus/templates/crm/app/routes/_index.tsx +26 -0
- package/corpus/templates/crm/app/routes/accounts.tsx +41 -0
- package/corpus/templates/crm/app/routes/agent.tsx +5 -0
- package/corpus/templates/crm/app/routes/ask.tsx +53 -0
- package/corpus/templates/crm/app/routes/dashboard.tsx +118 -0
- package/corpus/templates/crm/app/routes/lists.tsx +228 -0
- package/corpus/templates/crm/app/routes/opportunities.tsx +41 -0
- package/corpus/templates/crm/app/routes/people.tsx +41 -0
- package/corpus/templates/crm/app/routes/proposals.tsx +388 -0
- package/corpus/templates/crm/app/routes/records.$recordId.tsx +53 -0
- package/corpus/templates/crm/app/routes/records.tsx +64 -0
- package/corpus/templates/crm/app/routes/settings.tsx +118 -0
- package/corpus/templates/crm/app/routes/setup.tsx +308 -0
- package/corpus/templates/crm/app/routes/tasks.tsx +252 -0
- package/corpus/templates/crm/app/routes/views.tsx +683 -0
- package/corpus/templates/crm/app/routes.ts +19 -0
- package/corpus/templates/crm/app/vite-env.d.ts +6 -0
- package/corpus/templates/crm/changelog/2026-07-26-any-list-or-view-can-be-shown-as-a-board-grouped-by-stage-so.md +6 -0
- package/corpus/templates/crm/changelog/2026-07-26-crm-now-finds-likely-duplicate-records-and-tells-you-exactly.md +6 -0
- package/corpus/templates/crm/changelog/2026-07-26-enrichment-now-shows-what-a-run-will-cost-before-it-starts-g.md +6 -0
- package/corpus/templates/crm/changelog/2026-07-26-lists-turn-any-set-of-records-into-a-pipeline-with-its-own-s.md +6 -0
- package/corpus/templates/crm/changelog/2026-07-26-moving-a-record-or-list-entry-into-a-stage-that-was-retired-.md +6 -0
- package/corpus/templates/crm/changelog/2026-07-26-opening-a-record-now-shows-one-page-with-its-fields-the-list.md +6 -0
- package/corpus/templates/crm/changelog/2026-07-26-press-cmd-k-to-jump-to-any-record-list-view-or-setting-and-u.md +6 -0
- package/corpus/templates/crm/changelog/2026-07-26-provider-record-edits-now-show-an-exact-before-after-diff-an.md +6 -0
- package/corpus/templates/crm/changelog/2026-07-26-record-page-attribute-labels-now-read-in-full-instead-of-bei.md +6 -0
- package/corpus/templates/crm/changelog/2026-07-26-records-now-use-typed-fields-currency-dates-ratings-status-s.md +6 -0
- package/corpus/templates/crm/changelog/2026-07-26-retyping-a-value-on-the-record-page-now-replaces-it-instead-.md +6 -0
- package/corpus/templates/crm/changelog/2026-07-26-settings-now-has-fields-and-lists-tabs-for-adding-fields-edi.md +6 -0
- package/corpus/templates/crm/changelog/2026-07-26-the-proposal-review-now-shows-the-field-that-actually-change.md +6 -0
- package/corpus/templates/crm/changelog/2026-07-26-the-record-grid-is-now-a-real-spreadsheet-filter-sort-and-pa.md +6 -0
- package/corpus/templates/crm/components.json +20 -0
- package/corpus/templates/crm/docs/architecture/crm-contract.md +214 -0
- package/corpus/templates/crm/docs/features/README.md +55 -0
- package/corpus/templates/crm/docs/features/f1-records-and-fields.mdx +52 -0
- package/corpus/templates/crm/docs/features/f2-lists-pipelines-and-views.mdx +48 -0
- package/corpus/templates/crm/docs/features/f3-work-and-record-quality.mdx +40 -0
- package/corpus/templates/crm/docs/features/f4-evidence-and-chat.mdx +47 -0
- package/corpus/templates/crm/learnings.defaults.md +5 -0
- package/corpus/templates/crm/netlify.toml +11 -0
- package/corpus/templates/crm/package.json +61 -0
- package/corpus/templates/crm/public/favicon.svg +1 -0
- package/corpus/templates/crm/public/icon-180.svg +1 -0
- package/corpus/templates/crm/public/manifest.json +11 -0
- package/corpus/templates/crm/react-router.config.ts +7 -0
- package/corpus/templates/crm/server/crm/adapter.ts +32 -0
- package/corpus/templates/crm/server/crm/crm-field-firewall.ts +64 -0
- package/corpus/templates/crm/server/crm/crm-mirror.ts +721 -0
- package/corpus/templates/crm/server/crm/field-policy-attributes.ts +48 -0
- package/corpus/templates/crm/server/crm/hubspot-adapter.ts +1146 -0
- package/corpus/templates/crm/server/crm/native-adapter.ts +1810 -0
- package/corpus/templates/crm/server/crm/provider-record-link.ts +264 -0
- package/corpus/templates/crm/server/crm/read-through.ts +207 -0
- package/corpus/templates/crm/server/crm/salesforce-adapter.ts +1255 -0
- package/corpus/templates/crm/server/db/crm-store.ts +1112 -0
- package/corpus/templates/crm/server/db/index.ts +191 -0
- package/corpus/templates/crm/server/db/schema.ts +647 -0
- package/corpus/templates/crm/server/lib/crm-query.ts +1558 -0
- package/corpus/templates/crm/server/lib/dedupe.ts +714 -0
- package/corpus/templates/crm/server/lib/enrichment-cost.ts +381 -0
- package/corpus/templates/crm/server/lib/enrichment-slots.ts +519 -0
- package/corpus/templates/crm/server/lib/intelligence/default-detectors.ts +65 -0
- package/corpus/templates/crm/server/lib/intelligence/evidence.ts +105 -0
- package/corpus/templates/crm/server/lib/intelligence/keyword-detector.ts +94 -0
- package/corpus/templates/crm/server/lib/intelligence/smart-detector.ts +39 -0
- package/corpus/templates/crm/server/lib/intelligence/summary.ts +19 -0
- package/corpus/templates/crm/server/lib/lifecycle.ts +634 -0
- package/corpus/templates/crm/server/lib/provider-api.ts +64 -0
- package/corpus/templates/crm/server/middleware/auth.ts +4 -0
- package/corpus/templates/crm/server/plugins/agent-chat.ts +65 -0
- package/corpus/templates/crm/server/plugins/auth.ts +14 -0
- package/corpus/templates/crm/server/plugins/core-routes.ts +17 -0
- package/corpus/templates/crm/server/plugins/db.ts +738 -0
- package/corpus/templates/crm/server/routes/[...page].get.ts +5 -0
- package/corpus/templates/crm/shared/crm-attributes.ts +469 -0
- package/corpus/templates/crm/shared/crm-automation-recipes.ts +132 -0
- package/corpus/templates/crm/shared/crm-contract.ts +417 -0
- package/corpus/templates/crm/shared/crm-navigation.ts +190 -0
- package/corpus/templates/crm/shared/crm-sales-config.ts +63 -0
- package/corpus/templates/crm/ssr-entry.ts +11 -0
- package/corpus/templates/crm/tsconfig.json +24 -0
- package/corpus/templates/crm/vite.config.ts +15 -0
- package/corpus/templates/crm/vitest.config.ts +5 -0
- package/corpus/templates/design/app/i18n-data.ts +12 -12
- package/corpus/templates/design/changelog/2026-07-26-apply-design-updates-from-a-centered-top-toolbar-without-cov.md +6 -0
- package/dist/cli/templates-meta.d.ts.map +1 -1
- package/dist/cli/templates-meta.js +12 -0
- package/dist/cli/templates-meta.js.map +1 -1
- package/dist/collab/routes.d.ts +1 -1
- package/dist/observability/routes.d.ts +3 -3
- package/dist/resources/handlers.d.ts +1 -1
- package/dist/server/realtime-token.d.ts +1 -1
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/package.json +1 -1
- package/src/cli/templates-meta.ts +12 -0
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { sendToAgentChat } from "@agent-native/core/client/agent-chat";
|
|
2
|
+
import {
|
|
3
|
+
useActionMutation,
|
|
4
|
+
useActionQuery,
|
|
5
|
+
} from "@agent-native/core/client/hooks";
|
|
6
|
+
import {
|
|
7
|
+
IconCheck,
|
|
8
|
+
IconExternalLink,
|
|
9
|
+
IconWaveSine,
|
|
10
|
+
IconX,
|
|
11
|
+
} from "@tabler/icons-react";
|
|
12
|
+
import { useState } from "react";
|
|
13
|
+
|
|
14
|
+
import { Badge } from "@/components/ui/badge";
|
|
15
|
+
import { Button } from "@/components/ui/button";
|
|
16
|
+
|
|
17
|
+
interface Signal {
|
|
18
|
+
id: string;
|
|
19
|
+
label: string;
|
|
20
|
+
quote?: string;
|
|
21
|
+
summary?: string;
|
|
22
|
+
confidence: number;
|
|
23
|
+
reviewStatus: "unreviewed" | "confirmed" | "dismissed";
|
|
24
|
+
startSeconds?: number;
|
|
25
|
+
evidenceId: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
interface SignalList {
|
|
29
|
+
signals: Signal[];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
interface DelegatedRequest {
|
|
33
|
+
runId: string;
|
|
34
|
+
trackerId?: string;
|
|
35
|
+
kind: "smart" | "summary";
|
|
36
|
+
prompt: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
interface RunResult {
|
|
40
|
+
keywordSignalsCreated: number;
|
|
41
|
+
delegatedRequests: DelegatedRequest[];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function CrmSignalsPanel({
|
|
45
|
+
recordId,
|
|
46
|
+
evidence,
|
|
47
|
+
}: {
|
|
48
|
+
recordId: string;
|
|
49
|
+
evidence: Array<{ id: string; url?: string }>;
|
|
50
|
+
}) {
|
|
51
|
+
const [reviewingId, setReviewingId] = useState<string>();
|
|
52
|
+
const query = useActionQuery(
|
|
53
|
+
"list-crm-signal-hits" as never,
|
|
54
|
+
{ recordId, limit: 50 } as never,
|
|
55
|
+
) as { data?: SignalList; isLoading: boolean };
|
|
56
|
+
const run = useActionMutation(
|
|
57
|
+
"run-crm-signal-trackers" as never,
|
|
58
|
+
) as ReturnType<typeof useActionMutation<RunResult, never>>;
|
|
59
|
+
const review = useActionMutation("review-crm-signal" as never);
|
|
60
|
+
const evidenceById = new Map(evidence.map((item) => [item.id, item]));
|
|
61
|
+
|
|
62
|
+
const analyze = () => {
|
|
63
|
+
run.mutate(
|
|
64
|
+
{
|
|
65
|
+
recordId,
|
|
66
|
+
evidenceIds: evidence.map((item) => item.id),
|
|
67
|
+
includeSummary: true,
|
|
68
|
+
idempotencyKey: `ui-${recordId}-${Date.now()}`,
|
|
69
|
+
} as never,
|
|
70
|
+
{
|
|
71
|
+
onSuccess: (result) => {
|
|
72
|
+
if (result.delegatedRequests.length) {
|
|
73
|
+
const requests = result.delegatedRequests
|
|
74
|
+
.map((request, index) => {
|
|
75
|
+
const recorder =
|
|
76
|
+
request.kind === "smart"
|
|
77
|
+
? `Use record-crm-smart-signal with runId ${request.runId}, trackerId ${request.trackerId}, recordId ${recordId}, and a stable idempotencyKey for every grounded match.`
|
|
78
|
+
: `Use record-crm-call-insight once with runId ${request.runId}, recordId ${recordId}, all grounded insights as one bounded batch, and a stable idempotencyKey.`;
|
|
79
|
+
return `Request ${index + 1}\n${request.prompt}\n\n${recorder}`;
|
|
80
|
+
})
|
|
81
|
+
.join("\n\n---\n\n");
|
|
82
|
+
sendToAgentChat({
|
|
83
|
+
message: `Analyze all bounded call evidence requests for CRM record ${recordId}.`,
|
|
84
|
+
context: `${requests}\n\nProcess every request in this single run. Do not return or store a transcript.`,
|
|
85
|
+
submit: true,
|
|
86
|
+
newTab: true,
|
|
87
|
+
background: true,
|
|
88
|
+
openSidebar: false,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const setReview = (
|
|
97
|
+
signalId: string,
|
|
98
|
+
reviewStatus: "confirmed" | "dismissed",
|
|
99
|
+
) => {
|
|
100
|
+
setReviewingId(signalId);
|
|
101
|
+
review.mutate({ signalId, reviewStatus } as never, {
|
|
102
|
+
onSettled: () => setReviewingId(undefined),
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
return (
|
|
107
|
+
<div className="max-w-3xl">
|
|
108
|
+
<div className="flex flex-wrap items-start justify-between gap-3">
|
|
109
|
+
<div>
|
|
110
|
+
<h2 className="text-sm font-semibold">Signals</h2>
|
|
111
|
+
<p className="mt-1 text-sm text-muted-foreground">
|
|
112
|
+
Evidence-grounded moments and next steps from attached Clips calls.
|
|
113
|
+
</p>
|
|
114
|
+
</div>
|
|
115
|
+
<Button
|
|
116
|
+
size="sm"
|
|
117
|
+
variant="outline"
|
|
118
|
+
className="gap-1.5"
|
|
119
|
+
disabled={!evidence.length || run.isPending}
|
|
120
|
+
onClick={analyze}
|
|
121
|
+
>
|
|
122
|
+
<IconWaveSine className="size-3.5" />
|
|
123
|
+
{run.isPending ? "Preparing…" : "Analyze evidence"}
|
|
124
|
+
</Button>
|
|
125
|
+
</div>
|
|
126
|
+
{!evidence.length ? (
|
|
127
|
+
<p className="mt-4 rounded-lg border border-border/70 bg-card px-4 py-8 text-center text-sm text-muted-foreground">
|
|
128
|
+
Attach a bounded Clips evidence reference before running detectors.
|
|
129
|
+
</p>
|
|
130
|
+
) : query.data?.signals.length ? (
|
|
131
|
+
<div className="mt-4 divide-y divide-border rounded-lg border border-border/70 bg-card">
|
|
132
|
+
{query.data.signals.map((signal) => {
|
|
133
|
+
const source = evidenceById.get(signal.evidenceId);
|
|
134
|
+
return (
|
|
135
|
+
<article key={signal.id} className="px-4 py-3">
|
|
136
|
+
<div className="flex items-start gap-3">
|
|
137
|
+
<div className="min-w-0 flex-1">
|
|
138
|
+
<div className="flex flex-wrap items-center gap-2">
|
|
139
|
+
<p className="text-sm font-medium">{signal.label}</p>
|
|
140
|
+
<Badge
|
|
141
|
+
variant="secondary"
|
|
142
|
+
className="font-normal capitalize"
|
|
143
|
+
>
|
|
144
|
+
{signal.reviewStatus}
|
|
145
|
+
</Badge>
|
|
146
|
+
<span className="text-xs text-muted-foreground">
|
|
147
|
+
{Math.round(signal.confidence)}% confidence
|
|
148
|
+
</span>
|
|
149
|
+
</div>
|
|
150
|
+
{signal.quote ? (
|
|
151
|
+
<blockquote className="mt-2 border-l-2 border-border pl-3 text-sm leading-6 text-muted-foreground">
|
|
152
|
+
“{signal.quote}”
|
|
153
|
+
</blockquote>
|
|
154
|
+
) : signal.summary ? (
|
|
155
|
+
<p className="mt-2 text-sm leading-6 text-muted-foreground">
|
|
156
|
+
{signal.summary}
|
|
157
|
+
</p>
|
|
158
|
+
) : null}
|
|
159
|
+
{signal.startSeconds !== undefined ? (
|
|
160
|
+
<p className="mt-2 text-xs text-muted-foreground">
|
|
161
|
+
{formatTimestamp(signal.startSeconds)}
|
|
162
|
+
</p>
|
|
163
|
+
) : null}
|
|
164
|
+
</div>
|
|
165
|
+
<div className="flex shrink-0 items-center gap-1">
|
|
166
|
+
{source?.url ? (
|
|
167
|
+
<Button variant="ghost" size="icon" asChild>
|
|
168
|
+
<a
|
|
169
|
+
href={source.url}
|
|
170
|
+
target="_blank"
|
|
171
|
+
rel="noreferrer"
|
|
172
|
+
aria-label="Open call evidence"
|
|
173
|
+
>
|
|
174
|
+
<IconExternalLink className="size-4" />
|
|
175
|
+
</a>
|
|
176
|
+
</Button>
|
|
177
|
+
) : null}
|
|
178
|
+
{signal.reviewStatus === "unreviewed" ? (
|
|
179
|
+
<>
|
|
180
|
+
<Button
|
|
181
|
+
variant="ghost"
|
|
182
|
+
size="icon"
|
|
183
|
+
disabled={reviewingId === signal.id}
|
|
184
|
+
onClick={() => setReview(signal.id, "confirmed")}
|
|
185
|
+
aria-label="Confirm signal"
|
|
186
|
+
>
|
|
187
|
+
<IconCheck className="size-4" />
|
|
188
|
+
</Button>
|
|
189
|
+
<Button
|
|
190
|
+
variant="ghost"
|
|
191
|
+
size="icon"
|
|
192
|
+
disabled={reviewingId === signal.id}
|
|
193
|
+
onClick={() => setReview(signal.id, "dismissed")}
|
|
194
|
+
aria-label="Dismiss signal"
|
|
195
|
+
>
|
|
196
|
+
<IconX className="size-4" />
|
|
197
|
+
</Button>
|
|
198
|
+
</>
|
|
199
|
+
) : null}
|
|
200
|
+
</div>
|
|
201
|
+
</div>
|
|
202
|
+
</article>
|
|
203
|
+
);
|
|
204
|
+
})}
|
|
205
|
+
</div>
|
|
206
|
+
) : (
|
|
207
|
+
<p className="mt-4 rounded-lg border border-border/70 bg-card px-4 py-8 text-center text-sm text-muted-foreground">
|
|
208
|
+
{query.isLoading
|
|
209
|
+
? "Loading signals…"
|
|
210
|
+
: "No signals yet. Analyze the attached evidence to find grounded moments."}
|
|
211
|
+
</p>
|
|
212
|
+
)}
|
|
213
|
+
</div>
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
function formatTimestamp(value: number) {
|
|
218
|
+
const seconds = Math.max(0, Math.round(value));
|
|
219
|
+
return `${Math.floor(seconds / 60)}:${String(seconds % 60).padStart(2, "0")}`;
|
|
220
|
+
}
|
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useActionMutation,
|
|
3
|
+
useActionQuery,
|
|
4
|
+
} from "@agent-native/core/client/hooks";
|
|
5
|
+
import { useT } from "@agent-native/core/client/i18n";
|
|
6
|
+
import { IconBrain, IconPlus, IconTags, IconTrash } from "@tabler/icons-react";
|
|
7
|
+
import { useState } from "react";
|
|
8
|
+
import { toast } from "sonner";
|
|
9
|
+
|
|
10
|
+
import {
|
|
11
|
+
AlertDialog,
|
|
12
|
+
AlertDialogAction,
|
|
13
|
+
AlertDialogCancel,
|
|
14
|
+
AlertDialogContent,
|
|
15
|
+
AlertDialogDescription,
|
|
16
|
+
AlertDialogFooter,
|
|
17
|
+
AlertDialogHeader,
|
|
18
|
+
AlertDialogTitle,
|
|
19
|
+
AlertDialogTrigger,
|
|
20
|
+
} from "@/components/ui/alert-dialog";
|
|
21
|
+
import { Badge } from "@/components/ui/badge";
|
|
22
|
+
import { Button } from "@/components/ui/button";
|
|
23
|
+
import {
|
|
24
|
+
Dialog,
|
|
25
|
+
DialogContent,
|
|
26
|
+
DialogDescription,
|
|
27
|
+
DialogFooter,
|
|
28
|
+
DialogHeader,
|
|
29
|
+
DialogTitle,
|
|
30
|
+
DialogTrigger,
|
|
31
|
+
} from "@/components/ui/dialog";
|
|
32
|
+
import { Input } from "@/components/ui/input";
|
|
33
|
+
import { Label } from "@/components/ui/label";
|
|
34
|
+
import {
|
|
35
|
+
Select,
|
|
36
|
+
SelectContent,
|
|
37
|
+
SelectGroup,
|
|
38
|
+
SelectItem,
|
|
39
|
+
SelectTrigger,
|
|
40
|
+
SelectValue,
|
|
41
|
+
} from "@/components/ui/select";
|
|
42
|
+
import { Switch } from "@/components/ui/switch";
|
|
43
|
+
import { Textarea } from "@/components/ui/textarea";
|
|
44
|
+
|
|
45
|
+
type TrackerKind = "keyword" | "smart";
|
|
46
|
+
|
|
47
|
+
interface SignalTracker {
|
|
48
|
+
id: string;
|
|
49
|
+
name: string;
|
|
50
|
+
description: string;
|
|
51
|
+
kind: TrackerKind;
|
|
52
|
+
keywords: string[];
|
|
53
|
+
classifierPrompt: string;
|
|
54
|
+
enabled: boolean;
|
|
55
|
+
isDefault: boolean;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
interface SignalTrackersResult {
|
|
59
|
+
trackers: SignalTracker[];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
interface CreateTrackerInput {
|
|
63
|
+
name: string;
|
|
64
|
+
description: string;
|
|
65
|
+
kind: TrackerKind;
|
|
66
|
+
keywords: string[];
|
|
67
|
+
classifierPrompt: string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
interface ManageTrackerInput {
|
|
71
|
+
trackerId: string;
|
|
72
|
+
operation: "set-enabled" | "delete";
|
|
73
|
+
enabled?: boolean;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function IntelligenceSettings() {
|
|
77
|
+
const t = useT();
|
|
78
|
+
const trackersQuery = useActionQuery<SignalTrackersResult>(
|
|
79
|
+
"list-crm-signal-trackers" as never,
|
|
80
|
+
{} as never,
|
|
81
|
+
);
|
|
82
|
+
const createTracker = useActionMutation<unknown, CreateTrackerInput>(
|
|
83
|
+
"create-crm-signal-tracker" as never,
|
|
84
|
+
);
|
|
85
|
+
const manageTracker = useActionMutation<unknown, ManageTrackerInput>(
|
|
86
|
+
"manage-crm-signal-tracker" as never,
|
|
87
|
+
);
|
|
88
|
+
const [pendingTrackerIds, setPendingTrackerIds] = useState<Set<string>>(
|
|
89
|
+
new Set(),
|
|
90
|
+
);
|
|
91
|
+
const trackers = trackersQuery.data?.trackers ?? [];
|
|
92
|
+
|
|
93
|
+
async function manage(input: ManageTrackerInput) {
|
|
94
|
+
setPendingTrackerIds((current) => new Set(current).add(input.trackerId));
|
|
95
|
+
try {
|
|
96
|
+
await manageTracker.mutateAsync(input);
|
|
97
|
+
toast.success(
|
|
98
|
+
input.operation === "delete"
|
|
99
|
+
? t("intelligence.trackerDeleted")
|
|
100
|
+
: input.enabled
|
|
101
|
+
? t("intelligence.trackerEnabled")
|
|
102
|
+
: t("intelligence.trackerDisabled"),
|
|
103
|
+
);
|
|
104
|
+
} catch (error) {
|
|
105
|
+
toast.error(
|
|
106
|
+
error instanceof Error
|
|
107
|
+
? error.message
|
|
108
|
+
: t("intelligence.trackerUpdateFailed"),
|
|
109
|
+
);
|
|
110
|
+
} finally {
|
|
111
|
+
setPendingTrackerIds((current) => {
|
|
112
|
+
const next = new Set(current);
|
|
113
|
+
next.delete(input.trackerId);
|
|
114
|
+
return next;
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return (
|
|
120
|
+
<div className="mx-auto w-full max-w-2xl">
|
|
121
|
+
<div className="flex flex-wrap items-start justify-between gap-4">
|
|
122
|
+
<div className="min-w-0">
|
|
123
|
+
<h1 className="text-xl font-semibold tracking-tight">
|
|
124
|
+
{t("intelligence.title")}
|
|
125
|
+
</h1>
|
|
126
|
+
<p className="mt-1 max-w-xl text-sm leading-6 text-muted-foreground">
|
|
127
|
+
{t("intelligence.description")}
|
|
128
|
+
</p>
|
|
129
|
+
</div>
|
|
130
|
+
<CreateTrackerDialog mutation={createTracker} />
|
|
131
|
+
</div>
|
|
132
|
+
|
|
133
|
+
{trackersQuery.isLoading ? (
|
|
134
|
+
<p className="mt-8 text-sm text-muted-foreground">
|
|
135
|
+
{t("intelligence.loading")}
|
|
136
|
+
</p>
|
|
137
|
+
) : trackers.length ? (
|
|
138
|
+
<div className="mt-8 divide-y divide-border/70 rounded-lg border border-border/70 bg-card">
|
|
139
|
+
{trackers.map((tracker) => {
|
|
140
|
+
const pending = pendingTrackerIds.has(tracker.id);
|
|
141
|
+
const Icon = tracker.kind === "keyword" ? IconTags : IconBrain;
|
|
142
|
+
return (
|
|
143
|
+
<section
|
|
144
|
+
key={tracker.id}
|
|
145
|
+
className="flex flex-wrap items-center gap-4 px-4 py-3.5"
|
|
146
|
+
>
|
|
147
|
+
<Icon className="size-4 shrink-0 text-muted-foreground" />
|
|
148
|
+
<div className="min-w-0 flex-1">
|
|
149
|
+
<div className="flex flex-wrap items-center gap-2">
|
|
150
|
+
<p className="truncate text-sm font-medium">
|
|
151
|
+
{tracker.name}
|
|
152
|
+
</p>
|
|
153
|
+
<Badge variant="secondary" className="font-normal">
|
|
154
|
+
{tracker.kind === "keyword"
|
|
155
|
+
? t("intelligence.kindKeyword")
|
|
156
|
+
: t("intelligence.kindSmart")}
|
|
157
|
+
</Badge>
|
|
158
|
+
</div>
|
|
159
|
+
<p className="mt-1 text-sm text-muted-foreground">
|
|
160
|
+
{tracker.description || trackerSummary(tracker, t)}
|
|
161
|
+
</p>
|
|
162
|
+
</div>
|
|
163
|
+
<div className="flex shrink-0 items-center gap-2">
|
|
164
|
+
<Switch
|
|
165
|
+
checked={tracker.enabled}
|
|
166
|
+
disabled={pending}
|
|
167
|
+
aria-label={t("intelligence.toggleTracker", {
|
|
168
|
+
action: tracker.enabled
|
|
169
|
+
? t("intelligence.disable")
|
|
170
|
+
: t("intelligence.enable"),
|
|
171
|
+
name: tracker.name,
|
|
172
|
+
})}
|
|
173
|
+
onCheckedChange={(enabled) =>
|
|
174
|
+
void manage({
|
|
175
|
+
trackerId: tracker.id,
|
|
176
|
+
operation: "set-enabled",
|
|
177
|
+
enabled,
|
|
178
|
+
})
|
|
179
|
+
}
|
|
180
|
+
/>
|
|
181
|
+
<DeleteTrackerButton
|
|
182
|
+
tracker={tracker}
|
|
183
|
+
pending={pending}
|
|
184
|
+
onDelete={() =>
|
|
185
|
+
void manage({
|
|
186
|
+
trackerId: tracker.id,
|
|
187
|
+
operation: "delete",
|
|
188
|
+
})
|
|
189
|
+
}
|
|
190
|
+
/>
|
|
191
|
+
</div>
|
|
192
|
+
</section>
|
|
193
|
+
);
|
|
194
|
+
})}
|
|
195
|
+
</div>
|
|
196
|
+
) : (
|
|
197
|
+
<div className="mt-8 rounded-lg border border-dashed border-border px-4 py-10 text-center">
|
|
198
|
+
<p className="text-sm font-medium">{t("intelligence.emptyTitle")}</p>
|
|
199
|
+
<p className="mt-1 text-sm text-muted-foreground">
|
|
200
|
+
{t("intelligence.emptyDescription")}
|
|
201
|
+
</p>
|
|
202
|
+
</div>
|
|
203
|
+
)}
|
|
204
|
+
</div>
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
function CreateTrackerDialog({
|
|
209
|
+
mutation,
|
|
210
|
+
}: {
|
|
211
|
+
mutation: {
|
|
212
|
+
isPending: boolean;
|
|
213
|
+
mutateAsync: (input: CreateTrackerInput) => Promise<unknown>;
|
|
214
|
+
};
|
|
215
|
+
}) {
|
|
216
|
+
const t = useT();
|
|
217
|
+
const [open, setOpen] = useState(false);
|
|
218
|
+
const [name, setName] = useState("");
|
|
219
|
+
const [description, setDescription] = useState("");
|
|
220
|
+
const [kind, setKind] = useState<TrackerKind>("keyword");
|
|
221
|
+
const [keywords, setKeywords] = useState("");
|
|
222
|
+
const [criterion, setCriterion] = useState("");
|
|
223
|
+
|
|
224
|
+
const parsedKeywords = keywords
|
|
225
|
+
.split(",")
|
|
226
|
+
.map((value) => value.trim())
|
|
227
|
+
.filter(Boolean);
|
|
228
|
+
const canCreate = Boolean(
|
|
229
|
+
name.trim() &&
|
|
230
|
+
(kind === "keyword" ? parsedKeywords.length : criterion.trim()),
|
|
231
|
+
);
|
|
232
|
+
|
|
233
|
+
async function create() {
|
|
234
|
+
try {
|
|
235
|
+
await mutation.mutateAsync({
|
|
236
|
+
name: name.trim(),
|
|
237
|
+
description: description.trim(),
|
|
238
|
+
kind,
|
|
239
|
+
keywords: kind === "keyword" ? parsedKeywords : [],
|
|
240
|
+
classifierPrompt: kind === "smart" ? criterion.trim() : "",
|
|
241
|
+
});
|
|
242
|
+
setOpen(false);
|
|
243
|
+
setName("");
|
|
244
|
+
setDescription("");
|
|
245
|
+
setKeywords("");
|
|
246
|
+
setCriterion("");
|
|
247
|
+
toast.success(t("intelligence.trackerCreated"));
|
|
248
|
+
} catch (error) {
|
|
249
|
+
toast.error(
|
|
250
|
+
error instanceof Error
|
|
251
|
+
? error.message
|
|
252
|
+
: t("intelligence.trackerCreationFailed"),
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
return (
|
|
258
|
+
<Dialog open={open} onOpenChange={setOpen}>
|
|
259
|
+
<DialogTrigger asChild>
|
|
260
|
+
<Button size="sm" className="gap-1.5">
|
|
261
|
+
<IconPlus className="size-4" /> {t("intelligence.newTracker")}
|
|
262
|
+
</Button>
|
|
263
|
+
</DialogTrigger>
|
|
264
|
+
<DialogContent className="sm:max-w-lg">
|
|
265
|
+
<DialogHeader>
|
|
266
|
+
<DialogTitle>{t("intelligence.createTitle")}</DialogTitle>
|
|
267
|
+
<DialogDescription>
|
|
268
|
+
{t("intelligence.createDescription")}
|
|
269
|
+
</DialogDescription>
|
|
270
|
+
</DialogHeader>
|
|
271
|
+
<div className="grid gap-4 py-2">
|
|
272
|
+
<div className="grid gap-2">
|
|
273
|
+
<Label htmlFor="tracker-name">{t("intelligence.name")}</Label>
|
|
274
|
+
<Input
|
|
275
|
+
id="tracker-name"
|
|
276
|
+
value={name}
|
|
277
|
+
maxLength={120}
|
|
278
|
+
onChange={(event) => setName(event.target.value)}
|
|
279
|
+
/>
|
|
280
|
+
</div>
|
|
281
|
+
<div className="grid gap-2">
|
|
282
|
+
<Label htmlFor="tracker-description">
|
|
283
|
+
{t("intelligence.trackerDescription")}
|
|
284
|
+
</Label>
|
|
285
|
+
<Textarea
|
|
286
|
+
id="tracker-description"
|
|
287
|
+
value={description}
|
|
288
|
+
maxLength={500}
|
|
289
|
+
onChange={(event) => setDescription(event.target.value)}
|
|
290
|
+
/>
|
|
291
|
+
</div>
|
|
292
|
+
<div className="grid gap-2">
|
|
293
|
+
<Label htmlFor="tracker-kind">{t("intelligence.detector")}</Label>
|
|
294
|
+
<Select
|
|
295
|
+
value={kind}
|
|
296
|
+
onValueChange={(value) => setKind(value as TrackerKind)}
|
|
297
|
+
>
|
|
298
|
+
<SelectTrigger id="tracker-kind">
|
|
299
|
+
<SelectValue />
|
|
300
|
+
</SelectTrigger>
|
|
301
|
+
<SelectContent>
|
|
302
|
+
<SelectGroup>
|
|
303
|
+
<SelectItem value="keyword">
|
|
304
|
+
{t("intelligence.kindKeyword")}
|
|
305
|
+
</SelectItem>
|
|
306
|
+
<SelectItem value="smart">
|
|
307
|
+
{t("intelligence.kindSmart")}
|
|
308
|
+
</SelectItem>
|
|
309
|
+
</SelectGroup>
|
|
310
|
+
</SelectContent>
|
|
311
|
+
</Select>
|
|
312
|
+
</div>
|
|
313
|
+
{kind === "keyword" ? (
|
|
314
|
+
<div className="grid gap-2">
|
|
315
|
+
<Label htmlFor="tracker-keywords">
|
|
316
|
+
{t("intelligence.keywords")}
|
|
317
|
+
</Label>
|
|
318
|
+
<Input
|
|
319
|
+
id="tracker-keywords"
|
|
320
|
+
value={keywords}
|
|
321
|
+
maxLength={3_200}
|
|
322
|
+
placeholder={t("intelligence.keywordsPlaceholder")}
|
|
323
|
+
onChange={(event) => setKeywords(event.target.value)}
|
|
324
|
+
/>
|
|
325
|
+
<p className="text-xs text-muted-foreground">
|
|
326
|
+
{t("intelligence.keywordsHelp")}
|
|
327
|
+
</p>
|
|
328
|
+
</div>
|
|
329
|
+
) : (
|
|
330
|
+
<div className="grid gap-2">
|
|
331
|
+
<Label htmlFor="tracker-criterion">
|
|
332
|
+
{t("intelligence.classificationCriterion")}
|
|
333
|
+
</Label>
|
|
334
|
+
<Textarea
|
|
335
|
+
id="tracker-criterion"
|
|
336
|
+
value={criterion}
|
|
337
|
+
maxLength={1_000}
|
|
338
|
+
placeholder={t("intelligence.criterionPlaceholder")}
|
|
339
|
+
onChange={(event) => setCriterion(event.target.value)}
|
|
340
|
+
/>
|
|
341
|
+
</div>
|
|
342
|
+
)}
|
|
343
|
+
</div>
|
|
344
|
+
<DialogFooter>
|
|
345
|
+
<Button
|
|
346
|
+
disabled={!canCreate || mutation.isPending}
|
|
347
|
+
onClick={() => void create()}
|
|
348
|
+
>
|
|
349
|
+
{mutation.isPending
|
|
350
|
+
? t("intelligence.creating")
|
|
351
|
+
: t("intelligence.create")}
|
|
352
|
+
</Button>
|
|
353
|
+
</DialogFooter>
|
|
354
|
+
</DialogContent>
|
|
355
|
+
</Dialog>
|
|
356
|
+
);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
function DeleteTrackerButton({
|
|
360
|
+
tracker,
|
|
361
|
+
pending,
|
|
362
|
+
onDelete,
|
|
363
|
+
}: {
|
|
364
|
+
tracker: SignalTracker;
|
|
365
|
+
pending: boolean;
|
|
366
|
+
onDelete: () => void;
|
|
367
|
+
}) {
|
|
368
|
+
const t = useT();
|
|
369
|
+
return (
|
|
370
|
+
<AlertDialog>
|
|
371
|
+
<AlertDialogTrigger asChild>
|
|
372
|
+
<Button
|
|
373
|
+
variant="ghost"
|
|
374
|
+
size="icon"
|
|
375
|
+
disabled={pending}
|
|
376
|
+
aria-label={t("intelligence.deleteTrackerAria", {
|
|
377
|
+
name: tracker.name,
|
|
378
|
+
})}
|
|
379
|
+
>
|
|
380
|
+
<IconTrash className="size-4" />
|
|
381
|
+
</Button>
|
|
382
|
+
</AlertDialogTrigger>
|
|
383
|
+
<AlertDialogContent>
|
|
384
|
+
<AlertDialogHeader>
|
|
385
|
+
<AlertDialogTitle>
|
|
386
|
+
{t("intelligence.deleteTrackerTitle", { name: tracker.name })}
|
|
387
|
+
</AlertDialogTitle>
|
|
388
|
+
<AlertDialogDescription>
|
|
389
|
+
{t("intelligence.deleteTrackerDescription")}
|
|
390
|
+
</AlertDialogDescription>
|
|
391
|
+
</AlertDialogHeader>
|
|
392
|
+
<AlertDialogFooter>
|
|
393
|
+
<AlertDialogCancel>{t("intelligence.cancel")}</AlertDialogCancel>
|
|
394
|
+
<AlertDialogAction onClick={onDelete}>
|
|
395
|
+
{t("intelligence.deleteTracker")}
|
|
396
|
+
</AlertDialogAction>
|
|
397
|
+
</AlertDialogFooter>
|
|
398
|
+
</AlertDialogContent>
|
|
399
|
+
</AlertDialog>
|
|
400
|
+
);
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
function trackerSummary(
|
|
404
|
+
tracker: SignalTracker,
|
|
405
|
+
t: (key: string, options?: Record<string, unknown>) => string,
|
|
406
|
+
) {
|
|
407
|
+
if (tracker.kind === "keyword")
|
|
408
|
+
return tracker.keywords.length
|
|
409
|
+
? t("intelligence.keywordsSummary", {
|
|
410
|
+
keywords: tracker.keywords.join(", "),
|
|
411
|
+
})
|
|
412
|
+
: t("intelligence.noKeywordsConfigured");
|
|
413
|
+
return t("intelligence.evaluatedThroughAsk");
|
|
414
|
+
}
|