@lobu/runtime-device 24.1.1 → 24.3.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 (194) hide show
  1. package/dist/component.json +1 -1
  2. package/dist/dependencies.bun.lock +46 -134
  3. package/npm-shrinkwrap.json +229 -730
  4. package/package.json +1 -1
  5. package/vendor/cli/dist/bundled-skills/lobu/SKILL.md +20 -5
  6. package/vendor/cli/dist/chrome-extension/accessibility-tree.js +834 -0
  7. package/vendor/cli/dist/chrome-extension/ambient-context.js +53 -0
  8. package/vendor/cli/dist/chrome-extension/auth-refresh.js +167 -0
  9. package/vendor/cli/dist/chrome-extension/automation-run.js +13 -0
  10. package/vendor/cli/dist/chrome-extension/background.js +1155 -0
  11. package/vendor/cli/dist/chrome-extension/bridge.js +140 -0
  12. package/vendor/cli/dist/chrome-extension/browser-origin-policy.js +62 -0
  13. package/vendor/cli/dist/chrome-extension/browser-recovery.js +260 -0
  14. package/vendor/cli/dist/chrome-extension/browser-url-sanitizer.js +284 -0
  15. package/vendor/cli/dist/chrome-extension/completion-response.js +12 -0
  16. package/vendor/cli/dist/chrome-extension/config.js +144 -0
  17. package/vendor/cli/dist/chrome-extension/connector-manifests/chrome.json +1516 -0
  18. package/vendor/cli/dist/chrome-extension/connector-manifests/chrome_bookmarks.json +84 -0
  19. package/vendor/cli/dist/chrome-extension/connector-manifests/chrome_downloads.json +86 -0
  20. package/vendor/cli/dist/chrome-extension/connector-manifests/chrome_history.json +78 -0
  21. package/vendor/cli/dist/chrome-extension/connector-manifests.js +1767 -0
  22. package/vendor/cli/dist/chrome-extension/console-capture.js +627 -0
  23. package/vendor/cli/dist/chrome-extension/control-activity.js +70 -0
  24. package/vendor/cli/dist/chrome-extension/debugger-lease.js +439 -0
  25. package/vendor/cli/dist/chrome-extension/feed-listener.js +488 -0
  26. package/vendor/cli/dist/chrome-extension/feed-transaction.js +48 -0
  27. package/vendor/cli/dist/chrome-extension/feeds.js +632 -0
  28. package/vendor/cli/dist/chrome-extension/focus-tab.js +25 -0
  29. package/vendor/cli/dist/chrome-extension/fonts/dm-mono-latin-500-normal.woff2 +0 -0
  30. package/vendor/cli/dist/chrome-extension/fonts/dm-sans-latin-400-normal.woff2 +0 -0
  31. package/vendor/cli/dist/chrome-extension/fonts/dm-sans-latin-600-normal.woff2 +0 -0
  32. package/vendor/cli/dist/chrome-extension/heartbeat.js +140 -0
  33. package/vendor/cli/dist/chrome-extension/icons/icon-128-rec.png +0 -0
  34. package/vendor/cli/dist/chrome-extension/icons/icon-128.png +0 -0
  35. package/vendor/cli/dist/chrome-extension/icons/icon-16-rec.png +0 -0
  36. package/vendor/cli/dist/chrome-extension/icons/icon-16.png +0 -0
  37. package/vendor/cli/dist/chrome-extension/icons/icon-32-rec.png +0 -0
  38. package/vendor/cli/dist/chrome-extension/icons/icon-32.png +0 -0
  39. package/vendor/cli/dist/chrome-extension/icons/icon-48-rec.png +0 -0
  40. package/vendor/cli/dist/chrome-extension/icons/icon-48.png +0 -0
  41. package/vendor/cli/dist/chrome-extension/lens-page.js +135 -0
  42. package/vendor/cli/dist/chrome-extension/lens-target.js +20 -0
  43. package/vendor/cli/dist/chrome-extension/manifest.json +76 -0
  44. package/vendor/cli/dist/chrome-extension/network-intercept.js +657 -0
  45. package/vendor/cli/dist/chrome-extension/page-activation.js +120 -0
  46. package/vendor/cli/dist/chrome-extension/page-dialogs.js +125 -0
  47. package/vendor/cli/dist/chrome-extension/page-url.js +11 -0
  48. package/vendor/cli/dist/chrome-extension/panel-session.js +184 -0
  49. package/vendor/cli/dist/chrome-extension/poll-auth.js +85 -0
  50. package/vendor/cli/dist/chrome-extension/poll-backoff.js +22 -0
  51. package/vendor/cli/dist/chrome-extension/run-fence.js +117 -0
  52. package/vendor/cli/dist/chrome-extension/setup-status.js +71 -0
  53. package/vendor/cli/dist/chrome-extension/side-panel-action-click.js +65 -0
  54. package/vendor/cli/dist/chrome-extension/sidepanel-context.js +50 -0
  55. package/vendor/cli/dist/chrome-extension/sidepanel.html +680 -0
  56. package/vendor/cli/dist/chrome-extension/sidepanel.js +1643 -0
  57. package/vendor/cli/dist/chrome-extension/tab-labels.js +233 -0
  58. package/vendor/cli/dist/chrome-extension/tools.js +3354 -0
  59. package/vendor/cli/dist/chrome-extension/watch-observer.js +354 -0
  60. package/vendor/cli/dist/chrome-extension/watch-redact.js +96 -0
  61. package/vendor/cli/dist/chrome-extension/watch.js +348 -0
  62. package/vendor/cli/dist/commands/_lib/apply/desired-state.d.ts +6 -4
  63. package/vendor/cli/dist/commands/_lib/apply/desired-state.js +5 -3
  64. package/vendor/cli/dist/commands/_lib/apply/diff.js +4 -3
  65. package/vendor/cli/dist/commands/_lib/chrome-for-testing.d.ts +13 -0
  66. package/vendor/cli/dist/commands/_lib/chrome-for-testing.js +226 -0
  67. package/vendor/cli/dist/commands/_lib/device-credential.d.ts +34 -0
  68. package/vendor/cli/dist/commands/_lib/device-credential.js +157 -0
  69. package/vendor/cli/dist/commands/_lib/device-wizard.d.ts +17 -0
  70. package/vendor/cli/dist/commands/_lib/device-wizard.js +11 -2
  71. package/vendor/cli/dist/commands/_lib/native-messaging.d.ts +7 -0
  72. package/vendor/cli/dist/commands/_lib/native-messaging.js +40 -0
  73. package/vendor/cli/dist/commands/browser.d.ts +23 -0
  74. package/vendor/cli/dist/commands/browser.js +492 -0
  75. package/vendor/cli/dist/commands/call.d.ts +12 -0
  76. package/vendor/cli/dist/commands/call.js +48 -26
  77. package/vendor/cli/dist/commands/chat.d.ts +0 -12
  78. package/vendor/cli/dist/commands/chat.js +1 -1
  79. package/vendor/cli/dist/commands/context.d.ts +3 -1
  80. package/vendor/cli/dist/commands/context.js +13 -2
  81. package/vendor/cli/dist/commands/daemon.js +38 -171
  82. package/vendor/cli/dist/commands/doctor.d.ts +0 -6
  83. package/vendor/cli/dist/commands/doctor.js +1 -1
  84. package/vendor/cli/dist/commands/memory/_lib/errors.d.ts +4 -1
  85. package/vendor/cli/dist/commands/memory/_lib/errors.js +9 -1
  86. package/vendor/cli/dist/commands/memory/_lib/mcp.d.ts +0 -9
  87. package/vendor/cli/dist/commands/memory/_lib/mcp.js +1 -23
  88. package/vendor/cli/dist/commands/memory/_lib/memory-auth.d.ts +20 -4
  89. package/vendor/cli/dist/commands/memory/_lib/memory-auth.js +21 -17
  90. package/vendor/cli/dist/commands/memory/_lib/seed-cmd.d.ts +0 -8
  91. package/vendor/cli/dist/commands/memory/_lib/seed-cmd.js +7 -18
  92. package/vendor/cli/dist/commands/memory/run.js +4 -25
  93. package/vendor/cli/dist/config/define.d.ts +1 -1
  94. package/vendor/cli/dist/connectors/gchat.ts +31 -1
  95. package/vendor/cli/dist/connectors/google_gmail.ts +70 -41
  96. package/vendor/cli/dist/connectors/google_gmail_references.ts +406 -0
  97. package/vendor/cli/dist/connectors/linkedin-inbox-adapter.js +107 -36
  98. package/vendor/cli/dist/connectors/linkedin-inbox.ts +13 -0
  99. package/vendor/cli/dist/connectors/linkedin.ts +1 -1
  100. package/vendor/cli/dist/connectors/postgres.ts +14 -8
  101. package/vendor/cli/dist/connectors/reddit.ts +171 -5
  102. package/vendor/cli/dist/connectors/whatsapp-web-adapter.js +147 -61
  103. package/vendor/cli/dist/connectors/whatsapp-web-helpers.ts +6 -2
  104. package/vendor/cli/dist/connectors/whatsapp_web.ts +48 -17
  105. package/vendor/cli/dist/connectors/x-dm-adapter.js +252 -35
  106. package/vendor/cli/dist/connectors/x.ts +189 -13
  107. package/vendor/cli/dist/index.js +46 -6
  108. package/vendor/cli/dist/internal/cli-update-check.d.ts +33 -0
  109. package/vendor/cli/dist/internal/cli-update-check.js +98 -0
  110. package/vendor/cli/dist/internal/credentials.js +10 -36
  111. package/vendor/cli/dist/internal/device-state.d.ts +2 -0
  112. package/vendor/cli/dist/internal/device-state.js +4 -0
  113. package/vendor/cli/dist/internal/gateway-url.d.ts +0 -8
  114. package/vendor/cli/dist/internal/gateway-url.js +1 -1
  115. package/vendor/cli/dist/runtime-components.json +4 -4
  116. package/vendor/cli/dist/templates/AGENTS.md.tmpl +3 -1
  117. package/vendor/cli/dist/templates/TESTING.md.tmpl +8 -8
  118. package/vendor/cli/package.json +1 -1
  119. package/vendor/connector-sdk/dist/browser-requirement.js +1 -1
  120. package/vendor/connector-sdk/dist/connector-types.d.ts +34 -1
  121. package/vendor/connector-sdk/dist/index.d.ts +3 -1
  122. package/vendor/connector-sdk/dist/index.js +4 -0
  123. package/vendor/connector-sdk/dist/redact.d.ts +10 -0
  124. package/vendor/{connector-worker/dist/executor → connector-sdk/dist}/redact.js +0 -49
  125. package/vendor/connector-sdk/dist/types.d.ts +2 -1
  126. package/vendor/connector-sdk/package.json +6 -1
  127. package/vendor/connector-worker/dist/agent-turn/gateway-tools.d.ts +9 -0
  128. package/vendor/connector-worker/dist/agent-turn/gateway-tools.js +23 -2
  129. package/vendor/connector-worker/dist/agent-turn/guest-entry.js +14 -6
  130. package/vendor/connector-worker/dist/agent-turn/guest.bundle.js +62 -25
  131. package/vendor/connector-worker/dist/agent-turn/media-tools.d.ts +1 -0
  132. package/vendor/connector-worker/dist/agent-turn/media-tools.js +5 -2
  133. package/vendor/connector-worker/dist/bin.js +2 -0
  134. package/vendor/connector-worker/dist/daemon/acp-adapters/THIRD_PARTY_LICENSES.txt +1 -1
  135. package/vendor/connector-worker/dist/daemon/acp-adapters/claude.js +7339 -2136
  136. package/vendor/connector-worker/dist/daemon/agent-turn.js +52 -17
  137. package/vendor/connector-worker/dist/daemon/automation.js +3 -13
  138. package/vendor/connector-worker/dist/daemon/client.d.ts +23 -3
  139. package/vendor/connector-worker/dist/daemon/client.js +59 -5
  140. package/vendor/connector-worker/dist/daemon/executor.d.ts +0 -28
  141. package/vendor/connector-worker/dist/daemon/executor.js +27 -12
  142. package/vendor/connector-worker/dist/daemon/index.d.ts +1 -1
  143. package/vendor/connector-worker/dist/daemon/index.js +1 -1
  144. package/vendor/connector-worker/dist/daemon/interactive-session.js +29 -6
  145. package/vendor/connector-worker/dist/daemon/poll-loop.js +29 -2
  146. package/vendor/connector-worker/dist/daemon/start.d.ts +0 -1
  147. package/vendor/connector-worker/dist/daemon/start.js +1 -1
  148. package/vendor/connector-worker/dist/daemon/terminal-delivery.d.ts +6 -10
  149. package/vendor/connector-worker/dist/daemon/terminal-delivery.js +59 -23
  150. package/vendor/connector-worker/dist/daemon/terminal-failure.js +2 -2
  151. package/vendor/connector-worker/dist/executor/isolate.js +4 -1
  152. package/vendor/connector-worker/dist/isolate/bridge.d.ts +6 -2
  153. package/vendor/connector-worker/dist/isolate/bridge.js +14 -8
  154. package/vendor/connector-worker/package.json +2 -2
  155. package/vendor/core/dist/agent-tooling.d.ts +8 -0
  156. package/vendor/core/dist/agent-tooling.js +9 -1
  157. package/vendor/core/dist/capabilities.d.ts +1 -1
  158. package/vendor/core/dist/capabilities.js +5 -0
  159. package/vendor/core/dist/connector-query-errors.d.ts +6 -0
  160. package/vendor/core/dist/connector-query-errors.js +4 -0
  161. package/vendor/core/dist/contracts/entity-reference.d.ts +3 -0
  162. package/vendor/core/dist/contracts/entity-reference.js +31 -0
  163. package/vendor/core/dist/contracts/tools/manage-automations.d.ts +3 -0
  164. package/vendor/core/dist/contracts/tools/manage-automations.js +4 -1
  165. package/vendor/core/dist/contracts/tools/manage-connections.js +1 -1
  166. package/vendor/core/dist/contracts/tools/manage-entity-schema.js +2 -2
  167. package/vendor/core/dist/contracts/tools/manage-entity.d.ts +117 -34
  168. package/vendor/core/dist/contracts/tools/manage-entity.js +47 -14
  169. package/vendor/core/dist/contracts/tools/manage-operations.d.ts +13 -4
  170. package/vendor/core/dist/contracts/tools/manage-operations.js +19 -7
  171. package/vendor/core/dist/contracts/tools/read-knowledge.d.ts +6 -1
  172. package/vendor/core/dist/contracts/tools/read-knowledge.js +20 -1
  173. package/vendor/core/dist/contracts/tools/view-attach.d.ts +1 -1
  174. package/vendor/core/dist/contracts/tools/view-runtime.d.ts +2 -0
  175. package/vendor/core/dist/contracts/tools/view-runtime.js +3 -1
  176. package/vendor/core/dist/contracts/worker/device-automation.d.ts +4 -9
  177. package/vendor/core/dist/contracts/worker/device-automation.js +10 -15
  178. package/vendor/core/dist/contracts/worker/protocol.d.ts +20 -0
  179. package/vendor/core/dist/contracts/worker/protocol.js +20 -0
  180. package/vendor/core/dist/errors.d.ts +0 -20
  181. package/vendor/core/dist/errors.js +1 -25
  182. package/vendor/core/dist/otel.js +38 -10
  183. package/vendor/core/dist/reserved.d.ts +6 -3
  184. package/vendor/core/dist/reserved.js +6 -3
  185. package/vendor/core/dist/utils/ajv.js +3 -1
  186. package/vendor/core/dist/worker/auth.d.ts +3 -2
  187. package/vendor/core/package.json +31 -5
  188. package/vendor/postgres/cf/src/query.js +3 -1
  189. package/vendor/postgres/cjs/src/query.js +3 -1
  190. package/vendor/postgres/src/query.js +3 -1
  191. package/vendor/connector-worker/dist/executor/http-status.d.ts +0 -16
  192. package/vendor/connector-worker/dist/executor/http-status.js +0 -21
  193. package/vendor/connector-worker/dist/executor/redact.d.ts +0 -29
  194. /package/vendor/postgres/{.bun-tag-2f292c6554a8475e → .bun-tag-22d644c2873790db} +0 -0
