@lobu/runtime-device 22.0.0 → 24.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/dist/component.json +1 -1
  2. package/dist/dependencies.bun.lock +33 -30
  3. package/npm-shrinkwrap.json +140 -124
  4. package/package.json +2 -1
  5. package/vendor/cli/dist/bundled-skills/lobu/SKILL.md +74 -1
  6. package/vendor/cli/dist/commands/_lib/apply/apply-cmd.js +9 -11
  7. package/vendor/cli/dist/commands/_lib/apply/client.d.ts +3 -11
  8. package/vendor/cli/dist/commands/_lib/apply/client.js +3 -3
  9. package/vendor/cli/dist/commands/_lib/apply/desired-state.d.ts +0 -6
  10. package/vendor/cli/dist/commands/_lib/apply/desired-state.js +6 -15
  11. package/vendor/cli/dist/commands/_lib/apply/diff.js +1 -0
  12. package/vendor/cli/dist/commands/_lib/apply/map-config.js +8 -0
  13. package/vendor/cli/dist/commands/_lib/view-bundler.d.ts +2 -9
  14. package/vendor/cli/dist/commands/_lib/view-bundler.js +25 -97
  15. package/vendor/cli/dist/config/define.d.ts +8 -0
  16. package/vendor/cli/dist/connectors/README.md +15 -2
  17. package/vendor/cli/dist/connectors/google_gmail.ts +1 -0
  18. package/vendor/cli/dist/connectors/jira-helpers.ts +313 -0
  19. package/vendor/cli/dist/connectors/jira.ts +29 -221
  20. package/vendor/cli/dist/connectors/linkedin-browser-script.ts +13 -0
  21. package/vendor/cli/dist/connectors/linkedin-draft-page.js +104 -0
  22. package/vendor/cli/dist/connectors/linkedin-drafts.ts +73 -0
  23. package/vendor/cli/dist/connectors/linkedin-identity.ts +32 -0
  24. package/vendor/cli/dist/connectors/linkedin-inbox-adapter.js +1182 -0
  25. package/vendor/cli/dist/connectors/linkedin-inbox.ts +156 -0
  26. package/vendor/cli/dist/connectors/linkedin-like.ts +114 -0
  27. package/vendor/cli/dist/connectors/linkedin-takeout.ts +577 -0
  28. package/vendor/cli/dist/connectors/linkedin.ts +4017 -0
  29. package/vendor/cli/dist/connectors/reddit.ts +92 -20
  30. package/vendor/cli/dist/connectors/slack.ts +1 -0
  31. package/vendor/cli/dist/connectors/takeout-utils.ts +240 -0
  32. package/vendor/cli/dist/connectors/tiktok-inbox-page.js +9 -9
  33. package/vendor/cli/dist/connectors/tiktok-web-page.js +21 -15
  34. package/vendor/cli/dist/connectors/tiktok_web.ts +63 -30
  35. package/vendor/cli/dist/connectors/whatsapp-web-adapter.js +104 -574
  36. package/vendor/cli/dist/connectors/whatsapp-web-helpers.ts +30 -444
  37. package/vendor/cli/dist/connectors/whatsapp-web-identity.ts +20 -6
  38. package/vendor/cli/dist/connectors/whatsapp_web.ts +46 -646
  39. package/vendor/cli/dist/connectors/x-dm-adapter.js +556 -0
  40. package/vendor/cli/dist/connectors/x-identity.ts +33 -2
  41. package/vendor/cli/dist/connectors/x.ts +266 -120
  42. package/vendor/cli/dist/runtime-components.json +4 -4
  43. package/vendor/cli/dist/templates/AGENTS.md.tmpl +12 -5
  44. package/vendor/cli/package.json +1 -1
  45. package/vendor/connector-sdk/dist/browser-handoff-banner.d.ts +39 -0
  46. package/vendor/connector-sdk/dist/browser-handoff-banner.js +175 -0
  47. package/vendor/connector-sdk/dist/browser-source-read.d.ts +52 -0
  48. package/vendor/connector-sdk/dist/browser-source-read.js +107 -0
  49. package/vendor/connector-sdk/dist/connector-types.d.ts +10 -0
  50. package/vendor/connector-sdk/dist/index.d.ts +3 -0
  51. package/vendor/connector-sdk/dist/index.js +2 -0
  52. package/vendor/connector-sdk/package.json +9 -1
  53. package/vendor/connector-worker/dist/agent-turn/gateway-tools.d.ts +2 -2
  54. package/vendor/connector-worker/dist/agent-turn/gateway-tools.js +2 -2
  55. package/vendor/connector-worker/dist/agent-turn/guest-entry.js +49 -8
  56. package/vendor/connector-worker/dist/agent-turn/guest.bundle.js +650 -448
  57. package/vendor/connector-worker/dist/agent-turn/native-session.d.ts +12 -0
  58. package/vendor/connector-worker/dist/agent-turn/native-session.js +32 -6
  59. package/vendor/connector-worker/dist/agent-turn/types.d.ts +24 -3
  60. package/vendor/connector-worker/dist/daemon/agent-turn.js +5 -1
  61. package/vendor/connector-worker/dist/daemon/automation.d.ts +4 -11
  62. package/vendor/connector-worker/dist/daemon/automation.js +26 -21
  63. package/vendor/connector-worker/dist/daemon/client.d.ts +2 -4
  64. package/vendor/connector-worker/dist/daemon/client.js +0 -3
  65. package/vendor/connector-worker/dist/daemon/executor.js +0 -3
  66. package/vendor/connector-worker/dist/daemon/mac-device-daemon.d.ts +4 -3
  67. package/vendor/connector-worker/dist/daemon/mac-device-daemon.js +4 -10
  68. package/vendor/connector-worker/dist/daemon/native-bridge/executor.js +27 -25
  69. package/vendor/connector-worker/dist/daemon/start.js +3 -15
  70. package/vendor/connector-worker/dist/daemon/terminal-failure.js +0 -11
  71. package/vendor/connector-worker/dist/daemon/worker-id.d.ts +17 -0
  72. package/vendor/connector-worker/dist/daemon/worker-id.js +22 -0
  73. package/vendor/connector-worker/dist/isolate/prelude.js +93 -44
  74. package/vendor/connector-worker/dist/mac-device-daemon.js +14 -26
  75. package/vendor/connector-worker/package.json +1 -1
  76. package/vendor/core/dist/agent-policy.js +0 -3
  77. package/vendor/core/dist/agent-tooling.d.ts +1 -1
  78. package/vendor/core/dist/agent-tooling.js +3 -1
  79. package/vendor/core/dist/capabilities.d.ts +1 -1
  80. package/vendor/core/dist/capabilities.js +0 -1
  81. package/vendor/core/dist/connector-query-errors.d.ts +32 -0
  82. package/vendor/core/dist/connector-query-errors.js +41 -1
  83. package/vendor/core/dist/contracts/agent-settings.d.ts +6 -2
  84. package/vendor/core/dist/contracts/agent-settings.js +12 -1
  85. package/vendor/core/dist/contracts/tools/manage-conversations.js +2 -2
  86. package/vendor/core/dist/contracts/tools/manage-feeds.d.ts +14 -0
  87. package/vendor/core/dist/contracts/tools/manage-feeds.js +17 -0
  88. package/vendor/core/dist/contracts/tools/manage-views.d.ts +53 -234
  89. package/vendor/core/dist/contracts/tools/manage-views.js +50 -76
  90. package/vendor/core/dist/contracts/tools/view-attach.d.ts +5 -8
  91. package/vendor/core/dist/contracts/tools/view-attach.js +14 -31
  92. package/vendor/core/dist/contracts/tools/view-definition.d.ts +21 -0
  93. package/vendor/core/dist/contracts/tools/view-definition.js +165 -0
  94. package/vendor/core/dist/contracts/worker/protocol.d.ts +47 -133
  95. package/vendor/core/dist/contracts/worker/protocol.js +33 -62
  96. package/vendor/core/dist/device-pin-tombstones.d.ts +44 -0
  97. package/vendor/core/dist/device-pin-tombstones.js +57 -0
  98. package/vendor/core/dist/index.d.ts +3 -2
  99. package/vendor/core/dist/index.js +3 -1
  100. package/vendor/core/dist/logger.js +10 -25
  101. package/vendor/core/dist/suggestions.d.ts +15 -2
  102. package/vendor/core/dist/suggestions.js +48 -3
  103. package/vendor/core/dist/types.d.ts +26 -0
  104. package/vendor/core/dist/types.js +5 -0
  105. package/vendor/core/dist/utils/diagnostic-scrubber.js +258 -21
  106. package/vendor/core/dist/worker/wire.d.ts +0 -10
  107. package/vendor/core/package.json +16 -10
  108. package/vendor/postgres/cf/src/connection.js +18 -0
  109. package/vendor/postgres/cjs/src/connection.js +18 -0
  110. package/vendor/postgres/src/connection.js +18 -0
  111. package/vendor/connector-worker/dist/daemon/device-chat.d.ts +0 -9
  112. package/vendor/connector-worker/dist/daemon/device-chat.js +0 -61
  113. package/vendor/core/dist/contracts/worker/device-chat.d.ts +0 -4
  114. package/vendor/core/dist/contracts/worker/device-chat.js +0 -26
  115. /package/vendor/postgres/{.bun-tag-f39dafdb2305d504 → .bun-tag-2f292c6554a8475e} +0 -0
