peak6-x-intelligence-plugin 0.1.1 → 0.1.5

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/manifest.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // src/constants.ts
2
2
  var PLUGIN_ID = "peak6-labs.x-intelligence";
3
- var PLUGIN_VERSION = "0.1.1";
3
+ var PLUGIN_VERSION = "0.1.4";
4
4
  var JOB_KEYS = {
5
5
  discoveryRun: "discovery-run",
6
6
  authorityDecay: "authority-decay",
@@ -16,7 +16,10 @@ var TOOL_NAMES = {
16
16
  analyzeTopic: "analyze-topic",
17
17
  getThread: "get-thread",
18
18
  promoteHandle: "promote-handle",
19
- rateTweet: "rate-tweet"
19
+ rateTweet: "rate-tweet",
20
+ searchX: "search-x",
21
+ getTrending: "get-trending",
22
+ getUserTimeline: "get-user-timeline"
20
23
  };
21
24
  var SLOT_IDS = {
22
25
  dashboardWidget: "x-intelligence-dashboard",
@@ -133,7 +136,8 @@ var DEFAULT_CONFIG = {
133
136
  noise_floor: 10,
134
137
  expert: 50,
135
138
  escalation: 100
136
- }
139
+ },
140
+ alert_agents: []
137
141
  };
138
142
 
139
143
  // src/manifest.ts
@@ -160,7 +164,9 @@ var manifest = {
160
164
  "metrics.write",
161
165
  "instance.settings.register",
162
166
  "ui.dashboardWidget.register",
163
- "ui.page.register"
167
+ "ui.page.register",
168
+ "agents.invoke",
169
+ "agents.read"
164
170
  ],
165
171
  entrypoints: {
166
172
  worker: "./dist/worker.js",
@@ -270,6 +276,20 @@ var manifest = {
270
276
  escalation: { type: "number", default: 100 }
271
277
  },
272
278
  default: DEFAULT_CONFIG.engagement_thresholds
279
+ },
280
+ alert_agents: {
281
+ type: "array",
282
+ title: "Alert Agents",
283
+ description: "Agents to invoke on high-engagement tweets and corpus updates. Each entry maps an agent ID to an optional memory file for preference-enriched prompts.",
284
+ items: {
285
+ type: "object",
286
+ properties: {
287
+ agentId: { type: "string", description: "Paperclip agent UUID" },
288
+ memoryFile: { type: ["string", "null"], description: "Path to user memory file for enriched prompts (null for raw alerts)" }
289
+ },
290
+ required: ["agentId"]
291
+ },
292
+ default: DEFAULT_CONFIG.alert_agents
273
293
  }
274
294
  }
275
295
  },
@@ -419,6 +439,47 @@ var manifest = {
419
439
  },
420
440
  required: ["tweet_id", "rating"]
421
441
  }
442
+ },
443
+ {
444
+ name: TOOL_NAMES.searchX,
445
+ displayName: "Search X",
446
+ description: "Real-time semantic search on X/Twitter via xAI. Returns scored, enriched tweets without storing to corpus. Works any time \u2014 no pipeline required.",
447
+ parametersSchema: {
448
+ type: "object",
449
+ properties: {
450
+ query: { type: "string", description: "Search query (semantic \u2014 describe what you're looking for)" },
451
+ limit: { type: "number", description: "Max results (default 20)" },
452
+ handles: { type: "array", items: { type: "string" }, description: "Optional: restrict search to these handles only" },
453
+ quick: { type: "boolean", description: "Quick mode: skip enrichment, return xAI synthesis + tweet IDs only (lower cost)" }
454
+ },
455
+ required: ["query"]
456
+ }
457
+ },
458
+ {
459
+ name: TOOL_NAMES.getTrending,
460
+ displayName: "Get Trending",
461
+ description: "What's trending in PEAK6's configured domains right now. Searches all semantic topics (or a specific pillar) via xAI, enriches and scores results. No pipeline required.",
462
+ parametersSchema: {
463
+ type: "object",
464
+ properties: {
465
+ limit: { type: "number", description: "Max results (default 20)" },
466
+ pillar: { type: "string", description: "Filter to topics matching this pillar/keyword" }
467
+ }
468
+ }
469
+ },
470
+ {
471
+ name: TOOL_NAMES.getUserTimeline,
472
+ displayName: "Get User Timeline",
473
+ description: "Fetch a user's recent tweets from X/Twitter. Returns enriched tweet data with metrics.",
474
+ parametersSchema: {
475
+ type: "object",
476
+ properties: {
477
+ handle: { type: "string", description: "X handle (without @)" },
478
+ limit: { type: "number", description: "Max tweets to return (default 20, max 100)" },
479
+ since: { type: "string", description: "Only return tweets after this date (YYYY-MM-DD)" }
480
+ },
481
+ required: ["handle"]
482
+ }
422
483
  }
423
484
  ],