@@ -248,7 +248,9 @@ choices cover configured install flows; Telegram uses the link-code flow above.
248
248
  `cloud_status: "unavailable"` means discovery failed; retry before concluding
249
249
  that no managed option exists. Offers are not connected accounts. In an
250
250
  authenticated cloud context, use ClientSDK through Lobu MCP or
251
- `lobu memory exec`. Call `client.organizations.list()` to find organizations
251
+ `lobu memory run query_sdk '{"title":"Find managed connection providers","script":"export default async (_ctx, client) => client.organizations.list()"}'`.
252
+ This account discovery works before an active org is selected; `lobu call` over REST requires one.
253
+ Call `client.organizations.list()` to find organizations
252
254
  that offer managed connections. On account-scoped `/mcp`, first select an
253
255
  authorized home workspace with `const home = await client.org(homeSlug)` and use
254
256
  that client for `home.connections.connectManaged`. The public provider
@@ -45,8 +45,8 @@ prove Slack, Telegram, or another platform works.
45
45
  Discover the live ids and current state instead of copying ids from config:
46
46
 
47
47
  ```bash
48
- npx @lobu/cli@latest memory exec \
49
- 'export default async (_ctx, client) => ({ connections: await client.connections.list(), feeds: await client.feeds.list() });' \
48
+ npx @lobu/cli@latest call query_sdk --arg title='List connections and feeds' \
49
+ --arg script='export default async (_ctx, client) => ({ connections: await client.connections.list(), feeds: await client.feeds.list() });' \
50
50
  --context local
51
51
  ```
