@lobu/runtime-device 21.2.1 → 23.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 (233) hide show
  1. package/dist/component.json +1 -1
  2. package/dist/dependencies.bun.lock +91 -83
  3. package/npm-shrinkwrap.json +492 -438
  4. package/package.json +12 -2
  5. package/vendor/cli/dist/bundled-skills/lobu/SKILL.md +1 -1
  6. package/vendor/cli/dist/commands/_lib/apply/apply-cmd.js +5 -6
  7. package/vendor/cli/dist/commands/_lib/apply/client.d.ts +1 -0
  8. package/vendor/cli/dist/commands/_lib/apply/client.js +26 -7
  9. package/vendor/cli/dist/commands/_lib/apply/desired-state.d.ts +9 -1
  10. package/vendor/cli/dist/commands/_lib/apply/diff.d.ts +1 -0
  11. package/vendor/cli/dist/commands/_lib/apply/diff.js +46 -4
  12. package/vendor/cli/dist/commands/_lib/apply/map-config.js +18 -38
  13. package/vendor/cli/dist/commands/_lib/init-from-org/bootstrap.js +5 -17
  14. package/vendor/cli/dist/commands/init.d.ts +0 -2
  15. package/vendor/cli/dist/commands/init.js +0 -27
  16. package/vendor/cli/dist/commands/login.d.ts +17 -0
  17. package/vendor/cli/dist/commands/login.js +43 -17
  18. package/vendor/cli/dist/commands/memory/_lib/errors.d.ts +0 -8
  19. package/vendor/cli/dist/commands/memory/_lib/errors.js +0 -12
  20. package/vendor/cli/dist/commands/memory/_lib/mcp.js +6 -6
  21. package/vendor/cli/dist/commands/memory/_lib/seed-cmd.js +4 -10
  22. package/vendor/cli/dist/config/define.d.ts +21 -15
  23. package/vendor/cli/dist/config/define.js +2 -2
  24. package/vendor/cli/dist/connectors/README.md +21 -6
  25. package/vendor/cli/dist/connectors/_google/actions.ts +270 -0
  26. package/vendor/cli/dist/connectors/_google/discovery/calendar_v3.json +1 -0
  27. package/vendor/cli/dist/connectors/_google/discovery/chat_v1.json +1 -0
  28. package/vendor/cli/dist/connectors/_google/discovery/docs_v1.json +1 -0
  29. package/vendor/cli/dist/connectors/_google/discovery/drive_v3.json +1 -0
  30. package/vendor/cli/dist/connectors/_google/discovery/gmail_v1.json +1 -0
  31. package/vendor/cli/dist/connectors/_google/discovery/people_v1.json +1 -0
  32. package/vendor/cli/dist/connectors/_google/discovery/sheets_v4.json +1 -0
  33. package/vendor/cli/dist/connectors/_google/discovery/tasks_v1.json +1 -0
  34. package/vendor/cli/dist/connectors/_google/discovery/youtube_v3.json +1 -0
  35. package/vendor/cli/dist/connectors/_google/discovery.ts +442 -0
  36. package/vendor/cli/dist/connectors/_google/errors.ts +91 -0
  37. package/vendor/cli/dist/connectors/_google/list-feed.ts +223 -0
  38. package/vendor/cli/dist/connectors/_google/policies.ts +127 -0
  39. package/vendor/cli/dist/connectors/agentid.ts +43 -0
  40. package/vendor/cli/dist/connectors/chat-user-identity.ts +2 -1
  41. package/vendor/cli/dist/connectors/github-automation-events.ts +9 -0
  42. package/vendor/cli/dist/connectors/github-identity.ts +28 -3
  43. package/vendor/cli/dist/connectors/github.ts +101 -59
  44. package/vendor/cli/dist/connectors/google_calendar.ts +207 -719
  45. package/vendor/cli/dist/connectors/google_drive.ts +16 -2
  46. package/vendor/cli/dist/connectors/google_gmail.ts +52 -33
  47. package/vendor/cli/dist/connectors/herdr.ts +406 -0
  48. package/vendor/cli/dist/connectors/jira-helpers.ts +313 -0
  49. package/vendor/cli/dist/connectors/jira.ts +35 -227
  50. package/vendor/cli/dist/connectors/linear.ts +7 -4
  51. package/vendor/cli/dist/connectors/linkedin-browser-script.ts +13 -0
  52. package/vendor/cli/dist/connectors/linkedin-draft-page.js +104 -0
  53. package/vendor/cli/dist/connectors/linkedin-drafts.ts +73 -0
  54. package/vendor/cli/dist/connectors/linkedin-identity.ts +32 -0
  55. package/vendor/cli/dist/connectors/linkedin-inbox-adapter.js +1185 -0
  56. package/vendor/cli/dist/connectors/linkedin-inbox.ts +156 -0
  57. package/vendor/cli/dist/connectors/linkedin-like.ts +114 -0
  58. package/vendor/cli/dist/connectors/linkedin-takeout.ts +577 -0
  59. package/vendor/cli/dist/connectors/linkedin.ts +3998 -0
  60. package/vendor/cli/dist/connectors/postgres.ts +27 -2
  61. package/vendor/cli/dist/connectors/takeout-utils.ts +240 -0
  62. package/vendor/cli/dist/connectors/tiktok-inbox-page.js +230 -0
  63. package/vendor/cli/dist/connectors/tiktok-web-page.js +217 -0
  64. package/vendor/cli/dist/connectors/tiktok_web.ts +319 -0
  65. package/vendor/cli/dist/connectors/whatsapp-web-adapter.js +285 -567
  66. package/vendor/cli/dist/connectors/whatsapp-web-helpers.ts +74 -455
  67. package/vendor/cli/dist/connectors/whatsapp-web-identity.ts +135 -0
  68. package/vendor/cli/dist/connectors/whatsapp_web.ts +159 -618
  69. package/vendor/cli/dist/connectors/x-dm-adapter.js +556 -0
  70. package/vendor/cli/dist/connectors/x-identity.ts +31 -2
  71. package/vendor/cli/dist/connectors/x.ts +539 -253
  72. package/vendor/cli/dist/index.js +1 -37
  73. package/vendor/cli/dist/internal/context.d.ts +10 -0
  74. package/vendor/cli/dist/internal/context.js +26 -16
  75. package/vendor/cli/dist/internal/node-version.d.ts +1 -1
  76. package/vendor/cli/dist/internal/node-version.js +1 -1
  77. package/vendor/cli/dist/internal/oauth.d.ts +3 -1
  78. package/vendor/cli/dist/internal/oauth.js +4 -3
  79. package/vendor/cli/dist/internal/runtime-components.d.ts +9 -0
  80. package/vendor/cli/dist/internal/runtime-components.js +67 -2
  81. package/vendor/cli/dist/mac-auth.js +17 -1
  82. package/vendor/cli/dist/providers.json +1 -1
  83. package/vendor/cli/dist/runtime-components.json +4 -4
  84. package/vendor/cli/dist/templates/AGENTS.md.tmpl +12 -5
  85. package/vendor/cli/dist/templates/README.md.tmpl +1 -1
  86. package/vendor/cli/dist/vendor/ora/.bun-tag-fde20e9a6df212fa +0 -0
  87. package/vendor/cli/dist/vendor/ora/index.d.ts +332 -0
  88. package/vendor/cli/dist/vendor/ora/index.js +424 -0
  89. package/vendor/cli/dist/vendor/ora/license +9 -0
  90. package/vendor/cli/dist/vendor/ora/package.json +64 -0
  91. package/vendor/cli/dist/vendor/ora/readme.md +329 -0
  92. package/vendor/cli/package.json +2 -2
  93. package/vendor/connector-sdk/dist/browser-handoff-banner.d.ts +39 -0
  94. package/vendor/connector-sdk/dist/browser-handoff-banner.js +175 -0
  95. package/vendor/connector-sdk/dist/browser-requirement.d.ts +36 -0
  96. package/vendor/connector-sdk/dist/browser-requirement.js +60 -0
  97. package/vendor/connector-sdk/dist/browser-source-read.d.ts +52 -0
  98. package/vendor/connector-sdk/dist/browser-source-read.js +107 -0
  99. package/vendor/connector-sdk/dist/connector-runtime.d.ts +3 -1
  100. package/vendor/connector-sdk/dist/connector-runtime.js +10 -0
  101. package/vendor/connector-sdk/dist/connector-types.d.ts +169 -45
  102. package/vendor/connector-sdk/dist/define-connector.d.ts +4 -2
  103. package/vendor/connector-sdk/dist/define-connector.js +3 -0
  104. package/vendor/connector-sdk/dist/index.d.ts +8 -2
  105. package/vendor/connector-sdk/dist/index.js +3 -0
  106. package/vendor/connector-sdk/dist/reaction-client-types.d.ts +16 -21
  107. package/vendor/connector-sdk/dist/reaction-client-types.typecheck.d.ts +5 -0
  108. package/vendor/connector-sdk/package.json +13 -1
  109. package/vendor/connector-worker/dist/agent-turn/guest-entry.js +43 -30
  110. package/vendor/connector-worker/dist/agent-turn/guest.bundle.js +416 -330
  111. package/vendor/connector-worker/dist/agent-turn/memory.d.ts +3 -2
  112. package/vendor/connector-worker/dist/agent-turn/memory.js +3 -20
  113. package/vendor/connector-worker/dist/agent-turn/types.d.ts +3 -15
  114. package/vendor/connector-worker/dist/agent-turn/workspace.d.ts +2 -2
  115. package/vendor/connector-worker/dist/agent-turn/workspace.js +2 -4
  116. package/vendor/connector-worker/dist/daemon/action-monitor.d.ts +12 -0
  117. package/vendor/connector-worker/dist/daemon/action-monitor.js +25 -0
  118. package/vendor/connector-worker/dist/daemon/agent-turn.js +0 -9
  119. package/vendor/connector-worker/dist/daemon/automation.d.ts +4 -11
  120. package/vendor/connector-worker/dist/daemon/automation.js +6 -6
  121. package/vendor/connector-worker/dist/daemon/builtins/index.d.ts +12 -0
  122. package/vendor/connector-worker/dist/daemon/builtins/index.js +61 -1
  123. package/vendor/connector-worker/dist/daemon/builtins/os-shell.d.ts +2 -1
  124. package/vendor/connector-worker/dist/daemon/builtins/os-shell.js +40 -27
  125. package/vendor/connector-worker/dist/daemon/client.d.ts +6 -4
  126. package/vendor/connector-worker/dist/daemon/client.js +3 -3
  127. package/vendor/connector-worker/dist/daemon/device-concurrency.d.ts +8 -0
  128. package/vendor/connector-worker/dist/daemon/device-concurrency.js +13 -0
  129. package/vendor/connector-worker/dist/daemon/executor.d.ts +1 -1
  130. package/vendor/connector-worker/dist/daemon/executor.js +48 -120
  131. package/vendor/connector-worker/dist/daemon/log.d.ts +2 -0
  132. package/vendor/connector-worker/dist/daemon/log.js +23 -2
  133. package/vendor/connector-worker/dist/daemon/mac-device-daemon.d.ts +23 -6
  134. package/vendor/connector-worker/dist/daemon/mac-device-daemon.js +57 -23
  135. package/vendor/connector-worker/dist/daemon/native-bridge/client.d.ts +6 -0
  136. package/vendor/connector-worker/dist/daemon/native-bridge/client.js +15 -0
  137. package/vendor/connector-worker/dist/daemon/native-bridge/executor.js +29 -25
  138. package/vendor/connector-worker/dist/daemon/native-bridge/protocol.d.ts +1 -1
  139. package/vendor/connector-worker/dist/daemon/native-bridge/protocol.js +1 -0
  140. package/vendor/connector-worker/dist/daemon/poll-loop.d.ts +3 -0
  141. package/vendor/connector-worker/dist/daemon/poll-loop.js +5 -1
  142. package/vendor/connector-worker/dist/daemon/start.d.ts +1 -0
  143. package/vendor/connector-worker/dist/daemon/start.js +15 -20
  144. package/vendor/connector-worker/dist/daemon/terminal-failure.js +0 -11
  145. package/vendor/connector-worker/dist/daemon/worker-id.d.ts +17 -0
  146. package/vendor/connector-worker/dist/daemon/worker-id.js +22 -0
  147. package/vendor/connector-worker/dist/executor/interface.d.ts +34 -2
  148. package/vendor/connector-worker/dist/executor/isolate.js +66 -15
  149. package/vendor/connector-worker/dist/executor/redact.d.ts +1 -0
  150. package/vendor/connector-worker/dist/executor/redact.js +97 -26
  151. package/vendor/connector-worker/dist/executor/runtime.d.ts +7 -0
  152. package/vendor/connector-worker/dist/executor/runtime.js +26 -0
  153. package/vendor/connector-worker/dist/isolate/bridge.js +3 -1
  154. package/vendor/connector-worker/dist/mac-device-daemon.js +24 -29
  155. package/vendor/connector-worker/package.json +2 -2
  156. package/vendor/core/dist/agent-policy.js +1 -1
  157. package/vendor/core/dist/agent-store.d.ts +2 -0
  158. package/vendor/core/dist/agent-tooling.d.ts +1 -1
  159. package/vendor/core/dist/agent-tooling.js +1 -1
  160. package/vendor/core/dist/capabilities.d.ts +1 -1
  161. package/vendor/core/dist/capabilities.js +2 -1
  162. package/vendor/core/dist/connector-query-errors.d.ts +32 -0
  163. package/vendor/core/dist/connector-query-errors.js +41 -1
  164. package/vendor/core/dist/contracts/agent-settings.d.ts +0 -11
  165. package/vendor/core/dist/contracts/agent-settings.js +1 -7
  166. package/vendor/core/dist/contracts/tools/collection-presentation.d.ts +93 -0
  167. package/vendor/core/dist/contracts/tools/collection-presentation.js +88 -0
  168. package/vendor/core/dist/contracts/tools/collection-selection.d.ts +47 -0
  169. package/vendor/core/dist/contracts/tools/collection-selection.js +74 -0
  170. package/vendor/core/dist/contracts/tools/manage-agents.d.ts +10 -4
  171. package/vendor/core/dist/contracts/tools/manage-auth-profiles.d.ts +1 -1
  172. package/vendor/core/dist/contracts/tools/manage-auth-profiles.js +5 -1
  173. package/vendor/core/dist/contracts/tools/manage-automations.d.ts +19 -4
  174. package/vendor/core/dist/contracts/tools/manage-automations.js +25 -8
  175. package/vendor/core/dist/contracts/tools/manage-connections.d.ts +1 -0
  176. package/vendor/core/dist/contracts/tools/manage-connections.js +3 -0
  177. package/vendor/core/dist/contracts/tools/manage-conversations.js +2 -2
  178. package/vendor/core/dist/contracts/tools/manage-entity-schema.d.ts +11 -0
  179. package/vendor/core/dist/contracts/tools/manage-entity-schema.js +42 -3
  180. package/vendor/core/dist/contracts/tools/manage-entity.d.ts +181 -152
  181. package/vendor/core/dist/contracts/tools/manage-entity.js +118 -162
  182. package/vendor/core/dist/contracts/tools/manage-feeds.d.ts +14 -0
  183. package/vendor/core/dist/contracts/tools/manage-feeds.js +17 -0
  184. package/vendor/core/dist/contracts/tools/manage-operations.d.ts +41 -3
  185. package/vendor/core/dist/contracts/tools/manage-operations.js +40 -2
  186. package/vendor/core/dist/contracts/tools/manage-views.d.ts +182 -7
  187. package/vendor/core/dist/contracts/tools/manage-views.js +49 -13
  188. package/vendor/core/dist/contracts/tools/read-knowledge.d.ts +11 -2
  189. package/vendor/core/dist/contracts/tools/read-knowledge.js +23 -3
  190. package/vendor/core/dist/contracts/tools/save-memory.d.ts +3 -6
  191. package/vendor/core/dist/contracts/tools/save-memory.js +2 -6
  192. package/vendor/core/dist/contracts/tools/view-attach.d.ts +2 -1
  193. package/vendor/core/dist/contracts/tools/view-attach.js +7 -2
  194. package/vendor/core/dist/contracts/worker/protocol.d.ts +130 -159
  195. package/vendor/core/dist/contracts/worker/protocol.js +88 -76
  196. package/vendor/core/dist/device-pin-tombstones.d.ts +44 -0
  197. package/vendor/core/dist/device-pin-tombstones.js +57 -0
  198. package/vendor/core/dist/index.d.ts +5 -5
  199. package/vendor/core/dist/index.js +4 -6
  200. package/vendor/core/dist/json-template.d.ts +6 -10
  201. package/vendor/core/dist/json-template.js +5 -9
  202. package/vendor/core/dist/logger.js +17 -26
  203. package/vendor/core/dist/shell-safety.d.ts +9 -0
  204. package/vendor/core/dist/shell-safety.js +154 -0
  205. package/vendor/core/dist/suggestions.d.ts +1 -1
  206. package/vendor/core/dist/suggestions.js +1 -1
  207. package/vendor/core/dist/tool-trace-summary.d.ts +1 -1
  208. package/vendor/core/dist/tool-trace-summary.js +1 -1
  209. package/vendor/core/dist/types.d.ts +1 -3
  210. package/vendor/core/dist/utils/diagnostic-scrubber.d.ts +7 -0
  211. package/vendor/core/dist/utils/diagnostic-scrubber.js +437 -0
  212. package/vendor/core/dist/worker/auth.d.ts +44 -6
  213. package/vendor/core/dist/worker/auth.js +44 -11
  214. package/vendor/core/dist/worker/wire.d.ts +0 -10
  215. package/vendor/core/package.json +20 -11
  216. package/vendor/ora/.bun-tag-fde20e9a6df212fa +0 -0
  217. package/vendor/ora/index.d.ts +332 -0
  218. package/vendor/ora/index.js +424 -0
  219. package/vendor/ora/license +9 -0
  220. package/vendor/ora/package.json +53 -0
  221. package/vendor/ora/readme.md +329 -0
  222. package/vendor/cli/dist/commands/telemetry.d.ts +0 -10
  223. package/vendor/cli/dist/commands/telemetry.js +0 -66
  224. package/vendor/connector-worker/dist/daemon/device-chat.d.ts +0 -9
  225. package/vendor/connector-worker/dist/daemon/device-chat.js +0 -61
  226. package/vendor/core/dist/contracts/worker/device-chat.d.ts +0 -4
  227. package/vendor/core/dist/contracts/worker/device-chat.js +0 -26
  228. package/vendor/core/dist/sentry.d.ts +0 -26
  229. package/vendor/core/dist/sentry.js +0 -133
  230. package/vendor/core/dist/tool-policy.d.ts +0 -74
  231. package/vendor/core/dist/tool-policy.js +0 -305
  232. package/vendor/core/dist/utils/sentry-scrubber.d.ts +0 -29
  233. package/vendor/core/dist/utils/sentry-scrubber.js +0 -228
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Shared guards and reference-batch splitting for browser-source reads.
3
+ *
4
+ * Browser connectors observe references only (WhatsApp, TikTok inbox,
5
+ * LinkedIn inbox) or take bounded snapshots (TikTok timeline/search): the
6
+ * source owns order and pagination, so offsets, sorts, time windows, and
7
+ * exact-match filters are rejected before touching the page. Each durable
8
+ * browser record is limited to 128 KiB including its checkpoint, so reference
9
+ * batches are capped at 500 events and halved until they fit; only the final
10
+ * batch carries the checkpoint, so an interruption replays instead of
11
+ * skipping.
12
+ *
13
+ * Pure (no `node:`, no `@lobu/core`): the root must stay loadable inside a V8
14
+ * isolate.
15
+ */
16
+ import type { FeedReadContext } from "./connector-types.js";
17
+ /** Max references per durable browser record. */
18
+ export declare const SOURCE_REFERENCE_BATCH_MAX_EVENTS = 500;
19
+ /** Max serialized bytes per durable browser record, checkpoint included. */
20
+ export declare const SOURCE_RECORD_MAX_BYTES: number;
21
+ export declare function jsonByteLength(value: unknown): number;
22
+ /**
23
+ * Split references into ordered batches of at most `maxEvents` references and
24
+ * `maxBytes` serialized bytes. `buildBatch` shapes each record (id,
25
+ * checkpoint on the final batch, `more`); it receives the slice, whether it
26
+ * is the last batch, and the running offset. Throws when a single reference
27
+ * cannot fit even alone.
28
+ */
29
+ export declare function splitReferenceBatches<E>(events: E[], buildBatch: (slice: E[], isLast: boolean, offset: number) => Record<string, unknown>, opts?: {
30
+ maxEvents?: number;
31
+ maxBytes?: number;
32
+ }): Record<string, unknown>[];
33
+ type ReadShape = Pick<FeedReadContext, "offset" | "sort" | "window" | "match" | "query" | "cursor" | "limit">;
34
+ export declare function assertNoOffsetPaging(ctx: Pick<ReadShape, "offset">, message: string): void;
35
+ export declare function assertNoSort(ctx: Pick<ReadShape, "sort">, message: string): void;
36
+ export declare function assertNoWindow(ctx: Pick<ReadShape, "window">, message: string): void;
37
+ export declare function assertNoMatch(ctx: Pick<ReadShape, "match">, message: string): void;
38
+ export declare function assertNoQuery(ctx: Pick<ReadShape, "query">, message: string): void;
39
+ export declare function assertNoCursor(ctx: Pick<ReadShape, "cursor">, message: string): void;
40
+ export declare function assertPositiveReadLimit(ctx: Pick<ReadShape, "limit">, message?: string): void;
41
+ /**
42
+ * Inbox reads follow source order and the returned cursor; search, offsets,
43
+ * sorting, matching, and time windows are unsupported.
44
+ */
45
+ export declare function assertInboxSourceRead(ctx: ReadShape, sourceLabel: string): void;
46
+ /**
47
+ * Bounded snapshot reads support no pagination, sorting, time windows, or
48
+ * exact-match filters.
49
+ */
50
+ export declare function assertSnapshotSourceRead(ctx: ReadShape, sourceLabel: string): void;
51
+ export {};
52
+ //# sourceMappingURL=browser-source-read.d.ts.map
@@ -0,0 +1,107 @@
1
+ /**
2
+ * Shared guards and reference-batch splitting for browser-source reads.
3
+ *
4
+ * Browser connectors observe references only (WhatsApp, TikTok inbox,
5
+ * LinkedIn inbox) or take bounded snapshots (TikTok timeline/search): the
6
+ * source owns order and pagination, so offsets, sorts, time windows, and
7
+ * exact-match filters are rejected before touching the page. Each durable
8
+ * browser record is limited to 128 KiB including its checkpoint, so reference
9
+ * batches are capped at 500 events and halved until they fit; only the final
10
+ * batch carries the checkpoint, so an interruption replays instead of
11
+ * skipping.
12
+ *
13
+ * Pure (no `node:`, no `@lobu/core`): the root must stay loadable inside a V8
14
+ * isolate.
15
+ */
16
+ /** Max references per durable browser record. */
17
+ export const SOURCE_REFERENCE_BATCH_MAX_EVENTS = 500;
18
+ /** Max serialized bytes per durable browser record, checkpoint included. */
19
+ export const SOURCE_RECORD_MAX_BYTES = 128 * 1024;
20
+ export function jsonByteLength(value) {
21
+ return new TextEncoder().encode(JSON.stringify(value)).length;
22
+ }
23
+ /**
24
+ * Split references into ordered batches of at most `maxEvents` references and
25
+ * `maxBytes` serialized bytes. `buildBatch` shapes each record (id,
26
+ * checkpoint on the final batch, `more`); it receives the slice, whether it
27
+ * is the last batch, and the running offset. Throws when a single reference
28
+ * cannot fit even alone.
29
+ */
30
+ export function splitReferenceBatches(events, buildBatch, opts) {
31
+ const maxEvents = opts?.maxEvents ?? SOURCE_REFERENCE_BATCH_MAX_EVENTS;
32
+ const maxBytes = opts?.maxBytes ?? SOURCE_RECORD_MAX_BYTES;
33
+ const batches = [];
34
+ for (let offset = 0;;) {
35
+ const through = (end) => buildBatch(events.slice(offset, end), end === events.length, offset);
36
+ let end = Math.min(offset + maxEvents, events.length);
37
+ let batch = through(end);
38
+ while (jsonByteLength(batch) > maxBytes && end - offset > 1) {
39
+ end = offset + Math.floor((end - offset) / 2);
40
+ batch = through(end);
41
+ }
42
+ if (jsonByteLength(batch) > maxBytes) {
43
+ throw new Error("Source reference or checkpoint exceeds the browser record limit");
44
+ }
45
+ batches.push(batch);
46
+ if (end === events.length)
47
+ return batches;
48
+ offset = end;
49
+ }
50
+ }
51
+ export function assertNoOffsetPaging(ctx, message) {
52
+ if (ctx.offset)
53
+ throw new Error(message);
54
+ }
55
+ export function assertNoSort(ctx, message) {
56
+ if (ctx.sort)
57
+ throw new Error(message);
58
+ }
59
+ export function assertNoWindow(ctx, message) {
60
+ if (ctx.window)
61
+ throw new Error(message);
62
+ }
63
+ export function assertNoMatch(ctx, message) {
64
+ if (ctx.match)
65
+ throw new Error(message);
66
+ }
67
+ export function assertNoQuery(ctx, message) {
68
+ if (ctx.query)
69
+ throw new Error(message);
70
+ }
71
+ export function assertNoCursor(ctx, message) {
72
+ if (ctx.cursor)
73
+ throw new Error(message);
74
+ }
75
+ export function assertPositiveReadLimit(ctx, message = "limit must be a positive integer") {
76
+ if (ctx.limit !== undefined &&
77
+ (!Number.isInteger(ctx.limit) || ctx.limit < 1)) {
78
+ throw new Error(message);
79
+ }
80
+ }
81
+ /**
82
+ * Inbox reads follow source order and the returned cursor; search, offsets,
83
+ * sorting, matching, and time windows are unsupported.
84
+ */
85
+ export function assertInboxSourceRead(ctx, sourceLabel) {
86
+ const message = `${sourceLabel} inbox reads use source order and the returned cursor; ` +
87
+ `search, offsets, sorting, matching, and time windows are unsupported`;
88
+ assertNoOffsetPaging(ctx, message);
89
+ assertNoSort(ctx, message);
90
+ assertNoWindow(ctx, message);
91
+ assertNoMatch(ctx, message);
92
+ assertNoQuery(ctx, message);
93
+ }
94
+ /**
95
+ * Bounded snapshot reads support no pagination, sorting, time windows, or
96
+ * exact-match filters.
97
+ */
98
+ export function assertSnapshotSourceRead(ctx, sourceLabel) {
99
+ const message = `${sourceLabel} snapshot feeds do not support pagination, sorting, ` +
100
+ `time windows, or exact-match filters`;
101
+ assertNoCursor(ctx, message);
102
+ assertNoOffsetPaging(ctx, message);
103
+ assertNoSort(ctx, message);
104
+ assertNoWindow(ctx, message);
105
+ assertNoMatch(ctx, message);
106
+ }
107
+ //# sourceMappingURL=browser-source-read.js.map
@@ -4,7 +4,7 @@
4
4
  * Abstract base class that all connectors must implement.