424
485
  ui: {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/constants.ts", "../src/manifest.ts"],
4
- "sourcesContent": ["export const PLUGIN_ID = \"peak6-labs.x-intelligence\";\nexport const PLUGIN_VERSION = \"0.1.1\";\n\nexport const JOB_KEYS = {\n discoveryRun: \"discovery-run\",\n authorityDecay: \"authority-decay\",\n complianceCheck: \"compliance-check\",\n corpusRetention: \"corpus-retention\",\n} as const;\n\nexport const TOOL_NAMES = {\n searchCorpus: \"search-corpus\",\n getToday: \"get-today\",\n getAuthorities: \"get-authorities\",\n suggestHandles: \"suggest-handles\",\n trackHandle: \"track-handle\",\n analyzeTopic: \"analyze-topic\",\n getThread: \"get-thread\",\n promoteHandle: \"promote-handle\",\n rateTweet: \"rate-tweet\",\n} as const;\n\nexport const SLOT_IDS = {\n dashboardWidget: \"x-intelligence-dashboard\",\n settingsPage: \"x-intelligence-settings\",\n corpusBrowser: \"x-intelligence-corpus-browser\",\n} as const;\n\nexport const EXPORT_NAMES = {\n dashboardWidget: \"DashboardWidget\",\n settingsPage: \"SettingsPage\",\n corpusBrowser: \"CorpusBrowserPage\",\n} as const;\n\nexport const ENTITY_TYPES = {\n tweet: \"tweet\",\n handle: \"handle\",\n} as const;\n\nexport const STATE_KEYS = {\n corpusPrefix: \"corpus:\",\n lastDiscoveryRun: \"last-discovery-run\",\n pipelineStats: \"pipeline-stats\",\n} as const;\n\nexport const EVENT_NAMES = {\n corpusUpdated: \"corpus.updated\",\n handlePromoted: \"handle.promoted\",\n gapIdentified: \"gap.identified\",\n tweetHighEngagement: \"tweet.high-engagement\",\n} as const;\n\nexport const DEFAULT_CONFIG = {\n company_id: \"\",\n xai_api_key_ref: \"XAI_API_KEY\",\n x_api_bearer_ref: \"BEARER_TOKEN\",\n semantic_topics: [\n \"institutional investors discussing market structure reform\",\n \"fintech companies disrupting traditional trading\",\n \"SEC regulatory changes affecting options trading\",\n \"algorithmic trading and quantitative strategies\",\n \"venture capital investing in financial infrastructure\",\n \"PEAK6\",\n \"options market making technology\",\n \"Chicago trading community news\",\n ],\n keyword_searches: [\n \"\\\"PEAK6 Investments\\\" OR \\\"PEAK6\\\" trading fintech\",\n \"fintech and trading technology\",\n \"market structure and regulation\",\n \"options trading strategies and platforms\",\n ],\n content_pillars: [\n \"market structure & regulation\",\n \"fintech & trading technology\",\n \"venture capital & investment\",\n \"Chicago business ecosystem\",\n \"company culture & talent\",\n ],\n scoring_weights: {\n relevance: 0.45,\n recency: 0.25,\n engagement: 0.30,\n },\n engagement_sub_weights: {\n likes: 0.55,\n reposts: 0.25,\n replies: 0.15,\n quotes: 0.05,\n },\n max_corpus_size: 200,\n dedup_threshold: 0.70,\n authority_boost: 0.15,\n authority_lists: {\n market_structure: {\n description: \"Market structure, regulation, SEC reform, options trading\",\n handles: [\n \"LizAnnSonders\",\n \"matt_levine\",\n \"unusual_whales\",\n \"CMEGroup\",\n \"CBOE\",\n \"OptionsHawk\",\n \"InvestorDenis\",\n ],\n last_reviewed: \"2026-03-29\",\n },\n fintech: {\n description: \"Fintech, trading technology, AI in finance\",\n handles: [\n \"twifintech\",\n \"IBSIntelligence\",\n \"privy_io\",\n \"i_Know_First\",\n \"fintech_germany\",\n \"venture_radar\",\n ],\n last_reviewed: \"2026-03-29\",\n },\n venture_capital: {\n description: \"Venture capital investing in financial infrastructure\",\n handles: [\n \"a16z\",\n \"FundersVC\",\n ],\n last_reviewed: \"2026-03-29\",\n },\n chicago_trading: {\n description: \"Chicago trading community, prop firms, PEAK6 ecosystem\",\n handles: [\n \"CBOE\",\n \"CMEGroup\",\n \"boogeymantradez\",\n \"adealafia\",\n ],\n last_reviewed: \"2026-03-29\",\n },\n } as Record<string, AuthorityList>,\n global_excluded: [\"elonmusk\", \"openai\", \"google\", \"microsoft\"],\n authority_promotion_policy: {\n auto_promote_threshold: {\n min_appearances: 7,\n min_avg_relevance: 0.8,\n min_mutual_overlap: 3,\n },\n candidate_threshold: {\n min_appearances: 5,\n min_avg_relevance: 0.7,\n min_mutual_overlap: 2,\n },\n tracking_window_days: 14,\n },\n corpus_retention_days: 90,\n engagement_thresholds: {\n noise_floor: 10,\n expert: 50,\n escalation: 100,\n },\n} as const;\n\nexport interface AuthorityList {\n description: string;\n handles: string[];\n last_reviewed: string;\n}\n", "import type { PaperclipPluginManifestV1 } from \"@paperclipai/plugin-sdk\";\nimport {\n DEFAULT_CONFIG,\n EXPORT_NAMES,\n JOB_KEYS,\n PLUGIN_ID,\n PLUGIN_VERSION,\n SLOT_IDS,\n TOOL_NAMES,\n} from \"./constants.js\";\n\nconst manifest: PaperclipPluginManifestV1 = {\n id: PLUGIN_ID,\n apiVersion: 1,\n version: PLUGIN_VERSION,\n displayName: \"X Intelligence\",\n description:\n \"Automated X/Twitter intelligence pipeline \u2014 discovery, enrichment, scoring, deduplication, authority list management, and corpus storage.\",\n author: \"peak6-labs\",\n categories: [\"connector\", \"automation\"],\n capabilities: [\n \"http.outbound\",\n \"secrets.read-ref\",\n \"jobs.schedule\",\n \"agent.tools.register\",\n \"plugin.state.read\",\n \"plugin.state.write\",\n \"events.subscribe\",\n \"events.emit\",\n \"issues.read\",\n \"issues.create\",\n \"activity.log.write\",\n \"metrics.write\",\n \"instance.settings.register\",\n \"ui.dashboardWidget.register\",\n \"ui.page.register\",\n ],\n entrypoints: {\n worker: \"./dist/worker.js\",\n ui: \"./dist/ui\",\n },\n instanceConfigSchema: {\n type: \"object\",\n properties: {\n company_id: {\n type: \"string\",\n title: \"Company ID\",\n description: \"UUID of the company this plugin serves (required for events and activity logging)\",\n default: DEFAULT_CONFIG.company_id,\n },\n xai_api_key_ref: {\n type: \"string\",\n title: \"xAI API Key Secret Reference\",\n default: DEFAULT_CONFIG.xai_api_key_ref,\n },\n x_api_bearer_ref: {\n type: \"string\",\n title: \"X API Bearer Token Secret Reference\",\n default: DEFAULT_CONFIG.x_api_bearer_ref,\n },\n semantic_topics: {\n type: \"array\",\n title: \"Semantic Discovery Topics\",\n items: { type: \"string\" },\n default: DEFAULT_CONFIG.semantic_topics,\n },\n keyword_searches: {\n type: \"array\",\n title: \"Keyword Searches\",\n items: { type: \"string\" },\n default: DEFAULT_CONFIG.keyword_searches,\n },\n content_pillars: {\n type: \"array\",\n title: \"Content Pillars\",\n items: { type: \"string\" },\n default: DEFAULT_CONFIG.content_pillars,\n },\n scoring_weights: {\n type: \"object\",\n title: \"Scoring Weights\",\n properties: {\n relevance: { type: \"number\", default: 0.45 },\n recency: { type: \"number\", default: 0.25 },\n engagement: { type: \"number\", default: 0.30 },\n },\n default: DEFAULT_CONFIG.scoring_weights,\n },\n engagement_sub_weights: {\n type: \"object\",\n title: \"Engagement Sub-Weights\",\n properties: {\n likes: { type: \"number\", default: 0.55 },\n reposts: { type: \"number\", default: 0.25 },\n replies: { type: \"number\", default: 0.15 },\n quotes: { type: \"number\", default: 0.05 },\n },\n default: DEFAULT_CONFIG.engagement_sub_weights,\n },\n max_corpus_size: {\n type: \"number\",\n title: \"Max Corpus Size Per Day\",\n default: DEFAULT_CONFIG.max_corpus_size,\n },\n dedup_threshold: {\n type: \"number\",\n title: \"Dedup Jaccard Threshold\",\n default: DEFAULT_CONFIG.dedup_threshold,\n },\n authority_boost: {\n type: \"number\",\n title: \"Authority Score Boost\",\n default: DEFAULT_CONFIG.authority_boost,\n },\n authority_lists: {\n type: \"object\",\n title: \"Authority Handle Lists\",\n default: DEFAULT_CONFIG.authority_lists,\n },\n global_excluded: {\n type: \"array\",\n title: \"Globally Excluded Handles\",\n items: { type: \"string\" },\n default: DEFAULT_CONFIG.global_excluded,\n },\n authority_promotion_policy: {\n type: \"object\",\n title: \"Authority Promotion Policy\",\n default: DEFAULT_CONFIG.authority_promotion_policy,\n },\n corpus_retention_days: {\n type: \"number\",\n title: \"Corpus Retention (days)\",\n default: DEFAULT_CONFIG.corpus_retention_days,\n },\n engagement_thresholds: {\n type: \"object\",\n title: \"Engagement Thresholds\",\n description: \"Engagement level tiers: noise_floor (filter), expert (highlight), escalation (alert event)\",\n properties: {\n noise_floor: { type: \"number\", default: 10 },\n expert: { type: \"number\", default: 50 },\n escalation: { type: \"number\", default: 100 },\n },\n default: DEFAULT_CONFIG.engagement_thresholds,\n },\n },\n },\n jobs: [\n {\n jobKey: JOB_KEYS.discoveryRun,\n displayName: \"Discovery Run\",\n description:\n \"Two-stage pipeline: xAI open + focused discovery, X API v2 enrichment, scoring, and corpus storage.\",\n schedule: \"0 6 * * *\",\n },\n {\n jobKey: JOB_KEYS.authorityDecay,\n displayName: \"Authority Decay\",\n description:\n \"Weekly handle decay \u2014 downgrade or remove handles not seen within the tracking window.\",\n schedule: \"0 0 * * 0\",\n },\n {\n jobKey: JOB_KEYS.complianceCheck,\n displayName: \"Compliance Check\",\n description:\n \"Weekly re-check of stored tweets \u2014 remove deleted or suspended content.\",\n schedule: \"0 3 * * 0\",\n },\n {\n jobKey: JOB_KEYS.corpusRetention,\n displayName: \"Corpus Retention\",\n description:\n \"Monthly archive/delete corpus older than the retention window.\",\n schedule: \"0 4 1 * *\",\n },\n ],\n tools: [\n {\n name: TOOL_NAMES.searchCorpus,\n displayName: \"Search X Corpus\",\n description:\n \"Search the scored X intelligence corpus by query text, date range, content pillar, score threshold, and engagement level.\",\n parametersSchema: {\n type: \"object\",\n properties: {\n query: { type: \"string\", description: \"Search query (text match)\" },\n date: { type: \"string\", description: \"Date filter (YYYY-MM-DD)\" },\n pillar: { type: \"string\", description: \"Content pillar filter\" },\n limit: { type: \"number\", description: \"Max results (default 20)\" },\n min_score: { type: \"number\", description: \"Minimum score threshold (0-1)\" },\n min_engagement: { type: \"number\", description: \"Minimum total engagement (likes+reposts+replies+quotes)\" },\n since: { type: \"string\", description: \"Time window: '1h', '3h', '12h', '1d', '7d', or YYYY-MM-DD\" },\n },\n },\n },\n {\n name: TOOL_NAMES.getToday,\n displayName: \"Get Today's Intelligence\",\n description:\n \"Get today's scored X intelligence corpus from entities, optionally filtered by pillar and score threshold.\",\n parametersSchema: {\n type: \"object\",\n properties: {\n pillar: { type: \"string\", description: \"Content pillar filter\" },\n limit: { type: \"number\", description: \"Max results (default 20)\" },\n min_score: { type: \"number\", description: \"Minimum score threshold (0-1)\" },\n },\n },\n },\n {\n name: TOOL_NAMES.getAuthorities,\n displayName: \"Get Authority Handles\",\n description:\n \"Get the authority handle list for a domain, or all domains if none specified.\",\n parametersSchema: {\n type: \"object\",\n properties: {\n list_name: {\n type: \"string\",\n description: \"Domain name (e.g. 'market_structure')\",\n },\n },\n },\n },\n {\n name: TOOL_NAMES.suggestHandles,\n displayName: \"Suggest Handle Promotions\",\n description:\n \"Get handles that are candidates for authority list promotion based on tracking data.\",\n parametersSchema: {\n type: \"object\",\n properties: {},\n },\n },\n {\n name: TOOL_NAMES.trackHandle,\n displayName: \"Track Handle\",\n description:\n \"Record a handle appearance from agent discovery with relevance score and domain.\",\n parametersSchema: {\n type: \"object\",\n properties: {\n handle: { type: \"string\", description: \"X handle (without @)\" },\n relevance: { type: \"number\", description: \"Relevance score (0-1)\" },\n domain: { type: \"string\", description: \"Domain/topic area\" },\n },\n required: [\"handle\", \"relevance\", \"domain\"],\n },\n },\n {\n name: TOOL_NAMES.analyzeTopic,\n displayName: \"Analyze Topic\",\n description:\n \"On-demand xAI search for any topic with 5-perspective decomposition (core, expert voices, pain points, positive signals, link-based) and corpus cross-reference. Returns a synthesis brief.\",\n parametersSchema: {\n type: \"object\",\n properties: {\n topic: { type: \"string\", description: \"Topic to analyze\" },\n include_corpus: { type: \"boolean\", description: \"Cross-reference with stored corpus (default true)\" },\n },\n required: [\"topic\"],\n },\n },\n {\n name: TOOL_NAMES.getThread,\n displayName: \"Get Tweet Thread\",\n description:\n \"Fetch conversation context for a tweet. Returns the target tweet and other tweets in the same conversation thread.\",\n parametersSchema: {\n type: \"object\",\n properties: {\n tweet_id: { type: \"string\", description: \"Tweet ID to get thread for\" },\n },\n required: [\"tweet_id\"],\n },\n },\n {\n name: TOOL_NAMES.promoteHandle,\n displayName: \"Promote Handle\",\n description:\n \"Promote a tracked handle to authority status in a specific domain list. Sets entity status to promoted and records the target list.\",\n parametersSchema: {\n type: \"object\",\n properties: {\n handle: { type: \"string\", description: \"X handle (without @)\" },\n list_name: { type: \"string\", description: \"Authority list to promote to (e.g. 'market_structure')\" },\n note: { type: \"string\", description: \"Optional note about why this handle was promoted\" },\n },\n required: [\"handle\", \"list_name\"],\n },\n },\n {\n name: TOOL_NAMES.rateTweet,\n displayName: \"Rate Tweet\",\n description:\n \"Record relevance feedback on a tweet in the corpus. Agents or humans can rate tweets as relevant, irrelevant, or skip.\",\n parametersSchema: {\n type: \"object\",\n properties: {\n tweet_id: { type: \"string\", description: \"Tweet ID to rate\" },\n rating: { type: \"string\", enum: [\"relevant\", \"irrelevant\", \"skip\"], description: \"Relevance rating\" },\n rated_by: { type: \"string\", description: \"ID of the rater (agent or user)\" },\n },\n required: [\"tweet_id\", \"rating\"],\n },\n },\n ],\n ui: {\n slots: [\n {\n type: \"dashboardWidget\",\n id: SLOT_IDS.dashboardWidget,\n displayName: \"X Intelligence\",\n exportName: EXPORT_NAMES.dashboardWidget,\n },\n {\n type: \"settingsPage\",\n id: SLOT_IDS.settingsPage,\n displayName: \"X Intelligence Settings\",\n exportName: EXPORT_NAMES.settingsPage,\n },\n {\n type: \"page\",\n id: SLOT_IDS.corpusBrowser,\n displayName: \"X Intelligence Corpus\",\n exportName: EXPORT_NAMES.corpusBrowser,\n routePath: \"x-intelligence\",\n },\n ],\n },\n};\n\nexport default manifest;\n"],
5
- "mappings": ";AAAO,IAAM,YAAY;AAClB,IAAM,iBAAiB;AAEvB,IAAM,WAAW;AAAA,EACtB,cAAc;AAAA,EACd,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,iBAAiB;AACnB;AAEO,IAAM,aAAa;AAAA,EACxB,cAAc;AAAA,EACd,UAAU;AAAA,EACV,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,aAAa;AAAA,EACb,cAAc;AAAA,EACd,WAAW;AAAA,EACX,eAAe;AAAA,EACf,WAA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AAM;AAAA,QACN,YAAY;AAAA,UACV,UAAU,EAAE,MAAM,UAAU,aAAa,mBAAmB;AAAA,UAC5D,QAAQ,EAAE,MAAM,UAAU,MAAM,CAAC,YAAY,cAAc,MAAM,GAAG,aAAa,mBAAmB;AAAA,UACpG,UAAU,EAAE,MAAM,UAAU,aAAa,kCAAkC;AAAA,QAC7E;AAAA,QACA,UAAU,CAAC,YAAY,QAAQ;AAAA,MACjC;AAAA,IACF;AAAA,EACF;AAAA,EACA,IAAI;AAAA,IACF,OAAO;AAAA,MACL;AAAA,QACE,MAAM;AAAA,QACN,IAAI,SAAS;AAAA,QACb,aAAa;AAAA,QACb,YAAY,aAAa;AAAA,MAC3B;AAAA,MACA;AAAA,QACE,MAAM;AAAA,QACN,IAAI,SAAS;AAAA,QACb,aAAa;AAAA,QACb,YAAY,aAAa;AAAA,MAC3B;AAAA,MACA;AAAA,QACE,MAAM;AAAA,QACN,IAAI,SAAS;AAAA,QACb,aAAa;AAAA,QACb,YAAY,aAAa;AAAA,QACzB,WAAW;AAAA,MACb;AAAA,IACF;AAAA,EACF;AACF;AAEA,IAAO,mBAAQ;",
4
+ "sourcesContent": ["export const PLUGIN_ID = \"peak6-labs.x-intelligence\";\nexport const PLUGIN_VERSION = \"0.1.4\";\n\nexport const JOB_KEYS = {\n discoveryRun: \"discovery-run\",\n authorityDecay: \"authority-decay\",\n complianceCheck: \"compliance-check\",\n corpusRetention: \"corpus-retention\",\n} as const;\n\nexport const TOOL_NAMES = {\n searchCorpus: \"search-corpus\",\n getToday: \"get-today\",\n getAuthorities: \"get-authorities\",\n suggestHandles: \"suggest-handles\",\n trackHandle: \"track-handle\",\n analyzeTopic: \"analyze-topic\",\n getThread: \"get-thread\",\n promoteHandle: \"promote-handle\",\n rateTweet: \"rate-tweet\",\n searchX: \"search-x\",\n getTrending: \"get-trending\",\n getUserTimeline: \"get-user-timeline\",\n} as const;\n\nexport const SLOT_IDS = {\n dashboardWidget: \"x-intelligence-dashboard\",\n settingsPage: \"x-intelligence-settings\",\n corpusBrowser: \"x-intelligence-corpus-browser\",\n} as const;\n\nexport const EXPORT_NAMES = {\n dashboardWidget: \"DashboardWidget\",\n settingsPage: \"SettingsPage\",\n corpusBrowser: \"CorpusBrowserPage\",\n} as const;\n\nexport const ENTITY_TYPES = {\n tweet: \"tweet\",\n handle: \"handle\",\n} as const;\n\nexport const STATE_KEYS = {\n corpusPrefix: \"corpus:\",\n lastDiscoveryRun: \"last-discovery-run\",\n pipelineStats: \"pipeline-stats\",\n} as const;\n\nexport const EVENT_NAMES = {\n corpusUpdated: \"corpus.updated\",\n handlePromoted: \"handle.promoted\",\n gapIdentified: \"gap.identified\",\n tweetHighEngagement: \"tweet.high-engagement\",\n} as const;\n\nexport const DEFAULT_CONFIG = {\n company_id: \"\",\n xai_api_key_ref: \"XAI_API_KEY\",\n x_api_bearer_ref: \"BEARER_TOKEN\",\n semantic_topics: [\n \"institutional investors discussing market structure reform\",\n \"fintech companies disrupting traditional trading\",\n \"SEC regulatory changes affecting options trading\",\n \"algorithmic trading and quantitative strategies\",\n \"venture capital investing in financial infrastructure\",\n \"PEAK6\",\n \"options market making technology\",\n \"Chicago trading community news\",\n ],\n keyword_searches: [\n \"\\\"PEAK6 Investments\\\" OR \\\"PEAK6\\\" trading fintech\",\n \"fintech and trading technology\",\n \"market structure and regulation\",\n \"options trading strategies and platforms\",\n ],\n content_pillars: [\n \"market structure & regulation\",\n \"fintech & trading technology\",\n \"venture capital & investment\",\n \"Chicago business ecosystem\",\n \"company culture & talent\",\n ],\n scoring_weights: {\n relevance: 0.45,\n recency: 0.25,\n engagement: 0.30,\n },\n engagement_sub_weights: {\n likes: 0.55,\n reposts: 0.25,\n replies: 0.15,\n quotes: 0.05,\n },\n max_corpus_size: 200,\n dedup_threshold: 0.70,\n authority_boost: 0.15,\n authority_lists: {\n market_structure: {\n description: \"Market structure, regulation, SEC reform, options trading\",\n handles: [\n \"LizAnnSonders\",\n \"matt_levine\",\n \"unusual_whales\",\n \"CMEGroup\",\n \"CBOE\",\n \"OptionsHawk\",\n \"InvestorDenis\",\n ],\n last_reviewed: \"2026-03-29\",\n },\n fintech: {\n description: \"Fintech, trading technology, AI in finance\",\n handles: [\n \"twifintech\",\n \"IBSIntelligence\",\n \"privy_io\",\n \"i_Know_First\",\n \"fintech_germany\",\n \"venture_radar\",\n ],\n last_reviewed: \"2026-03-29\",\n },\n venture_capital: {\n description: \"Venture capital investing in financial infrastructure\",\n handles: [\n \"a16z\",\n \"FundersVC\",\n ],\n last_reviewed: \"2026-03-29\",\n },\n chicago_trading: {\n description: \"Chicago trading community, prop firms, PEAK6 ecosystem\",\n handles: [\n \"CBOE\",\n \"CMEGroup\",\n \"boogeymantradez\",\n \"adealafia\",\n ],\n last_reviewed: \"2026-03-29\",\n },\n } as Record<string, AuthorityList>,\n global_excluded: [\"elonmusk\", \"openai\", \"google\", \"microsoft\"],\n authority_promotion_policy: {\n auto_promote_threshold: {\n min_appearances: 7,\n min_avg_relevance: 0.8,\n min_mutual_overlap: 3,\n },\n candidate_threshold: {\n min_appearances: 5,\n min_avg_relevance: 0.7,\n min_mutual_overlap: 2,\n },\n tracking_window_days: 14,\n },\n corpus_retention_days: 90,\n engagement_thresholds: {\n noise_floor: 10,\n expert: 50,\n escalation: 100,\n },\n alert_agents: [] as Array<{ agentId: string; memoryFile: string | null }>,\n} as const;\n\nexport interface AuthorityList {\n description: string;\n handles: string[];\n last_reviewed: string;\n}\n", "import type { PaperclipPluginManifestV1 } from \"@paperclipai/plugin-sdk\";\nimport {\n DEFAULT_CONFIG,\n EXPORT_NAMES,\n JOB_KEYS,\n PLUGIN_ID,\n PLUGIN_VERSION,\n SLOT_IDS,\n TOOL_NAMES,\n} from \"./constants.js\";\n\nconst manifest: PaperclipPluginManifestV1 = {\n id: PLUGIN_ID,\n apiVersion: 1,\n version: PLUGIN_VERSION,\n displayName: \"X Intelligence\",\n description:\n \"Automated X/Twitter intelligence pipeline \u2014 discovery, enrichment, scoring, deduplication, authority list management, and corpus storage.\",\n author: \"peak6-labs\",\n categories: [\"connector\", \"automation\"],\n capabilities: [\n \"http.outbound\",\n \"secrets.read-ref\",\n \"jobs.schedule\",\n \"agent.tools.register\",\n \"plugin.state.read\",\n \"plugin.state.write\",\n \"events.subscribe\",\n \"events.emit\",\n \"issues.read\",\n \"issues.create\",\n \"activity.log.write\",\n \"metrics.write\",\n \"instance.settings.register\",\n \"ui.dashboardWidget.register\",\n \"ui.page.register\",\n \"agents.invoke\",\n \"agents.read\",\n ],\n entrypoints: {\n worker: \"./dist/worker.js\",\n ui: \"./dist/ui\",\n },\n instanceConfigSchema: {\n type: \"object\",\n properties: {\n company_id: {\n type: \"string\",\n title: \"Company ID\",\n description: \"UUID of the company this plugin serves (required for events and activity logging)\",\n default: DEFAULT_CONFIG.company_id,\n },\n xai_api_key_ref: {\n type: \"string\",\n title: \"xAI API Key Secret Reference\",\n default: DEFAULT_CONFIG.xai_api_key_ref,\n },\n x_api_bearer_ref: {\n type: \"string\",\n title: \"X API Bearer Token Secret Reference\",\n default: DEFAULT_CONFIG.x_api_bearer_ref,\n },\n semantic_topics: {\n type: \"array\",\n title: \"Semantic Discovery Topics\",\n items: { type: \"string\" },\n default: DEFAULT_CONFIG.semantic_topics,\n },\n keyword_searches: {\n type: \"array\",\n title: \"Keyword Searches\",\n items: { type: \"string\" },\n default: DEFAULT_CONFIG.keyword_searches,\n },\n content_pillars: {\n type: \"array\",\n title: \"Content Pillars\",\n items: { type: \"string\" },\n default: DEFAULT_CONFIG.content_pillars,\n },\n scoring_weights: {\n type: \"object\",\n title: \"Scoring Weights\",\n properties: {\n relevance: { type: \"number\", default: 0.45 },\n recency: { type: \"number\", default: 0.25 },\n engagement: { type: \"number\", default: 0.30 },\n },\n default: DEFAULT_CONFIG.scoring_weights,\n },\n engagement_sub_weights: {\n type: \"object\",\n title: \"Engagement Sub-Weights\",\n properties: {\n likes: { type: \"number\", default: 0.55 },\n reposts: { type: \"number\", default: 0.25 },\n replies: { type: \"number\", default: 0.15 },\n quotes: { type: \"number\", default: 0.05 },\n },\n default: DEFAULT_CONFIG.engagement_sub_weights,\n },\n max_corpus_size: {\n type: \"number\",\n title: \"Max Corpus Size Per Day\",\n default: DEFAULT_CONFIG.max_corpus_size,\n },\n dedup_threshold: {\n type: \"number\",\n title: \"Dedup Jaccard Threshold\",\n default: DEFAULT_CONFIG.dedup_threshold,\n },\n authority_boost: {\n type: \"number\",\n title: \"Authority Score Boost\",\n default: DEFAULT_CONFIG.authority_boost,\n },\n authority_lists: {\n type: \"object\",\n title: \"Authority Handle Lists\",\n default: DEFAULT_CONFIG.authority_lists,\n },\n global_excluded: {\n type: \"array\",\n title: \"Globally Excluded Handles\",\n items: { type: \"string\" },\n default: DEFAULT_CONFIG.global_excluded,\n },\n authority_promotion_policy: {\n type: \"object\",\n title: \"Authority Promotion Policy\",\n default: DEFAULT_CONFIG.authority_promotion_policy,\n },\n corpus_retention_days: {\n type: \"number\",\n title: \"Corpus Retention (days)\",\n default: DEFAULT_CONFIG.corpus_retention_days,\n },\n engagement_thresholds: {\n type: \"object\",\n title: \"Engagement Thresholds\",\n description: \"Engagement level tiers: noise_floor (filter), expert (highlight), escalation (alert event)\",\n properties: {\n noise_floor: { type: \"number\", default: 10 },\n expert: { type: \"number\", default: 50 },\n escalation: { type: \"number\", default: 100 },\n },\n default: DEFAULT_CONFIG.engagement_thresholds,\n },\n alert_agents: {\n type: \"array\",\n title: \"Alert Agents\",\n description: \"Agents to invoke on high-engagement tweets and corpus updates. Each entry maps an agent ID to an optional memory file for preference-enriched prompts.\",\n items: {\n type: \"object\",\n properties: {\n agentId: { type: \"string\", description: \"Paperclip agent UUID\" },\n memoryFile: { type: [\"string\", \"null\"], description: \"Path to user memory file for enriched prompts (null for raw alerts)\" },\n },\n required: [\"agentId\"],\n },\n default: DEFAULT_CONFIG.alert_agents,\n },\n },\n },\n jobs: [\n {\n jobKey: JOB_KEYS.discoveryRun,\n displayName: \"Discovery Run\",\n description:\n \"Two-stage pipeline: xAI open + focused discovery, X API v2 enrichment, scoring, and corpus storage.\",\n schedule: \"0 6 * * *\",\n },\n {\n jobKey: JOB_KEYS.authorityDecay,\n displayName: \"Authority Decay\",\n description:\n \"Weekly handle decay \u2014 downgrade or remove handles not seen within the tracking window.\",\n schedule: \"0 0 * * 0\",\n },\n {\n jobKey: JOB_KEYS.complianceCheck,\n displayName: \"Compliance Check\",\n description:\n \"Weekly re-check of stored tweets \u2014 remove deleted or suspended content.\",\n schedule: \"0 3 * * 0\",\n },\n {\n jobKey: JOB_KEYS.corpusRetention,\n displayName: \"Corpus Retention\",\n description:\n \"Monthly archive/delete corpus older than the retention window.\",\n schedule: \"0 4 1 * *\",\n },\n ],\n tools: [\n {\n name: TOOL_NAMES.searchCorpus,\n displayName: \"Search X Corpus\",\n description:\n \"Search the scored X intelligence corpus by query text, date range, content pillar, score threshold, and engagement level.\",\n parametersSchema: {\n type: \"object\",\n properties: {\n query: { type: \"string\", description: \"Search query (text match)\" },\n date: { type: \"string\", description: \"Date filter (YYYY-MM-DD)\" },\n pillar: { type: \"string\", description: \"Content pillar filter\" },\n limit: { type: \"number\", description: \"Max results (default 20)\" },\n min_score: { type: \"number\", description: \"Minimum score threshold (0-1)\" },\n min_engagement: { type: \"number\", description: \"Minimum total engagement (likes+reposts+replies+quotes)\" },\n since: { type: \"string\", description: \"Time window: '1h', '3h', '12h', '1d', '7d', or YYYY-MM-DD\" },\n },\n },\n },\n {\n name: TOOL_NAMES.getToday,\n displayName: \"Get Today's Intelligence\",\n description:\n \"Get today's scored X intelligence corpus from entities, optionally filtered by pillar and score threshold.\",\n parametersSchema: {\n type: \"object\",\n properties: {\n pillar: { type: \"string\", description: \"Content pillar filter\" },\n limit: { type: \"number\", description: \"Max results (default 20)\" },\n min_score: { type: \"number\", description: \"Minimum score threshold (0-1)\" },\n },\n },\n },\n {\n name: TOOL_NAMES.getAuthorities,\n displayName: \"Get Authority Handles\",\n description:\n \"Get the authority handle list for a domain, or all domains if none specified.\",\n parametersSchema: {\n type: \"object\",\n properties: {\n list_name: {\n type: \"string\",\n description: \"Domain name (e.g. 'market_structure')\",\n },\n },\n },\n },\n {\n name: TOOL_NAMES.suggestHandles,\n displayName: \"Suggest Handle Promotions\",\n description:\n \"Get handles that are candidates for authority list promotion based on tracking data.\",\n parametersSchema: {\n type: \"object\",\n properties: {},\n },\n },\n {\n name: TOOL_NAMES.trackHandle,\n displayName: \"Track Handle\",\n description:\n \"Record a handle appearance from agent discovery with relevance score and domain.\",\n parametersSchema: {\n type: \"object\",\n properties: {\n handle: { type: \"string\", description: \"X handle (without @)\" },\n relevance: { type: \"number\", description: \"Relevance score (0-1)\" },\n domain: { type: \"string\", description: \"Domain/topic area\" },\n },\n required: [\"handle\", \"relevance\", \"domain\"],\n },\n },\n {\n name: TOOL_NAMES.analyzeTopic,\n displayName: \"Analyze Topic\",\n description:\n \"On-demand xAI search for any topic with 5-perspective decomposition (core, expert voices, pain points, positive signals, link-based) and corpus cross-reference. Returns a synthesis brief.\",\n parametersSchema: {\n type: \"object\",\n properties: {\n topic: { type: \"string\", description: \"Topic to analyze\" },\n include_corpus: { type: \"boolean\", description: \"Cross-reference with stored corpus (default true)\" },\n },\n required: [\"topic\"],\n },\n },\n {\n name: TOOL_NAMES.getThread,\n displayName: \"Get Tweet Thread\",\n description:\n \"Fetch conversation context for a tweet. Returns the target tweet and other tweets in the same conversation thread.\",\n parametersSchema: {\n type: \"object\",\n properties: {\n tweet_id: { type: \"string\", description: \"Tweet ID to get thread for\" },\n },\n required: [\"tweet_id\"],\n },\n },\n {\n name: TOOL_NAMES.promoteHandle,\n displayName: \"Promote Handle\",\n description:\n \"Promote a tracked handle to authority status in a specific domain list. Sets entity status to promoted and records the target list.\",\n parametersSchema: {\n type: \"object\",\n properties: {\n handle: { type: \"string\", description: \"X handle (without @)\" },\n list_name: { type: \"string\", description: \"Authority list to promote to (e.g. 'market_structure')\" },\n note: { type: \"string\", description: \"Optional note about why this handle was promoted\" },\n },\n required: [\"handle\", \"list_name\"],\n },\n },\n {\n name: TOOL_NAMES.rateTweet,\n displayName: \"Rate Tweet\",\n description:\n \"Record relevance feedback on a tweet in the corpus. Agents or humans can rate tweets as relevant, irrelevant, or skip.\",\n parametersSchema: {\n type: \"object\",\n properties: {\n tweet_id: { type: \"string\", description: \"Tweet ID to rate\" },\n rating: { type: \"string\", enum: [\"relevant\", \"irrelevant\", \"skip\"], description: \"Relevance rating\" },\n rated_by: { type: \"string\", description: \"ID of the rater (agent or user)\" },\n },\n required: [\"tweet_id\", \"rating\"],\n },\n },\n {\n name: TOOL_NAMES.searchX,\n displayName: \"Search X\",\n description:\n \"Real-time semantic search on X/Twitter via xAI. Returns scored, enriched tweets without storing to corpus. Works any time \u2014 no pipeline required.\",\n parametersSchema: {\n type: \"object\",\n properties: {\n query: { type: \"string\", description: \"Search query (semantic \u2014 describe what you're looking for)\" },\n limit: { type: \"number\", description: \"Max results (default 20)\" },\n handles: { type: \"array\", items: { type: \"string\" }, description: \"Optional: restrict search to these handles only\" },\n quick: { type: \"boolean\", description: \"Quick mode: skip enrichment, return xAI synthesis + tweet IDs only (lower cost)\" },\n },\n required: [\"query\"],\n },\n },\n {\n name: TOOL_NAMES.getTrending,\n displayName: \"Get Trending\",\n description:\n \"What's trending in PEAK6's configured domains right now. Searches all semantic topics (or a specific pillar) via xAI, enriches and scores results. No pipeline required.\",\n parametersSchema: {\n type: \"object\",\n properties: {\n limit: { type: \"number\", description: \"Max results (default 20)\" },\n pillar: { type: \"string\", description: \"Filter to topics matching this pillar/keyword\" },\n },\n },\n },\n {\n name: TOOL_NAMES.getUserTimeline,\n displayName: \"Get User Timeline\",\n description:\n \"Fetch a user's recent tweets from X/Twitter. Returns enriched tweet data with metrics.\",\n parametersSchema: {\n type: \"object\",\n properties: {\n handle: { type: \"string\", description: \"X handle (without @)\" },\n limit: { type: \"number\", description: \"Max tweets to return (default 20, max 100)\" },\n since: { type: \"string\", description: \"Only return tweets after this date (YYYY-MM-DD)\" },\n },\n required: [\"handle\"],\n },\n },\n ],\n ui: {\n slots: [\n {\n type: \"dashboardWidget\",\n id: SLOT_IDS.dashboardWidget,\n displayName: \"X Intelligence\",\n exportName: EXPORT_NAMES.dashboardWidget,\n },\n {\n type: \"settingsPage\",\n id: SLOT_IDS.settingsPage,\n displayName: \"X Intelligence Settings\",\n exportName: EXPORT_NAMES.settingsPage,\n },\n {\n type: \"page\",\n id: SLOT_IDS.corpusBrowser,\n displayName: \"X Intelligence Corpus\",\n exportName: EXPORT_NAMES.corpusBrowser,\n routePath: \"x-intelligence\",\n },\n ],\n },\n};\n\nexport default manifest;\n"],
5
+ "mappings": ";AAAO,IAAM,YAAY;AAClB,IAAM,iBAAiB;AAEvB,IAAM,WAAW;AAAA,EACtB,cAAc;AAAA,EACd,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,iBAAiB;AACnB;AAEO,IAAM,aAAa;AAAA,EACxB,cAAc;AAAA,EACd,UAAU;AAAA,EACV,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,aAAa;AAAA,EACb,cAAc;AAAA,EACd,WAAW;AAAA,EACX,eAAe;AAAA,EACf,WAAW;AAAA,EACX,SAAS;AAAA,EACT,aAAa;AAAA,EACb,iBAAiB;AACnB;AAEO,IAAM,WAAW;AAAA,EACtB,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,eAAe;AACjB;AAEO,IAAM,eAAe;AAAA,EAC1B,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,eAAe;AACjB;AAoBO,IAAM,iBAAiB;AAAA,EAC5B,YAAY;AAAA,EACZ,iBAAiB;AAAA,EACjB,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,kBAAkB;AAAA,IAChB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,iBAAiB;AAA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I;AAAA,IACF,OAAO;AAAA,MACL;AAAA,QACE,MAAM;AAAA,QACN,IAAI,SAAS;AAAA,QACb,aAAa;AAAA,QACb,YAAY,aAAa;AAAA,MAC3B;AAAA,MACA;AAAA,QACE,MAAM;AAAA,QACN,IAAI,SAAS;AAAA,QACb,aAAa;AAAA,QACb,YAAY,aAAa;AAAA,MAC3B;AAAA,MACA;AAAA,QACE,MAAM;AAAA,QACN,IAAI,SAAS;AAAA,QACb,aAAa;AAAA,QACb,YAAY,aAAa;AAAA,QACzB,WAAW;AAAA,MACb;AAAA,IACF;AAAA,EACF;AACF;AAEA,IAAO,mBAAQ;",
6
6
  "names": []
7
7
  }