52
52
 
@@ -62,8 +62,8 @@ After the user explicitly approves provider-data access, dry-run a collected
62
62
  feed server-side first:
63
63
 
64
64
  ```bash
65
- npx @lobu/cli@latest memory exec \
66
- 'export default async (_ctx, client) => client.feeds.trigger({ feed_id: Number("<feed-id>"), dry_run: true });' \
65
+ npx @lobu/cli@latest call run_sdk --arg title='Dry-run feed' \
66
+ --arg script='export default async (_ctx, client) => client.feeds.trigger({ feed_id: Number("<feed-id>"), dry_run: true });' \
67
67
  --context local
68
68
  ```
69
69
 
@@ -86,12 +86,12 @@ List configured Automations, then trigger each selected Automation by its return
86
86
  id:
87
87
 
88
88
  ```bash
89
- npx @lobu/cli@latest memory exec \
90
- 'export default async (_ctx, client) => client.automations.list();' \
89
+ npx @lobu/cli@latest call query_sdk --arg title='List Automations' \
90
+ --arg script='export default async (_ctx, client) => client.automations.list();' \
91
91
  --context local
92
92
 
93
- npx @lobu/cli@latest memory exec \
94
- 'export default async (_ctx, client) => client.automations.trigger({ automation_id: "<automation-id>" });' \
93
+ npx @lobu/cli@latest call run_sdk --arg title='Trigger Automation' \
94
+ --arg script='export default async (_ctx, client) => client.automations.trigger({ automation_id: "<automation-id>" });' \
95
95
  --context local
96
96
  ```
