agentbnb 4.0.4 → 5.1.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/chunk-AUBHR7HH.js +25 -0
- package/dist/chunk-B5FTAGFN.js +393 -0
- package/dist/{chunk-GGYC5U2Z.js → chunk-BTTL24TZ.js} +29 -91
- package/dist/chunk-C6KPAFCC.js +387 -0
- package/dist/{chunk-JXEOE7HX.js → chunk-CRFCWD6V.js} +163 -92
- package/dist/chunk-CSATDXZC.js +89 -0
- package/dist/{chunk-T7NS2J2B.js → chunk-DFBX3BBD.js} +84 -1
- package/dist/{chunk-DNWT5FZQ.js → chunk-EANI2N2V.js} +98 -1
- package/dist/{chunk-HH24WMFN.js → chunk-FLY3WIQR.js} +1 -1
- package/dist/{chunk-EVBX22YU.js → chunk-HLUEOLSZ.js} +11 -17
- package/dist/chunk-IVOYM3WG.js +25 -0
- package/dist/chunk-LCAIAAG2.js +916 -0
- package/dist/chunk-MLS6IGGG.js +294 -0
- package/dist/{chunk-4P3EMGL4.js → chunk-MNO4COST.js} +5 -3
- package/dist/chunk-NH2FIERR.js +138 -0
- package/dist/chunk-UKT6H7YT.js +29 -0
- package/dist/{chunk-BH6WGYFB.js → chunk-VE3E4AMH.js} +8 -8
- package/dist/{chunk-5QGXARLJ.js → chunk-W5BZMKMF.js} +159 -27
- package/dist/{chunk-FF226TIV.js → chunk-ZX5623ER.js} +0 -57
- package/dist/cli/index.js +362 -4633
- package/dist/{conduct-N52JX7RT.js → conduct-KM6ZNJGE.js} +10 -8
- package/dist/{conduct-GZQNFTRP.js → conduct-WGTMQND5.js} +10 -8
- package/dist/{conductor-mode-XUWGR4ZE.js → conductor-mode-OL2FNOYY.js} +6 -4
- package/dist/{conductor-mode-ESGFZ6T5.js → conductor-mode-VRO7TYW2.js} +20 -167
- package/dist/execute-CPFSOOO3.js +13 -0
- package/dist/execute-IP2QHALV.js +10 -0
- package/dist/index.d.ts +14 -8
- package/dist/index.js +190 -36
- package/dist/{peers-E4MKNNDN.js → peers-CJ7T4RJO.js} +2 -1
- package/dist/process-guard-CC7CNRQJ.js +176 -0
- package/dist/{request-4GQSSM4B.js → request-YOWPXVLQ.js} +13 -10
- package/dist/schema-7BSSLZ4S.js +8 -0
- package/dist/{serve-skill-Q6NHX2RA.js → serve-skill-JHFNR7BW.js} +8 -7
- package/dist/{server-B5E566CI.js → server-HKJJWFRG.js} +10 -8
- package/dist/service-coordinator-UTKI4FRI.js +4922 -0
- package/dist/skills/agentbnb/bootstrap.js +5034 -849
- package/dist/websocket-client-WRN3HO73.js +6 -0
- package/package.json +4 -1
- package/skills/agentbnb/SKILL.md +87 -70
- package/skills/agentbnb/bootstrap.test.ts +142 -242
- package/skills/agentbnb/bootstrap.ts +88 -95
- package/skills/agentbnb/install.sh +97 -27
- package/skills/deep-stock-analyst/package.json +24 -0
- package/skills/deep-stock-analyst/src/analysis/financial-health.ts +167 -0
- package/skills/deep-stock-analyst/src/analysis/sentiment.ts +68 -0
- package/skills/deep-stock-analyst/src/analysis/signal.ts +188 -0
- package/skills/deep-stock-analyst/src/analysis/technicals.ts +318 -0
- package/skills/deep-stock-analyst/src/analysis/utils.ts +137 -0
- package/skills/deep-stock-analyst/src/analysis/valuation.ts +95 -0
- package/skills/deep-stock-analyst/src/api/alpha-vantage.ts +133 -0
- package/skills/deep-stock-analyst/src/api/types.ts +238 -0
- package/skills/deep-stock-analyst/src/index.ts +84 -0
- package/skills/deep-stock-analyst/src/llm/thesis.ts +101 -0
- package/skills/deep-stock-analyst/src/orchestrator.ts +228 -0
- package/skills/deep-stock-analyst/tsconfig.json +21 -0
- package/dist/card-RNEWSAQ6.js +0 -88
- package/dist/chunk-UB2NPFC7.js +0 -165
- package/dist/execute-QH6F54D7.js +0 -10
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thesis generation via Gemini Flash.
|
|
3
|
+
* Uses genesis-bot's existing GOOGLE_API_KEY.
|
|
4
|
+
* Input: pre-computed CompositeSignal + raw data → structured thesis JSON.
|
|
5
|
+
* LLM interprets numbers — does NOT recalculate anything.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { GoogleGenerativeAI } from '@google/generative-ai';
|
|
9
|
+
import type { ValuationScore } from '../analysis/valuation.js';
|
|
10
|
+
import type { TechnicalScore } from '../analysis/technicals.js';
|
|
11
|
+
import type { FinancialHealth } from '../analysis/financial-health.js';
|
|
12
|
+
import type { SentimentScore } from '../analysis/sentiment.js';
|
|
13
|
+
import type { CompositeSignal } from '../analysis/signal.js';
|
|
14
|
+
import type { AVOverview } from '../api/types.js';
|
|
15
|
+
|
|
16
|
+
export interface InvestmentThesis {
|
|
17
|
+
bull_case: string;
|
|
18
|
+
bear_case: string;
|
|
19
|
+
catalysts: string[];
|
|
20
|
+
risks: string[];
|
|
21
|
+
time_horizon: 'short_term' | 'medium_term' | 'long_term';
|
|
22
|
+
entry_strategy: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const FALLBACK_THESIS: InvestmentThesis = {
|
|
26
|
+
bull_case: 'Quantitative metrics indicate favorable risk/reward. See scores for details.',
|
|
27
|
+
bear_case: 'Monitor red flags and technical weakness signals before committing capital.',
|
|
28
|
+
catalysts: ['Earnings surprise', 'Sector rotation', 'Macro tailwinds'],
|
|
29
|
+
risks: ['Market volatility', 'Rate sensitivity', 'Execution risk'],
|
|
30
|
+
time_horizon: 'medium_term',
|
|
31
|
+
entry_strategy: 'Consider scaling in near support levels identified in technical analysis.',
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export async function generateThesis(
|
|
35
|
+
ticker: string,
|
|
36
|
+
overview: AVOverview,
|
|
37
|
+
composite: CompositeSignal,
|
|
38
|
+
valuation: ValuationScore,
|
|
39
|
+
technicals: TechnicalScore,
|
|
40
|
+
financials: FinancialHealth,
|
|
41
|
+
sentiment: SentimentScore,
|
|
42
|
+
): Promise<InvestmentThesis> {
|
|
43
|
+
const apiKey = process.env['GOOGLE_API_KEY'];
|
|
44
|
+
if (!apiKey) {
|
|
45
|
+
console.error('[thesis] GOOGLE_API_KEY not set — returning fallback thesis');
|
|
46
|
+
return FALLBACK_THESIS;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const prompt = `You are a senior equity analyst. Based on the pre-computed analysis below, write a concise investment thesis. CRITICAL: Do NOT recalculate any numbers. All numbers have been verified. Your job is to INTERPRET, not COMPUTE.
|
|
50
|
+
|
|
51
|
+
Ticker: ${ticker}
|
|
52
|
+
Company: ${overview.Name ?? ticker}
|
|
53
|
+
Sector: ${overview.Sector ?? 'N/A'}
|
|
54
|
+
Industry: ${overview.Industry ?? 'N/A'}
|
|
55
|
+
|
|
56
|
+
Signal: ${composite.signal} (confidence: ${(composite.confidence * 100).toFixed(0)}%)
|
|
57
|
+
Composite Score: ${composite.composite_score}/100
|
|
58
|
+
|
|
59
|
+
Valuation: ${valuation.verdict} (score: ${valuation.composite.toFixed(0)}/100)
|
|
60
|
+
- P/E: ${overview.PERatio}, PEG: ${overview.PEGRatio}
|
|
61
|
+
- FCF Yield score: ${valuation.fcf_yield_score.toFixed(0)}/100
|
|
62
|
+
|
|
63
|
+
Technical Regime: ${technicals.regime}
|
|
64
|
+
- Trend: ${technicals.trend_score.toFixed(0)}/100, Momentum: ${technicals.momentum_score.toFixed(0)}/100
|
|
65
|
+
- Active Signals: ${JSON.stringify(technicals.signals.map((s) => s.name))}
|
|
66
|
+
|
|
67
|
+
Financial Health: ${financials.composite.toFixed(0)}/100
|
|
68
|
+
- Growth score: ${financials.growth_score.toFixed(0)}/100, Revenue growth: ${financials.raw.revenueGrowthPct.toFixed(1)}% YoY
|
|
69
|
+
- Red Flags: ${JSON.stringify(financials.red_flags)}
|
|
70
|
+
- Green Flags: ${JSON.stringify(financials.green_flags)}
|
|
71
|
+
|
|
72
|
+
Sentiment: ${sentiment.composite.toFixed(0)}/100 (${sentiment.news_volume} articles, ${(sentiment.bullish_ratio * 100).toFixed(0)}% bullish)
|
|
73
|
+
|
|
74
|
+
Support: ${composite.support_levels.join(', ')}
|
|
75
|
+
Resistance: ${composite.resistance_levels.join(', ')}
|
|
76
|
+
|
|
77
|
+
Respond ONLY with valid JSON (no markdown fences):
|
|
78
|
+
{
|
|
79
|
+
"bull_case": "3-4 sentences with specific numbers only from the data above",
|
|
80
|
+
"bear_case": "3-4 sentences with specific numbers only from the data above",
|
|
81
|
+
"catalysts": ["upcoming event or condition 1", "event 2", "event 3"],
|
|
82
|
+
"risks": ["risk 1", "risk 2", "risk 3"],
|
|
83
|
+
"time_horizon": "short_term | medium_term | long_term",
|
|
84
|
+
"entry_strategy": "Specific entry approach given support/resistance levels above"
|
|
85
|
+
}`;
|
|
86
|
+
|
|
87
|
+
try {
|
|
88
|
+
const genAI = new GoogleGenerativeAI(apiKey);
|
|
89
|
+
const model = genAI.getGenerativeModel({ model: 'gemini-2.0-flash' });
|
|
90
|
+
const result = await model.generateContent(prompt);
|
|
91
|
+
const text = result.response.text().trim();
|
|
92
|
+
|
|
93
|
+
// Strip markdown fences if present
|
|
94
|
+
const clean = text.replace(/^```(?:json)?\n?/, '').replace(/\n?```$/, '').trim();
|
|
95
|
+
const parsed = JSON.parse(clean) as InvestmentThesis;
|
|
96
|
+
return parsed;
|
|
97
|
+
} catch (err) {
|
|
98
|
+
console.error('[thesis] Gemini call failed:', err);
|
|
99
|
+
return FALLBACK_THESIS;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Orchestrator: ties together all 5 analysis modules + thesis.
|
|
3
|
+
* All heavy computation happens here (no LLM until thesis step).
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { fetchAllData } from './api/alpha-vantage.js';
|
|
7
|
+
import { calculateValuation } from './analysis/valuation.js';
|
|
8
|
+
import { analyzeTechnicals } from './analysis/technicals.js';
|
|
9
|
+
import { analyzeFinancialHealth } from './analysis/financial-health.js';
|
|
10
|
+
import { analyzeSentiment } from './analysis/sentiment.js';
|
|
11
|
+
import { generateCompositeSignal } from './analysis/signal.js';
|
|
12
|
+
import { generateThesis } from './llm/thesis.js';
|
|
13
|
+
import type { InvestmentStyle } from './analysis/signal.js';
|
|
14
|
+
|
|
15
|
+
export interface AnalysisOptions {
|
|
16
|
+
ticker: string;
|
|
17
|
+
depth?: 'quick' | 'standard' | 'deep';
|
|
18
|
+
style?: InvestmentStyle;
|
|
19
|
+
apiKey: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface AnalysisResult {
|
|
23
|
+
ticker: string;
|
|
24
|
+
analyzed_at: string;
|
|
25
|
+
depth: string;
|
|
26
|
+
style: string;
|
|
27
|
+
|
|
28
|
+
// Top-level verdict
|
|
29
|
+
signal: string;
|
|
30
|
+
confidence: number;
|
|
31
|
+
composite_score: number;
|
|
32
|
+
|
|
33
|
+
// Module results
|
|
34
|
+
valuation: {
|
|
35
|
+
verdict: string;
|
|
36
|
+
composite: number;
|
|
37
|
+
pe_score: number;
|
|
38
|
+
peg_score: number;
|
|
39
|
+
fcf_yield_score: number;
|
|
40
|
+
ev_ebitda_score: number;
|
|
41
|
+
ps_score: number;
|
|
42
|
+
raw: Record<string, number>;
|
|
43
|
+
};
|
|
44
|
+
technicals: {
|
|
45
|
+
regime: string;
|
|
46
|
+
composite: number;
|
|
47
|
+
trend_score: number;
|
|
48
|
+
momentum_score: number;
|
|
49
|
+
volatility_score: number;
|
|
50
|
+
strength_score: number;
|
|
51
|
+
signals: Array<{ type: string; name: string; strength: number; description: string }>;
|
|
52
|
+
raw: Record<string, number>;
|
|
53
|
+
};
|
|
54
|
+
financials: {
|
|
55
|
+
composite: number;
|
|
56
|
+
profitability_score: number;
|
|
57
|
+
growth_score: number;
|
|
58
|
+
leverage_score: number;
|
|
59
|
+
efficiency_score: number;
|
|
60
|
+
red_flags: string[];
|
|
61
|
+
green_flags: string[];
|
|
62
|
+
raw: Record<string, number>;
|
|
63
|
+
};
|
|
64
|
+
sentiment: {
|
|
65
|
+
composite: number;
|
|
66
|
+
news_sentiment: number;
|
|
67
|
+
news_volume: number;
|
|
68
|
+
bullish_ratio: number;
|
|
69
|
+
key_headlines: string[];
|
|
70
|
+
topic_breakdown: Record<string, number>;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
// LLM thesis
|
|
74
|
+
thesis: {
|
|
75
|
+
bull_case: string;
|
|
76
|
+
bear_case: string;
|
|
77
|
+
catalysts: string[];
|
|
78
|
+
risks: string[];
|
|
79
|
+
time_horizon: string;
|
|
80
|
+
entry_strategy: string;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
// Price levels
|
|
84
|
+
support_levels: number[];
|
|
85
|
+
resistance_levels: number[];
|
|
86
|
+
key_factors: string[];
|
|
87
|
+
risk_factors: string[];
|
|
88
|
+
data_completeness: number;
|
|
89
|
+
|
|
90
|
+
// Company metadata
|
|
91
|
+
company: {
|
|
92
|
+
name: string;
|
|
93
|
+
sector: string;
|
|
94
|
+
industry: string;
|
|
95
|
+
market_cap: string;
|
|
96
|
+
price: number;
|
|
97
|
+
analyst_target: number;
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export async function runAnalysis(options: AnalysisOptions): Promise<AnalysisResult> {
|
|
102
|
+
const { ticker, depth = 'standard', style = 'hybrid', apiKey } = options;
|
|
103
|
+
|
|
104
|
+
// Step 1: Fetch all API data (12 calls, serialized)
|
|
105
|
+
const data = await fetchAllData(ticker, apiKey);
|
|
106
|
+
|
|
107
|
+
// Step 2: Compute all modules (pure math, no LLM)
|
|
108
|
+
const valuation = calculateValuation(data.overview);
|
|
109
|
+
const technicals = analyzeTechnicals(
|
|
110
|
+
data.daily, data.rsi, data.macd, data.bbands, data.stoch, data.adx,
|
|
111
|
+
);
|
|
112
|
+
const financials = analyzeFinancialHealth(
|
|
113
|
+
data.overview, data.income, data.balance, data.cashflow, data.earnings,
|
|
114
|
+
);
|
|
115
|
+
const sentiment = analyzeSentiment(data.news, ticker);
|
|
116
|
+
const composite = generateCompositeSignal(
|
|
117
|
+
valuation, technicals, financials, sentiment, data.daily, style,
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
// Step 3: LLM thesis (~200ms, Gemini Flash)
|
|
121
|
+
const thesis = await generateThesis(
|
|
122
|
+
ticker, data.overview, composite, valuation, technicals, financials, sentiment,
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
// Step 4: Assemble result
|
|
126
|
+
const price = parseFloat(data.daily[0]?.adjustedClose ?? data.daily[0]?.close ?? '0');
|
|
127
|
+
const analystTarget = parseFloat(data.overview.AnalystTargetPrice ?? '0');
|
|
128
|
+
const marketCap = parseFloat(data.overview.MarketCapitalization ?? '0');
|
|
129
|
+
const mcStr =
|
|
130
|
+
marketCap >= 1e12 ? `$${(marketCap / 1e12).toFixed(2)}T`
|
|
131
|
+
: marketCap >= 1e9 ? `$${(marketCap / 1e9).toFixed(2)}B`
|
|
132
|
+
: marketCap >= 1e6 ? `$${(marketCap / 1e6).toFixed(2)}M`
|
|
133
|
+
: `$${marketCap.toFixed(0)}`;
|
|
134
|
+
|
|
135
|
+
return {
|
|
136
|
+
ticker: ticker.toUpperCase(),
|
|
137
|
+
analyzed_at: new Date().toISOString(),
|
|
138
|
+
depth,
|
|
139
|
+
style,
|
|
140
|
+
|
|
141
|
+
signal: composite.signal,
|
|
142
|
+
confidence: composite.confidence,
|
|
143
|
+
composite_score: composite.composite_score,
|
|
144
|
+
|
|
145
|
+
valuation: {
|
|
146
|
+
verdict: valuation.verdict,
|
|
147
|
+
composite: parseFloat(valuation.composite.toFixed(1)),
|
|
148
|
+
pe_score: parseFloat(valuation.pe_score.toFixed(1)),
|
|
149
|
+
peg_score: parseFloat(valuation.peg_score.toFixed(1)),
|
|
150
|
+
fcf_yield_score: parseFloat(valuation.fcf_yield_score.toFixed(1)),
|
|
151
|
+
ev_ebitda_score: parseFloat(valuation.ev_ebitda_score.toFixed(1)),
|
|
152
|
+
ps_score: parseFloat(valuation.ps_score.toFixed(1)),
|
|
153
|
+
raw: {
|
|
154
|
+
pe: valuation.raw.pe,
|
|
155
|
+
peg: valuation.raw.peg,
|
|
156
|
+
ps: valuation.raw.ps,
|
|
157
|
+
fcf_yield_pct: parseFloat(valuation.raw.fcfYieldPct.toFixed(2)),
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
|
|
161
|
+
technicals: {
|
|
162
|
+
regime: technicals.regime,
|
|
163
|
+
composite: parseFloat(technicals.composite.toFixed(1)),
|
|
164
|
+
trend_score: parseFloat(technicals.trend_score.toFixed(1)),
|
|
165
|
+
momentum_score: parseFloat(technicals.momentum_score.toFixed(1)),
|
|
166
|
+
volatility_score: parseFloat(technicals.volatility_score.toFixed(1)),
|
|
167
|
+
strength_score: parseFloat(technicals.strength_score.toFixed(1)),
|
|
168
|
+
signals: technicals.signals,
|
|
169
|
+
raw: {
|
|
170
|
+
rsi: parseFloat(technicals.raw.rsi.toFixed(1)),
|
|
171
|
+
macd_hist: parseFloat(technicals.raw.macdHist.toFixed(4)),
|
|
172
|
+
adx: parseFloat(technicals.raw.adx.toFixed(1)),
|
|
173
|
+
bb_position: parseFloat(technicals.raw.bbPosition.toFixed(2)),
|
|
174
|
+
price,
|
|
175
|
+
sma20: parseFloat(technicals.raw.sma20.toFixed(2)),
|
|
176
|
+
sma50: parseFloat(technicals.raw.sma50.toFixed(2)),
|
|
177
|
+
sma200: parseFloat(technicals.raw.sma200.toFixed(2)),
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
|
|
181
|
+
financials: {
|
|
182
|
+
composite: parseFloat(financials.composite.toFixed(1)),
|
|
183
|
+
profitability_score: parseFloat(financials.profitability_score.toFixed(1)),
|
|
184
|
+
growth_score: parseFloat(financials.growth_score.toFixed(1)),
|
|
185
|
+
leverage_score: parseFloat(financials.leverage_score.toFixed(1)),
|
|
186
|
+
efficiency_score: parseFloat(financials.efficiency_score.toFixed(1)),
|
|
187
|
+
red_flags: financials.red_flags,
|
|
188
|
+
green_flags: financials.green_flags,
|
|
189
|
+
raw: {
|
|
190
|
+
gross_margin_pct: parseFloat(financials.raw.grossMarginPct.toFixed(1)),
|
|
191
|
+
operating_margin_pct: parseFloat(financials.raw.operatingMarginPct.toFixed(1)),
|
|
192
|
+
net_margin_pct: parseFloat(financials.raw.netMarginPct.toFixed(1)),
|
|
193
|
+
roe: parseFloat(financials.raw.roe.toFixed(1)),
|
|
194
|
+
debt_to_equity: parseFloat(financials.raw.debtToEquity.toFixed(2)),
|
|
195
|
+
current_ratio: parseFloat(financials.raw.currentRatio.toFixed(2)),
|
|
196
|
+
revenue_growth_pct: parseFloat(financials.raw.revenueGrowthPct.toFixed(1)),
|
|
197
|
+
earnings_growth_pct: parseFloat(financials.raw.earningsGrowthPct.toFixed(1)),
|
|
198
|
+
consecutive_beats: financials.raw.consecutiveBeats,
|
|
199
|
+
},
|
|
200
|
+
},
|
|
201
|
+
|
|
202
|
+
sentiment: {
|
|
203
|
+
composite: parseFloat(sentiment.composite.toFixed(1)),
|
|
204
|
+
news_sentiment: parseFloat(sentiment.news_sentiment.toFixed(3)),
|
|
205
|
+
news_volume: sentiment.news_volume,
|
|
206
|
+
bullish_ratio: parseFloat(sentiment.bullish_ratio.toFixed(2)),
|
|
207
|
+
key_headlines: sentiment.key_headlines,
|
|
208
|
+
topic_breakdown: sentiment.topic_breakdown,
|
|
209
|
+
},
|
|
210
|
+
|
|
211
|
+
thesis,
|
|
212
|
+
|
|
213
|
+
support_levels: composite.support_levels,
|
|
214
|
+
resistance_levels: composite.resistance_levels,
|
|
215
|
+
key_factors: composite.key_factors,
|
|
216
|
+
risk_factors: composite.risk_factors,
|
|
217
|
+
data_completeness: composite.data_completeness,
|
|
218
|
+
|
|
219
|
+
company: {
|
|
220
|
+
name: data.overview.Name ?? ticker,
|
|
221
|
+
sector: data.overview.Sector ?? 'N/A',
|
|
222
|
+
industry: data.overview.Industry ?? 'N/A',
|
|
223
|
+
market_cap: mcStr,
|
|
224
|
+
price,
|
|
225
|
+
analyst_target: analystTarget,
|
|
226
|
+
},
|
|
227
|
+
};
|
|
228
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"strict": true,
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"outDir": "dist",
|
|
10
|
+
"rootDir": "src",
|
|
11
|
+
"declaration": true,
|
|
12
|
+
"sourceMap": true,
|
|
13
|
+
"resolveJsonModule": true,
|
|
14
|
+
"isolatedModules": true,
|
|
15
|
+
"noUncheckedIndexedAccess": true,
|
|
16
|
+
"noUnusedLocals": true,
|
|
17
|
+
"noUnusedParameters": true
|
|
18
|
+
},
|
|
19
|
+
"include": ["src/**/*.ts"],
|
|
20
|
+
"exclude": ["node_modules", "dist", "**/*.test.ts"]
|
|
21
|
+
}
|
package/dist/card-RNEWSAQ6.js
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CapabilityCardV2Schema
|
|
3
|
-
} from "./chunk-UB2NPFC7.js";
|
|
4
|
-
|
|
5
|
-
// src/conductor/card.ts
|
|
6
|
-
import { createHash } from "crypto";
|
|
7
|
-
var CONDUCTOR_OWNER = "agentbnb-conductor";
|
|
8
|
-
var CONDUCTOR_CARD_ID = "00000000-0000-4000-8000-000000000001";
|
|
9
|
-
function ownerToCardId(owner) {
|
|
10
|
-
const hash = createHash("sha256").update(owner).digest("hex").slice(0, 32);
|
|
11
|
-
return `${hash.slice(0, 8)}-${hash.slice(8, 12)}-4${hash.slice(13, 16)}-8${hash.slice(17, 20)}-${hash.slice(20, 32)}`;
|
|
12
|
-
}
|
|
13
|
-
function buildConductorCard(owner) {
|
|
14
|
-
const cardOwner = owner ?? CONDUCTOR_OWNER;
|
|
15
|
-
const cardId = owner ? ownerToCardId(owner) : CONDUCTOR_CARD_ID;
|
|
16
|
-
const card = {
|
|
17
|
-
spec_version: "2.0",
|
|
18
|
-
id: cardId,
|
|
19
|
-
owner: cardOwner,
|
|
20
|
-
agent_name: "AgentBnB Conductor",
|
|
21
|
-
skills: [
|
|
22
|
-
{
|
|
23
|
-
id: "orchestrate",
|
|
24
|
-
name: "Task Orchestration",
|
|
25
|
-
description: "Decomposes complex tasks and coordinates multi-agent execution",
|
|
26
|
-
level: 3,
|
|
27
|
-
inputs: [
|
|
28
|
-
{
|
|
29
|
-
name: "task",
|
|
30
|
-
type: "text",
|
|
31
|
-
description: "Natural language task description"
|
|
32
|
-
}
|
|
33
|
-
],
|
|
34
|
-
outputs: [
|
|
35
|
-
{
|
|
36
|
-
name: "result",
|
|
37
|
-
type: "json",
|
|
38
|
-
description: "Aggregated execution results"
|
|
39
|
-
}
|
|
40
|
-
],
|
|
41
|
-
pricing: { credits_per_call: 5 }
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
id: "plan",
|
|
45
|
-
name: "Execution Planning",
|
|
46
|
-
description: "Returns an execution plan with cost estimate without executing",
|
|
47
|
-
level: 1,
|
|
48
|
-
inputs: [
|
|
49
|
-
{
|
|
50
|
-
name: "task",
|
|
51
|
-
type: "text",
|
|
52
|
-
description: "Natural language task description"
|
|
53
|
-
}
|
|
54
|
-
],
|
|
55
|
-
outputs: [
|
|
56
|
-
{
|
|
57
|
-
name: "plan",
|
|
58
|
-
type: "json",
|
|
59
|
-
description: "Execution plan with cost breakdown"
|
|
60
|
-
}
|
|
61
|
-
],
|
|
62
|
-
pricing: { credits_per_call: 1 }
|
|
63
|
-
}
|
|
64
|
-
],
|
|
65
|
-
availability: { online: true }
|
|
66
|
-
};
|
|
67
|
-
return CapabilityCardV2Schema.parse(card);
|
|
68
|
-
}
|
|
69
|
-
function registerConductorCard(db) {
|
|
70
|
-
const card = buildConductorCard();
|
|
71
|
-
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
72
|
-
const existing = db.prepare("SELECT id FROM capability_cards WHERE id = ?").get(card.id);
|
|
73
|
-
if (existing) {
|
|
74
|
-
db.prepare(
|
|
75
|
-
"UPDATE capability_cards SET data = ?, updated_at = ? WHERE id = ?"
|
|
76
|
-
).run(JSON.stringify(card), now, card.id);
|
|
77
|
-
} else {
|
|
78
|
-
db.prepare(
|
|
79
|
-
"INSERT INTO capability_cards (id, owner, data, created_at, updated_at) VALUES (?, ?, ?, ?, ?)"
|
|
80
|
-
).run(card.id, card.owner, JSON.stringify(card), now, now);
|
|
81
|
-
}
|
|
82
|
-
return card;
|
|
83
|
-
}
|
|
84
|
-
export {
|
|
85
|
-
CONDUCTOR_OWNER,
|
|
86
|
-
buildConductorCard,
|
|
87
|
-
registerConductorCard
|
|
88
|
-
};
|
package/dist/chunk-UB2NPFC7.js
DELETED
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
// src/types/index.ts
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
var IOSchemaSchema = z.object({
|
|
4
|
-
name: z.string(),
|
|
5
|
-
type: z.enum(["text", "json", "file", "audio", "image", "video", "stream"]),
|
|
6
|
-
description: z.string().optional(),
|
|
7
|
-
required: z.boolean().default(true),
|
|
8
|
-
schema: z.record(z.unknown()).optional()
|
|
9
|
-
// JSON Schema
|
|
10
|
-
});
|
|
11
|
-
var PoweredBySchema = z.object({
|
|
12
|
-
provider: z.string().min(1),
|
|
13
|
-
model: z.string().optional(),
|
|
14
|
-
tier: z.string().optional()
|
|
15
|
-
});
|
|
16
|
-
var CapabilityCardSchema = z.object({
|
|
17
|
-
spec_version: z.literal("1.0").default("1.0"),
|
|
18
|
-
id: z.string().uuid(),
|
|
19
|
-
owner: z.string().min(1),
|
|
20
|
-
name: z.string().min(1).max(100),
|
|
21
|
-
description: z.string().max(500),
|
|
22
|
-
level: z.union([z.literal(1), z.literal(2), z.literal(3)]),
|
|
23
|
-
inputs: z.array(IOSchemaSchema),
|
|
24
|
-
outputs: z.array(IOSchemaSchema),
|
|
25
|
-
pricing: z.object({
|
|
26
|
-
credits_per_call: z.number().nonnegative(),
|
|
27
|
-
credits_per_minute: z.number().nonnegative().optional(),
|
|
28
|
-
/** Number of free monthly calls. Shown as a "N free/mo" badge in the Hub. */
|
|
29
|
-
free_tier: z.number().nonnegative().optional()
|
|
30
|
-
}),
|
|
31
|
-
availability: z.object({
|
|
32
|
-
online: z.boolean(),
|
|
33
|
-
schedule: z.string().optional()
|
|
34
|
-
// cron expression
|
|
35
|
-
}),
|
|
36
|
-
powered_by: z.array(PoweredBySchema).optional(),
|
|
37
|
-
/**
|
|
38
|
-
* Private per-card metadata. Stripped from all API and CLI responses —
|
|
39
|
-
* never transmitted beyond the local store.
|
|
40
|
-
*/
|
|
41
|
-
_internal: z.record(z.unknown()).optional(),
|
|
42
|
-
/** Public gateway URL where this agent accepts requests. Populated on remote publish. */
|
|
43
|
-
gateway_url: z.string().url().optional(),
|
|
44
|
-
metadata: z.object({
|
|
45
|
-
apis_used: z.array(z.string()).optional(),
|
|
46
|
-
avg_latency_ms: z.number().nonnegative().optional(),
|
|
47
|
-
success_rate: z.number().min(0).max(1).optional(),
|
|
48
|
-
tags: z.array(z.string()).optional()
|
|
49
|
-
}).optional(),
|
|
50
|
-
created_at: z.string().datetime().optional(),
|
|
51
|
-
updated_at: z.string().datetime().optional()
|
|
52
|
-
});
|
|
53
|
-
var SkillSchema = z.object({
|
|
54
|
-
/** Stable skill identifier, e.g. 'tts-elevenlabs'. Used for gateway routing and idle tracking. */
|
|
55
|
-
id: z.string().min(1),
|
|
56
|
-
name: z.string().min(1).max(100),
|
|
57
|
-
description: z.string().max(500),
|
|
58
|
-
level: z.union([z.literal(1), z.literal(2), z.literal(3)]),
|
|
59
|
-
/** Optional grouping category, e.g. 'tts' | 'video_gen' | 'code_review'. */
|
|
60
|
-
category: z.string().optional(),
|
|
61
|
-
inputs: z.array(IOSchemaSchema),
|
|
62
|
-
outputs: z.array(IOSchemaSchema),
|
|
63
|
-
pricing: z.object({
|
|
64
|
-
credits_per_call: z.number().nonnegative(),
|
|
65
|
-
credits_per_minute: z.number().nonnegative().optional(),
|
|
66
|
-
free_tier: z.number().nonnegative().optional()
|
|
67
|
-
}),
|
|
68
|
-
/** Per-skill online flag — overrides card-level availability for this skill. */
|
|
69
|
-
availability: z.object({ online: z.boolean() }).optional(),
|
|
70
|
-
powered_by: z.array(PoweredBySchema).optional(),
|
|
71
|
-
metadata: z.object({
|
|
72
|
-
apis_used: z.array(z.string()).optional(),
|
|
73
|
-
avg_latency_ms: z.number().nonnegative().optional(),
|
|
74
|
-
success_rate: z.number().min(0).max(1).optional(),
|
|
75
|
-
tags: z.array(z.string()).optional(),
|
|
76
|
-
capacity: z.object({
|
|
77
|
-
calls_per_hour: z.number().positive().default(60)
|
|
78
|
-
}).optional()
|
|
79
|
-
}).optional(),
|
|
80
|
-
/**
|
|
81
|
-
* Private per-skill metadata. Stripped from all API and CLI responses —
|
|
82
|
-
* never transmitted beyond the local store.
|
|
83
|
-
*/
|
|
84
|
-
_internal: z.record(z.unknown()).optional()
|
|
85
|
-
});
|
|
86
|
-
var SuitabilitySchema = z.object({
|
|
87
|
-
/** Use cases this agent/skill is optimised for. */
|
|
88
|
-
ideal_for: z.array(z.string()).optional(),
|
|
89
|
-
/** Scenarios this agent/skill cannot reliably handle. */
|
|
90
|
-
not_suitable_for: z.array(z.string()).optional(),
|
|
91
|
-
/** Domains explicitly excluded (used for routing exclusions in later phases). */
|
|
92
|
-
excluded_domains: z.array(z.string()).optional(),
|
|
93
|
-
/** Conditions that increase failure risk, shown as warnings in the Hub. */
|
|
94
|
-
risk_conditions: z.array(z.string()).optional(),
|
|
95
|
-
/** Recommended alternative when this agent is unsuitable. */
|
|
96
|
-
fallback_recommendation: z.string().optional()
|
|
97
|
-
});
|
|
98
|
-
var LearningSchema = z.object({
|
|
99
|
-
/** Known limitations that may affect reliability (self-declared). */
|
|
100
|
-
known_limitations: z.array(z.string()).optional(),
|
|
101
|
-
/** Common failure patterns observed by the provider. */
|
|
102
|
-
common_failure_patterns: z.array(z.string()).optional(),
|
|
103
|
-
/** Version-tagged improvements the provider has shipped. */
|
|
104
|
-
recent_improvements: z.array(z.object({
|
|
105
|
-
version: z.string(),
|
|
106
|
-
summary: z.string(),
|
|
107
|
-
timestamp: z.string()
|
|
108
|
-
})).optional(),
|
|
109
|
-
/** Structured critiques from external sources (phase 2+). */
|
|
110
|
-
critiques: z.array(z.object({
|
|
111
|
-
type: z.literal("structured"),
|
|
112
|
-
summary: z.string(),
|
|
113
|
-
source_tier: z.string(),
|
|
114
|
-
timestamp: z.string()
|
|
115
|
-
})).optional()
|
|
116
|
-
});
|
|
117
|
-
var CapabilityCardV2Schema = z.object({
|
|
118
|
-
spec_version: z.literal("2.0"),
|
|
119
|
-
id: z.string().uuid(),
|
|
120
|
-
owner: z.string().min(1),
|
|
121
|
-
/** Agent display name — was 'name' in v1.0. */
|
|
122
|
-
agent_name: z.string().min(1).max(100),
|
|
123
|
-
/** Short one-liner shown in Hub v2 Identity Header. */
|
|
124
|
-
short_description: z.string().max(200).optional(),
|
|
125
|
-
/** At least one skill is required. */
|
|
126
|
-
skills: z.array(SkillSchema).min(1),
|
|
127
|
-
availability: z.object({
|
|
128
|
-
online: z.boolean(),
|
|
129
|
-
schedule: z.string().optional()
|
|
130
|
-
}),
|
|
131
|
-
/** Optional deployment environment metadata. */
|
|
132
|
-
environment: z.object({
|
|
133
|
-
runtime: z.string(),
|
|
134
|
-
region: z.string().optional()
|
|
135
|
-
}).optional(),
|
|
136
|
-
/** Suitability metadata for Hub v2 profile and future routing warnings. */
|
|
137
|
-
suitability: SuitabilitySchema.optional(),
|
|
138
|
-
/** Learning signals — self-declared limitations, improvements, critiques. */
|
|
139
|
-
learning: LearningSchema.optional(),
|
|
140
|
-
/**
|
|
141
|
-
* Private per-card metadata. Stripped from all API and CLI responses —
|
|
142
|
-
* never transmitted beyond the local store.
|
|
143
|
-
*/
|
|
144
|
-
_internal: z.record(z.unknown()).optional(),
|
|
145
|
-
/** Public gateway URL where this agent accepts requests. Populated on remote publish. */
|
|
146
|
-
gateway_url: z.string().url().optional(),
|
|
147
|
-
created_at: z.string().datetime().optional(),
|
|
148
|
-
updated_at: z.string().datetime().optional()
|
|
149
|
-
});
|
|
150
|
-
var AnyCardSchema = z.discriminatedUnion("spec_version", [
|
|
151
|
-
CapabilityCardSchema,
|
|
152
|
-
CapabilityCardV2Schema
|
|
153
|
-
]);
|
|
154
|
-
var AgentBnBError = class extends Error {
|
|
155
|
-
constructor(message, code) {
|
|
156
|
-
super(message);
|
|
157
|
-
this.code = code;
|
|
158
|
-
this.name = "AgentBnBError";
|
|
159
|
-
}
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
export {
|
|
163
|
-
CapabilityCardV2Schema,
|
|
164
|
-
AgentBnBError
|
|
165
|
-
};
|
package/dist/execute-QH6F54D7.js
DELETED