package/dist/worker.js CHANGED
@@ -905,7 +905,10 @@ var TOOL_NAMES = {
905
905
  analyzeTopic: "analyze-topic",
906
906
  getThread: "get-thread",
907
907
  promoteHandle: "promote-handle",
908
- rateTweet: "rate-tweet"
908
+ rateTweet: "rate-tweet",
909
+ searchX: "search-x",
910
+ getTrending: "get-trending",
911
+ getUserTimeline: "get-user-timeline"
909
912
  };
910
913
  var ENTITY_TYPES = {
911
914
  tweet: "tweet",
@@ -1027,7 +1030,8 @@ var DEFAULT_CONFIG = {
1027
1030
  noise_floor: 10,
1028
1031
  expert: 50,
1029
1032
  escalation: 100
1030
- }
1033
+ },
1034
+ alert_agents: []
1031
1035
  };
1032
1036
 
1033
1037
  // src/pipeline/xai-client.ts
@@ -1244,6 +1248,48 @@ async function fetchConversationTweets(http, secrets, logger, bearerRef, convers
1244
1248
  logger.debug("Conversation tweets fetched", { conversationId, count: tweets.length });
1245
1249
  return tweets;
1246
1250
  }
1251
+ async function fetchUserTimeline(http, secrets, logger, bearerRef, username, limit, sinceDate) {
1252
+ const bearerToken = await secrets.resolve(bearerRef);
1253
+ const userUrl = `${X_API_BASE}/users/by/username/${encodeURIComponent(username)}?user.fields=${USER_FIELDS}`;
1254
+ const userResponse = await http.fetch(userUrl, {
1255
+ method: "GET",
1256
+ headers: { Authorization: `Bearer ${bearerToken}` }
1257
+ });
1258
+ if (!userResponse.ok) {
1259
+ const errorText = await userResponse.text();
1260
+ throw new Error(`X API user lookup failed for @${username}: ${userResponse.status} ${errorText}`);
1261
+ }
1262
+ const userData = await userResponse.json();
1263
+ if (!userData.data) {
1264
+ throw new Error(`User @${username} not found`);
1265
+ }
1266
+ const userId = userData.data.id;
1267
+ const user = userData.data;
1268
+ const apiLimit = Math.min(Math.max(limit, 5), 100);
1269
+ let timelineUrl = `${X_API_BASE}/users/${userId}/tweets?tweet.fields=${TWEET_FIELDS}&max_results=${apiLimit}`;
1270
+ if (sinceDate) {
1271
+ timelineUrl += `&start_time=${sinceDate}T00:00:00Z`;
1272
+ }
1273
+ logger.debug("Fetching user timeline", { username, userId, limit: apiLimit });
1274
+ const timelineResponse = await http.fetch(timelineUrl, {
1275
+ method: "GET",
1276
+ headers: { Authorization: `Bearer ${bearerToken}` }
1277
+ });
1278
+ if (!timelineResponse.ok) {
1279
+ const errorText = await timelineResponse.text();
1280
+ throw new Error(`X API timeline fetch failed for @${username}: ${timelineResponse.status} ${errorText}`);
1281
+ }
1282
+ const timelineData = await timelineResponse.json();
1283
+ const tweets = [];
1284
+ if (timelineData.data) {
1285
+ for (const tweet of timelineData.data) {
1286
+ tweets.push(mapToEnrichedTweet(tweet, user, "open_discovery"));
1287
+ }
1288
+ }
1289
+ const trimmed = tweets.slice(0, limit);
1290
+ logger.debug("User timeline fetched", { username, count: trimmed.length });
1291
+ return trimmed;
1292
+ }
1247
1293
 
