@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
@@ -1,14 +1,10 @@
1
- import type { ExecutorClient } from './client.js';
1
+ import type { CompleteAgentTurnRequest, CompleteAgentTurnResponse, ExecutorClient } from './client.js';
2
2
  /**
3
- * Retry one immutable terminal payload without changing its outcome.
4
- *
5
- * A timed-out attempt is retried, not abandoned: a hung connection is the
6
- * commonest transient failure, and abandoning it there would leave the rest of
7
- * the deadline unused. The timeout does not cancel the in-flight request, so a
8
- * retry can reach a gateway that already accepted the first one -- that is
9
- * safe because the gateway's terminal write is fenced
10
- * (`status = 'running' AND claimed_by = worker_id`) and answers a second
11
- * delivery with `already_finalized` rather than re-finalizing the run.
3
+ * A delivery failure's retry classification: HTTP 5xx/429 and transport errors
4
+ * are retriable; an explicit decode failure or any other 4xx is not.
12
5
  */
6
+ export declare function isRetriableDeliveryFailure(err: unknown): boolean;
7
+ export declare function completeSyncOnce(client: ExecutorClient, payload: Parameters<ExecutorClient['complete']>[0]): Promise<void>;
13
8
  export declare function completeActionOnce(client: ExecutorClient, payload: Parameters<ExecutorClient['completeAction']>[0]): Promise<void>;
9
+ export declare function completeAgentTurnOnce(client: ExecutorClient, payload: CompleteAgentTurnRequest): Promise<CompleteAgentTurnResponse>;
14
10
  //# sourceMappingURL=terminal-delivery.d.ts.map
@@ -1,18 +1,39 @@
1
1
  /**
2
- * One terminal-completion policy for the whole daemon.
3
- *
4
- * Both the ordinary executor path and the failure-reporting path awaited
5
- * `client.completeAction` directly, which neither retries nor bounds its wait:
6
- * a single dropped connection lost an already-decided outcome and left the run
7
- * to the gateway's stale-run reaper. Route both through one bounded retry so
8
- * the outcome survives a transient failure without either caller inventing its
9
- * own budget. A `WorkerDecodeError` is rethrown rather than retried -- a retry
10
- * cannot fix a payload the gateway could not parse, and re-sending would hide
11
- * the protocol fault behind a timeout.
2
+ * Bounded delivery of an immutable terminal outcome. Execution and failure
3
+ * reporting share the retry loop; sync/action and agent-turn budgets differ.
4
+ * WorkerDecodeError identifies an unreadable response, not an execution
5
+ * failure, and is surfaced without retrying.
6
+ */
7
+ import { WorkerDecodeError, WorkerHttpError } from './client.js';
8
+ /** Syncs/actions: two attempts in 15s, anything but an undecodable answer retried. */
9
+ const ACTION_DELIVERY = {
10
+ deadlineMs: 15_000,
11
+ attempts: 2,
12
+ backoffMs: 0,
13
+ retriable: (error) => !(error instanceof WorkerDecodeError),
14
+ };
15
+ /**
16
+ * Agent turns retry transient delivery failures across a short gateway outage.
17
+ * Except for rate limiting (429), a 4xx is the gateway's decision and is not
18
+ * retried. In particular, a divergent completion must retain its 409.
12
19
  */