5
5
  * Provides the contract for feed sync, source reads, and connector actions.
6
6
  */
7
- import type { ActionContext, ActionResult, AuthContext, AuthResult, FeedReadContext, FeedReadResult, QueryContext, QueryResult, ReflectContext, ReflectResult, RuntimeConnectorDefinition, SyncContext, SyncResult, WebhookRegistration, WebhookRegistrationContext } from './connector-types.js';
7
+ import type { ActionContext, ActionResult, AuthContext, AuthResult, FeedObserveContext, FeedReadContext, FeedReadResult, QueryContext, QueryResult, ReflectContext, ReflectResult, RuntimeConnectorDefinition, SyncContext, SyncResult, WebhookRegistration, WebhookRegistrationContext } from './connector-types.js';
8
8
  /**
9
9
  * ConnectorRuntime is the base class for all connectors.
10
10
  *
@@ -51,6 +51,8 @@ export declare abstract class ConnectorRuntime<C = Record<string, unknown>, F =
51
51
  * kind or persistence flag.
52
52
  */
53
53
  read(ctx: FeedReadContext<F>): Promise<FeedReadResult>;
54
+ /** Attach/reconnect the connector-owned listener; reference delivery bypasses this hook. */
55
+ observe(ctx: FeedObserveContext<C, F>): Promise<void>;
54
56
  /**
55
57
  * Execute an action on the connected service.
56
58
  *
@@ -62,10 +62,20 @@ export class ConnectorRuntime {
62
62
  if (!handler) {
63
63
  throw new Error(`${this.definition.key} feed '${ctx.feedKey}' does not support source reads`);
64
64
  }
65
+ if (ctx.match && !feed.matchPaths?.includes(ctx.match.path)) {
66
+ throw new Error(`${this.definition.key} feed '${ctx.feedKey}' cannot filter on '${ctx.match.path}'`);
67
+ }
65
68
  const result = await handler(ctx);
66
69
  assertFeedReadWindow(result, ctx.window, feed.readWindowAxis);
67
70
  return result;
68
71
  }
72
+ /** Attach/reconnect the connector-owned listener; reference delivery bypasses this hook. */
73
+ async observe(ctx) {
74
+ const handler = this.definition.feeds?.[ctx.feedKey]?.observe;
75
+ if (!handler)
76
+ throw new Error(`${this.definition.key} feed '${ctx.feedKey}' has no source listener`);
77
+ await handler(ctx);
78
+ }
69
79
  /**
70
80
  * Execute an action on the connected service.
71
81
  *
@@ -5,6 +5,10 @@
5
5
  * Defines the contract between connectors, the runtime, and the platform.
6
6
  */