1248
1294
  // src/pipeline/scoring.ts
1249
1295
  function trigrams(text) {
@@ -1679,6 +1725,9 @@ function crossReferenceCorpus(topic, corpus) {
1679
1725
 
1680
1726
  // src/worker.ts
1681
1727
  function tweetUrl(authorUsername, tweetId) {
1728
+ if (!authorUsername || authorUsername === "unknown") {
1729
+ return `https://x.com/i/status/${tweetId}`;
1730
+ }
1682
1731
  return `https://x.com/${authorUsername}/status/${tweetId}`;
1683
1732
  }
1684
1733
  function withUrl(tweet) {
@@ -1841,6 +1890,19 @@ async function runDiscoveryPipeline(ctx, job) {
1841
1890
  threshold_crossed: "escalation"
1842
1891
  });
1843
1892
  await ctx.metrics.write("pipeline.tweet.high_engagement", 1);
1893
+ const highEngAlertContext = [
1894
+ "=== X Intelligence: High-Engagement Tweet Alert ===",
1895
+ `Threshold crossed: escalation (${engagementThresholds.escalation}+ engagements)`,
1896
+ "",
1897
+ `Author: @${tweet.author_username}${tweet.is_authority ? " (authority)" : ""}`,
1898
+ `Score: ${tweet.score.toFixed(2)}`,
1899
+ `Total engagement: ${totalEngagement}`,
1900
+ `Likes: ${tweet.metrics.like_count} | Reposts: ${tweet.metrics.retweet_count} | Replies: ${tweet.metrics.reply_count} | Quotes: ${tweet.metrics.quote_count}`,
1901
+ "",
1902
+ `Text: ${tweet.text.slice(0, 280)}`,
1903
+ `URL: ${tweetUrl(tweet.author_username, tweet.tweet_id)}`
1904
+ ].join("\n");
1905
+ await invokeAlertAgents(ctx, config, highEngAlertContext);
1844
1906
  }
1845
1907
  }