13
- import { WorkerDecodeError } from './client.js';
14
- const TERMINAL_DELIVERY_DEADLINE_MS = 15_000;
15
- const TERMINAL_DELIVERY_ATTEMPTS = 2;
20
+ const AGENT_TURN_DELIVERY = {
21
+ deadlineMs: 60_000,
22
+ attempts: 4,
23
+ backoffMs: 1_000,
24
+ retriable: isRetriableDeliveryFailure,
25
+ };
26
+ /**
27
+ * A delivery failure's retry classification: HTTP 5xx/429 and transport errors
28
+ * are retriable; an explicit decode failure or any other 4xx is not.
29
+ */
30
+ export function isRetriableDeliveryFailure(err) {
31
+ if (err instanceof WorkerHttpError)
32
+ return err.status >= 500 || err.status === 429;
33
+ if (err instanceof WorkerDecodeError)
34
+ return false;
35
+ return true;
36
+ }
16
37
  async function withTerminalDeliveryTimeout(promise, timeoutMs) {
17
38
  let timer;
18
39
  try {
@@ -36,30 +57,45 @@ async function withTerminalDeliveryTimeout(promise, timeoutMs) {
36
57
  * commonest transient failure, and abandoning it there would leave the rest of
37
58
  * the deadline unused. The timeout does not cancel the in-flight request, so a
38
59
  * retry can reach a gateway that already accepted the first one -- that is
39
- * safe because the gateway's terminal write is fenced
40
- * (`status = 'running' AND claimed_by = worker_id`) and answers a second
41
- * delivery with `already_finalized` rather than re-finalizing the run.
60
+ * safe because terminal writes are fenced: syncs and actions by
61
+ * `status = 'running' AND claimed_by = worker_id` (a duplicate cannot repeat
62
+ * the terminal write or its side effects), an agent turn's by the run row lock
63
+ * plus its stored completion hash (an exact retry is acknowledged, a divergent
64
+ * one 409s).
42
65
  */
43
- export async function completeActionOnce(client, payload) {
44
- const deadline = Date.now() + TERMINAL_DELIVERY_DEADLINE_MS;
66
+ async function deliverTerminal(send, policy) {
67
+ const deadline = Date.now() + policy.deadlineMs;
45
68
  let lastError;
46
- for (let attempt = 0; attempt < TERMINAL_DELIVERY_ATTEMPTS; attempt += 1) {
69
+ for (let attempt = 0; attempt < policy.attempts; attempt += 1) {
70
+ if (attempt > 0 && policy.backoffMs > 0) {
71
+ const pause = Math.min(policy.backoffMs * 2 ** (attempt - 1), deadline - Date.now());
72
+ if (pause > 0)
73
+ await new Promise((resolve) => setTimeout(resolve, pause));
74
+ }
47
75
  const remaining = deadline - Date.now();
48
76
  if (remaining <= 0)
49
77
  break;
50
78
  try {
51
79
  // Split the remaining budget across the attempts still to come, so a hung
52
80
  // connection cannot spend the whole deadline before anything is retried.
53
- const attemptsLeft = TERMINAL_DELIVERY_ATTEMPTS - attempt;
54
- await withTerminalDeliveryTimeout(client.completeAction(payload), Math.max(1, Math.floor(remaining / attemptsLeft)));
55
- return;
81
+ const attemptsLeft = policy.attempts - attempt;
82
+ return await withTerminalDeliveryTimeout(send(), Math.max(1, Math.floor(remaining / attemptsLeft)));
56
83
  }
57
84
  catch (error) {
58
- if (error instanceof WorkerDecodeError)
85
+ if (!policy.retriable(error))
59
86
  throw error;
60
87
  lastError = error;
61
88
  }
62
89
  }
63
90
  throw lastError instanceof Error ? lastError : new Error(String(lastError));
64
91
  }
92
+ export async function completeSyncOnce(client, payload) {
93
+ await deliverTerminal(() => client.complete(payload), ACTION_DELIVERY);
94
+ }
95
+ export async function completeActionOnce(client, payload) {
96
+ await deliverTerminal(() => client.completeAction(payload), ACTION_DELIVERY);
97
+ }
98
+ export function completeAgentTurnOnce(client, payload) {
99
+ return deliverTerminal(() => client.completeAgentTurn(payload), AGENT_TURN_DELIVERY);
100
+ }
65
101
  //# sourceMappingURL=terminal-delivery.js.map
@@ -1,4 +1,4 @@
1
- import { completeActionOnce } from './terminal-delivery.js';
1
+ import { completeActionOnce, completeAgentTurnOnce } from './terminal-delivery.js';
2
2
  export async function reportTerminalFailure(client, job, message, exitReason = 'crash') {
3
3
  if (job.run_id == null)
4
4
  return;
@@ -23,7 +23,7 @@ export async function reportTerminalFailure(client, job, message, exitReason = '
23
23
  if (job.run_type === 'agent_turn') {
24
24
  // The generic route refuses an agent turn with a 409, so a failure that
25
25
  // fell through to it would leave the run parked until the stale sweep.
26
- await client.completeAgentTurn({
26
+ await completeAgentTurnOnce(client, {
27
27
  run_id: job.run_id,
28
28
  worker_id: client.id,
29
29
  status: 'failed',
@@ -37,7 +37,7 @@ import { IsolateHost, IsolateHostError } from '../isolate/bridge.js';
37
37
  import { assertIsolateEligible } from '../isolate/eligibility.js';
38
38
  import { isolatedVmUnavailableReason, loadIsolatedVm } from '../isolate/load.js';
39
39
  import { buildConnectorConfig } from './connector-config.js';
40
- import { redactOutput } from './redact.js';
40
+ import { redactOutput } from '@lobu/connector-sdk/redact';
41
41
  import { RingBuffer, ConnectorExecutionError } from './interface.js';
42
42
  const MIB = 1024 * 1024;
43
43
  const DEFAULT_OPTIONS = {
@@ -220,6 +220,9 @@ const GUEST_RUNNER = String.raw `
220
220
  if (job.exactMatch && !(queryCapabilities && queryCapabilities.exactMatch === true)) {
221
221
  throw Object.assign(new Error('Connector does not support exact-match queries'), { status: 400 });
222
222
  }
223
+ if (job.exactMatch && job.exactMatch.verbatim === true && !(queryCapabilities && queryCapabilities.verbatimExactMatch === true)) {
224
+ throw Object.assign(new Error('Connector does not support verbatim exact-match queries'), { status: 400 });
225
+ }
223
226
  var queryResult = await instance.query({
224
227
  query: job.query, config: mergedConfig, credentials: job.credentials, sessionState: job.sessionState,
225
228
  limit: job.limit, offset: job.offset, sort: job.sort, exactMatch: job.exactMatch, selection: supportsSelection ? job.selection : undefined
@@ -19,8 +19,10 @@
19
19
  * - `script.run({ timeout })` bounds only the synchronous part of the run; a
20
20
  * loop entered after an `await` is not interrupted. The wall clock here
21
21
  * disposes the isolate, which rejects the pending run.
22
- * - Exceeding `memoryLimit` disposes the isolate automatically; the run
23
- * rejects with "disposed during execution due to memory limit".
22
+ * - Exceeding `memoryLimit` disposes the isolate automatically and rejects
23
+ * the run. That is the only disposal the host does not perform itself, so
24
+ * an isolate disposed without `dispose()` is how a memory kill is told
25
+ * apart from a guest error whose text merely mentions a memory limit.
24
26
  * - `dispose()` on a disposed isolate throws; guard with `isDisposed`.
25
27
  */
26
28
  import type { IsolatedVm } from './ivm-types.js';
@@ -65,6 +67,8 @@ export declare class IsolateHost {
65
67
  private readonly sync;
66
68
  private terminalState;
67
69
  private timedOut;
70
+ /** Set before every host disposal; a disposed isolate without it was disposed by V8. */
71
+ private disposedByHost;
68
72
  private constructor();
69
73
  static create(options: IsolateHostOptions): Promise<IsolateHost>;
70
74
  /** The state the host imposed, if it ended the run. */
@@ -19,8 +19,10 @@
19
19
  * - `script.run({ timeout })` bounds only the synchronous part of the run; a
20
20
  * loop entered after an `await` is not interrupted. The wall clock here
21
21
  * disposes the isolate, which rejects the pending run.
22
- * - Exceeding `memoryLimit` disposes the isolate automatically; the run
23
- * rejects with "disposed during execution due to memory limit".
22
+ * - Exceeding `memoryLimit` disposes the isolate automatically and rejects
23
+ * the run. That is the only disposal the host does not perform itself, so
24
+ * an isolate disposed without `dispose()` is how a memory kill is told
25
+ * apart from a guest error whose text merely mentions a memory limit.
24
26
  * - `dispose()` on a disposed isolate throws; guard with `isDisposed`.
25
27
  */
26
28
  import { createPreludeHostSync, GUEST_PRELUDE } from './prelude.js';
@@ -57,6 +59,8 @@ export class IsolateHost {
57
59
  sync;
58
60
  terminalState = null;
59
61
  timedOut = false;
62
+ /** Set before every host disposal; a disposed isolate without it was disposed by V8. */
63
+ disposedByHost = false;
60
64
  constructor(isolate, context, options) {
61
65
  this.isolate = isolate;
62
66
  this.context = context;
@@ -204,19 +208,21 @@ export class IsolateHost {
204
208
  cause: error,
205
209
  });
206
210
  }
207
- const message = error instanceof Error ? error.message : String(error);
208
- if (/memory limit/i.test(message)) {
211
+ // Decided from the isolate's state, never the rejection's text: a guest's
212
+ // own error may say "memory limit" or "terminated" too.
213
+ if (!this.isolate.isDisposed)
214
+ return error;
215
+ if (!this.disposedByHost) {
209
216
  this.terminalState = { name: 'MemoryLimitExceeded', message: `isolate exceeded its ${this.options.memoryMb} MB memory limit` };
210
217
  return new IsolateHostError('memory', this.terminalState.message, this.terminalState, { cause: error });
211
218
  }
212
- if (/disposed|abandoned|terminated/i.test(message)) {
213
- return new IsolateHostError('crash', `isolate ended unexpectedly: ${message}`, null, { cause: error });
214
- }
215
- return error;
219
+ const message = error instanceof Error ? error.message : String(error);
220
+ return new IsolateHostError('crash', `isolate ended unexpectedly: ${message}`, null, { cause: error });
216
221
  }
217
222
  dispose() {
218
223
  if (this.isolate.isDisposed)
219
224
  return;
225
+ this.disposedByHost = true;
220
226
  try {
221
227
  this.isolate.dispose();
222
228
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobu/connector-worker",
3
- "version": "24.1.1",
3
+ "version": "24.3.0",
4
4
  "description": "Self-hosted worker for Lobu memory — connectors and embedding generation",
5
5
  "type": "module",
6
6
  "bin": {
@@ -70,7 +70,7 @@
70
70
  "esbuild": "^0.28.1",
71
71
  "just-bash": "^2.14.2",
72
72
  "pathe": "^2.0.3",
73
- "undici": "7.29.1"
73
+ "undici": "7.30.1"
74
74
  },
75
75
  "optionalDependencies": {
76
76
  "isolated-vm": "^6.2.0",
@@ -13,6 +13,14 @@
13
13
  * modules it names, or the isolate lane loses its gateway tools with no
14
14
  * compile error to say so — `assertIsolateEligible` catches it at run time.
15
15
  */
16
+ /**
17
+ * Request header an agent turn's isolate sets on a gateway tool call to name
18
+ * the steered input run the call answers (the same id its tool trace carries
19
+ * as `input_run_id`). Advisory until verified: the gateway accepts it only as
20
+ * the turn's own run or one of that turn's stored inputs, and derives a
21
+ * write's idempotency key from THAT row. Absent means the owner input.
22
+ */
23
+ export declare const TURN_INPUT_RUN_HEADER = "x-lobu-turn-input-run";
16
24
  export { CUSTOM_TOOL_METADATA, type CustomToolMetadata, getCustomToolDescription, renderAlwaysOnToolPolicyRulesFor, } from "./agent-policy";
17
25
  export { FOLLOW_UP_SUGGESTIONS_PROMPT, parseFollowUpSuggestions, sanitizeSuggestionPrompts, SUGGESTION_LIMITS, type SuggestedPrompt, } from "./suggestions";
18
26
  /**
@@ -15,9 +15,17 @@
15
15
  * compile error to say so — `assertIsolateEligible` catches it at run time.
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.SUGGESTION_LIMITS = exports.sanitizeSuggestionPrompts = exports.parseFollowUpSuggestions = exports.FOLLOW_UP_SUGGESTIONS_PROMPT = exports.renderAlwaysOnToolPolicyRulesFor = exports.getCustomToolDescription = exports.CUSTOM_TOOL_METADATA = void 0;
18
+ exports.SUGGESTION_LIMITS = exports.sanitizeSuggestionPrompts = exports.parseFollowUpSuggestions = exports.FOLLOW_UP_SUGGESTIONS_PROMPT = exports.renderAlwaysOnToolPolicyRulesFor = exports.getCustomToolDescription = exports.CUSTOM_TOOL_METADATA = exports.TURN_INPUT_RUN_HEADER = void 0;
19
19
  exports.withLobuFileParameters = withLobuFileParameters;
20
20
  const typebox_1 = require("@sinclair/typebox");
21
+ /**
22
+ * Request header an agent turn's isolate sets on a gateway tool call to name
23
+ * the steered input run the call answers (the same id its tool trace carries
24
+ * as `input_run_id`). Advisory until verified: the gateway accepts it only as
25
+ * the turn's own run or one of that turn's stored inputs, and derives a
26
+ * write's idempotency key from THAT row. Absent means the owner input.
27
+ */
28
+ exports.TURN_INPUT_RUN_HEADER = "x-lobu-turn-input-run";
21
29
  var agent_policy_1 = require("./agent-policy");
22
30
  Object.defineProperty(exports, "CUSTOM_TOOL_METADATA", { enumerable: true, get: function () { return agent_policy_1.CUSTOM_TOOL_METADATA; } });
23
31
  Object.defineProperty(exports, "getCustomToolDescription", { enumerable: true, get: function () { return agent_policy_1.getCustomToolDescription; } });
@@ -1,7 +1,7 @@
1
1
  export declare const BROWSER_CAPABILITIES: readonly ["browser.tabs", "browser.scripting", "browser.history", "browser.bookmarks", "browser.downloads", "browser.notifications", "browser.debugger"];
2
2
  export declare const OS_CAPABILITIES: readonly ["os.shell", "os.files", "os.notifications"];
3
3
  export declare const IOS_CAPABILITIES: readonly ["ios.notifications", "ios.share-sheet", "ios.files"];
4
- export declare const MAC_DEVICE_CAPABILITIES: readonly ["automations.execute", "screentime", "local_directory", "healthkit", "photos", "calendar", "reminders", "computer_use"];
4
+ export declare const MAC_DEVICE_CAPABILITIES: readonly ["automations.execute", "screentime", "local_directory", "healthkit", "photos", "calendar", "reminders", "system_audio", "computer_use"];
5
5
  export declare const HEADLESS_CAPABILITIES: readonly ["os.shell", "os.files", "automations.execute"];
6
6
  export interface CapabilityAuthorizationResult {
7
7
  authorized: string[];
@@ -55,6 +55,11 @@ exports.MAC_DEVICE_CAPABILITIES = [
55
55
  "photos",
56
56
  "calendar",
57
57
  "reminders",
58
+ // Advertised only by Mac builds released before native meeting recording was
59
+ // retired (owletto #1211); they still send the `apple.system_audio` manifest,
60
+ // and one disallowed capability rejects the whole manifest payload. Drop this
61
+ // once MIN_CLIENT_VERSION excludes those builds.
62
+ "system_audio",
58
63
  "computer_use",
59
64
  ];
60
65
  // A server/VM with no UI or browser (the herdr box, a CI node, a k8s pod).
@@ -30,6 +30,12 @@ export type ToolErrorCode =
30
30
  | "VALIDATION"
31
31
  /** Denied by org-scope / cross-org visibility rules. */
32
32
  | "PERMISSION"
33
+ /**
34
+ * `manage_entity update` sent `manual_edit: true`, but the caller may not
35
+ * assert a person's edit: it lacks the `entities:manual_edit` scope, or an
36
+ * agent, MCP session or Automation is behind the call (HTTP 403).
37
+ */
38
+ | "MANUAL_EDIT_NOT_ALLOWED"
33
39
  /** Upstream throttled the request (HTTP 429 / too many requests). */
34
40
  | "RATE_LIMITED"
35
41
  /** Upstream request or DB statement timed out (e.g. PG 57014). */
@@ -50,6 +50,10 @@ exports.TOOL_ERRORS = {
50
50
  retryable: false,
51
51
  message: "Not permitted in this organization scope.",
52
52
  },
53
+ MANUAL_EDIT_NOT_ALLOWED: {
54
+ retryable: false,
55
+ message: "This caller may not assert a manual edit; it needs the entities:manual_edit scope and no agent, MCP session or Automation behind it.",
56
+ },
53
57
  RATE_LIMITED: {
54
58
  retryable: true,
55
59
  message: "The upstream rate limit was hit; retry shortly.",
@@ -0,0 +1,3 @@
1
+ export declare function recordKeyColumn(schema: unknown): string | null;
2
+ export declare function recordKey(row: Record<string, unknown>, column: string): string | null;
3
+ //# sourceMappingURL=entity-reference.d.ts.map
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.recordKeyColumn = recordKeyColumn;
4
+ exports.recordKey = recordKey;
5
+ /** Source-backed types opt into durable addressing by declaring one projected key. */
6
+ const RECORD_KEY_ANNOTATION = "x-lobu-record-key";
7
+ function recordKeyColumn(schema) {
8
+ if (!schema || typeof schema !== "object")
9
+ return null;
10
+ const key = schema[RECORD_KEY_ANNOTATION];
11
+ if (key === undefined)
12
+ return null;
13
+ if (typeof key !== "string" || !/^[A-Za-z_][A-Za-z0-9_]{0,62}$/.test(key)) {
14
+ throw new Error(`${RECORD_KEY_ANNOTATION} must name one projected column`);
15
+ }
16
+ return key;
17
+ }
18
+ function recordKey(row, column) {
19
+ const value = row[column];
20
+ if (typeof value !== "string" && typeof value !== "number")
21
+ return null;
22
+ if (typeof value === "number" && !Number.isFinite(value))
23
+ return null;
24
+ const key = String(value);
25
+ return key.length > 0 &&
26
+ !key.includes("\0") &&
27
+ new TextEncoder().encode(key).length <= 1024
28
+ ? key
29
+ : null;
30
+ }
31
+ //# sourceMappingURL=entity-reference.js.map
@@ -10,6 +10,7 @@ export declare const AutomationEventTriggerSchema: import("@sinclair/typebox").T
10
10
  connector_key: import("@sinclair/typebox").TString;
11
11
  connection_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
12
12
  event_types: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
13
+ capture: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TLiteral<"references">>;
13
14
  match: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TBoolean, import("@sinclair/typebox").TNull]>>>;
14
15
  execution: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"turn">, import("@sinclair/typebox").TLiteral<"window">]>>;
15
16
  active_run: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"queue">, import("@sinclair/typebox").TLiteral<"coalesce">, import("@sinclair/typebox").TLiteral<"steer">]>>;
@@ -59,6 +60,7 @@ export declare const AutomationTriggerSchema: import("@sinclair/typebox").TUnion
59
60
  connector_key: import("@sinclair/typebox").TString;
60
61
  connection_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
61
62
  event_types: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
63
+ capture: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TLiteral<"references">>;
62
64
  match: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TBoolean, import("@sinclair/typebox").TNull]>>>;
63
65
  execution: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"turn">, import("@sinclair/typebox").TLiteral<"window">]>>;
64
66
  active_run: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"queue">, import("@sinclair/typebox").TLiteral<"coalesce">, import("@sinclair/typebox").TLiteral<"steer">]>>;
@@ -226,6 +228,7 @@ export declare const ManageAutomationsSchema: import("@sinclair/typebox").TObjec
226
228
  connector_key: import("@sinclair/typebox").TString;
227
229
  connection_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
228
230
  event_types: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
231
+ capture: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TLiteral<"references">>;
229
232
  match: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TBoolean, import("@sinclair/typebox").TNull]>>>;
230
233
  execution: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"turn">, import("@sinclair/typebox").TLiteral<"window">]>>;
231
234
  active_run: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"queue">, import("@sinclair/typebox").TLiteral<"coalesce">, import("@sinclair/typebox").TLiteral<"steer">]>>;
@@ -29,6 +29,9 @@ exports.AutomationEventTriggerSchema = typebox_1.Type.Object({
29
29
  maxItems: 32,
30
30
  uniqueItems: true,
31
31
  }),
32
+ capture: typebox_1.Type.Optional(typebox_1.Type.Literal("references", {
33
+ description: "Authorize continuous retention of source change references from declared source-only observers while this Automation is active. Supports resource_ref/resource_type matching only. Does not retain bodies or start an external executor.",
34
+ })),
32
35
  match: typebox_1.Type.Optional(typebox_1.Type.Record(typebox_1.Type.String(), AutomationTriggerMatchValueSchema, {
33
36
  description: "Connector-normalized exact-match fields such as resource_ref or channel_id.",
34
37
  })),
@@ -119,7 +122,7 @@ exports.AutomationScheduleTriggerSchema = typebox_1.Type.Object({
119
122
  })),
120
123
  skip_if_unchanged: typebox_1.Type.Optional(typebox_1.Type.Boolean({
121
124
  default: true,
122
- description: "Native executors may skip unchanged source windows. External executors always receive due windows and decide whether to emit output.",
125
+ description: "Book a due window with no new or changed source content as a no-op run instead of dispatching an agent. Applies to native dispatch and to external claimNextWindow, which answers 409 for a skipped window.",
123
126
  })),
124
127
  }, { additionalProperties: false });
125
128
  exports.AutomationTriggerSchema = typebox_1.Type.Union([
@@ -199,7 +199,7 @@ exports.ReauthenticateAction = typebox_1.Type.Object({
199
199
  description: "Start a fresh OAuth authorization or interactive pairing flow for an existing connection.",
200
200
  }),
201
201
  connection_id: typebox_1.Type.Number({
202
- description: "Connection ID whose OAuth-account or interactive auth profile should be reauthenticated.",
202
+ description: "Connection ID to reauthenticate. Unfinished OAuth setup without an account profile returns the pending-recovery shape (action 'connect', status 'pending_auth', connect_url). A valid pending link is reused; an expired link is renewed.",
203
203
  }),
204
204
  requested_scopes: typebox_1.Type.Optional(typebox_1.Type.Array(typebox_1.Type.String(), {
205
205
  description: "Additional OAuth permissions to request. Existing grants remain usable until consent succeeds.",
@@ -95,7 +95,7 @@ exports.ManageEntitySchemaSchema = typebox_1.Type.Object({
95
95
  name: typebox_1.Type.Optional(typebox_1.Type.String({ description: "[create/update] Display name", minLength: 1 })),
96
96
  description: typebox_1.Type.Optional(typebox_1.Type.String({ description: "[create/update] Description" })),
97
97
  metadata_schema: typebox_1.Type.Optional(typebox_1.Type.Record(typebox_1.Type.String(), typebox_1.Type.Unknown(), {
98
- description: "[create/update] JSON Schema for metadata validation. Entity property annotations: x-facet: true exposes scalar enum values as collection filters; x-sidebar: true also exposes those values as navigation shortcuts. x-enum-labels maps stringified enum values to display labels. x-table-label or title labels the attribute. These annotations do not grant access or define separate segments.",
98
+ description: "[create/update] JSON Schema for metadata validation. Source-backed types declare a durable projected key with root x-lobu-record-key naming the key column; this enables string entity_id + entity_type addressing and authored links without storing source rows. A linked type cannot change its backing or key until its edges are unlinked. Entity property annotations: x-facet: true exposes scalar enum values as collection filters; x-sidebar: true also exposes those values as navigation shortcuts. x-enum-labels maps stringified enum values to display labels. x-table-label or title labels the attribute. These annotations do not grant access or define separate segments.",
99
99
  })),
100
100
  list_scope: typebox_1.Type.Optional(typebox_1.Type.Union([typebox_1.Type.Literal("accessible"), typebox_1.Type.Literal("organization")], {
101
101
  description: "[list] accessible (default) includes the current org plus public schemas; organization returns only the bound org.",
@@ -114,7 +114,7 @@ exports.ManageEntitySchemaSchema = typebox_1.Type.Object({
114
114
  interactions: typebox_1.Type.Optional(typebox_1.Type.Record(typebox_1.Type.String(), typebox_1.Type.Object({ emits: typebox_1.Type.String() }))),
115
115
  })),
116
116
  ], {
117
- description: "[entity_type: create/update] Event semantic types this type produces, keyed by semantic_type slug. Each entry can have a description, optional metadataSchema (JSON Schema), optional jsonTemplate (the event card's render template), and optional interactions registry mapping template action names to emitted event kinds. Author interactive dashboards as React views attached to the kind (views.set with attach [{ event_kind }]), not as jsonTemplate. Supplying an object replaces the entire registry: read the current value and merge before updating. `null` clears all kinds; omit to leave unchanged.",
117
+ description: "[entity_type: create/update] Event semantic types this type produces, keyed by semantic_type slug. Each entry can have a description, optional metadataSchema (JSON Schema), optional jsonTemplate (the event card's render template), and optional interactions registry mapping template action names to emitted event kinds. Author interactive dashboards as React views attached to the kind (views.set with attach [{ event: '<kind>' }]), not as jsonTemplate. Supplying an object replaces the entire registry: read the current value and merge before updating. `null` clears all kinds; omit to leave unchanged.",
118
118
  })),
119
119
  backing: typebox_1.Type.Optional(typebox_1.Type.Union([typebox_1.Type.Null(), exports.BackingInputSchema], {
120
120
  description: "[entity_type: create/update] Makes the type DERIVED — a read-only SQL view. `{ sql }` runs over your org's internal tables; `{ sql, connection: <slug> }` runs LIVE against that connection's external database (read-only, no copy). `null` clears it (revert to a stored type); omit to leave unchanged. Read a derived type's rows by running its `backing_sql` (returned by `get`) through `query_sql` — and when `get` also returns a `backing_source`, pass it as `query_sql`'s `connection` so the view runs against the external DB instead of your internal tables. `get` also returns `measure_columns` (the view's aggregate columns, classified on read).",