opencandle 0.4.0 → 0.5.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/LICENSE +1 -1
- package/README.md +106 -14
- package/dist/cli.js +2 -1
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +19 -3
- package/dist/config.js +61 -2
- package/dist/config.js.map +1 -1
- package/dist/infra/browser.d.ts +1 -3
- package/dist/infra/browser.js +1 -1
- package/dist/infra/browser.js.map +1 -1
- package/dist/infra/rate-limiter.d.ts +4 -0
- package/dist/infra/rate-limiter.js +5 -1
- package/dist/infra/rate-limiter.js.map +1 -1
- package/dist/memory/manager.d.ts +9 -0
- package/dist/memory/manager.js +28 -11
- package/dist/memory/manager.js.map +1 -1
- package/dist/memory/storage.d.ts +3 -2
- package/dist/memory/storage.js.map +1 -1
- package/dist/memory/types.js +4 -0
- package/dist/memory/types.js.map +1 -1
- package/dist/pi/opencandle-extension.js +230 -36
- package/dist/pi/opencandle-extension.js.map +1 -1
- package/dist/pi/setup.js +10 -0
- package/dist/pi/setup.js.map +1 -1
- package/dist/prompts/context-builder.d.ts +18 -3
- package/dist/prompts/context-builder.js +102 -16
- package/dist/prompts/context-builder.js.map +1 -1
- package/dist/prompts/disclaimer.js +1 -1
- package/dist/prompts/disclaimer.js.map +1 -1
- package/dist/prompts/policy-cards.d.ts +13 -0
- package/dist/prompts/policy-cards.js +197 -0
- package/dist/prompts/policy-cards.js.map +1 -0
- package/dist/prompts/sections.js +3 -3
- package/dist/prompts/sections.js.map +1 -1
- package/dist/prompts/workflow-prompts.js +170 -18
- package/dist/prompts/workflow-prompts.js.map +1 -1
- package/dist/providers/alpha-vantage.js +23 -1
- package/dist/providers/alpha-vantage.js.map +1 -1
- package/dist/providers/sec-edgar.d.ts +8 -1
- package/dist/providers/sec-edgar.js +172 -5
- package/dist/providers/sec-edgar.js.map +1 -1
- package/dist/providers/yahoo-finance.d.ts +2 -0
- package/dist/providers/yahoo-finance.js +134 -3
- package/dist/providers/yahoo-finance.js.map +1 -1
- package/dist/routing/classify-intent.d.ts +3 -0
- package/dist/routing/classify-intent.js +82 -3
- package/dist/routing/classify-intent.js.map +1 -1
- package/dist/routing/defaults.js +3 -3
- package/dist/routing/defaults.js.map +1 -1
- package/dist/routing/entity-extractor.d.ts +1 -0
- package/dist/routing/entity-extractor.js +158 -12
- package/dist/routing/entity-extractor.js.map +1 -1
- package/dist/routing/index.d.ts +7 -1
- package/dist/routing/index.js +4 -0
- package/dist/routing/index.js.map +1 -1
- package/dist/routing/legacy-rule-router.d.ts +9 -0
- package/dist/routing/legacy-rule-router.js +12 -0
- package/dist/routing/legacy-rule-router.js.map +1 -0
- package/dist/routing/planning.d.ts +54 -0
- package/dist/routing/planning.js +531 -0
- package/dist/routing/planning.js.map +1 -0
- package/dist/routing/route-manifest.d.ts +35 -0
- package/dist/routing/route-manifest.js +221 -0
- package/dist/routing/route-manifest.js.map +1 -0
- package/dist/routing/router-prompt.js +45 -42
- package/dist/routing/router-prompt.js.map +1 -1
- package/dist/routing/router-types.d.ts +9 -0
- package/dist/routing/router.d.ts +1 -0
- package/dist/routing/router.js +456 -12
- package/dist/routing/router.js.map +1 -1
- package/dist/routing/slot-resolver.js +46 -6
- package/dist/routing/slot-resolver.js.map +1 -1
- package/dist/routing/turn-context.d.ts +44 -0
- package/dist/routing/turn-context.js +45 -0
- package/dist/routing/turn-context.js.map +1 -0
- package/dist/routing/types.d.ts +13 -1
- package/dist/runtime/answer-contracts.d.ts +82 -0
- package/dist/runtime/answer-contracts.js +414 -0
- package/dist/runtime/answer-contracts.js.map +1 -0
- package/dist/runtime/artifact-contracts.d.ts +14 -0
- package/dist/runtime/artifact-contracts.js +57 -0
- package/dist/runtime/artifact-contracts.js.map +1 -0
- package/dist/runtime/planning-evidence.d.ts +99 -0
- package/dist/runtime/planning-evidence.js +445 -0
- package/dist/runtime/planning-evidence.js.map +1 -0
- package/dist/runtime/session-coordinator.d.ts +20 -2
- package/dist/runtime/session-coordinator.js +47 -14
- package/dist/runtime/session-coordinator.js.map +1 -1
- package/dist/system-prompt.js +4 -1
- package/dist/system-prompt.js.map +1 -1
- package/dist/tools/fundamentals/company-overview.js +1 -1
- package/dist/tools/fundamentals/company-overview.js.map +1 -1
- package/dist/tools/fundamentals/comps.js +1 -1
- package/dist/tools/fundamentals/comps.js.map +1 -1
- package/dist/tools/fundamentals/dcf.js +1 -1
- package/dist/tools/fundamentals/dcf.js.map +1 -1
- package/dist/tools/fundamentals/earnings.js +1 -1
- package/dist/tools/fundamentals/earnings.js.map +1 -1
- package/dist/tools/fundamentals/financials.js +1 -1
- package/dist/tools/fundamentals/financials.js.map +1 -1
- package/dist/tools/fundamentals/sec-filings.d.ts +1 -0
- package/dist/tools/fundamentals/sec-filings.js +19 -2
- package/dist/tools/fundamentals/sec-filings.js.map +1 -1
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.js +3 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/macro/fear-greed.js +1 -1
- package/dist/tools/macro/fear-greed.js.map +1 -1
- package/dist/tools/macro/fred-data.js +29 -5
- package/dist/tools/macro/fred-data.js.map +1 -1
- package/dist/tools/market/crypto-history.js +18 -2
- package/dist/tools/market/crypto-history.js.map +1 -1
- package/dist/tools/market/crypto-price.js +1 -1
- package/dist/tools/market/crypto-price.js.map +1 -1
- package/dist/tools/market/search-ticker.js +1 -1
- package/dist/tools/market/search-ticker.js.map +1 -1
- package/dist/tools/market/stock-history.js +1 -1
- package/dist/tools/market/stock-history.js.map +1 -1
- package/dist/tools/market/stock-quote.js +1 -1
- package/dist/tools/market/stock-quote.js.map +1 -1
- package/dist/tools/options/greeks.js +0 -1
- package/dist/tools/options/greeks.js.map +1 -1
- package/dist/tools/options/option-chain.js +9 -4
- package/dist/tools/options/option-chain.js.map +1 -1
- package/dist/tools/portfolio/correlation.js +1 -1
- package/dist/tools/portfolio/correlation.js.map +1 -1
- package/dist/tools/portfolio/holdings-overlap.d.ts +8 -0
- package/dist/tools/portfolio/holdings-overlap.js +105 -0
- package/dist/tools/portfolio/holdings-overlap.js.map +1 -0
- package/dist/tools/portfolio/predictions.js +1 -1
- package/dist/tools/portfolio/predictions.js.map +1 -1
- package/dist/tools/portfolio/risk-analysis.js +1 -1
- package/dist/tools/portfolio/risk-analysis.js.map +1 -1
- package/dist/tools/portfolio/tracker.js +1 -1
- package/dist/tools/portfolio/tracker.js.map +1 -1
- package/dist/tools/portfolio/watchlist.js +12 -4
- package/dist/tools/portfolio/watchlist.js.map +1 -1
- package/dist/tools/sentiment/reddit-sentiment.js +1 -1
- package/dist/tools/sentiment/reddit-sentiment.js.map +1 -1
- package/dist/tools/sentiment/sentiment-summary.js +57 -2
- package/dist/tools/sentiment/sentiment-summary.js.map +1 -1
- package/dist/tools/sentiment/twitter-sentiment.js +1 -1
- package/dist/tools/sentiment/twitter-sentiment.js.map +1 -1
- package/dist/tools/sentiment/web-search.js +32 -3
- package/dist/tools/sentiment/web-search.js.map +1 -1
- package/dist/tools/sentiment/web-sentiment.js +1 -1
- package/dist/tools/sentiment/web-sentiment.js.map +1 -1
- package/dist/tools/technical/backtest.d.ts +2 -2
- package/dist/tools/technical/backtest.js +41 -27
- package/dist/tools/technical/backtest.js.map +1 -1
- package/dist/tools/technical/indicators.js +1 -3
- package/dist/tools/technical/indicators.js.map +1 -1
- package/dist/types/options.d.ts +10 -0
- package/dist/types/portfolio.d.ts +27 -0
- package/dist/workflows/compare-assets.js +38 -2
- package/dist/workflows/compare-assets.js.map +1 -1
- package/dist/workflows/options-screener.js +88 -7
- package/dist/workflows/options-screener.js.map +1 -1
- package/dist/workflows/portfolio-builder.js +7 -3
- package/dist/workflows/portfolio-builder.js.map +1 -1
- package/gui/server/ask-user-bridge.ts +82 -0
- package/gui/server/gui-session-manager.ts +5 -0
- package/gui/server/projector.ts +47 -5
- package/gui/server/prompt-observation.ts +61 -0
- package/gui/server/server.ts +119 -8
- package/gui/server/session-entry-wait.ts +81 -0
- package/gui/web/dist/assets/{CatalogOverlay-D1ImSJTe.js → CatalogOverlay-Bmp6Knu7.js} +1 -1
- package/gui/web/dist/assets/index-Bxt9QpLX.css +1 -0
- package/gui/web/dist/assets/index-CZ9DHZYy.js +67 -0
- package/gui/web/dist/index.html +2 -2
- package/package.json +18 -12
- package/src/cli.ts +2 -1
- package/src/config.ts +89 -5
- package/src/infra/browser.ts +1 -1
- package/src/infra/rate-limiter.ts +10 -1
- package/src/memory/manager.ts +43 -10
- package/src/memory/storage.ts +3 -2
- package/src/memory/types.ts +4 -0
- package/src/pi/opencandle-extension.ts +273 -42
- package/src/pi/setup.ts +10 -0
- package/src/prompts/context-builder.ts +128 -17
- package/src/prompts/disclaimer.ts +1 -1
- package/src/prompts/policy-cards.ts +220 -0
- package/src/prompts/sections.ts +3 -3
- package/src/prompts/workflow-prompts.ts +172 -18
- package/src/providers/alpha-vantage.ts +24 -1
- package/src/providers/sec-edgar.ts +220 -4
- package/src/providers/web-search.ts +1 -1
- package/src/providers/yahoo-finance.ts +171 -4
- package/src/routing/classify-intent.ts +94 -3
- package/src/routing/defaults.ts +3 -3
- package/src/routing/entity-extractor.ts +164 -13
- package/src/routing/index.ts +44 -0
- package/src/routing/legacy-rule-router.ts +13 -0
- package/src/routing/planning.ts +732 -0
- package/src/routing/route-manifest.ts +287 -0
- package/src/routing/router-prompt.ts +50 -46
- package/src/routing/router-types.ts +21 -0
- package/src/routing/router.ts +511 -12
- package/src/routing/slot-resolver.ts +44 -6
- package/src/routing/turn-context.ts +111 -0
- package/src/routing/types.ts +13 -1
- package/src/runtime/answer-contracts.ts +633 -0
- package/src/runtime/artifact-contracts.ts +76 -0
- package/src/runtime/planning-evidence.ts +591 -0
- package/src/runtime/session-coordinator.ts +78 -12
- package/src/system-prompt.ts +4 -1
- package/src/tools/fundamentals/company-overview.ts +1 -1
- package/src/tools/fundamentals/comps.ts +1 -1
- package/src/tools/fundamentals/dcf.ts +1 -1
- package/src/tools/fundamentals/earnings.ts +1 -1
- package/src/tools/fundamentals/financials.ts +1 -1
- package/src/tools/fundamentals/sec-filings.ts +25 -2
- package/src/tools/index.ts +3 -0
- package/src/tools/macro/fear-greed.ts +1 -1
- package/src/tools/macro/fred-data.ts +31 -5
- package/src/tools/market/crypto-history.ts +18 -2
- package/src/tools/market/crypto-price.ts +1 -1
- package/src/tools/market/search-ticker.ts +1 -1
- package/src/tools/market/stock-history.ts +1 -1
- package/src/tools/market/stock-quote.ts +1 -1
- package/src/tools/options/greeks.ts +0 -1
- package/src/tools/options/option-chain.ts +9 -4
- package/src/tools/portfolio/correlation.ts +1 -1
- package/src/tools/portfolio/holdings-overlap.ts +123 -0
- package/src/tools/portfolio/predictions.ts +1 -1
- package/src/tools/portfolio/risk-analysis.ts +1 -1
- package/src/tools/portfolio/tracker.ts +1 -1
- package/src/tools/portfolio/watchlist.ts +10 -4
- package/src/tools/sentiment/reddit-sentiment.ts +1 -1
- package/src/tools/sentiment/sentiment-summary.ts +62 -2
- package/src/tools/sentiment/twitter-sentiment.ts +1 -1
- package/src/tools/sentiment/web-search.ts +36 -3
- package/src/tools/sentiment/web-sentiment.ts +1 -1
- package/src/tools/technical/backtest.ts +50 -29
- package/src/tools/technical/indicators.ts +1 -3
- package/src/types/options.ts +17 -0
- package/src/types/portfolio.ts +32 -0
- package/src/workflows/compare-assets.ts +38 -2
- package/src/workflows/options-screener.ts +85 -7
- package/src/workflows/portfolio-builder.ts +7 -3
- package/dist/runtime/index.d.ts +0 -16
- package/dist/runtime/index.js +0 -10
- package/dist/runtime/index.js.map +0 -1
- package/dist/runtime/provider-ids.d.ts +0 -14
- package/dist/runtime/provider-ids.js +0 -14
- package/dist/runtime/provider-ids.js.map +0 -1
- package/gui/web/dist/assets/index-DBrWq43L.css +0 -1
- package/gui/web/dist/assets/index-RflHaj0y.js +0 -67
- package/src/runtime/index.ts +0 -55
- package/src/runtime/provider-ids.ts +0 -15
|
@@ -20,9 +20,34 @@ interface Preferences {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
function mapDteHintToTarget(dteHint: string | undefined): string | undefined {
|
|
23
|
-
|
|
23
|
+
const normalized = dteHint?.toLowerCase().trim();
|
|
24
|
+
if (!normalized) return undefined;
|
|
25
|
+
|
|
26
|
+
if (/\bleaps?\b/.test(normalized) || /\blong[\s-]*dated\b/.test(normalized)) {
|
|
27
|
+
return "180_plus_days";
|
|
28
|
+
}
|
|
29
|
+
if (/\b(?:1|one)\s*(?:-|to|or)\s*(?:2|two)\s*weeks?\b/.test(normalized)) {
|
|
30
|
+
return "7_to_14_days";
|
|
31
|
+
}
|
|
32
|
+
if (/\bevent[_\s-]?week\b/.test(normalized)) {
|
|
33
|
+
return "0_to_7_days";
|
|
34
|
+
}
|
|
35
|
+
const explicitDays = normalized.match(/\b(\d+)\s*(?:-|to|or)\s*(\d+)\s*(?:days?|dte)\b/);
|
|
36
|
+
if (explicitDays) {
|
|
37
|
+
return `${explicitDays[1]}_to_${explicitDays[2]}_days`;
|
|
38
|
+
}
|
|
39
|
+
if (/\b(?:week|weekly|weeks?)\b/.test(normalized)) {
|
|
40
|
+
return "7_to_14_days";
|
|
41
|
+
}
|
|
42
|
+
if (/\b(?:month|monthly|months?)\b/.test(normalized)) {
|
|
43
|
+
return "25_to_45_days";
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
switch (normalized) {
|
|
24
47
|
case "week":
|
|
25
48
|
return "7_to_14_days";
|
|
49
|
+
case "event_week":
|
|
50
|
+
return "0_to_7_days";
|
|
26
51
|
case "month":
|
|
27
52
|
return "25_to_45_days";
|
|
28
53
|
case "leaps":
|
|
@@ -68,7 +93,7 @@ export function resolvePortfolioSlots(
|
|
|
68
93
|
sources.timeHorizon = horizon.source;
|
|
69
94
|
if (horizon.source === "default") defaultsUsed.push("timeHorizon");
|
|
70
95
|
|
|
71
|
-
const scope = resolve(
|
|
96
|
+
const scope = resolve(entities.assetScope, preferences.assetScope, PORTFOLIO_DEFAULTS.assetScope);
|
|
72
97
|
sources.assetScope = scope.source;
|
|
73
98
|
if (scope.source === "default") defaultsUsed.push("assetScope");
|
|
74
99
|
|
|
@@ -105,16 +130,20 @@ export function resolveOptionsScreenerSlots(
|
|
|
105
130
|
|
|
106
131
|
// Symbol: required, no default
|
|
107
132
|
let symbol = "";
|
|
108
|
-
|
|
109
|
-
|
|
133
|
+
const requestedUnderlying = entities.heldSymbol ?? entities.symbols[0];
|
|
134
|
+
if (requestedUnderlying) {
|
|
135
|
+
symbol = requestedUnderlying;
|
|
110
136
|
sources.symbol = "user";
|
|
111
137
|
} else {
|
|
112
138
|
missingRequired.push("symbol");
|
|
113
139
|
sources.symbol = "default";
|
|
114
140
|
}
|
|
115
141
|
|
|
116
|
-
// Direction: default to bullish
|
|
117
|
-
const
|
|
142
|
+
// Direction: default to bullish unless the user specified a protective put hedge.
|
|
143
|
+
const inferredDirection = entities.optionStrategy === "protective_put"
|
|
144
|
+
? "bearish"
|
|
145
|
+
: entities.direction;
|
|
146
|
+
const dir = resolve(inferredDirection, undefined, "bullish" as const);
|
|
118
147
|
sources.direction = dir.source;
|
|
119
148
|
if (dir.source === "default") defaultsUsed.push("direction");
|
|
120
149
|
|
|
@@ -134,6 +163,11 @@ export function resolveOptionsScreenerSlots(
|
|
|
134
163
|
sources.liquidityMinimum = liquidity.source;
|
|
135
164
|
if (liquidity.source === "default") defaultsUsed.push("liquidityMinimum");
|
|
136
165
|
|
|
166
|
+
if (entities.optionStrategy) sources.optionStrategy = "user";
|
|
167
|
+
if (entities.costBasis !== undefined) sources.costBasis = "user";
|
|
168
|
+
if (entities.shareQuantity !== undefined) sources.shareQuantity = "user";
|
|
169
|
+
if (entities.catalystSymbols !== undefined) sources.catalystSymbols = "user";
|
|
170
|
+
|
|
137
171
|
return {
|
|
138
172
|
resolved: {
|
|
139
173
|
symbol,
|
|
@@ -144,6 +178,10 @@ export function resolveOptionsScreenerSlots(
|
|
|
144
178
|
liquidityMinimum: liquidity.value,
|
|
145
179
|
budget: entities.budget,
|
|
146
180
|
maxPremium: entities.maxPremium,
|
|
181
|
+
optionStrategy: entities.optionStrategy,
|
|
182
|
+
costBasis: entities.costBasis,
|
|
183
|
+
shareQuantity: entities.shareQuantity,
|
|
184
|
+
catalystSymbols: entities.catalystSymbols,
|
|
147
185
|
},
|
|
148
186
|
sources,
|
|
149
187
|
defaultsUsed,
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import type { MemoryCategory, MemoryEntry } from "../memory/types.js";
|
|
2
|
+
import {
|
|
3
|
+
activeToolsForBundles,
|
|
4
|
+
memoryScopesForRoute,
|
|
5
|
+
} from "./route-manifest.js";
|
|
6
|
+
import type {
|
|
7
|
+
RouterInputContext,
|
|
8
|
+
RouterOutput,
|
|
9
|
+
RouterRoute,
|
|
10
|
+
RouterRouteKind,
|
|
11
|
+
RouterSlot,
|
|
12
|
+
ToolBundleName,
|
|
13
|
+
RouterDiagnostic,
|
|
14
|
+
} from "./router-types.js";
|
|
15
|
+
import {
|
|
16
|
+
buildPlanningEnvelope,
|
|
17
|
+
type PlanningBuildOptions,
|
|
18
|
+
type PlanningEnvelope,
|
|
19
|
+
} from "./planning.js";
|
|
20
|
+
import type { ExtractedEntities, WorkflowType } from "./types.js";
|
|
21
|
+
|
|
22
|
+
export interface MemoryQueryPlan {
|
|
23
|
+
routeKind: RouterRouteKind;
|
|
24
|
+
workflow?: Exclude<WorkflowType, "unclassified">;
|
|
25
|
+
categories: MemoryCategory[];
|
|
26
|
+
symbols: string[];
|
|
27
|
+
slotKeys: string[];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface MemoryProvenance {
|
|
31
|
+
category: MemoryCategory;
|
|
32
|
+
key: string;
|
|
33
|
+
source?: string;
|
|
34
|
+
recordedAt: string;
|
|
35
|
+
confidence?: string;
|
|
36
|
+
filtered?: boolean;
|
|
37
|
+
filterReason?: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface ResolvedTurnContext {
|
|
41
|
+
userInput: string;
|
|
42
|
+
priorTurns: RouterInputContext["priorTurns"];
|
|
43
|
+
routeKind: RouterRouteKind;
|
|
44
|
+
legacyRoute: RouterRoute;
|
|
45
|
+
workflow?: Exclude<WorkflowType, "unclassified">;
|
|
46
|
+
entities: ExtractedEntities;
|
|
47
|
+
slots: Record<string, RouterSlot>;
|
|
48
|
+
missingRequired: string[];
|
|
49
|
+
toolBundles: ToolBundleName[];
|
|
50
|
+
activeToolNames: string[];
|
|
51
|
+
memoryQueryPlan: MemoryQueryPlan;
|
|
52
|
+
memoryProvenance: MemoryProvenance[];
|
|
53
|
+
promptPlaybook: RouterRouteKind;
|
|
54
|
+
diagnostics: RouterDiagnostic[];
|
|
55
|
+
planning: PlanningEnvelope;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function buildResolvedTurnContext(
|
|
59
|
+
input: RouterInputContext,
|
|
60
|
+
output: RouterOutput,
|
|
61
|
+
options: {
|
|
62
|
+
availableToolNames?: readonly string[];
|
|
63
|
+
memoryEntries?: readonly MemoryEntry[];
|
|
64
|
+
filteredMemory?: readonly MemoryProvenance[];
|
|
65
|
+
planning?: PlanningBuildOptions;
|
|
66
|
+
} = {},
|
|
67
|
+
): ResolvedTurnContext {
|
|
68
|
+
const memoryQueryPlan = buildMemoryQueryPlan(output);
|
|
69
|
+
const memoryProvenance = [
|
|
70
|
+
...(options.memoryEntries ?? []).map(memoryEntryToProvenance),
|
|
71
|
+
...(options.filteredMemory ?? []),
|
|
72
|
+
];
|
|
73
|
+
|
|
74
|
+
return {
|
|
75
|
+
userInput: input.text,
|
|
76
|
+
priorTurns: input.priorTurns,
|
|
77
|
+
routeKind: output.routeKind,
|
|
78
|
+
legacyRoute: output.route,
|
|
79
|
+
workflow: output.workflow,
|
|
80
|
+
entities: output.entities,
|
|
81
|
+
slots: output.slots,
|
|
82
|
+
missingRequired: output.missing_required,
|
|
83
|
+
toolBundles: output.tool_bundles,
|
|
84
|
+
activeToolNames: activeToolsForBundles(output.tool_bundles, options.availableToolNames),
|
|
85
|
+
memoryQueryPlan,
|
|
86
|
+
memoryProvenance,
|
|
87
|
+
promptPlaybook: output.routeKind,
|
|
88
|
+
diagnostics: output.diagnostics,
|
|
89
|
+
planning: buildPlanningEnvelope(input, output, options.planning),
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export function buildMemoryQueryPlan(output: RouterOutput): MemoryQueryPlan {
|
|
94
|
+
return {
|
|
95
|
+
routeKind: output.routeKind,
|
|
96
|
+
workflow: output.workflow,
|
|
97
|
+
categories: memoryScopesForRoute(output.routeKind, output.workflow),
|
|
98
|
+
symbols: output.entities.symbols,
|
|
99
|
+
slotKeys: Object.keys(output.slots),
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function memoryEntryToProvenance(entry: MemoryEntry): MemoryProvenance {
|
|
104
|
+
return {
|
|
105
|
+
category: entry.category,
|
|
106
|
+
key: entry.key,
|
|
107
|
+
source: entry.source,
|
|
108
|
+
recordedAt: entry.recordedAt,
|
|
109
|
+
confidence: entry.confidence,
|
|
110
|
+
};
|
|
111
|
+
}
|
package/src/routing/types.ts
CHANGED
|
@@ -12,9 +12,16 @@ export interface ExtractedEntities {
|
|
|
12
12
|
budget?: number;
|
|
13
13
|
maxPremium?: number;
|
|
14
14
|
timeHorizon?: string;
|
|
15
|
+
assetScope?: string;
|
|
15
16
|
riskProfile?: string;
|
|
16
17
|
direction?: "bullish" | "bearish";
|
|
17
18
|
dteHint?: string;
|
|
19
|
+
optionStrategy?: "covered_call" | "protective_put";
|
|
20
|
+
heldSymbol?: string;
|
|
21
|
+
catalystSymbols?: string[];
|
|
22
|
+
costBasis?: number;
|
|
23
|
+
shareQuantity?: number;
|
|
24
|
+
compareMetrics?: string[];
|
|
18
25
|
}
|
|
19
26
|
|
|
20
27
|
export interface ClassificationResult {
|
|
@@ -45,15 +52,20 @@ export interface OptionsScreenerSlots {
|
|
|
45
52
|
liquidityMinimum: string;
|
|
46
53
|
budget?: number;
|
|
47
54
|
maxPremium?: number;
|
|
55
|
+
optionStrategy?: "covered_call" | "protective_put";
|
|
56
|
+
costBasis?: number;
|
|
57
|
+
shareQuantity?: number;
|
|
58
|
+
catalystSymbols?: string[];
|
|
48
59
|
ivPreference?: string;
|
|
49
60
|
}
|
|
50
61
|
|
|
51
62
|
export interface CompareAssetsSlots {
|
|
52
63
|
symbols: string[];
|
|
64
|
+
timeHorizon?: string;
|
|
53
65
|
metrics?: string[];
|
|
54
66
|
}
|
|
55
67
|
|
|
56
|
-
export type SlotSource = "user" | "preference" | "default";
|
|
68
|
+
export type SlotSource = "user" | "preference" | "default" | "prior_context" | "memory";
|
|
57
69
|
|
|
58
70
|
export interface SlotResolution<T> {
|
|
59
71
|
resolved: T;
|