1846
1908
  for (const tweet of corpus) {
@@ -1907,6 +1969,21 @@ async function runDiscoveryPipeline(ctx, job) {
1907
1969
  authority_count: Object.values(config.authority_lists).reduce((n, l) => n + l.handles.length, 0),
1908
1970
  handle_candidates: handleStats.discovered
1909
1971
  });
1972
+ const corpusAlertContext = [
1973
+ "=== X Intelligence: Corpus Updated ===",
1974
+ `Date: ${today}`,
1975
+ `Corpus size: ${corpus.length} tweets`,
1976
+ `Top score: ${(corpus[0]?.score ?? 0).toFixed(2)}`,
1977
+ "",
1978
+ "Top items:",
1979
+ ...corpus.slice(0, 5).map(
1980
+ (t) => `- @${t.author_username} (score: ${t.score.toFixed(2)}): ${t.text.slice(0, 120)} ${tweetUrl(t.author_username, t.tweet_id)}`
1981
+ ),
1982
+ "",
1983
+ `Discovery stats: ${openQueries.length} open queries, ${focusedQueries.length} focused queries`,
1984
+ `New handles discovered: ${handleStats.discovered}`
1985
+ ].join("\n");
1986
+ await invokeAlertAgents(ctx, config, corpusAlertContext);
1910
1987
  for (const promo of promotions) {
1911
1988
  if (promo.status === "promoted") {
1912
1989
  await ctx.events.emit(EVENT_NAMES.handlePromoted, config.company_id, {
@@ -2356,6 +2433,237 @@ async function handleRateTweet(ctx, params, runCtx) {
2356
2433
  ${ratedUrl}`
2357
2434
  };
2358
2435
  }
2436
+ async function handleSearchX(ctx, params, _runCtx) {
2437
+ const p = params;
2438
+ const query = typeof p.query === "string" ? p.query : "";
2439
+ const limit = typeof p.limit === "number" ? p.limit : 20;
2440
+ const handles = Array.isArray(p.handles) ? p.handles : void 0;
2441
+ const quick = p.quick === true;
2442
+ if (!query) return { error: "query is required" };
2443
+ const config = await getConfig(ctx);
2444
+ await ctx.metrics.write("tool.search_x.invoked", 1);
2445
+ const today = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
2446
+ const threeDaysAgo = new Date(Date.now() - 3 * 864e5).toISOString().split("T")[0];
2447
+ let totalCost = 0;
2448
+ const result = await xaiSearch(
2449
+ ctx.http,
2450
+ ctx.secrets,
2451
+ ctx.logger,
2452
+ config.xai_api_key_ref,
2453
+ {
2454
+ query,
2455
+ fromDate: threeDaysAgo,
2456
+ toDate: today,
2457
+ allowedHandles: handles,
2458
+ excludedHandles: handles ? void 0 : config.global_excluded
2459
+ }
2460
+ );
2461
+ totalCost += result.costUsdTicks;
2462
+ if (quick) {
2463
+ const limitedIds = result.tweetIds.slice(0, limit);
2464
+ await ctx.metrics.write("tool.search_x.cost", totalCost / 1e9);
2465
+ return {
2466
+ content: `Search for "${query}" (quick mode): ${limitedIds.length} tweets found.
2467
+
2468
+ ${result.synthesisText}`,
2469
+ data: {
2470
+ query,
2471
+ mode: "quick",
2472
+ tweet_ids: limitedIds,
2473
+ synthesis: result.synthesisText,
2474
+ cost_usd: totalCost / 1e9
2475
+ }
2476
+ };
2477
+ }
2478
+ const tweets = await batchLookupTweets(
2479
+ ctx.http,
2480
+ ctx.secrets,
2481
+ ctx.logger,
2482
+ config.x_api_bearer_ref,
2483
+ result.tweetIds,
2484
+ "open_discovery"
2485
+ );
2486
+ const { allHandles, byDomain } = buildAuthorityMaps(config);
2487
+ const scored = scoreTweets(
2488
+ tweets,
2489
+ config.scoring_weights,
2490
+ config.engagement_sub_weights,
2491
+ config.authority_boost,
2492
+ allHandles,
2493
+ byDomain,
2494
+ config.semantic_topics
2495
+ );
2496
+ const deduped = deduplicateTweets(scored, config.dedup_threshold);
2497
+ const limited = deduped.slice(0, limit).map(withUrl);
2498
+ await ctx.metrics.write("tool.search_x.cost", totalCost / 1e9);
2499
+ const topLinks = limited.slice(0, 5).map(
2500
+ (t) => `- @${t.author_username} (score: ${t.score.toFixed(1)}): ${t.url}`
2501
+ ).join("\n");
2502
+ return {
2503
+ content: `Search for "${query}": ${limited.length} enriched tweets (of ${deduped.length} unique).
2504
+
2505
+ Top results:
2506
+ ${topLinks}
2507
+
2508
+ Synthesis:
2509
+ ${result.synthesisText}`,
2510
+ data: {
2511
+ query,
2512
+ mode: "full",
2513
+ items: limited,
2514
+ total_unique: deduped.length,
2515
+ synthesis: result.synthesisText,
2516
+ cost_usd: totalCost / 1e9
2517
+ }
2518
+ };
2519
+ }
2520
+ async function handleGetTrending(ctx, params, _runCtx) {
2521
+ const p = params;
2522
+ const limit = typeof p.limit === "number" ? p.limit : 20;
2523
+ const pillar = typeof p.pillar === "string" ? p.pillar : void 0;
2524
+ const config = await getConfig(ctx);
2525
+ await ctx.metrics.write("tool.get_trending.invoked", 1);
2526
+ const today = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
2527
+ const threeDaysAgo = new Date(Date.now() - 3 * 864e5).toISOString().split("T")[0];
2528
+ const topics = pillar ? (() => {
2529
+ const words = pillar.toLowerCase().split(/[^a-z0-9]+/).filter((w) => w.length > 2);
2530
+ return config.semantic_topics.filter((t) => {
2531
+ const lower = t.toLowerCase();
2532
+ return words.some((w) => lower.includes(w));
2533
+ });
2534
+ })() : config.semantic_topics;
2535
+ if (topics.length === 0) {
2536
+ return {
2537
+ error: pillar ? `No semantic topics match pillar "${pillar}". Available topics: ${config.semantic_topics.join(", ")}` : "No semantic topics configured"
2538
+ };
2539
+ }
2540
+ const queries = buildOpenQueries(topics, [], today);
2541
+ const allTweetIdArrays = [];
2542
+ let totalCost = 0;
2543
+ for (const query of queries) {
2544
+ try {
2545
+ const result = await xaiSearch(
2546
+ ctx.http,
2547
+ ctx.secrets,
2548
+ ctx.logger,
2549
+ config.xai_api_key_ref,
2550
+ { query: query.text, fromDate: threeDaysAgo, toDate: today, excludedHandles: config.global_excluded }
2551
+ );
2552
+ allTweetIdArrays.push(result.tweetIds);
2553
+ totalCost += result.costUsdTicks;
2554
+ } catch (err) {
2555
+ ctx.logger.warn("Trending query failed", {
2556
+ query: query.text,
2557
+ error: err instanceof Error ? err.message : String(err)
2558
+ });
2559
+ }
2560
+ }
2561
+ const tweetIds = deduplicateIds(allTweetIdArrays);
2562
+ const tweets = await batchLookupTweets(
2563
+ ctx.http,
2564
+ ctx.secrets,
2565
+ ctx.logger,
2566
+ config.x_api_bearer_ref,
2567
+ tweetIds,
2568
+ "open_discovery"
2569
+ );
2570
+ const { allHandles, byDomain } = buildAuthorityMaps(config);
2571
+ const scored = scoreTweets(
2572
+ tweets,
2573
+ config.scoring_weights,
2574
+ config.engagement_sub_weights,
2575
+ config.authority_boost,
2576
+ allHandles,
2577
+ byDomain,
2578
+ config.semantic_topics
2579
+ );
2580
+ const deduped = deduplicateTweets(scored, config.dedup_threshold);
2581
+ const limited = deduped.slice(0, limit).map(withUrl);
2582
+ await ctx.metrics.write("tool.get_trending.cost", totalCost / 1e9);
2583
+ const topLinks = limited.slice(0, 5).map(
2584
+ (t) => `- @${t.author_username} (score: ${t.score.toFixed(1)}): ${t.url}`
2585
+ ).join("\n");
2586
+ return {
2587
+ content: `Trending${pillar ? ` in "${pillar}"` : ""}: ${limited.length} tweets across ${queries.length} topics.
2588
+
2589
+ Top results:
2590
+ ${topLinks}`,
2591
+ data: {
2592
+ pillar: pillar ?? null,
2593
+ topics_queried: queries.length,
2594
+ items: limited,
2595
+ total_unique: deduped.length,
2596
+ cost_usd: totalCost / 1e9
2597
+ }
2598
+ };
2599
+ }
2600
+ async function handleGetUserTimeline(ctx, params, _runCtx) {
2601
+ const p = params;
2602
+ const handle = typeof p.handle === "string" ? p.handle.replace(/^@/, "") : "";
2603
+ const limit = typeof p.limit === "number" ? p.limit : 20;
2604
+ const since = typeof p.since === "string" ? p.since : void 0;
2605
+ if (!handle) return { error: "handle is required" };
2606
+ const config = await getConfig(ctx);
2607
+ await ctx.metrics.write("tool.get_user_timeline.invoked", 1);
2608
+ try {
2609
+ const tweets = await fetchUserTimeline(
2610
+ ctx.http,
2611
+ ctx.secrets,
2612
+ ctx.logger,
2613
+ config.x_api_bearer_ref,
2614
+ handle,
2615
+ limit,
2616
+ since
2617
+ );
2618
+ const tweetsWithUrls = tweets.map(withUrl);
2619
+ const topLinks = tweetsWithUrls.slice(0, 5).map((t) => `- ${t.url}`).join("\n");
2620
+ return {
2621
+ content: `@${handle}'s timeline: ${tweetsWithUrls.length} tweets${since ? ` since ${since}` : ""}.
2622
+
2623
+ Recent:
2624
+ ${topLinks}`,
2625
+ data: {
2626
+ handle,
2627
+ items: tweetsWithUrls,
2628
+ total: tweetsWithUrls.length
2629
+ }
2630
+ };
2631
+ } catch (err) {
2632
+ return {
2633
+ error: `Failed to fetch timeline for @${handle}: ${err instanceof Error ? err.message : String(err)}`
2634
+ };
2635
+ }
2636
+ }
2637
+ async function invokeAlertAgents(ctx, config, alertContext) {
2638
+ const alertAgents = config.alert_agents ?? [];
2639
+ if (alertAgents.length === 0) return;
2640
+ for (const agent of alertAgents) {
2641
+ try {
2642
+ let prompt = alertContext;
2643
+ if (agent.memoryFile) {
2644
+ prompt = `${alertContext}
2645
+
2646
+ --- Memory File ---
2647
+ Load your user's preferences from: ${agent.memoryFile}
2648
+ Apply their alert thresholds and topic interests when deciding how to handle this alert.`;
2649
+ }
2650
+ const result = await ctx.agents.invoke(agent.agentId, config.company_id, {
2651
+ prompt,
2652
+ reason: "x-intelligence-alert"
2653
+ });
2654
+ ctx.logger.info("Agent invoked for alert", {
2655
+ agentId: agent.agentId,
2656
+ runId: result.runId,
2657
+ enriched: !!agent.memoryFile
2658
+ });
2659
+ } catch (err) {
2660
+ ctx.logger.warn("Failed to invoke agent for alert", {
2661
+ agentId: agent.agentId,
2662
+ error: err instanceof Error ? err.message : String(err)
2663
+ });
2664
+ }
2665
+ }
2666
+ }
2359
2667
  var plugin = definePlugin({
2360
2668
  async setup(ctx) {
2361
2669
  pluginCtx = ctx;
@@ -2408,6 +2716,21 @@ var plugin = definePlugin({
2408
2716
  { displayName: "Rate Tweet", description: "Record relevance feedback on a corpus tweet", parametersSchema: {} },
2409
2717
  (params, runCtx) => handleRateTweet(ctx, params, runCtx)
2410
2718
  );
2719
+ ctx.tools.register(
2720
+ TOOL_NAMES.searchX,
2721
+ { displayName: "Search X", description: "Real-time semantic search on X/Twitter via xAI. Any query, any time \u2014 no pipeline required.", parametersSchema: {} },
2722
+ (params, runCtx) => handleSearchX(ctx, params, runCtx)
2723
+ );
2724
+ ctx.tools.register(
2725
+ TOOL_NAMES.getTrending,
2726
+ { displayName: "Get Trending", description: "What's trending in PEAK6's configured domains right now. No pipeline required.", parametersSchema: {} },
2727
+ (params, runCtx) => handleGetTrending(ctx, params, runCtx)
2728
+ );
2729
+ ctx.tools.register(
2730
+ TOOL_NAMES.getUserTimeline,
2731
+ { displayName: "Get User Timeline", description: "Fetch a user's recent tweets from X/Twitter.", parametersSchema: {} },
2732
+ (params, runCtx) => handleGetUserTimeline(ctx, params, runCtx)
2733
+ );
2411
2734
  ctx.data.register("dashboard-summary", async () => {
2412
2735
  const today = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
2413
2736
  const summary = await ctx.state.get({