7
7
  import type { EntityTypeContribution, ReflectedMeasure } from './metrics.js';
8
+ import type { ConnectorBrowserRequirement } from './browser-requirement.js';
9
+ import type { ChromeActionDispatcher } from './extension-network.js';
10
+ import type { AttributeFilter } from '@lobu/core/contracts/tools/collection-selection';
11
+ import type { ConnectorOperationRequest, ConnectorOperationResult } from '@lobu/core/contracts/tools/manage-operations';
8
12
  import type { ConnectorAutomationEvent, ConnectorAutomationSignalDraft } from './automation-triggers.js';
9
13
  export interface ConnectorDefinition {
10
14
  /** Unique connector key, e.g. 'google.gmail' */
@@ -28,6 +32,8 @@ export interface ConnectorDefinition {
28
32
  kind?: 'data' | 'integration';
29
33
  /** Auth configuration */
30
34
  authSchema?: ConnectorAuthSchema;
35
+ /** Delegated browser dependency. This does not change worker placement. */
36
+ browser?: ConnectorBrowserRequirement;
31
37
  /** Available feed definitions (keyed by feed_key) */
32
38
  feeds?: Record<string, FeedDefinition>;
33
39
  /** Available action definitions (keyed by action_key) */
@@ -35,18 +41,22 @@ export interface ConnectorDefinition {
35
41
  /** Query filters implemented by this connector. Unsupported filters fail before query(). */
36
42
  queryCapabilities?: {
37
43
  exactMatch?: boolean;
44
+ selection?: boolean;
38
45
  };
39
46
  /** Connector-normalized events that can activate Automations. */
40
47
  automationEvents?: ConnectorAutomationEvent[];
41
48
  /**
42
49
  * Declarative inbound-webhook config. Presence means this connector receives
43
- * real-time provider deliveries at `POST /api/v1/webhooks/:connectionId`,
44
- * which are landed RAW into `events` (extract-load — the agent/downstream
45
- * stages interpret them; no transform on the ingest hot path). The gateway
46
- * verifies the signature IN-PROCESS using this schema + the secret stored on
47
- * the connection, so the hot path never loads connector code. Pair with
48
- * {@link ConnectorRuntime.registerWebhook}, which subscribes with the provider
49
- * at connect time and stamps the signing secret onto the connection.
50
+ * real-time provider deliveries at `POST /api/v1/webhooks/:connectionId` (or
51
+ * the shared app-webhook endpoint for `delivery: 'app_installation'`). With an
52
+ * {@link ConnectorWebhookSchema.eventType} they are dispatched to the feeds
53
+ * that declare the event; without one, per-connection deliveries are stored
54
+ * raw under `webhook:<connectionId>` and app-installation deliveries are
55
+ * acked with nothing triggered. The gateway verifies the signature in process
56
+ * using this schema and the connection or app webhook secret, so verification
57
+ * never loads connector code. Per-connection subscriptions use
58
+ * {@link ConnectorRuntime.registerWebhook} at connect time and store the
59
+ * signing secret on the connection.
50
60
  */
51
61
  webhook?: ConnectorWebhookSchema;
52
62
  /** Global connector options schema (JSON Schema) */
@@ -235,12 +245,24 @@ export interface ConnectorWebhookSchema {
235
245
  * raw-body HMAC, Slack `v0:{ts}:{rawBody}` with timestamp freshness, etc.).
236
246
  */
237
247
  delivery?: 'registered' | 'app_installation';
248
+ /**
249
+ * Where a delivery names its event type: a request header (GitHub
250
+ * `x-github-event`) or a dotted body path. The platform matches it against
251
+ * each feed's `webhook.events` to dispatch a verified data delivery to the
252
+ * feeds it updates. Without it, per-connection deliveries are stored raw and
253
+ * app-installation deliveries trigger nothing.
254
+ */
255
+ eventType?: {
256
+ header: string;
257
+ } | {
258
+ path: string;
259
+ };
238
260
  /**
239
261
  * `app_installation` mode only: how a VERIFIED delivery is dispatched once the
240
262
  * generic engine has checked its signature.
241
- * - `'data'` (default, absent) — land/trigger through the data path: the
242
- * connector's poll-canonical trigger/store hook when it has one (GitHub), else
243
- * the raw event-ingest path (Jira/Linear).
263
+ * - `'data'` (default, absent) — dispatch to the feeds whose `webhook.events`
264
+ * name the delivery's {@link eventType}; a delivery no feed declares (or a
265
+ * connector with no `eventType`) is acked with nothing triggered.
244
266
  * - `'chat'` — forward to the chat adapter for the connector's provider (Slack;
245
267
  * reusable by any future chat platform), bypassing the data-ingest pipeline.
246
268
  * The engine dispatches on THIS, never on a provider name.
@@ -338,6 +360,8 @@ export interface ConnectorAuthInteractive {
338
360
  }
339
361
  export interface ConnectorAuthBrowser {
340
362
  type: 'browser';
363
+ /** Existing profiles capture cookies; live profiles keep the session in Chrome. */
364
+ mode?: 'cookies' | 'live';
341
365
  required?: boolean;
342
366
  description?: string;
343
367
  requiredDomains?: string[];
@@ -442,6 +466,47 @@ export interface ConnectorInstallationContext {
442
466
  /** Provider-specific install metadata (bot_user_id, account login, …). */
443
467
  metadata?: Record<string, unknown>;
444
468
  }
469
+ /** The persisted part of a feed's {@link FeedDefinition.webhook} declaration. */
470
+ export interface FeedWebhookDeclaration {
471
+ /** Provider event types (values of the connector's `webhook.eventType`) that update this feed. */
472
+ events: string[];
473
+ /** Superseded by `kind`; still accepted, and `'store'` keeps a feed off device notifications. */
474
+ mode?: 'trigger' | 'store';
475
+ /** How a matching delivery is handled. Default `'invalidate'`. */
476
+ kind?: 'invalidate' | 'record';
477
+ /**
478
+ * Which feed instances a delivery belongs to: every `fields` entry maps a
479
+ * feed config key to a dotted payload path, and all of them must hold
480
+ * (AND). Only non-empty scalar values compare; a missing, empty or
481
+ * non-scalar value never matches. Omitted, a delivery reaches every feed of
482
+ * this key on the delivering connection.
483
+ */
484
+ match?: {
485
+ fields: Record<string, string>;
486
+ /** Compare case-insensitively (GitHub owner/repo names). Default exact. */
487
+ caseInsensitive?: boolean;
488
+ };
489
+ }
490
+ /** Context for a `record` feed's {@link RuntimeFeedWebhook.normalize}. */
491
+ export interface WebhookRecordContext<F = Record<string, unknown>> {
492
+ feedKey: string;
493
+ /** The delivery's event type, read through the connector's `webhook.eventType`. */
494
+ eventType: string;
495
+ /** The feed instance's config (never credentials or connection secrets). */
496
+ config: F;
497
+ /** ISO time the platform verified the delivery. */
498
+ receivedAt: string;
499
+ }
500
+ /**
501
+ * Map one verified delivery to the envelope the feed's poll emits for the same
502
+ * source item (same origin_id), or null when the delivery records nothing
503
+ * (e.g. an unstar). Runs with no credentials, network, browser or operations.
504
+ */
505
+ export type WebhookRecordNormalizer<F = Record<string, unknown>> = (payload: unknown, ctx: WebhookRecordContext<F>) => EventEnvelope | null | Promise<EventEnvelope | null>;
506
+ /** Runtime feed webhook: the persisted declaration plus a `record` feed's normalizer. */
507
+ export interface RuntimeFeedWebhook<F = Record<string, unknown>> extends FeedWebhookDeclaration {
508
+ normalize?: WebhookRecordNormalizer<F>;
509
+ }
445
510
  export interface FeedDefinition {
446
511
  /** Feed key, e.g. 'threads' */
447
512
  key: string;
@@ -464,7 +529,7 @@ export interface FeedDefinition {
464
529
  * this feed — every feed instance is created explicitly by the user (or by
465
530
  * the device worker on their behalf). Use this for feeds whose configSchema
466
531
  * has required fields that can only be supplied by an external actor, e.g.
467
- * `local.directory.files` needs a per-folder `folder_id` from the Mac app.
532
+ * the postgres `query` feed needs a user-authored SQL query.
468
533
  */
469
534
  userManaged?: boolean;
470
535
  /**
@@ -476,30 +541,44 @@ export interface FeedDefinition {
476
541
  /** Declares that live reads can honor fixed windows on this source timestamp. */
477
542
  readWindowAxis?: string;
478
543
  /**
479
- * Routes inbound app-webhook deliveries to this feed. Lives on the feed (not
544
+ * Event paths a live read can filter by exact value (`FeedReadContext.match`).
545
+ * A feed that declares them returns EventEnvelope-shaped rows, newest first,
546
+ * so its event-kind attributions and relationships resolve against read rows
547
+ * exactly as they do against synced events.
548
+ */
549
+ matchPaths?: string[];
550
+ /**
551
+ * Routes inbound provider deliveries to this feed. Lives on the feed (not
480
552
  * the connector's webhook schema) because feeds_schema is the persisted,
481
- * server-readable surface — the app-webhook router reads this to dispatch a
482
- * delivery WITHOUT hardcoding provider event types. The connector owns this
483
- * knowledge (which event updates which feed, and whether the payload is
484
- * complete enough to store):
485
- * - `mode: 'trigger'` (default) — the poll brings more than the webhook, so
486
- * mark this feed due and let the poll fetch the complete record (deduped by
487
- * origin_id). Use for events whose poll endpoint returns richer data.
488
- * - `mode: 'store'` — the payload is event-complete (e.g. a GitHub `star`
489
- * carries the actor + starred_at) and re-polling the whole list is wasteful,
490
- * so the router stores the structured event directly, consolidating with the
491
- * poll on the same origin_id.
553
+ * server-readable surface — the platform reads this to dispatch a delivery
554
+ * WITHOUT hardcoding provider event types. The connector owns this knowledge
555
+ * (which event updates which feed, and whether the payload is complete
556
+ * enough to record):
557
+ * - `kind: 'invalidate'` (default) — the poll brings more than the webhook,
558
+ * so mark this feed due and let the poll fetch the complete record (deduped
559
+ * by origin_id). On a read-only feed, these are `automationEvents` keys
560
+ * whose source references (from `observe`) activate subscribed Automations
561
+ * without importing content.
562
+ * - `kind: 'record'` — the payload is event-complete (e.g. a GitHub `star`
563
+ * carries the actor + starred_at), so the runtime feed's `normalize` maps it
564
+ * to the same envelope (and origin_id) the poll emits, and the platform
565
+ * stores it without re-polling.
492
566
  */
493
- webhook?: {
494
- /** Provider webhook event types (e.g. `x-github-event` values) that update this feed. */
495
- events: string[];
496
- /** How a matching delivery is handled. Default `'trigger'`. */
497
- mode?: 'trigger' | 'store';
498
- };
567
+ webhook?: FeedWebhookDeclaration;
499
568
  /** Event kinds this feed produces, keyed by kind slug */
500
569
  eventKinds?: Record<string, {
501
570
  description?: string;
502
571
  metadataSchema?: Record<string, unknown>;
572
+ /**
573
+ * Opt in to a separate `<kind>.updated` Automation trigger when a sync
574
+ * supersedes this source item with changed durable content and strictly
575
+ * newer `occurred_at` activity. The original kind remains insert-only.
576
+ * Unchanged rows, volatile-only updates and cold-start backfills stay
577
+ * quiet. Use activity time for `occurred_at`, not a scheduled start time.
578
+ * A declared literal kind wins a collision; composite keys over 100
579
+ * characters are not derived. Persisted unchanged in feeds_schema.
580
+ */
581
+ updatedEvent?: boolean;
503
582
  /**
504
583
  * Generic event attribution declarations. New connector work should model
505
584
  * "who authored / what resource this event belongs to / what it is about"
@@ -745,14 +824,12 @@ export interface EventEnvelope {
745
824
  origin_id: string;
746
825
  /** Source-native item type (e.g. post, message, issue) */
747
826
  origin_type?: string;
748
- /** Content format: 'text' (default), 'markdown', 'json_template', 'media', 'empty' */
749
- payload_type?: 'text' | 'markdown' | 'json_template' | 'media' | 'empty';
827
+ /** Content format: 'text' (default), 'markdown', 'media', 'empty' */
828
+ payload_type?: 'text' | 'markdown' | 'media' | 'empty';
750
829
  /** Main text content */
751
830
  payload_text: string;
752
- /** Structured data (template data for json_template, or structured metadata for media) */
831
+ /** Structured event data, preserved alongside content and media. */
753
832
  payload_data?: Record<string, unknown>;
754
- /** JSON template for rendering (required when payload_type is 'json_template') */
755
- payload_template?: Record<string, unknown> | null;
756
833
  /** File or media attachments */
757
834
  attachments?: unknown[];
758
835
  /** Title / subject line */
@@ -784,6 +861,8 @@ export interface EventEnvelope {
784
861
  * - `F` — feed config shape (defaults to `Record<string, unknown>`)
785
862
  */
786
863
  export interface SyncContext<C = Record<string, unknown>, F = Record<string, unknown>> {
864
+ /** Browser handle scoped by the host to this connection and declared origins. */
865
+ browser?: ChromeActionDispatcher;
787
866
  /** Feed key */
788
867
  feedKey: string;
789
868
  /**
@@ -896,6 +975,8 @@ export interface WebhookRegistration {
896
975
  metadata?: Record<string, unknown>;
897
976
  }
898
977
  export type FeedOperation = 'sync' | 'read';
978
+ /** Installs/reconnects a source listener. Delivery uses the existing browser feed transport. */
979
+ export type FeedObserveContext<C = Record<string, unknown>, F = Record<string, unknown>> = Omit<SyncContext<C, F>, 'commit' | 'entityIds'>;
899
980
  /** Fixed half-open source-time bounds, preserved across every page of a read. */
900
981
  export interface FeedReadWindow {
901
982
  start: string;
@@ -911,6 +992,8 @@ export interface FeedReadWindowCoverage extends FeedReadWindow {
911
992
  * returned to the caller without being persisted by this contract.
912
993
  */
913
994
  export interface FeedReadContext<F = Record<string, unknown>> {
995
+ /** Browser handle scoped by the host to this connection and declared origins. */
996
+ browser?: ChromeActionDispatcher;
914
997
  feedId?: number;
915
998
  feedKey: string;
916
999
  query?: string;
@@ -927,9 +1010,27 @@ export interface FeedReadContext<F = Record<string, unknown>> {
927
1010
  column: string;
928
1011
  order: 'asc' | 'desc';
929
1012
  };
1013
+ /**
1014
+ * Exact-value filter on one of the feed's declared `matchPaths`. A matched
1015
+ * read pages only by `nextCursor`: a result without one is the last page.
1016
+ * Source-native page tokens are supported. Merged record activity also
1017
+ * needs `FeedReadResult.rowCursors` to resume a partially consumed page.
1018
+ */
1019
+ match?: FeedReadMatch;
1020
+ }
1021
+ export interface FeedReadMatch {
1022
+ path: string;
1023
+ values: string[];
930
1024
  }
931
1025
  export interface FeedReadResult {
932
1026
  rows: Record<string, unknown>[];
1027
+ /**
1028
+ * Optional exact resume token after each row, in the same order as `rows`.
1029
+ * Supply only when the source can seek past a stable row key even if that
1030
+ * row is deleted. Enables merging partially consumed pages across feeds.
1031
+ * Ordinary page-token readers omit this; never synthesize it from offsets.
1032
+ */
1033
+ rowCursors?: string[];
933
1034
  columns?: {
934
1035
  name: string;
935
1036
  type: string;
@@ -945,9 +1046,12 @@ export interface FeedReadResult {
945
1046
  export type FeedSyncHandler<C = Record<string, unknown>, F = Record<string, unknown>> = (ctx: SyncContext<C, F>) => Promise<SyncResult>;
946
1047
  export type FeedReadHandler<F = Record<string, unknown>> = (ctx: FeedReadContext<F>) => Promise<FeedReadResult>;
947
1048
  /** Executable feed definition held only inside a connector runtime. */
948
- export interface RuntimeFeedDefinition<C = Record<string, unknown>, F = Record<string, unknown>> extends Omit<FeedDefinition, 'operations'> {
1049
+ export interface RuntimeFeedDefinition<C = Record<string, unknown>, F = Record<string, unknown>> extends Omit<FeedDefinition, 'operations' | 'webhook'> {
1050
+ webhook?: RuntimeFeedWebhook<F>;
949
1051
  sync?: FeedSyncHandler<C, F>;
950
1052
  read?: FeedReadHandler<F>;
1053
+ /** Setup only: emits no result and does not add a feed operation. */
1054
+ observe?: (ctx: FeedObserveContext<C, F>) => Promise<void>;
951
1055
  }
952
1056
  /** Runtime-only connector definition. Metadata extraction strips handlers. */
953
1057
  export interface RuntimeConnectorDefinition<C = Record<string, unknown>, F = Record<string, unknown>> extends Omit<ConnectorDefinition, 'feeds'> {
@@ -987,6 +1091,20 @@ export interface QueryContext<F = Record<string, unknown>> {
987
1091
  columns: string[];
988
1092
  value: string;
989
1093
  };
1094
+ /**
1095
+ * Shared collection predicates, applied before sorting and pagination.
1096
+ * Search is a literal case-insensitive substring of the projected name.
1097
+ * Attribute filters are ANDed, use typed values, and treat absent fields as
1098
+ * null. The connector owns dialect-safe encoding and must reject unknown
1099
+ * columns. An empty object identifies an unfiltered collection read, allowing
1100
+ * a source to return its population total without counting ordinary SQL reads.
1101
+ * Requires queryCapabilities.selection for nonempty predicates; old sources
1102
+ * keep their unfiltered query semantics when the selection is empty.
1103
+ */
1104
+ selection?: {
1105
+ search?: string;
1106
+ filters?: AttributeFilter[];
1107
+ };
990
1108
  }
991
1109
  /** Result from ConnectorRuntime.query(). Rows are returned to the caller, never persisted. */
992
1110
  export interface QueryResult {
@@ -1105,10 +1223,21 @@ export interface AuthResult {
1105
1223
  [key: string]: unknown;
1106
1224
  };
1107
1225
  }
1226
+ /** Host-mediated calls to a visible native device connection. The target's
1227
+ * Auto/Ask/Block policy applies independently. Pending approval is a receipt,
1228
+ * not a completed effect. Reuse the same key on ambiguous outcomes; do not
1229
+ * blindly retry an interactive prompt. Keys are scoped to the parent run. */
1230
+ export interface ConnectorOperations {
1231
+ execute(request: ConnectorOperationRequest): Promise<ConnectorOperationResult>;
1232
+ }
1108
1233
  /**
1109
1234
  * Context passed to ConnectorRuntime.execute()
1110
1235
  */
1111
1236
  export interface ActionContext {
1237
+ /** Native device operations, delegated through the host's operation lifecycle. */
1238
+ operations?: ConnectorOperations;
1239
+ /** Browser handle scoped by the host to this connection and declared origins. */
1240
+ browser?: ChromeActionDispatcher;
1112
1241
  /** Action key to execute */
1113
1242
  actionKey: string;
1114
1243
  /** Action input parameters */
@@ -1117,13 +1246,7 @@ export interface ActionContext {
1117
1246
  credentials: SyncCredentials | null;
1118
1247
  /** Connection config */
1119
1248
  config: Record<string, unknown>;
1120
- /**
1121
- * Per-run session state. The connector-worker splices a live
1122
- * `chrome_dispatcher` (a `ChromeActionDispatcher`) onto this for action runs
1123
- * the same way it does for syncs, so on-demand actions can drive the paired
1124
- * Owletto Chrome extension (e.g. scrape a page the agent chose at runtime).
1125
- * Null when no session/dispatcher applies.
1126
- */
1249
+ /** Per-run authentication state. Use `browser` for declared browser access. */
1127
1250
  sessionState?: Record<string, unknown> | null;
1128
1251
  /** App-installation context when this connection is backed by an App install. */
1129
1252
  installation?: ConnectorInstallationContext;
@@ -1174,7 +1297,8 @@ export interface ContentItem {
1174
1297
  attachments_bytes?: number;
1175
1298
  rating: string | null;
1176
1299
  source_url: string | null;
1177
- score: number;
1300
+ /** Score returned by the read path; null when no score is available. */
1301
+ score: number | null;
1178
1302
  normalized_score?: number;
1179
1303
  metadata: Record<string, unknown>;
1180
1304
  classifications: Record<string, unknown>;
@@ -1248,7 +1372,7 @@ export interface ContentItem {
1248
1372
  text_content: string;
1249
1373
  occurred_at: string;
1250
1374
  source_url: string;
1251
- score: number;
1375
+ score: number | null;
1252
1376
  } | null;
1253
1377
  /** Only if root not in results AND depth > 0 */
1254
1378
  root_context?: {
@@ -1256,7 +1380,7 @@ export interface ContentItem {
1256
1380
  title: string;
1257
1381
  occurred_at: string;
1258
1382
  source_url: string;
1259
- score: number;
1383
+ score: number | null;
1260
1384
  } | null;
1261
1385
  /** Permalink URL for this specific knowledge item */
1262
1386
  permalink?: string | null;
@@ -30,7 +30,7 @@
30
30
  * ```
31
31
  */
32
32
  import { ConnectorRuntime } from "./connector-runtime.js";
33
- import type { ActionContext, ActionDefinition, ActionResult, AuthContext, AuthResult, ConnectorDefinition, FeedDefinition, FeedReadHandler, FeedSyncHandler, QueryContext, QueryResult, ReflectContext, ReflectResult, WebhookRegistration, WebhookRegistrationContext } from "./connector-types.js";
33
+ import type { ActionContext, ActionDefinition, ActionResult, AuthContext, AuthResult, ConnectorDefinition, FeedDefinition, FeedObserveContext, FeedReadHandler, FeedSyncHandler, QueryContext, QueryResult, ReflectContext, ReflectResult, WebhookRegistration, WebhookRegistrationContext } from "./connector-types.js";
34
34
  /**
35
35
  * A feed's metadata plus one or both executable operations. Capabilities are
36
36
  * inferred from these handlers when metadata is extracted.
@@ -38,9 +38,11 @@ import type { ActionContext, ActionDefinition, ActionResult, AuthContext, AuthRe
38
38
  export type ConnectorFeedSpec<C = Record<string, unknown>, F = Record<string, unknown>> = Omit<FeedDefinition, "key" | "operations"> & ({
39
39
  sync: FeedSyncHandler<C, F>;
40
40
  read?: FeedReadHandler<F>;
41
+ observe?: never;
41
42
  } | {
42
- sync?: FeedSyncHandler<C, F>;
43
+ sync?: never;
43
44
  read: FeedReadHandler<F>;
45
+ observe?: (ctx: FeedObserveContext<C, F>) => Promise<void>;
44
46
  });
45
47
  /** An action's metadata (minus `key`) plus its `execute` handler. */
46
48
  export interface ConnectorActionSpec extends Omit<ActionDefinition, "key"> {
@@ -44,6 +44,7 @@ function buildDefinition(spec) {
44
44
  mcpConfig: spec.mcpConfig,
45
45
  openapiConfig: spec.openapiConfig,
46
46
  requiredCapability: spec.requiredCapability,
47
+ browser: spec.browser,
47
48
  runtime: spec.runtime,
48
49
  webhook: spec.webhook,
49
50
  automationEvents: spec.automationEvents,
@@ -63,7 +64,9 @@ function buildDefinition(spec) {
63
64
  eventKinds: feed.eventKinds,
64
65
  sync: feed.sync,
65
66
  read: feed.read,
67
+ observe: feed.observe,
66
68
  readWindowAxis: feed.readWindowAxis,
69
+ matchPaths: feed.matchPaths,
67
70
  },
68
71
  ]));
69
72
  }