97
97
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobu/cli",
3
- "version": "24.1.1",
3
+ "version": "24.3.0",
4
4
  "description": "CLI for deploying and managing AI agents on Lobu",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -36,7 +36,7 @@ export function resolveBrowserRequirement(value, authMethod) {
36
36
  /** Replaces caller-supplied `allowed_origins` with the catalog grant; URLs must fall inside it. */
37
37
  export function constrainBrowserInput(browser, actionKey, input) {
38
38
  validateBrowserRequirement(browser);
39
- const allowedActions = [BROWSER_VERIFY_OPERATION, 'navigate', 'evaluate', 'get_accessibility_tree', 'wait_for_selector', 'screenshot', 'click_ref', 'type_ref', 'press_key', 'scroll', 'focus_tab', 'close_tab', 'list_tabs', 'feed_listen', 'show_notification', 'network_intercept_start', 'network_intercept_drain', 'network_intercept_stop', 'network_intercept_replay', 'console_capture_start', 'console_capture_drain', 'console_capture_stop'];
39
+ const allowedActions = [BROWSER_VERIFY_OPERATION, 'navigate', 'evaluate', 'get_accessibility_tree', 'wait_for_selector', 'screenshot', 'click_ref', 'type_ref', 'press_key', 'hover_ref', 'scroll', 'select_option', 'handle_dialog', 'focus_tab', 'close_tab', 'list_tabs', 'feed_listen', 'show_notification', 'network_intercept_start', 'network_intercept_drain', 'network_intercept_stop', 'network_intercept_replay', 'console_capture_start', 'console_capture_drain', 'console_capture_stop'];
40
40
  if (!allowedActions.includes(actionKey))
41
41
  throw new Error('Operation is outside the declared browser resource');
42
42
  if (actionKey === 'navigate' && input.url === 'about:blank')
@@ -41,6 +41,7 @@ export interface ConnectorDefinition {
41
41
  /** Query filters implemented by this connector. Unsupported filters fail before query(). */
42
42
  queryCapabilities?: {
43
43
  exactMatch?: boolean;
44
+ verbatimExactMatch?: boolean;
44
45
  selection?: boolean;
45
46
  };
46
47
  /** Connector-normalized events that can activate Automations. */
@@ -181,6 +182,30 @@ export interface ConnectorRuntimeInfo {
181
182
  packages: string[];
182
183
  };
183
184
  }
185
+ /**
186
+ * `app_installation` deliveries authenticated by a Google-signed bearer JWT
187
+ * (Google Chat) instead of an HMAC. `{appId}` in {@link signers} is replaced
188
+ * by the value of {@link appIdKey}.
189
+ */
190
+ export interface ConnectorWebhookGoogleJwtVerification {
191
+ type: 'google-jwt';
192
+ /**
193
+ * Env var holding the receiving app's id (the Google Cloud project number).
194
+ * It is the installs' `provider_app_id`; when unset the provider is not
195
+ * registered and its app-webhook endpoint answers 404.
196
+ */
197
+ appIdKey: string;
198
+ /**
199
+ * Token audiences to accept, either of which verifies:
200
+ * - `'app_id'` — a JWT self-signed by one of {@link signers} with `aud` = the
201
+ * app id, checked against that service account's published keys.
202
+ * - `'endpoint_url'` — a Google OIDC ID token with `aud` = this provider's
203
+ * public app-webhook URL and a verified `email` in {@link signers}.
204
+ */
205
+ audiences: Array<'app_id' | 'endpoint_url'>;
206
+ /** Google service-account emails allowed to sign a delivery. */
207
+ signers: string[];
208
+ }
184
209
  /**
185
210
  * Declarative scheme the gateway uses to verify an inbound provider webhook in
186
211
  * the request hot path — no connector code runs before the 202 ack. The shared
@@ -188,6 +213,11 @@ export interface ConnectorRuntimeInfo {
188
213
  * at connect time and stored on the connection.
189
214
  */
190
215
  export interface ConnectorWebhookSchema {
216
+ /**
217
+ * Non-HMAC verification for `app_installation` deliveries. When set, the HMAC
218
+ * fields below are not used and no webhook secret is resolved.
219
+ */
220
+ verification?: ConnectorWebhookGoogleJwtVerification;
191
221
  /**
192
222
  * Request header carrying the provider's HMAC signature over the raw body,
193
223
  * e.g. `x-hub-signature-256` (GitHub), `linear-signature`. Omit for providers
@@ -1082,14 +1112,17 @@ export interface QueryContext<F = Record<string, unknown>> {
1082
1112
  order: 'asc' | 'desc';
1083
1113
  };
1084
1114
  /**
1085
- * Filter before pagination by the trimmed string of the first non-null
1115
+ * Filter before pagination by the string (trimmed by default) of the first non-null
1086
1116
  * projected column, in order. Missing columns count as null; an empty string
1087
1117
  * does not fall through. Values must be bound or safely encoded by the
1088
1118
  * connector, which owns its source dialect. Requires queryCapabilities.exactMatch.
1119
+ * `verbatim: true` preserves the scalar string without trimming and additionally
1120
+ * requires queryCapabilities.verbatimExactMatch. The default stays trimmed.
1089
1121
  */
1090
1122
  exactMatch?: {
1091
1123
  columns: string[];
1092
1124
  value: string;
1125
+ verbatim?: boolean;
1093
1126
  };
1094
1127
  /**
1095
1128
  * Shared collection predicates, applied before sorting and pagination.
@@ -15,7 +15,7 @@ import { validateEntityMetrics } from './metrics.js';
15
15
  export { validateEntityMetrics };
16
16
  export type { Dimension, EntityMetrics, EventSet, FactMatchRule, Measure, MetricReadMode, MetricTier, Segment, } from './metrics.js';
17
17
  export type { ConnectorActionSpec, ConnectorClass, ConnectorFeedSpec, ConnectorSpec, } from './define-connector.js';
18
- export type { ActionContext, ActionDefinition, ActionResult, ApprovalStatus, AuthArtifact, AuthContext, AuthResult, Connection, ConnectorAgentTooling, ConnectorAgentToolingEnv, ConnectorAuthAppInstallation, ConnectorAuthBrowser, ConnectorAuthEnvField, ConnectorAuthEnvKeys, ConnectorAuthInteractive, ConnectorAuthMethod, ConnectorAuthNone, ConnectorAuthOAuth, ConnectorAuthSchema, ConnectorDefinition, ConnectorInstallationContext, ConnectorOperations, ConnectorRuntimeInfo, ConnectorWebhookSchema, ContentItem, EntityIdentitySpec, EntityLinkPredicate, EntityTraitSpec, EventAttributionRole, EventAttributionRule, EventAttributionTargetSpec, EventEnvelope, Feed, FeedDefinition, FeedOperation, FeedObserveContext, FeedReadContext, FeedReadHandler, FeedReadResult, FeedReadMatch, FeedReadWindow, FeedReadWindowCoverage, FeedSyncHandler, FeedWebhookDeclaration, EntityTypeContribution, QueryContext, QueryResult, ReflectContext, ReflectedMeasure, ReflectResult, Run, RunStatus, RunType, RuntimeConnectorDefinition, RuntimeFeedDefinition, RuntimeFeedWebhook, SyncContext, SyncCredentials, SyncResult, WebhookRecordContext, WebhookRecordNormalizer, WebhookRegistration, WebhookRegistrationContext, } from './connector-types.js';
18
+ export type { ActionContext, ActionDefinition, ActionResult, ApprovalStatus, AuthArtifact, AuthContext, AuthResult, Connection, ConnectorAgentTooling, ConnectorAgentToolingEnv, ConnectorAuthAppInstallation, ConnectorAuthBrowser, ConnectorAuthEnvField, ConnectorAuthEnvKeys, ConnectorAuthInteractive, ConnectorAuthMethod, ConnectorAuthNone, ConnectorAuthOAuth, ConnectorAuthSchema, ConnectorDefinition, ConnectorInstallationContext, ConnectorOperations, ConnectorRuntimeInfo, ConnectorWebhookGoogleJwtVerification, ConnectorWebhookSchema, ContentItem, EntityIdentitySpec, EntityLinkPredicate, EntityTraitSpec, EventAttributionRole, EventAttributionRule, EventAttributionTargetSpec, EventEnvelope, Feed, FeedDefinition, FeedOperation, FeedObserveContext, FeedReadContext, FeedReadHandler, FeedReadResult, FeedReadMatch, FeedReadWindow, FeedReadWindowCoverage, FeedSyncHandler, FeedWebhookDeclaration, EntityTypeContribution, QueryContext, QueryResult, ReflectContext, ReflectedMeasure, ReflectResult, Run, RunStatus, RunType, RuntimeConnectorDefinition, RuntimeFeedDefinition, RuntimeFeedWebhook, SyncContext, SyncCredentials, SyncResult, WebhookRecordContext, WebhookRecordNormalizer, WebhookRegistration, WebhookRegistrationContext, } from './connector-types.js';
19
19
  import { normalizeAuthUserId, normalizeEmail, normalizeEmailDomain, normalizeIdentifier, normalizePhone } from './identity-normalize.js';
20
20
  export { normalizeAuthUserId, normalizeEmail, normalizeEmailDomain, normalizeIdentifier, normalizePhone, };
21
21
  export type { IdentityNamespace, IdentityNamespaceDefinition, IdentityNormalizerKind, IdentitySubjectKind, } from './identity-namespaces.js';
@@ -58,4 +58,6 @@ export type { FileDelta, FileSystemSource, Snapshot } from './file-source.js';
58
58
  export { connect } from './net.js';
59
59
  export type { ConnectFn, Socket, SocketAddress, SocketOptions, } from './net.js';
60
60
  export { assertFeedReadWindow, validateFeedReadWindow } from './feed-read-window.js';
61
+ export { isSecretOutputKey, redactOutput } from './redact.js';
62
+ export { scrubDiagnosticValue } from '@lobu/core/diagnostic-scrubber';
61
63
  //# sourceMappingURL=index.d.ts.map
@@ -46,4 +46,8 @@ export { extensionNetworkSync } from './extension-network.js';
46
46
  // =============================================================================
47
47
  export { connect } from './net.js';
48
48
  export { assertFeedReadWindow, validateFeedReadWindow } from './feed-read-window.js';
49
+ // The worker's output redaction catalog, shared so a connector that returns
50
+ // third-party text (logs, messages) can scrub it with the same patterns.
51
+ export { isSecretOutputKey, redactOutput } from './redact.js';
52
+ export { scrubDiagnosticValue } from '@lobu/core/diagnostic-scrubber';
49
53
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Redact secrets from connector output before it leaves the worker.
3
+ *
4
+ * Patterns are deliberately broad — false positives are preferred to leaking a
5
+ * real credential into the runs table. Add new patterns here when a connector
6
+ * surfaces a new sensitive shape.
7
+ */
8
+ export declare function isSecretOutputKey(key: string): boolean;
9
+ export declare function redactOutput(text: string): string;
10
+ //# sourceMappingURL=redact.d.ts.map
@@ -127,53 +127,4 @@ export function redactOutput(text) {
127
127
  }
128
128
  return result;
129
129
  }
130
- /**
131
- * Streaming redactor for live tee to parent stdout/stderr. Buffers up to the
132
- * last newline so that secrets split across stream chunk boundaries — for
133
- * example "Authorization: Bear" + "er abc..." in two `data` events — still
134
- * get matched by `redactOutput()`. The persisted `output_tail` already runs
135
- * `redactOutput()` over the full ring-buffer string and is unaffected; this
136
- * class exists solely to make the live-forwarded stream as safe as the
137
- * persisted tail.
138
- *
139
- * `flush()` MUST be called on stream end to release any trailing partial
140
- * line; otherwise its (redacted) content is dropped from the live tee but
141
- * still appears in the persisted tail.
142
- */
143
- export class StreamRedactor {
144
- carryover = '';
145
- // Safety cap for input with no newlines at all; emit the prefix and keep
146
- // a sliding window of the last MAX_BUFFER chars to catch boundary splits
147
- // up to that length.
148
- static MAX_BUFFER = 8192;
149
- process(chunk, emit) {
150
- if (!chunk)
151
- return;
152
- const combined = this.carryover + chunk;
153
- const lastNewline = combined.lastIndexOf('\n');
154
- if (lastNewline >= 0) {
155
- const complete = combined.slice(0, lastNewline + 1);
156
- this.carryover = combined.slice(lastNewline + 1);
157
- emit(redactOutput(complete));
158
- return;
159
- }
160
- if (combined.length > StreamRedactor.MAX_BUFFER) {
161
- // No newline but we have to bound memory. Redact the whole buffer
162
- // before emitting — slicing would re-introduce a boundary mid-secret.
163
- // Carryover resets; the next chunk starts fresh, accepting that a
164
- // secret split across the cap boundary may be redacted twice (safe)
165
- // but never split within a regex match.
166
- emit(redactOutput(combined));
167
- this.carryover = '';
168
- return;
169
- }
170
- this.carryover = combined;
171
- }
172
- flush(emit) {
173
- if (this.carryover) {
174
- emit(redactOutput(this.carryover));
175
- this.carryover = '';
176
- }
177
- }
178
- }
179
130
  //# sourceMappingURL=redact.js.map
@@ -38,7 +38,8 @@ export interface Env {
38
38
  GOOGLE_CLIENT_SECRET?: string;
39
39
  APPLE_CLIENT_ID?: string;
40
40
  APPLE_CLIENT_SECRET?: string;
41
- RESEND_API_KEY?: string;
41
+ CLOUDFLARE_EMAIL_ACCOUNT_ID?: string;
42
+ CLOUDFLARE_EMAIL_API_TOKEN?: string;
42
43
  EMAIL_FROM_AUTH?: string;
43
44
  EMAIL_FROM_INVITES?: string;
44
45
  EMAIL_REPLY_TO?: string;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobu/connector-sdk",
3
- "version": "24.1.1",
3
+ "version": "24.3.0",
4
4
  "description": "Lobu memory SDK — build pluggable connectors for Lobu memory",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -75,10 +75,15 @@
75
75
  "./device-manifest-hash": {
76
76
  "types": "./dist/device-manifest-hash.d.ts",
77
77
  "import": "./dist/device-manifest-hash.js"
78
+ },
79
+ "./redact": {
80
+ "types": "./dist/redact.d.ts",
81
+ "import": "./dist/redact.js"
78
82
  }
79
83
  },
80
84
  "files": [
81
85
  "dist",
86
+ "src/redact.ts",
82
87
  "!**/*.map"
83
88
  ],
84
89
  "sideEffects": false,
@@ -18,6 +18,14 @@
18
18
  */
19
19
  import type { AgentTool } from '@mariozechner/pi-agent-core';
20
20
  import type { AgentTurnConversation, AgentTurnGatewayTool } from './types.js';
21
+ /**
22
+ * `tools`, with each call executed by a tool set built for THAT call: one whose
23
+ * gateway requests name the steered input the call answers
24
+ * (`TURN_INPUT_RUN_HEADER`), so the gateway keys the write on that input's
25
+ * stored message. Building a plugin tool set is only object construction; the
26
+ * schemas and descriptions offered to the model are the first set's.
27
+ */
28
+ export declare function perCallInputRun(tools: AgentTool[], build: (headers: Record<string, string>) => AgentTool[], inputRunFor: (toolCallId: string) => number | undefined): AgentTool[];
21
29
  /**
22
30
  * Build the gateway tools this turn may call.
23
31
  *
@@ -41,5 +49,6 @@ export declare function createGatewayTools(allowed: readonly AgentTurnGatewayToo
41
49
  conversation: AgentTurnConversation;
42
50
  onAskUserPosted: () => void;
43
51
  onInBandReplyDelivered: () => void;
52
+ inputRunFor: (toolCallId: string) => number | undefined;
44
53
  }): AgentTool[];
45
54
  //# sourceMappingURL=gateway-tools.d.ts.map
@@ -16,7 +16,27 @@
16
16
  * What this module adds is only the seam: which tools the policy admitted,
17
17
  * the turn's one credential as the bearer, and pi's `AgentTool` shape.
18
18
  */
19
+ import { TURN_INPUT_RUN_HEADER } from '@lobu/core/agent-tooling';
19
20
  import { createConversationTools } from '@lobu/plugin-conversations';
21
+ /**
22
+ * `tools`, with each call executed by a tool set built for THAT call: one whose
23
+ * gateway requests name the steered input the call answers
24
+ * (`TURN_INPUT_RUN_HEADER`), so the gateway keys the write on that input's
25
+ * stored message. Building a plugin tool set is only object construction; the
26
+ * schemas and descriptions offered to the model are the first set's.
27
+ */
28
+ export function perCallInputRun(tools, build, inputRunFor) {
29
+ return tools.map((tool) => ({
30
+ ...tool,
31
+ execute: (toolCallId, ...rest) => {
32
+ const inputRunId = inputRunFor(toolCallId);
33
+ if (inputRunId === undefined)
34
+ return tool.execute(toolCallId, ...rest);
35
+ const forCall = build({ [TURN_INPUT_RUN_HEADER]: String(inputRunId) }).find((t) => t.name === tool.name);
36
+ return forCall.execute(toolCallId, ...rest);
37
+ },
38
+ }));
39
+ }
20
40
  /**
21
41
  * Build the gateway tools this turn may call.
22
42
  *
@@ -38,15 +58,16 @@ export function createGatewayTools(allowed, args) {
38
58
  const wanted = new Set(allowed);
39
59
  if (wanted.size === 0)
40
60
  return [];
41
- const tools = createConversationTools({
61
+ const build = (headers) => createConversationTools({
42
62
  gatewayUrl: args.gatewayUrl,
43
63
  workerToken: args.credential,
44
64
  channelId: args.conversation.channelId,
45
65
  conversationId: args.conversation.conversationId,
46
66
  platform: args.conversation.platform,
67
+ ...(headers ? { headers } : {}),
47
68
  onAskUserPosted: args.onAskUserPosted,
48
69
  onInBandReplyDelivered: args.onInBandReplyDelivered,
49
70
  });
50
- return tools.filter((tool) => wanted.has(tool.name));
71
+ return perCallInputRun(build().filter((tool) => wanted.has(tool.name)), build, args.inputRunFor);
51
72
  }
52
73
  //# sourceMappingURL=gateway-tools.js.map
@@ -19,7 +19,7 @@
19
19
  * provider credential and the MCP route accepts it as the bearer.
20
20
  */
21
21
  import { mcpToolResult, toolImageBudget } from '@lobu/plugin-toolkit';
22
- import { FOLLOW_UP_SUGGESTIONS_PROMPT, parseFollowUpSuggestions } from '@lobu/core/agent-tooling';
22
+ import { FOLLOW_UP_SUGGESTIONS_PROMPT, parseFollowUpSuggestions, TURN_INPUT_RUN_HEADER } from '@lobu/core/agent-tooling';
23
23
  import { createGatewayTools } from './gateway-tools.js';
24
24
  import { createTurnMediaTools } from './media-tools.js';
25
25
  import { createTurnMemoryHooks } from './memory.js';
@@ -62,7 +62,7 @@ function joinText(content) {
62
62
  * result, so a blocked or approval-gated call reaches the model as text and the
63
63
  * turn goes on.
64
64
  */
65
- async function callMcpTool(gatewayUrl, credential, tool, args, timeoutMs = TOOL_CALL_TIMEOUT_MS, supportsImages = true, imageBudget) {
65
+ async function callMcpTool(gatewayUrl, credential, tool, args, timeoutMs = TOOL_CALL_TIMEOUT_MS, supportsImages = true, imageBudget, inputRunId) {
66
66
  const url = `${gatewayUrl}/mcp/${encodeURIComponent(tool.mcpId)}/tools/${encodeURIComponent(tool.name)}`;
67
67
  let response;
68
68
  try {
@@ -75,6 +75,10 @@ async function callMcpTool(gatewayUrl, credential, tool, args, timeoutMs = TOOL_
75
75
  // structured body; capture validates the save receipt. The gateway
76
76
  // renders markdown unless asked.
77
77
  ...(isRetrievalTool(tool.name) || tool.name === 'save_memory' ? { 'x-mcp-format': 'json' } : {}),
78
+ // The steered input this call answers. The gateway verifies it against
79
+ // the turn's stored inputs before a write keys on its message; absent
80
+ // means the turn's own (owner) input.
81
+ ...(inputRunId !== undefined ? { [TURN_INPUT_RUN_HEADER]: String(inputRunId) } : {}),
78
82
  },
79
83
  body: JSON.stringify(args ?? {}),
80
84
  signal: AbortSignal.timeout(timeoutMs),
@@ -111,7 +115,7 @@ async function callMcpTool(gatewayUrl, credential, tool, args, timeoutMs = TOOL_
111
115
  * `onAskUserPosted` is threaded through because `ask_user` ends the turn — see
112
116
  * `createGatewayTools`.
113
117
  */
114
- function buildTools(input, credential, onAskUserPosted, onInBandReplyDelivered, emit, runtimeExec) {
118
+ function buildTools(input, credential, onAskUserPosted, onInBandReplyDelivered, emit, inputRunFor, runtimeExec) {
115
119
  const imageBudget = toolImageBudget((input.images ?? []).map(image => ({ type: 'image', data: image.data })));
116
120
  const tools = input.tools;
117
121
  if (!tools)
@@ -131,6 +135,7 @@ function buildTools(input, credential, onAskUserPosted, onInBandReplyDelivered,
131
135
  conversation: tools.conversation,
132
136
  onAskUserPosted,
133
137
  onInBandReplyDelivered,
138
+ inputRunFor,
134
139
  })
135
140
  : [];
136
141
  const media = tools.media && tools.media.length > 0 && tools.conversation
@@ -142,6 +147,7 @@ function buildTools(input, credential, onAskUserPosted, onInBandReplyDelivered,
142
147
  // The isolate has one channel out — its event stream — so the upload
143
148
  // notification rides that and the host decides what to do with it.
144
149
  onFileUploaded: (data) => emit({ type: 'file_uploaded', data }),
150
+ inputRunFor,
145
151
  })
146
152
  : [];
147
153
  const mcp = tools.definitions.map((tool) => ({
@@ -150,8 +156,8 @@ function buildTools(input, credential, onAskUserPosted, onInBandReplyDelivered,
150
156
  description: tool.description,
151
157
  // A plain JSON schema: pi-ai validates arguments against it as-is.
152
158
  parameters: tool.inputSchema,
153
- execute: async (_toolCallId, args) => {
154
- const result = await callMcpTool(tools.gatewayUrl, credential, tool, args, TOOL_CALL_TIMEOUT_MS, input.provider.input?.includes('image') === true, imageBudget);
159
+ execute: async (toolCallId, args) => {
160
+ const result = await callMcpTool(tools.gatewayUrl, credential, tool, args, TOOL_CALL_TIMEOUT_MS, input.provider.input?.includes('image') === true, imageBudget, inputRunFor(toolCallId));
155
161
  const text = joinText(result.content);
156
162
  if (result.isError === true)
157
163
  throw new Error(String(result.error || text || `${tool.name} failed`));
@@ -437,7 +443,9 @@ export async function runAgentTurn(input, emit, takeSteering = () => [], runtime
437
443
  * survive.
438
444
  */
439
445
  const messageContext = new Map();
440
- const built = buildTools(input, credential, () => { askedUser = true; }, () => { repliedInBand = true; }, emit, runtimeExec);
446
+ const built = buildTools(input, credential, () => { askedUser = true; }, () => { repliedInBand = true; }, emit,
447
+ // Bound at `tool_execution_start`, which Pi emits before `execute`.
448
+ (toolCallId) => toolInputRun.get(toolCallId), runtimeExec);
441
449
  const tools = built.tools;
442
450
  const session = createNativeSession(input, tools, (message) => {
443
451
  // The context of THIS message, or nothing. No per-turn fallback: the