@@ -20,6 +20,9 @@
20
20
  * - liked_tweets: posts the user has liked (API v2 or signed-in extension backfill)
21
21
  * - bookmarks: posts the user has bookmarked (API v2 or extension)
22
22
  * - direct_messages: 1:1 and group DMs (OAuth API; extension fallback on /messages)
23
+ * - live_messages: DMs read live from the signed-in browser without importing
24
+ * history; Automations subscribe to `message.created` and can
25
+ * answer through `send_message`
23
26
  * - following_timeline: live chronological Following timeline (OAuth API,
24
27
  * source reads only; does not import tweet events)
25
28
  * - home_feed: personalized x.com home timeline (extension only — the
@@ -29,9 +32,13 @@
29
32
  */
30
33
 
31
34
  import {
32
- requireBrowser,
33
35
  type ActionContext,
34
36
  type ActionResult,
37
+ assertNoMatch,
38
+ assertNoOffsetPaging,
39
+ assertNoSort,
40
+ assertNoWindow,
41
+ buildInjectHandoffBannerExpression as buildSharedHandoffBannerExpression,
35
42
  type ChromeActionDispatcher,
36
43
  ConnectorRuntime,
37
44
  calculateEngagementScore,
@@ -42,15 +49,19 @@ import {
42
49
  type EventEnvelope,
43
50
  extensionDomScrape,
44
51
  extensionNetworkSync,
52
+ type FeedObserveContext,
45
53
  type FeedReadContext,
46
54
  type FeedReadResult,
47
55
  type HttpClient,
48
56
  HttpStatusError,
49
57
  paginateByCursor,
50
58
  type RuntimeConnectorDefinition,
59
+ requireBrowser,
51
60
  type SyncContext,
52
61
  type SyncResult,
62
+ truncateHandoffReason as truncateSharedHandoffReason,
53
63
  } from "@lobu/connector-sdk";
64
+ import { xDirectMessagesProgram } from "./x-dm-adapter.js";
54
65
 
55
66
  /** What one X sync gathers before it is committed. */
56
67
  type XSyncPage = {
@@ -2707,16 +2718,16 @@ const dmMetadataSchema = {
2707
2718
  // type it, so this drives the paired Owletto Chrome and stops before submit.
2708
2719
 
2709
2720
  /** Cap the explanation shown in the in-page banner. Mirrors linkedin. */
2710
- export function truncateHandoffReason(
2711
- reason: string | undefined | null,
2712
- maxLen = 120,
2713
- ): string | undefined {
2714
- if (reason == null) return undefined;
2715
- const t = reason.replace(/\s+/g, " ").trim();
2716
- if (!t) return undefined;
2717
- if (t.length <= maxLen) return t;
2718
- return `${t.slice(0, Math.max(0, maxLen - 1)).trimEnd()}…`;
2719
- }
2721
+ export const truncateHandoffReason = truncateSharedHandoffReason;
2722
+
2723
+ const X_HANDOFF_TITLE = "Lobu staged this reply";
2724
+ const X_HANDOFF_INSTRUCTION =
2725
+ "Review the draft and click Reply yourself — Lobu did not submit.";
2726
+ const X_HANDOFF_COMPOSER_SELECTORS = [
2727
+ '[data-testid="tweetTextarea_0"]',
2728
+ 'div[role="textbox"][contenteditable="true"]',
2729
+ ];
2730
+ const X_HANDOFF_HOST_SELECTORS = ["form"];
2720
2731
 
2721
2732
  /**
2722
2733
  * JS expression: inject a small Lobu handoff banner above X's reply composer,
@@ -2734,113 +2745,13 @@ export function truncateHandoffReason(
2734
2745
  export function buildInjectHandoffBannerExpression(opts: {
2735
2746
  reason?: string;
2736
2747
  }): string {
2737
- const reason = truncateHandoffReason(opts.reason);
2738
- const titleLit = JSON.stringify("Lobu staged this reply");
2739
- const reasonLit = JSON.stringify(reason ?? null);
2740
- return `(async()=>{
2741
- const TITLE = ${titleLit};
2742
- const REASON = ${reasonLit};
2743
- const ID = 'lobu-handoff-banner';
2744
- try {
2745
- const prev = document.getElementById(ID);
2746
- if (prev) prev.remove();
2747
- } catch (_) {}
2748
-
2749
- const root = document.createElement('div');
2750
- root.id = ID;
2751
- root.setAttribute('role', 'status');
2752
- root.setAttribute('data-lobu', 'handoff-banner');
2753
- root.style.cssText = [
2754
- 'position:fixed',
2755
- 'top:12px',
2756
- 'left:50%',
2757
- 'transform:translateX(-50%)',
2758
- 'z-index:2147483646',
2759
- 'max-width:min(520px,calc(100vw - 24px))',
2760
- 'font:13px/1.4 -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif',
2761
- 'color:#0f172a',
2762
- 'background:#fff',
2763
- 'border:1px solid #cbd5e1',
2764
- 'border-left:4px solid #0ea5e9',
2765
- 'border-radius:10px',
2766
- 'box-shadow:0 8px 28px rgba(15,23,42,.18)',
2767
- 'padding:10px 12px',
2768
- 'display:flex',
2769
- 'gap:10px',
2770
- 'align-items:flex-start',
2771
- 'pointer-events:auto',
2772
- ].join(';');
2773
-
2774
- const body = document.createElement('div');
2775
- body.style.cssText = 'flex:1;min-width:0';
2776
-
2777
- const head = document.createElement('div');
2778
- head.style.cssText = 'font-weight:600;margin:0 0 2px;color:#0c4a6e';
2779
- head.textContent = TITLE;
2780
-
2781
- const line = document.createElement('div');
2782
- line.style.cssText = 'color:#334155;margin:0 0 2px';
2783
- line.textContent = 'Review the draft and click Reply yourself — Lobu did not submit.';
2784
-
2785
- body.appendChild(head);
2786
- body.appendChild(line);
2787
-
2788
- if (REASON) {
2789
- const why = document.createElement('div');
2790
- why.style.cssText = 'color:#64748b;margin:4px 0 0;font-size:12px';
2791
- why.textContent = 'Why: ' + REASON;
2792
- body.appendChild(why);
2793
- }
2794
-
2795
- const close = document.createElement('button');
2796
- close.type = 'button';
2797
- close.setAttribute('aria-label', 'Dismiss');
2798
- close.textContent = '\\u00d7';
2799
- close.style.cssText = [
2800
- 'flex:none',
2801
- 'border:0',
2802
- 'background:transparent',
2803
- 'color:#64748b',
2804
- 'font:20px/1 sans-serif',
2805
- 'cursor:pointer',
2806
- 'padding:0 2px',
2807
- ].join(';');
2808
- close.onclick = function () { try { root.remove(); } catch (_) {} };
2809
-
2810
- root.appendChild(body);
2811
- root.appendChild(close);
2812
-
2813
- // Anchor above the reply composer when we can find it, so the reason sits
2814
- // next to the draft instead of floating over unrelated timeline content.
2815
- let anchored = false;
2816
- try {
2817
- const composer =
2818
- document.querySelector('[data-testid="tweetTextarea_0"]') ||
2819
- document.querySelector('div[role="textbox"][contenteditable="true"]');
2820
- if (composer) {
2821
- const host = composer.closest('form') || composer.parentElement;
2822
- if (host && host.parentElement) {
2823
- root.style.position = 'relative';
2824
- root.style.top = '0';
2825
- root.style.left = '0';
2826
- root.style.transform = 'none';
2827
- root.style.margin = '8px 0 12px';
2828
- root.style.maxWidth = '100%';
2829
- host.parentElement.insertBefore(root, host);
2830
- anchored = true;
2831
- }
2832
- }
2833
- } catch (_) {}
2834
-
2835
- if (!anchored) {
2836
- (document.body || document.documentElement).appendChild(root);
2837
- }
2838
-
2839
- // No auto-dismiss: the draft lives in the user's page, so its context should
2840
- // still be present when the user returns later. The dismiss button remains.
2841
-
2842
- return { ok: true, anchored: anchored };
2843
- })()`;
2748
+ return buildSharedHandoffBannerExpression({
2749
+ reason: opts.reason,
2750
+ title: X_HANDOFF_TITLE,
2751
+ instruction: X_HANDOFF_INSTRUCTION,
2752
+ composerSelectors: X_HANDOFF_COMPOSER_SELECTORS,
2753
+ hostSelectors: X_HANDOFF_HOST_SELECTORS,
2754
+ });
2844
2755
  }
2845
2756
 
2846
2757
  export interface PrepareReplyResult {
@@ -3180,6 +3091,146 @@ export async function prepareXReply(
3180
3091
  };
3181
3092
  }
3182
3093
 
3094
+ // ── Live DMs (browser source program) ─────────────────────────
3095
+
3096
+ /**
3097
+ * A neutral signed-in route for the live DM program. Opening /messages marks
3098
+ * conversations read, so the program calls the DM endpoints from here instead.
3099
+ */
3100
+ const X_LIVE_MESSAGES_TAB_URL = "https://x.com/home";
3101
+
3102
+ const X_LIVE_MESSAGE_COLUMNS = [
3103
+ { name: "id", type: "string" },
3104
+ { name: "message_id", type: "string" },
3105
+ { name: "conversation_id", type: "string" },
3106
+ { name: "conversation_name", type: "string" },
3107
+ { name: "sender_id", type: "string" },
3108
+ { name: "sender_handle", type: "string" },
3109
+ { name: "sender_name", type: "string" },
3110
+ { name: "from_me", type: "boolean" },
3111
+ { name: "is_group", type: "boolean" },
3112
+ { name: "is_request", type: "boolean" },
3113
+ { name: "text", type: "string" },
3114
+ { name: "content_kind", type: "string" },
3115
+ { name: "occurred_at", type: "string" },
3116
+ ];
3117
+
3118
+ /** Keep data inert in generated page code, including an HTML script context. */
3119
+ function xScriptArgument(value: unknown): string {
3120
+ const literal = JSON.stringify(JSON.stringify(value)).replace(
3121
+ /[<>\u2028\u2029]/g,
3122
+ (char) => `\\u${char.charCodeAt(0).toString(16).padStart(4, "0")}`,
3123
+ );
3124
+ return `JSON.parse(${literal})`;
3125
+ }
3126
+
3127
+ async function readyXLiveTab(
3128
+ dispatcher: ChromeActionDispatcher,
3129
+ ): Promise<number> {
3130
+ const nav = await dispatcher.dispatch<{
3131
+ tab_id?: number;
3132
+ current_url?: string;
3133
+ }>("navigate", {
3134
+ url: X_LIVE_MESSAGES_TAB_URL,
3135
+ persistent: true,
3136
+ wait_for_load: true,
3137
+ });
3138
+ if (isXAuthWall(nav.current_url)) {
3139
+ throw new Error(
3140
+ "X is not signed in on the paired Chrome. Sign in at https://x.com, then retry.",
3141
+ );
3142
+ }
3143
+ if (typeof nav.tab_id !== "number") {
3144
+ throw new Error("Chrome did not return an X tab id");
3145
+ }
3146
+ return nav.tab_id;
3147
+ }
3148
+
3149
+ /** One call into the page program, installing it first when absent or stale. */
3150
+ async function invokeXDirectMessages<T>(
3151
+ dispatcher: ChromeActionDispatcher,
3152
+ tabId: number,
3153
+ op: "read" | "listen" | "send",
3154
+ input: Record<string, unknown>,
3155
+ ): Promise<T> {
3156
+ const result = await dispatcher.dispatch<{
3157
+ value?: T;
3158
+ exception?: { description?: string } | unknown;
3159
+ }>("evaluate", {
3160
+ tab_id: tabId,
3161
+ expression: `(() => { (${xDirectMessagesProgram.toString()})(); return globalThis.__lobuXDirectMessagesV1.${op}(${xScriptArgument(input)}); })()`,
3162
+ await_promise: true,
3163
+ });
3164
+ if (result.exception || !result.value) {
3165
+ const description = (
3166
+ result.exception as { description?: unknown } | undefined
3167
+ )?.description;
3168
+ throw new Error(
3169
+ typeof description === "string"
3170
+ ? description.split("\n")[0]
3171
+ : `X direct messages ${op} failed: ${JSON.stringify(result.exception ?? "empty response")}`,
3172
+ );
3173
+ }
3174
+ return result.value;
3175
+ }
3176
+
3177
+ async function readXLiveMessages(
3178
+ ctx: FeedReadContext,
3179
+ ): Promise<FeedReadResult> {
3180
+ const message =
3181
+ "X live messages read the recent inbox in source order with the returned cursor, or one message by id:<message id>; search, offsets, sorting, matching, and time windows are unsupported";
3182
+ assertNoOffsetPaging(ctx, message);
3183
+ assertNoSort(ctx, message);
3184
+ assertNoWindow(ctx, message);
3185
+ assertNoMatch(ctx, message);
3186
+ const dispatcher = requireXBrowser(ctx);
3187
+ const tabId = await readyXLiveTab(dispatcher);
3188
+ const page = await invokeXDirectMessages<{
3189
+ rows: Array<Record<string, unknown>>;
3190
+ nextCursor?: string;
3191
+ hasMore: boolean;
3192
+ }>(dispatcher, tabId, "read", {
3193
+ query: ctx.query,
3194
+ cursor: ctx.cursor,
3195
+ limit: ctx.limit,
3196
+ });
3197
+ return {
3198
+ rows: page.rows,
3199
+ columns: X_LIVE_MESSAGE_COLUMNS,
3200
+ ...(page.nextCursor ? { nextCursor: page.nextCursor } : {}),
3201
+ hasMore: page.hasMore,
3202
+ };
3203
+ }
3204
+
3205
+ /**
3206
+ * Attach the page program's listener. It checks for new DMs once a minute
3207
+ * while the browser is online and publishes `message.created` references
3208
+ * through the bridge; the checkpoint is X's own inbox update cursor.
3209
+ */
3210
+ async function observeXLiveMessages(ctx: FeedObserveContext): Promise<void> {
3211
+ const dispatcher = requireXBrowser(ctx);
3212
+ const tabId = await readyXLiveTab(dispatcher);
3213
+ const binding = await dispatcher.dispatch<{
3214
+ bridge_id?: string;
3215
+ token?: string;
3216
+ listening?: boolean;
3217
+ subscription?: { scope_key: string };
3218
+ }>("feed_listen", { tab_id: tabId });
3219
+ if (
3220
+ !binding.bridge_id ||
3221
+ !binding.token ||
3222
+ !binding.subscription ||
3223
+ binding.listening === false
3224
+ ) {
3225
+ throw new Error("The paired browser must support source subscriptions");
3226
+ }
3227
+ await invokeXDirectMessages(dispatcher, tabId, "listen", {
3228
+ checkpoint: ctx.checkpoint ?? null,
3229
+ bridge_id: binding.bridge_id,
3230
+ token: binding.token,
3231
+ });
3232
+ }
3233
+
3183
3234
  // ── Connector ──────────────────────────────────────────────────
3184
3235
 
3185
3236
  export default class XConnector extends ConnectorRuntime {
@@ -3187,8 +3238,8 @@ export default class XConnector extends ConnectorRuntime {
3187
3238
  key: "x",
3188
3239
  name: "X (Twitter)",
3189
3240
  description:
3190
- "Fetches tweets, browser-visible like history, bookmarks, and DMs through the X API v2 or the paired Owletto Chrome extension, and reads the chronological Following timeline live through the X API. Links social actors into the person graph.",
3191
- version: "3.14.2",
3241
+ "Fetches tweets, browser-visible like history, bookmarks, and DMs through the X API v2 or the paired Owletto Chrome extension, reads the chronological Following timeline live through the X API, and reads and answers DMs live in the paired browser. Links social actors into the person graph.",
3242
+ version: "3.15.0",
3192
3243
  faviconDomain: "x.com",
3193
3244
  browser: {
3194
3245
  origins: ["https://x.com", "https://twitter.com"],
@@ -3247,7 +3298,43 @@ export default class XConnector extends ConnectorRuntime {
3247
3298
  },
3248
3299
  ],
3249
3300
  },
3301
+ // Declaring automationEvents replaces the eventKinds-derived catalog, so
3302
+ // every kind the sync feeds emit is listed alongside the live DM event.
3303
+ automationEvents: [
3304
+ {
3305
+ key: "message.created",
3306
+ label: "New DM",
3307
+ resourceType: "message",
3308
+ description:
3309
+ "A new X direct message reference from the paired browser. The Automation reads its content from the live messages feed, or replies in the conversation it came from.",
3310
+ filterSchema: {
3311
+ type: "object",
3312
+ properties: {
3313
+ channel_id: {
3314
+ type: "string",
3315
+ title: "Conversation",
3316
+ description: "X DM conversation ID.",
3317
+ },
3318
+ },
3319
+ },
3320
+ capabilities: { replyToSource: true },
3321
+ },
3322
+ { key: "tweet", label: "Tweet" },
3323
+ { key: "reply", label: "Reply" },
3324
+ { key: "liked_tweet", label: "Liked Tweet" },
3325
+ { key: "bookmark", label: "Bookmark" },
3326
+ { key: "dm_message", label: "DM Message" },
3327
+ ],
3250
3328
  feeds: {
3329
+ live_messages: {
3330
+ key: "live_messages",
3331
+ name: "Live messages",
3332
+ description:
3333
+ "Read recent X direct messages live from the paired browser without importing history or marking them read, page by the returned cursor, or read one message by id:<message id>. Message requests from accounts the user does not follow are included and marked is_request. Active Automations subscribe to new-message references; the browser checks once a minute while it is online and resumes from X's inbox update cursor after reconnecting. Requires a browser-authenticated X connection.",
3334
+ read: readXLiveMessages,
3335
+ observe: observeXLiveMessages,
3336
+ webhook: { mode: "trigger", events: ["message.created"] },
3337
+ },
3251
3338
  following_timeline: {
3252
3339
  key: "following_timeline",
3253
3340
  name: "Following Timeline (live)",
@@ -3383,6 +3470,50 @@ export default class XConnector extends ConnectorRuntime {
3383
3470
  },
3384
3471
  },
3385
3472
  actions: {
3473
+ send_message: {
3474
+ key: "send_message",
3475
+ kind: "write",
3476
+ name: "Send DM reply",
3477
+ description:
3478
+ "Requires an X connection authenticated through your paired Chrome browser. Send a text reply into an exact existing X direct message conversation and confirm it appears there. This direct send is approved only for answering DMs on bot accounts the owner operates; public replies and posts stay draft-only through prepare_reply. On retry, reuse both this input's idempotency_key and the enclosing operations.execute idempotency_key. The browser can recognise an earlier send only while its request ID is on the latest conversation page; matching recent text without a request ID is refused.",
3479
+ annotations: {
3480
+ destructiveHint: false,
3481
+ idempotentHint: false,
3482
+ openWorldHint: true,
3483
+ },
3484
+ inputSchema: {
3485
+ type: "object",
3486
+ required: ["conversation_id", "text", "idempotency_key"],
3487
+ additionalProperties: false,
3488
+ properties: {
3489
+ conversation_id: {
3490
+ type: "string",
3491
+ pattern: "^[0-9]{1,20}(-[0-9]{1,20})?$",
3492
+ description:
3493
+ "Exact X DM conversation ID, the conversation_id of a live_messages row.",
3494
+ },
3495
+ text: { type: "string", minLength: 1, maxLength: 10000 },
3496
+ idempotency_key: {
3497
+ type: "string",
3498
+ minLength: 1,
3499
+ maxLength: 200,
3500
+ description:
3501
+ "Stable key used to derive X's client request ID. Reuse it and the enclosing operation's idempotency_key on retry; browser deduplication only checks the latest conversation page.",
3502
+ },
3503
+ },
3504
+ },
3505
+ outputSchema: {
3506
+ type: "object",
3507
+ properties: {
3508
+ sent: { type: "boolean" },
3509
+ deduplicated: { type: "boolean" },
3510
+ id: { type: "string" },
3511
+ message_id: { type: "string" },
3512
+ conversation_id: { type: "string" },
3513
+ occurred_at: { type: "string" },
3514
+ },
3515
+ },
3516
+ },
3386
3517
  prepare_reply: {
3387
3518
  key: "prepare_reply",
3388
3519
  kind: "write",
@@ -3452,6 +3583,21 @@ export default class XConnector extends ConnectorRuntime {
3452
3583
 
3453
3584
  async execute(ctx: ActionContext): Promise<ActionResult> {
3454
3585
  try {
3586
+ if (ctx.actionKey === "send_message") {
3587
+ const dispatcher = requireXBrowser(ctx);
3588
+ const tabId = await readyXLiveTab(dispatcher);
3589
+ const output = await invokeXDirectMessages<Record<string, unknown>>(
3590
+ dispatcher,
3591
+ tabId,
3592
+ "send",
3593
+ {
3594
+ conversation_id: ctx.input.conversation_id,
3595
+ text: ctx.input.text,
3596
+ idempotency_key: ctx.input.idempotency_key,
3597
+ },
3598
+ );
3599
+ return { success: true, output };
3600
+ }
3455
3601
  if (ctx.actionKey !== "prepare_reply") {
3456
3602
  return { success: false, error: `Unknown action: ${ctx.actionKey}` };
3457
3603
  }
@@ -5,7 +5,7 @@
5
5
  "server": "dist/server.bundle.mjs",
6
6
  "embeddingsServer": "dist/embeddings-server.mjs"
7
7
  },
8
- "version": "22.0.0",
8
+ "version": "24.0.0",
9
9
  "verify": "dist/verify.mjs"
10
10
  },
11
11
  "device": {
@@ -16,7 +16,7 @@
16
16
  "connector": "node_modules/@lobu/cli/dist/commands/connector.js",
17
17
  "worker": "node_modules/@lobu/connector-worker/dist/bin.js"
18
18
  },
19
- "version": "22.0.0",
19
+ "version": "24.0.0",
20
20
  "verify": "dist/verify.mjs"
21
21
  },
22
22
  "postgres": {
@@ -24,7 +24,7 @@
24
24
  "entries": {
25
25
  "postgres": "dist/index.mjs"
26
26
  },
27
- "version": "22.0.0",
27
+ "version": "24.0.0",
28
28
  "verify": "dist/verify.mjs"
29
29
  },
30
30
  "embeddings": {
@@ -32,7 +32,7 @@
32
32
  "entries": {
33
33
  "embeddings": "dist/embeddings.js"
34
34
  },
35
- "version": "22.0.0",
35
+ "version": "24.0.0",
36
36
  "verify": "dist/verify.mjs"
37
37
  }
38
38
  }
@@ -172,14 +172,21 @@ const ticket = defineEntityType({
172
172
  name: "Ticket",
173
173
  required: ["subject"],
174
174
  properties: {
175
- subject: { type: "string", "x-table-label": "Subject", "x-table-column": true },
176
- status: { type: "string", enum: ["open", "closed"], "x-table-label": "Status", "x-table-column": true },
175
+ subject: { type: "string", title: "Subject", "x-table-label": "Subject", "x-table-column": true },
176
+ status: { type: "string", title: "Status", enum: ["open", "closed"], "x-table-label": "Status", "x-table-column": true },
177
+ contacts: {
178
+ type: "array",
179
+ title: "Contacts",
180
+ items: { type: "object", properties: { email: { type: "string", title: "Email" } } },
181
+ },
177
182
  },
178
183
  });
179
184
  ```
180
185
 
181
186
  Each property is a JSON Schema fragment. `"x-table-column": true` surfaces it as a
182
- column in the admin UI.
187
+ column in the admin UI. The same schema renders the record page form: give every
188
+ array `items` and every object `properties` (bare ones render as raw JSON), put the
189
+ label in `title` and help text in `description`, and mark derived fields `readOnly: true`.
183
190
 
184
191
  ### Connection (a bundled connector — preferred)
185
192
 
@@ -219,8 +226,8 @@ const gh = defineConnection({
219
226
  **Bundled connector keys** — use the exact key; several are dotted (Gmail is
220
227
  `google.gmail`, not `gmail` or `google_gmail`): `github`, `slack`, `linear`, `jira`, `google.gmail`,
221
228
  `google.calendar`, `google.drive`, `microsoft.outlook`, `discord`, `teams`, `telegram`, `tiktok.web`, `webhook`,
222
- `whatsapp`, `gchat`, `rss`, `postgres`,
223
- `hackernews`, `herdr`, `market.quotes`, `reddit`, `x`, `youtube`, `producthunt`, `agentid`.
229
+ `whatsapp`, `whatsapp.web`, `gchat`, `rss`, `postgres`,
230
+ `hackernews`, `herdr`, `linkedin`, `market.quotes`, `reddit`, `x`, `youtube`, `producthunt`, `agentid`.
224
231
 
225
232
  Device connectors are not in that list: they are advertised by the device at
226
233
  poll time and appear after it grants permission. `os.shell` is one of them —
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobu/cli",
3
- "version": "22.0.0",
3
+ "version": "24.0.0",
4
4
  "description": "CLI for deploying and managing AI agents on Lobu",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Shared in-page handoff banner for browser-staged drafts.
3
+ *
4
+ * Two connectors stage text in the user's own signed-in page and stop before
5
+ * submit (`x.prepare_reply`, `linkedin.prepare_comment`). Without a banner the
6
+ * staged page is context-free — a draft in a box with no record of why the
7
+ * agent thought the post mattered. Both banners are the same DOM shape (a
8
+ * fixed `#lobu-handoff-banner` status node, anchored above the composer when
9
+ * one is found, dismissible, never auto-submitted); only the title,
10
+ * instruction line, optional footer, and composer/host selectors differ per
11
+ * site. Callers pass those; this module owns the injection script.
12
+ *
13
+ * Pure (no `node:`, no `@lobu/core`): the root must stay loadable inside a V8
14
+ * isolate.
15
+ */
16
+ export declare function truncateHandoffReason(reason: string | undefined | null, maxLen?: number): string | undefined;
17
+ export interface HandoffBannerOptions {
18
+ reason?: string;
19
+ /** Banner heading. Defaults to a neutral staged-draft title. */
20
+ title?: string;
21
+ /** Instruction line under the heading. Defaults to a never-submits line. */
22
+ instruction?: string;
23
+ /** Optional third line (e.g. where to record the outcome). Omit for none. */
24
+ footer?: string;
25
+ /** Composer selectors tried in order. Defaults to a generic textbox. */
26
+ composerSelectors?: string[];
27
+ /** `closest()` hosts tried in order before falling back to `parentElement`. */
28
+ hostSelectors?: string[];
29
+ }
30
+ /**
31
+ * JS expression: inject the Lobu handoff banner on the page.
32
+ *
33
+ * Best-effort; the host page re-renders aggressively and may drop the node.
34
+ * Never fatal — the draft is already staged by the time this runs. No
35
+ * auto-dismiss: the draft lives in the user's page, so its context should
36
+ * still be present when the user returns later.
37
+ */
38
+ export declare function buildInjectHandoffBannerExpression(opts: HandoffBannerOptions): string;
39
+ //# sourceMappingURL=browser-handoff-banner.d.ts.map