profclaw 0.0.1-beta.2 → 2.0.0
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/CHANGELOG.md +21 -38
- package/CONTRIBUTING.md +3 -5
- package/README.md +128 -63
- package/dist/chat/execution/tools/index.d.ts +1 -1
- package/dist/chat/execution/tools/index.js +41 -2
- package/dist/chat/providers/slack/index.d.ts +2 -2
- package/dist/cli/commands/models.js +39 -26
- package/dist/cli/commands/onboard.js +64 -79
- package/dist/cli/commands/setup.js +293 -90
- package/dist/cli/index.js +0 -6
- package/dist/cli/providers.d.ts +15 -0
- package/dist/cli/providers.js +41 -0
- package/dist/core/deployment.js +2 -0
- package/dist/providers/ai-sdk.js +26 -6
- package/dist/routes/channels.d.ts +12 -0
- package/dist/routes/channels.js +166 -0
- package/dist/server/route-loader.js +1 -0
- package/dist/server.js +115 -109
- package/package.json +1 -1
- package/skills/git-workflow/SKILL.md +3 -3
- package/ui/dist/assets/{ActivityView-DIPQSJ_d.js → ActivityView-BeshZXmE.js} +1 -1
- package/ui/dist/assets/{AgentList-CqyaYrcq.js → AgentList-QVHeldPi.js} +1 -1
- package/ui/dist/assets/{AnalyticsDashboard-C-mjuGHT.js → AnalyticsDashboard-C9R97dXE.js} +1 -1
- package/ui/dist/assets/{AreaChart-CfYWmbtr.js → AreaChart-B73gaiVQ.js} +1 -1
- package/ui/dist/assets/{CartesianChart-BaQ3It0c.js → CartesianChart-CXYL2R-A.js} +1 -1
- package/ui/dist/assets/{ChatView-DxxQy6pl.js → ChatView-qjZErlrp.js} +1 -1
- package/ui/dist/assets/{CostsDashboard-CDBBcGkg.js → CostsDashboard-O4DCLy1i.js} +1 -1
- package/ui/dist/assets/{EstimateSelect-CDjf5qKl.js → EstimateSelect-1hQf4Osk.js} +1 -1
- package/ui/dist/assets/{FloatingChatbot-CZHjvJIe.js → FloatingChatbot-BZBzrJxd.js} +1 -1
- package/ui/dist/assets/{InviteCodeManagement-DTm-IPTm.js → InviteCodeManagement-LEoGqYeA.js} +1 -1
- package/ui/dist/assets/{ProjectDetail-DlYUcOss.js → ProjectDetail--gPfvATB.js} +1 -1
- package/ui/dist/assets/{ProjectIcon-BMRpnM04.js → ProjectIcon-Chd_ofsw.js} +1 -1
- package/ui/dist/assets/{ProjectList-D85TN0i0.js → ProjectList-BvUfVB6c.js} +1 -1
- package/ui/dist/assets/{Settings-CgPqzUvj.js → Settings-1kaf7VHE.js} +1 -1
- package/ui/dist/assets/{StatusIndicator-yig0uZEA.js → StatusIndicator-pRfkNcdV.js} +1 -1
- package/ui/dist/assets/{SummaryDetail-CwLAfHgJ.js → SummaryDetail-DV3AmONk.js} +1 -1
- package/ui/dist/assets/{SummaryList-BvS5Idnu.js → SummaryList-B6kXiTxL.js} +1 -1
- package/ui/dist/assets/{TaskDetail-zarC1fOt.js → TaskDetail-CV6CzbOS.js} +1 -1
- package/ui/dist/assets/{TaskList-CyJq3ANE.js → TaskList-DL7brQKd.js} +1 -1
- package/ui/dist/assets/{TicketBoard-BlWr3-iH.js → TicketBoard-CrkkFj7C.js} +1 -1
- package/ui/dist/assets/{TicketDetail-DmqWKj2W.js → TicketDetail-hnnYclpD.js} +1 -1
- package/ui/dist/assets/{TicketList-Scj4pMWa.js → TicketList-CsDAyQCL.js} +1 -1
- package/ui/dist/assets/{UserManagement-BH7uG7dw.js → UserManagement-BGFQyTSr.js} +1 -1
- package/ui/dist/assets/{ViewSwitcher-3HzZUdWn.js → ViewSwitcher-CnL0OqA8.js} +1 -1
- package/ui/dist/assets/{alert-dialog-DWPb2IfQ.js → alert-dialog-SKM6Gjz4.js} +1 -1
- package/ui/dist/assets/{archive-CGck7gxR.js → archive-BsLa7brF.js} +1 -1
- package/ui/dist/assets/{badge-DEmc3Z_l.js → badge-CVHH1a-v.js} +1 -1
- package/ui/dist/assets/{brain-CfFdLVqb.js → brain-6o_RHVpe.js} +1 -1
- package/ui/dist/assets/{bug-DqSGPUUE.js → bug-CmZI7jqM.js} +1 -1
- package/ui/dist/assets/{calendar-BuZ4zbPW.js → calendar-Bf0t2B82.js} +1 -1
- package/ui/dist/assets/{chevron-up-DcJ4LL_N.js → chevron-up-CoUsOvZj.js} +1 -1
- package/ui/dist/assets/{circle-x-C78PNZjF.js → circle-x-Dgw11LgT.js} +1 -1
- package/ui/dist/assets/{constants-DhDjZe4P.js → constants-Q5Zivl-a.js} +1 -1
- package/ui/dist/assets/{cpu-Ck6AoG8c.js → cpu-DiPMQICV.js} +1 -1
- package/ui/dist/assets/{database-CA2w8Lvt.js → database-BwTfupDi.js} +1 -1
- package/ui/dist/assets/{dialog-BOdGWhgE.js → dialog-BUqN9Psj.js} +1 -1
- package/ui/dist/assets/{ellipsis-FhHKRbfl.js → ellipsis-UJx4Xnf6.js} +1 -1
- package/ui/dist/assets/{ellipsis-vertical-CO0UqE4-.js → ellipsis-vertical-DoULYEKn.js} +1 -1
- package/ui/dist/assets/{file-code-ChnhYYj1.js → file-code-B2UrJLwi.js} +1 -1
- package/ui/dist/assets/{folder-open-CHwA1-ve.js → folder-open-BJi577JH.js} +1 -1
- package/ui/dist/assets/{funnel-ByEjRFNB.js → funnel-PkaD_HSR.js} +1 -1
- package/ui/dist/assets/{git-branch-GTOPQgU4.js → git-branch-C_K30am0.js} +1 -1
- package/ui/dist/assets/{git-commit-horizontal-F5M84Kut.js → git-commit-horizontal-IT6ecxWQ.js} +1 -1
- package/ui/dist/assets/{globe-CQWfr7hT.js → globe-f-jjCa_g.js} +1 -1
- package/ui/dist/assets/{hash-nKC9gtLg.js → hash-DNEv8Elo.js} +1 -1
- package/ui/dist/assets/{history-DfFSA9xJ.js → history-BQSBo_1Q.js} +1 -1
- package/ui/dist/assets/{index-DHGvP9mp.js → index-BUmnwPQr.js} +1 -1
- package/ui/dist/assets/{index-Z4-RtZcs.js → index-BfF5G4Cw.js} +1 -1
- package/ui/dist/assets/{index-DeI8lKRR.js → index-C8N375c2.js} +1 -1
- package/ui/dist/assets/index-CuxnqVVz.css +1 -0
- package/ui/dist/assets/{index-Ca3vk7Gq.js → index-CzMM3QOk.js} +1 -1
- package/ui/dist/assets/{index--JkIxVXb.js → index-lJlNPFVJ.js} +3 -3
- package/ui/dist/assets/{index-a4Fxq0Hb.js → index-nS3EErDg.js} +1 -1
- package/ui/dist/assets/{layers-DFeLExSa.js → layers-jFqVrWMD.js} +1 -1
- package/ui/dist/assets/{layout-dashboard-WmgjMhWF.js → layout-dashboard-CcKt1hXw.js} +1 -1
- package/ui/dist/assets/{lightbulb-Bo8hEr7B.js → lightbulb-Jhp7FvbU.js} +1 -1
- package/ui/dist/assets/{link-2-YqrpQXBH.js → link-2-DdO7ostF.js} +1 -1
- package/ui/dist/assets/{markdown-renderer-Croje6Xe.js → markdown-renderer-n1ToC4XQ.js} +1 -1
- package/ui/dist/assets/{message-square-CD0H5hot.js → message-square-CBgH65X7.js} +1 -1
- package/ui/dist/assets/{pencil-DpFnj5dn.js → pencil-CYXCEPQh.js} +1 -1
- package/ui/dist/assets/{play-DVgea_jT.js → play-d1ONaH0-.js} +1 -1
- package/ui/dist/assets/{popover-JXecfWG5.js → popover-CrmZgoWu.js} +1 -1
- package/ui/dist/assets/{progress-C1ghf1Fu.js → progress-uv4SPkL5.js} +1 -1
- package/ui/dist/assets/{rocket-BFxPYGx9.js → rocket-DhvUetsk.js} +1 -1
- package/ui/dist/assets/{select-MADP8m6Q.js → select-CeQ8AHGy.js} +1 -1
- package/ui/dist/assets/{send-eYnW_7n-.js → send-P0r5D7td.js} +1 -1
- package/ui/dist/assets/{server-CPMaysH8.js → server-CVHTZB72.js} +1 -1
- package/ui/dist/assets/{settings-2-scXUOuE_.js → settings-2-ocj5uHGx.js} +1 -1
- package/ui/dist/assets/{sheet-r6NSOxi-.js → sheet-DuQExSho.js} +1 -1
- package/ui/dist/assets/{shield-check-PEr7nmVw.js → shield-check-DfVdE34l.js} +1 -1
- package/ui/dist/assets/{shield-off-CLtXio62.js → shield-off-8l0J6R-8.js} +1 -1
- package/ui/dist/assets/{skeleton-C9oEzNlU.js → skeleton-TFiFJ3nB.js} +1 -1
- package/ui/dist/assets/{smartphone-DusFfY0U.js → smartphone-77_g3SQn.js} +1 -1
- package/ui/dist/assets/{square-e1yxB2eR.js → square-Ckzsr3Rn.js} +1 -1
- package/ui/dist/assets/{switch-tNs0n-kz.js → switch-CAePkd6k.js} +1 -1
- package/ui/dist/assets/{table-CXxtLicg.js → table-ZjAZ7hkt.js} +1 -1
- package/ui/dist/assets/{tag-tAwMmQ9G.js → tag-C35mgoEv.js} +1 -1
- package/ui/dist/assets/{textarea-BjiEeIWh.js → textarea-DsVPnSgR.js} +1 -1
- package/ui/dist/assets/{timer-Vel1N3RP.js → timer-DHJBS2w1.js} +1 -1
- package/ui/dist/assets/{tooltip-ZMwtfr1J.js → tooltip-BYmQ331W.js} +1 -1
- package/ui/dist/assets/{trash-2-eM-CNwsZ.js → trash-2-keO5tKPE.js} +1 -1
- package/ui/dist/assets/{trending-up-BGafmjRo.js → trending-up-BBv8KbrY.js} +1 -1
- package/ui/dist/assets/{wand-sparkles-DPvcd9Pi.js → wand-sparkles-BusQ52ZK.js} +1 -1
- package/ui/dist/assets/{wrench-B8s3zYVV.js → wrench-02YaOSiK.js} +1 -1
- package/ui/dist/index.html +2 -2
- package/dist/chat/auto-reply.d.ts +0 -90
- package/dist/chat/auto-reply.js +0 -272
- package/dist/chat/execution/pty.d.ts +0 -92
- package/dist/chat/execution/pty.js +0 -285
- package/dist/chat/execution/tools/glinr-ops.d.ts +0 -202
- package/dist/chat/execution/tools/glinr-ops.js +0 -694
- package/dist/cli/commands/browser.d.ts +0 -3
- package/dist/cli/commands/browser.js +0 -138
- package/dist/cli/commands/canvas.d.ts +0 -3
- package/dist/cli/commands/canvas.js +0 -155
- package/dist/cli/commands/nodes.d.ts +0 -3
- package/dist/cli/commands/nodes.js +0 -193
- package/dist/diagnostics/exporters.d.ts +0 -21
- package/dist/diagnostics/exporters.js +0 -138
- package/dist/diagnostics/index.d.ts +0 -10
- package/dist/diagnostics/index.js +0 -9
- package/dist/diagnostics/middleware.d.ts +0 -12
- package/dist/diagnostics/middleware.js +0 -58
- package/dist/diagnostics/tracer.d.ts +0 -133
- package/dist/diagnostics/tracer.js +0 -257
- package/dist/discovery/index.d.ts +0 -8
- package/dist/discovery/index.js +0 -7
- package/dist/discovery/mdns.d.ts +0 -40
- package/dist/discovery/mdns.js +0 -249
- package/dist/plugins/registry.d.ts +0 -122
- package/dist/plugins/registry.js +0 -352
- package/dist/plugins/sandbox.d.ts +0 -77
- package/dist/plugins/sandbox.js +0 -287
- package/dist/plugins/search/brave.d.ts +0 -9
- package/dist/plugins/search/brave.js +0 -157
- package/dist/plugins/search/duckduckgo.d.ts +0 -9
- package/dist/plugins/search/duckduckgo.js +0 -171
- package/dist/plugins/search/index.d.ts +0 -13
- package/dist/plugins/search/index.js +0 -23
- package/dist/plugins/search/searxng.d.ts +0 -9
- package/dist/plugins/search/searxng.js +0 -170
- package/dist/plugins/search/serper.d.ts +0 -9
- package/dist/plugins/search/serper.js +0 -135
- package/dist/plugins/search/tavily.d.ts +0 -9
- package/dist/plugins/search/tavily.js +0 -146
- package/dist/providers/adapters/anthropic.d.ts +0 -26
- package/dist/providers/adapters/anthropic.js +0 -306
- package/dist/providers/adapters/base.d.ts +0 -53
- package/dist/providers/adapters/base.js +0 -99
- package/dist/providers/adapters/ollama.d.ts +0 -30
- package/dist/providers/adapters/ollama.js +0 -292
- package/dist/utils/ai-cache.d.ts +0 -72
- package/dist/utils/ai-cache.js +0 -204
- package/dist/utils/file-lock.d.ts +0 -85
- package/dist/utils/file-lock.js +0 -204
- package/ui/dist/assets/index-WclMPci1.css +0 -1
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Serper Search Provider
|
|
3
|
-
*
|
|
4
|
-
* Fast and cost-effective Google Search API.
|
|
5
|
-
* https://serper.dev/
|
|
6
|
-
*/
|
|
7
|
-
const SERPER_API_URL = 'https://google.serper.dev/search';
|
|
8
|
-
class SerperProvider {
|
|
9
|
-
metadata = SERPER_DEFINITION.metadata;
|
|
10
|
-
apiKey;
|
|
11
|
-
baseUrl;
|
|
12
|
-
constructor(config) {
|
|
13
|
-
this.apiKey = config.credentials?.apiKey || '';
|
|
14
|
-
this.baseUrl = config.credentials?.baseUrl || SERPER_API_URL;
|
|
15
|
-
}
|
|
16
|
-
async search(query, options) {
|
|
17
|
-
if (!this.apiKey) {
|
|
18
|
-
throw new Error('Serper API key not configured');
|
|
19
|
-
}
|
|
20
|
-
const startTime = Date.now();
|
|
21
|
-
const body = {
|
|
22
|
-
q: query,
|
|
23
|
-
num: options?.limit || 10,
|
|
24
|
-
};
|
|
25
|
-
if (options?.language)
|
|
26
|
-
body.hl = options.language;
|
|
27
|
-
if (options?.region)
|
|
28
|
-
body.gl = options.region;
|
|
29
|
-
const response = await fetch(this.baseUrl, {
|
|
30
|
-
method: 'POST',
|
|
31
|
-
headers: {
|
|
32
|
-
'X-API-KEY': this.apiKey,
|
|
33
|
-
'Content-Type': 'application/json',
|
|
34
|
-
},
|
|
35
|
-
body: JSON.stringify(body),
|
|
36
|
-
});
|
|
37
|
-
if (!response.ok) {
|
|
38
|
-
const error = await response.text();
|
|
39
|
-
throw new Error(`Serper API error: ${response.status} - ${error}`);
|
|
40
|
-
}
|
|
41
|
-
const data = await response.json();
|
|
42
|
-
const searchTime = Date.now() - startTime;
|
|
43
|
-
const results = (data.organic || []).map((item) => ({
|
|
44
|
-
title: item.title,
|
|
45
|
-
url: item.link,
|
|
46
|
-
snippet: item.snippet || '',
|
|
47
|
-
date: item.date,
|
|
48
|
-
source: 'serper',
|
|
49
|
-
metadata: {
|
|
50
|
-
position: item.position,
|
|
51
|
-
sitelinks: item.sitelinks,
|
|
52
|
-
},
|
|
53
|
-
}));
|
|
54
|
-
return {
|
|
55
|
-
results,
|
|
56
|
-
query,
|
|
57
|
-
totalResults: data.searchParameters?.totalResults,
|
|
58
|
-
searchTime,
|
|
59
|
-
provider: 'serper',
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
async isAvailable() {
|
|
63
|
-
return !!this.apiKey;
|
|
64
|
-
}
|
|
65
|
-
async healthCheck() {
|
|
66
|
-
if (!this.apiKey) {
|
|
67
|
-
return {
|
|
68
|
-
healthy: false,
|
|
69
|
-
lastCheck: new Date(),
|
|
70
|
-
errorMessage: 'API key not configured',
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
try {
|
|
74
|
-
const startTime = Date.now();
|
|
75
|
-
await this.search('test', { limit: 1 });
|
|
76
|
-
const latency = Date.now() - startTime;
|
|
77
|
-
return {
|
|
78
|
-
healthy: true,
|
|
79
|
-
lastCheck: new Date(),
|
|
80
|
-
latency,
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
catch (error) {
|
|
84
|
-
return {
|
|
85
|
-
healthy: false,
|
|
86
|
-
lastCheck: new Date(),
|
|
87
|
-
errorMessage: error instanceof Error ? error.message : 'Health check failed',
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
// Plugin Definition
|
|
93
|
-
export const SERPER_DEFINITION = {
|
|
94
|
-
metadata: {
|
|
95
|
-
id: 'serper',
|
|
96
|
-
name: 'Serper',
|
|
97
|
-
description: 'Fast Google Search API - cost-effective at scale',
|
|
98
|
-
category: 'search',
|
|
99
|
-
icon: 'search',
|
|
100
|
-
version: '1.0.0',
|
|
101
|
-
homepage: 'https://serper.dev',
|
|
102
|
-
pricing: {
|
|
103
|
-
type: 'paid',
|
|
104
|
-
costPer1k: 1.0, // $1 per 1000 queries at starter tier
|
|
105
|
-
freeQuota: 100, // 100 free queries
|
|
106
|
-
},
|
|
107
|
-
rateLimit: {
|
|
108
|
-
requestsPerSecond: 300,
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
settingsSchema: {
|
|
112
|
-
credentials: [
|
|
113
|
-
{
|
|
114
|
-
key: 'apiKey',
|
|
115
|
-
type: 'password',
|
|
116
|
-
label: 'API Key',
|
|
117
|
-
description: 'Your Serper API key from serper.dev',
|
|
118
|
-
placeholder: 'Enter your Serper API key',
|
|
119
|
-
required: true,
|
|
120
|
-
},
|
|
121
|
-
],
|
|
122
|
-
settings: [
|
|
123
|
-
{
|
|
124
|
-
key: 'defaultLimit',
|
|
125
|
-
type: 'number',
|
|
126
|
-
label: 'Default Results',
|
|
127
|
-
description: 'Default number of results to return',
|
|
128
|
-
default: 10,
|
|
129
|
-
validation: { min: 1, max: 100 },
|
|
130
|
-
},
|
|
131
|
-
],
|
|
132
|
-
},
|
|
133
|
-
factory: (config) => new SerperProvider(config),
|
|
134
|
-
};
|
|
135
|
-
//# sourceMappingURL=serper.js.map
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tavily Search Provider
|
|
3
|
-
*
|
|
4
|
-
* AI-optimized search API with safety filtering.
|
|
5
|
-
* https://tavily.com/
|
|
6
|
-
*/
|
|
7
|
-
import type { SearchPluginDefinition } from '../types.js';
|
|
8
|
-
export declare const TAVILY_DEFINITION: SearchPluginDefinition;
|
|
9
|
-
//# sourceMappingURL=tavily.d.ts.map
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tavily Search Provider
|
|
3
|
-
*
|
|
4
|
-
* AI-optimized search API with safety filtering.
|
|
5
|
-
* https://tavily.com/
|
|
6
|
-
*/
|
|
7
|
-
const TAVILY_API_URL = 'https://api.tavily.com/search';
|
|
8
|
-
class TavilyProvider {
|
|
9
|
-
metadata = TAVILY_DEFINITION.metadata;
|
|
10
|
-
apiKey;
|
|
11
|
-
includeRawContent;
|
|
12
|
-
constructor(config) {
|
|
13
|
-
this.apiKey = config.credentials?.apiKey || '';
|
|
14
|
-
this.includeRawContent = config.settings?.includeRawContent || false;
|
|
15
|
-
}
|
|
16
|
-
async search(query, options) {
|
|
17
|
-
if (!this.apiKey) {
|
|
18
|
-
throw new Error('Tavily API key not configured');
|
|
19
|
-
}
|
|
20
|
-
const startTime = Date.now();
|
|
21
|
-
const body = {
|
|
22
|
-
api_key: this.apiKey,
|
|
23
|
-
query,
|
|
24
|
-
max_results: options?.limit || 10,
|
|
25
|
-
include_raw_content: this.includeRawContent,
|
|
26
|
-
include_images: options?.includeImages || false,
|
|
27
|
-
};
|
|
28
|
-
if (options?.includeDomains?.length) {
|
|
29
|
-
body.include_domains = options.includeDomains;
|
|
30
|
-
}
|
|
31
|
-
if (options?.excludeDomains?.length) {
|
|
32
|
-
body.exclude_domains = options.excludeDomains;
|
|
33
|
-
}
|
|
34
|
-
const response = await fetch(TAVILY_API_URL, {
|
|
35
|
-
method: 'POST',
|
|
36
|
-
headers: {
|
|
37
|
-
'Content-Type': 'application/json',
|
|
38
|
-
},
|
|
39
|
-
body: JSON.stringify(body),
|
|
40
|
-
});
|
|
41
|
-
if (!response.ok) {
|
|
42
|
-
const error = await response.text();
|
|
43
|
-
throw new Error(`Tavily API error: ${response.status} - ${error}`);
|
|
44
|
-
}
|
|
45
|
-
const data = await response.json();
|
|
46
|
-
const searchTime = Date.now() - startTime;
|
|
47
|
-
const results = (data.results || []).map((item) => ({
|
|
48
|
-
title: item.title,
|
|
49
|
-
url: item.url,
|
|
50
|
-
snippet: item.content || '',
|
|
51
|
-
source: 'tavily',
|
|
52
|
-
score: item.score,
|
|
53
|
-
metadata: {
|
|
54
|
-
rawContent: item.raw_content,
|
|
55
|
-
},
|
|
56
|
-
}));
|
|
57
|
-
return {
|
|
58
|
-
results,
|
|
59
|
-
query: data.query,
|
|
60
|
-
searchTime,
|
|
61
|
-
provider: 'tavily',
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
async isAvailable() {
|
|
65
|
-
return !!this.apiKey;
|
|
66
|
-
}
|
|
67
|
-
async healthCheck() {
|
|
68
|
-
if (!this.apiKey) {
|
|
69
|
-
return {
|
|
70
|
-
healthy: false,
|
|
71
|
-
lastCheck: new Date(),
|
|
72
|
-
errorMessage: 'API key not configured',
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
try {
|
|
76
|
-
const startTime = Date.now();
|
|
77
|
-
await this.search('test', { limit: 1 });
|
|
78
|
-
const latency = Date.now() - startTime;
|
|
79
|
-
return {
|
|
80
|
-
healthy: true,
|
|
81
|
-
lastCheck: new Date(),
|
|
82
|
-
latency,
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
catch (error) {
|
|
86
|
-
return {
|
|
87
|
-
healthy: false,
|
|
88
|
-
lastCheck: new Date(),
|
|
89
|
-
errorMessage: error instanceof Error ? error.message : 'Health check failed',
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
export const TAVILY_DEFINITION = {
|
|
95
|
-
metadata: {
|
|
96
|
-
id: 'tavily',
|
|
97
|
-
name: 'Tavily',
|
|
98
|
-
description: 'AI-optimized search with safety filtering - built for agents',
|
|
99
|
-
category: 'search',
|
|
100
|
-
icon: 'brain',
|
|
101
|
-
version: '1.0.0',
|
|
102
|
-
homepage: 'https://tavily.com',
|
|
103
|
-
pricing: {
|
|
104
|
-
type: 'credit-based',
|
|
105
|
-
costPer1k: 8.0, // ~$0.008 per credit, 1 credit per search
|
|
106
|
-
freeQuota: 1000,
|
|
107
|
-
},
|
|
108
|
-
rateLimit: {
|
|
109
|
-
requestsPerMinute: 60,
|
|
110
|
-
},
|
|
111
|
-
},
|
|
112
|
-
settingsSchema: {
|
|
113
|
-
credentials: [
|
|
114
|
-
{
|
|
115
|
-
key: 'apiKey',
|
|
116
|
-
type: 'password',
|
|
117
|
-
label: 'API Key',
|
|
118
|
-
description: 'Your Tavily API key',
|
|
119
|
-
placeholder: 'tvly-...',
|
|
120
|
-
required: true,
|
|
121
|
-
},
|
|
122
|
-
],
|
|
123
|
-
settings: [
|
|
124
|
-
{
|
|
125
|
-
key: 'includeRawContent',
|
|
126
|
-
type: 'boolean',
|
|
127
|
-
label: 'Include Raw Content',
|
|
128
|
-
description: 'Include full page content in results (uses more credits)',
|
|
129
|
-
default: false,
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
key: 'searchDepth',
|
|
133
|
-
type: 'select',
|
|
134
|
-
label: 'Search Depth',
|
|
135
|
-
description: 'Basic is faster, Advanced is more thorough',
|
|
136
|
-
default: 'basic',
|
|
137
|
-
options: [
|
|
138
|
-
{ value: 'basic', label: 'Basic (1 credit)' },
|
|
139
|
-
{ value: 'advanced', label: 'Advanced (2 credits)' },
|
|
140
|
-
],
|
|
141
|
-
},
|
|
142
|
-
],
|
|
143
|
-
},
|
|
144
|
-
factory: (config) => new TavilyProvider(config),
|
|
145
|
-
};
|
|
146
|
-
//# sourceMappingURL=tavily.js.map
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Anthropic Provider Adapter
|
|
3
|
-
*
|
|
4
|
-
* Claude models via Anthropic API.
|
|
5
|
-
* Supports streaming, vision, and tool use.
|
|
6
|
-
*
|
|
7
|
-
* @see https://docs.anthropic.com/
|
|
8
|
-
*/
|
|
9
|
-
import type { ChatCompletionRequest, ChatCompletionResponse, ModelDefinition, ProviderConfig, ProviderHealth, ProviderType } from '../types.js';
|
|
10
|
-
import { BaseProvider } from './base.js';
|
|
11
|
-
export declare class AnthropicProvider extends BaseProvider {
|
|
12
|
-
readonly type: ProviderType;
|
|
13
|
-
readonly name = "Anthropic";
|
|
14
|
-
private static readonly API_VERSION;
|
|
15
|
-
private static readonly BASE_URL;
|
|
16
|
-
protected createDefaultConfig(partial: Partial<ProviderConfig>): ProviderConfig;
|
|
17
|
-
protected getDefaultModels(): ModelDefinition[];
|
|
18
|
-
healthCheck(): Promise<ProviderHealth>;
|
|
19
|
-
protected doComplete(request: ChatCompletionRequest): Promise<ChatCompletionResponse>;
|
|
20
|
-
protected doCompleteStream(request: ChatCompletionRequest, onChunk: (chunk: string) => void): Promise<ChatCompletionResponse>;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Create an Anthropic provider instance
|
|
24
|
-
*/
|
|
25
|
-
export declare function createAnthropicProvider(config?: Partial<ProviderConfig>): AnthropicProvider;
|
|
26
|
-
//# sourceMappingURL=anthropic.d.ts.map
|
|
@@ -1,306 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Anthropic Provider Adapter
|
|
3
|
-
*
|
|
4
|
-
* Claude models via Anthropic API.
|
|
5
|
-
* Supports streaming, vision, and tool use.
|
|
6
|
-
*
|
|
7
|
-
* @see https://docs.anthropic.com/
|
|
8
|
-
*/
|
|
9
|
-
import { randomUUID } from 'node:crypto';
|
|
10
|
-
import { ANTHROPIC_MODELS } from '../types.js';
|
|
11
|
-
import { BaseProvider } from './base.js';
|
|
12
|
-
import { logger } from '../../utils/logger.js';
|
|
13
|
-
export class AnthropicProvider extends BaseProvider {
|
|
14
|
-
type = 'anthropic';
|
|
15
|
-
name = 'Anthropic';
|
|
16
|
-
static API_VERSION = '2023-06-01';
|
|
17
|
-
static BASE_URL = 'https://api.anthropic.com/v1';
|
|
18
|
-
createDefaultConfig(partial) {
|
|
19
|
-
return {
|
|
20
|
-
id: 'anthropic',
|
|
21
|
-
type: 'anthropic',
|
|
22
|
-
name: 'Anthropic',
|
|
23
|
-
enabled: true,
|
|
24
|
-
baseUrl: partial.baseUrl || AnthropicProvider.BASE_URL,
|
|
25
|
-
apiKey: partial.apiKey || process.env.ANTHROPIC_API_KEY,
|
|
26
|
-
defaultModel: partial.defaultModel || 'claude-sonnet-4-5',
|
|
27
|
-
maxConcurrent: partial.maxConcurrent || 5,
|
|
28
|
-
timeout: partial.timeout || 300000,
|
|
29
|
-
models: ANTHROPIC_MODELS,
|
|
30
|
-
...partial,
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
getDefaultModels() {
|
|
34
|
-
return ANTHROPIC_MODELS;
|
|
35
|
-
}
|
|
36
|
-
async healthCheck() {
|
|
37
|
-
const startTime = Date.now();
|
|
38
|
-
if (!this.config.apiKey) {
|
|
39
|
-
return {
|
|
40
|
-
provider: 'anthropic',
|
|
41
|
-
healthy: false,
|
|
42
|
-
latencyMs: Date.now() - startTime,
|
|
43
|
-
message: 'API key not configured',
|
|
44
|
-
lastChecked: new Date().toISOString(),
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
try {
|
|
48
|
-
// Anthropic doesn't have a dedicated health endpoint
|
|
49
|
-
// We'll do a minimal messages call with 1 max token
|
|
50
|
-
const response = await fetch(`${this.config.baseUrl}/messages`, {
|
|
51
|
-
method: 'POST',
|
|
52
|
-
headers: {
|
|
53
|
-
'Content-Type': 'application/json',
|
|
54
|
-
'x-api-key': this.config.apiKey,
|
|
55
|
-
'anthropic-version': AnthropicProvider.API_VERSION,
|
|
56
|
-
},
|
|
57
|
-
body: JSON.stringify({
|
|
58
|
-
model: this.config.defaultModel || 'claude-sonnet-4-5',
|
|
59
|
-
max_tokens: 1,
|
|
60
|
-
messages: [{ role: 'user', content: 'Hi' }],
|
|
61
|
-
}),
|
|
62
|
-
signal: AbortSignal.timeout(10000),
|
|
63
|
-
});
|
|
64
|
-
const latencyMs = Date.now() - startTime;
|
|
65
|
-
if (!response.ok) {
|
|
66
|
-
const error = await response.json().catch(() => ({}));
|
|
67
|
-
return {
|
|
68
|
-
provider: 'anthropic',
|
|
69
|
-
healthy: false,
|
|
70
|
-
latencyMs,
|
|
71
|
-
message: error?.error?.message || `API returned ${response.status}`,
|
|
72
|
-
lastChecked: new Date().toISOString(),
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
return {
|
|
76
|
-
provider: 'anthropic',
|
|
77
|
-
healthy: true,
|
|
78
|
-
latencyMs,
|
|
79
|
-
message: 'Anthropic API is available',
|
|
80
|
-
availableModels: ANTHROPIC_MODELS.map((m) => m.id),
|
|
81
|
-
lastChecked: new Date().toISOString(),
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
catch (error) {
|
|
85
|
-
return {
|
|
86
|
-
provider: 'anthropic',
|
|
87
|
-
healthy: false,
|
|
88
|
-
latencyMs: Date.now() - startTime,
|
|
89
|
-
message: error instanceof Error ? error.message : 'Connection failed',
|
|
90
|
-
lastChecked: new Date().toISOString(),
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
async doComplete(request) {
|
|
95
|
-
if (!this.config.apiKey) {
|
|
96
|
-
throw new Error('Anthropic API key not configured');
|
|
97
|
-
}
|
|
98
|
-
const startTime = Date.now();
|
|
99
|
-
const model = request.model || this.config.defaultModel || 'claude-sonnet-4-5';
|
|
100
|
-
// Build Anthropic messages format
|
|
101
|
-
const messages = [];
|
|
102
|
-
for (const msg of request.messages) {
|
|
103
|
-
if (msg.role === 'user' || msg.role === 'assistant') {
|
|
104
|
-
messages.push({
|
|
105
|
-
role: msg.role,
|
|
106
|
-
content: msg.content,
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
const requestBody = {
|
|
111
|
-
model,
|
|
112
|
-
max_tokens: request.maxTokens || 8192,
|
|
113
|
-
messages,
|
|
114
|
-
};
|
|
115
|
-
if (request.systemPrompt) {
|
|
116
|
-
requestBody.system = request.systemPrompt;
|
|
117
|
-
}
|
|
118
|
-
if (request.temperature !== undefined) {
|
|
119
|
-
requestBody.temperature = request.temperature;
|
|
120
|
-
}
|
|
121
|
-
// Add tools if provided
|
|
122
|
-
if (request.tools && request.tools.length > 0) {
|
|
123
|
-
requestBody.tools = request.tools.map((tool) => ({
|
|
124
|
-
name: tool.name,
|
|
125
|
-
description: tool.description,
|
|
126
|
-
input_schema: tool.parameters,
|
|
127
|
-
}));
|
|
128
|
-
}
|
|
129
|
-
logger.debug(`[Anthropic] Calling ${model} with ${messages.length} messages`);
|
|
130
|
-
const response = await fetch(`${this.config.baseUrl}/messages`, {
|
|
131
|
-
method: 'POST',
|
|
132
|
-
headers: {
|
|
133
|
-
'Content-Type': 'application/json',
|
|
134
|
-
'x-api-key': this.config.apiKey,
|
|
135
|
-
'anthropic-version': AnthropicProvider.API_VERSION,
|
|
136
|
-
},
|
|
137
|
-
body: JSON.stringify(requestBody),
|
|
138
|
-
signal: AbortSignal.timeout(this.config.timeout),
|
|
139
|
-
});
|
|
140
|
-
if (!response.ok) {
|
|
141
|
-
const error = await response.json().catch(() => ({}));
|
|
142
|
-
throw new Error(`Anthropic API error: ${response.status} - ${error?.error?.message || 'Unknown error'}`);
|
|
143
|
-
}
|
|
144
|
-
const result = (await response.json());
|
|
145
|
-
const duration = Date.now() - startTime;
|
|
146
|
-
// Extract text content
|
|
147
|
-
const textContent = result.content
|
|
148
|
-
.filter((c) => c.type === 'text')
|
|
149
|
-
.map((c) => c.text)
|
|
150
|
-
.join('');
|
|
151
|
-
// Extract tool calls
|
|
152
|
-
const toolCalls = result.content
|
|
153
|
-
.filter((c) => c.type === 'tool_use')
|
|
154
|
-
.map((c) => ({
|
|
155
|
-
id: c.id || randomUUID(),
|
|
156
|
-
name: c.name || '',
|
|
157
|
-
arguments: c.input || {},
|
|
158
|
-
}));
|
|
159
|
-
const finishReason = result.stop_reason === 'end_turn'
|
|
160
|
-
? 'stop'
|
|
161
|
-
: result.stop_reason === 'max_tokens'
|
|
162
|
-
? 'length'
|
|
163
|
-
: result.stop_reason === 'tool_use'
|
|
164
|
-
? 'tool_calls'
|
|
165
|
-
: 'stop';
|
|
166
|
-
return {
|
|
167
|
-
id: result.id,
|
|
168
|
-
provider: 'anthropic',
|
|
169
|
-
model: result.model,
|
|
170
|
-
message: this.createMessage('assistant', textContent),
|
|
171
|
-
finishReason: finishReason,
|
|
172
|
-
usage: {
|
|
173
|
-
promptTokens: result.usage.input_tokens,
|
|
174
|
-
completionTokens: result.usage.output_tokens,
|
|
175
|
-
totalTokens: result.usage.input_tokens + result.usage.output_tokens,
|
|
176
|
-
cost: this.calculateCost(result.usage.input_tokens, result.usage.output_tokens, model),
|
|
177
|
-
},
|
|
178
|
-
toolCalls: toolCalls.length > 0 ? toolCalls : undefined,
|
|
179
|
-
duration,
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
async doCompleteStream(request, onChunk) {
|
|
183
|
-
if (!this.config.apiKey) {
|
|
184
|
-
throw new Error('Anthropic API key not configured');
|
|
185
|
-
}
|
|
186
|
-
const startTime = Date.now();
|
|
187
|
-
const model = request.model || this.config.defaultModel || 'claude-sonnet-4-5';
|
|
188
|
-
const messages = [];
|
|
189
|
-
for (const msg of request.messages) {
|
|
190
|
-
if (msg.role === 'user' || msg.role === 'assistant') {
|
|
191
|
-
messages.push({
|
|
192
|
-
role: msg.role,
|
|
193
|
-
content: msg.content,
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
const requestBody = {
|
|
198
|
-
model,
|
|
199
|
-
max_tokens: request.maxTokens || 8192,
|
|
200
|
-
messages,
|
|
201
|
-
stream: true,
|
|
202
|
-
};
|
|
203
|
-
if (request.systemPrompt) {
|
|
204
|
-
requestBody.system = request.systemPrompt;
|
|
205
|
-
}
|
|
206
|
-
if (request.temperature !== undefined) {
|
|
207
|
-
requestBody.temperature = request.temperature;
|
|
208
|
-
}
|
|
209
|
-
const response = await fetch(`${this.config.baseUrl}/messages`, {
|
|
210
|
-
method: 'POST',
|
|
211
|
-
headers: {
|
|
212
|
-
'Content-Type': 'application/json',
|
|
213
|
-
'x-api-key': this.config.apiKey,
|
|
214
|
-
'anthropic-version': AnthropicProvider.API_VERSION,
|
|
215
|
-
},
|
|
216
|
-
body: JSON.stringify(requestBody),
|
|
217
|
-
signal: AbortSignal.timeout(this.config.timeout),
|
|
218
|
-
});
|
|
219
|
-
if (!response.ok) {
|
|
220
|
-
const error = await response.json().catch(() => ({}));
|
|
221
|
-
throw new Error(`Anthropic API error: ${response.status} - ${error?.error?.message || 'Unknown error'}`);
|
|
222
|
-
}
|
|
223
|
-
// Process SSE stream
|
|
224
|
-
let fullContent = '';
|
|
225
|
-
let promptTokens = 0;
|
|
226
|
-
let completionTokens = 0;
|
|
227
|
-
let messageId = randomUUID();
|
|
228
|
-
let finishReason = 'stop';
|
|
229
|
-
const reader = response.body?.getReader();
|
|
230
|
-
if (!reader) {
|
|
231
|
-
throw new Error('No response body');
|
|
232
|
-
}
|
|
233
|
-
const decoder = new TextDecoder();
|
|
234
|
-
let buffer = '';
|
|
235
|
-
while (true) {
|
|
236
|
-
const { done, value } = await reader.read();
|
|
237
|
-
if (done)
|
|
238
|
-
break;
|
|
239
|
-
buffer += decoder.decode(value, { stream: true });
|
|
240
|
-
const lines = buffer.split('\n');
|
|
241
|
-
buffer = lines.pop() || '';
|
|
242
|
-
for (const line of lines) {
|
|
243
|
-
if (line.startsWith('data: ')) {
|
|
244
|
-
const data = line.slice(6);
|
|
245
|
-
if (data === '[DONE]')
|
|
246
|
-
continue;
|
|
247
|
-
try {
|
|
248
|
-
const event = JSON.parse(data);
|
|
249
|
-
switch (event.type) {
|
|
250
|
-
case 'message_start':
|
|
251
|
-
if (event.message) {
|
|
252
|
-
messageId = event.message.id;
|
|
253
|
-
promptTokens = event.message.usage?.input_tokens || 0;
|
|
254
|
-
}
|
|
255
|
-
break;
|
|
256
|
-
case 'content_block_delta':
|
|
257
|
-
if (event.delta?.text) {
|
|
258
|
-
fullContent += event.delta.text;
|
|
259
|
-
onChunk(event.delta.text);
|
|
260
|
-
}
|
|
261
|
-
break;
|
|
262
|
-
case 'message_delta':
|
|
263
|
-
if (event.delta?.stop_reason) {
|
|
264
|
-
finishReason =
|
|
265
|
-
event.delta.stop_reason === 'end_turn'
|
|
266
|
-
? 'stop'
|
|
267
|
-
: event.delta.stop_reason === 'max_tokens'
|
|
268
|
-
? 'length'
|
|
269
|
-
: 'stop';
|
|
270
|
-
}
|
|
271
|
-
if (event.usage) {
|
|
272
|
-
completionTokens = event.usage.output_tokens;
|
|
273
|
-
}
|
|
274
|
-
break;
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
catch {
|
|
278
|
-
// Skip invalid JSON
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
const duration = Date.now() - startTime;
|
|
284
|
-
return {
|
|
285
|
-
id: messageId,
|
|
286
|
-
provider: 'anthropic',
|
|
287
|
-
model,
|
|
288
|
-
message: this.createMessage('assistant', fullContent),
|
|
289
|
-
finishReason,
|
|
290
|
-
usage: {
|
|
291
|
-
promptTokens,
|
|
292
|
-
completionTokens,
|
|
293
|
-
totalTokens: promptTokens + completionTokens,
|
|
294
|
-
cost: this.calculateCost(promptTokens, completionTokens, model),
|
|
295
|
-
},
|
|
296
|
-
duration,
|
|
297
|
-
};
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
/**
|
|
301
|
-
* Create an Anthropic provider instance
|
|
302
|
-
*/
|
|
303
|
-
export function createAnthropicProvider(config) {
|
|
304
|
-
return new AnthropicProvider(config || {});
|
|
305
|
-
}
|
|
306
|
-
//# sourceMappingURL=anthropic.js.map
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Base Provider Adapter
|
|
3
|
-
*
|
|
4
|
-
* Abstract base class for AI provider implementations.
|
|
5
|
-
* Handles common functionality like configuration and model management.
|
|
6
|
-
*/
|
|
7
|
-
import type { AIProvider, ChatCompletionRequest, ChatCompletionResponse, ChatMessage, ModelDefinition, ProviderConfig, ProviderHealth, ProviderType } from '../types.js';
|
|
8
|
-
export declare abstract class BaseProvider implements AIProvider {
|
|
9
|
-
abstract readonly type: ProviderType;
|
|
10
|
-
abstract readonly name: string;
|
|
11
|
-
protected config: ProviderConfig;
|
|
12
|
-
protected models: ModelDefinition[];
|
|
13
|
-
constructor(config: Partial<ProviderConfig>);
|
|
14
|
-
/**
|
|
15
|
-
* Create default configuration for this provider
|
|
16
|
-
*/
|
|
17
|
-
protected abstract createDefaultConfig(partial: Partial<ProviderConfig>): ProviderConfig;
|
|
18
|
-
/**
|
|
19
|
-
* Get default models for this provider
|
|
20
|
-
*/
|
|
21
|
-
protected abstract getDefaultModels(): ModelDefinition[];
|
|
22
|
-
/**
|
|
23
|
-
* Make the actual API call for completion
|
|
24
|
-
*/
|
|
25
|
-
protected abstract doComplete(request: ChatCompletionRequest): Promise<ChatCompletionResponse>;
|
|
26
|
-
/**
|
|
27
|
-
* Make the actual API call for streaming completion
|
|
28
|
-
*/
|
|
29
|
-
protected abstract doCompleteStream(request: ChatCompletionRequest, onChunk: (chunk: string) => void): Promise<ChatCompletionResponse>;
|
|
30
|
-
configure(config: Partial<ProviderConfig>): void;
|
|
31
|
-
getConfig(): ProviderConfig;
|
|
32
|
-
abstract healthCheck(): Promise<ProviderHealth>;
|
|
33
|
-
listModels(): Promise<ModelDefinition[]>;
|
|
34
|
-
getModel(modelId: string): ModelDefinition | undefined;
|
|
35
|
-
complete(request: ChatCompletionRequest): Promise<ChatCompletionResponse>;
|
|
36
|
-
completeStream(request: ChatCompletionRequest, onChunk: (chunk: string) => void): Promise<ChatCompletionResponse>;
|
|
37
|
-
/**
|
|
38
|
-
* Create a chat message
|
|
39
|
-
*/
|
|
40
|
-
protected createMessage(role: ChatMessage['role'], content: string, options?: Partial<ChatMessage>): ChatMessage;
|
|
41
|
-
/**
|
|
42
|
-
* Convert messages to provider-specific format
|
|
43
|
-
*/
|
|
44
|
-
protected formatMessages(messages: ChatMessage[], systemPrompt?: string): Array<{
|
|
45
|
-
role: string;
|
|
46
|
-
content: string;
|
|
47
|
-
}>;
|
|
48
|
-
/**
|
|
49
|
-
* Calculate cost from token usage
|
|
50
|
-
*/
|
|
51
|
-
protected calculateCost(promptTokens: number, completionTokens: number, modelId?: string): number;
|
|
52
|
-
}
|
|
53
|
-
//# sourceMappingURL=base.d.ts.map
|