@lobu/runtime-device 21.2.1 → 22.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 (196) 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/commands/_lib/apply/apply-cmd.js +5 -6
  6. package/vendor/cli/dist/commands/_lib/apply/client.d.ts +1 -0
  7. package/vendor/cli/dist/commands/_lib/apply/client.js +26 -7
  8. package/vendor/cli/dist/commands/_lib/apply/desired-state.d.ts +9 -1
  9. package/vendor/cli/dist/commands/_lib/apply/diff.d.ts +1 -0
  10. package/vendor/cli/dist/commands/_lib/apply/diff.js +46 -4
  11. package/vendor/cli/dist/commands/_lib/apply/map-config.js +18 -38
  12. package/vendor/cli/dist/commands/_lib/init-from-org/bootstrap.js +5 -17
  13. package/vendor/cli/dist/commands/init.d.ts +0 -2
  14. package/vendor/cli/dist/commands/init.js +0 -27
  15. package/vendor/cli/dist/commands/login.d.ts +17 -0
  16. package/vendor/cli/dist/commands/login.js +43 -17
  17. package/vendor/cli/dist/commands/memory/_lib/errors.d.ts +0 -8
  18. package/vendor/cli/dist/commands/memory/_lib/errors.js +0 -12
  19. package/vendor/cli/dist/commands/memory/_lib/mcp.js +6 -6
  20. package/vendor/cli/dist/commands/memory/_lib/seed-cmd.js +4 -10
  21. package/vendor/cli/dist/config/define.d.ts +21 -15
  22. package/vendor/cli/dist/config/define.js +2 -2
  23. package/vendor/cli/dist/connectors/README.md +7 -5
  24. package/vendor/cli/dist/connectors/_google/actions.ts +270 -0
  25. package/vendor/cli/dist/connectors/_google/discovery/calendar_v3.json +1 -0
  26. package/vendor/cli/dist/connectors/_google/discovery/chat_v1.json +1 -0
  27. package/vendor/cli/dist/connectors/_google/discovery/docs_v1.json +1 -0
  28. package/vendor/cli/dist/connectors/_google/discovery/drive_v3.json +1 -0
  29. package/vendor/cli/dist/connectors/_google/discovery/gmail_v1.json +1 -0
  30. package/vendor/cli/dist/connectors/_google/discovery/people_v1.json +1 -0
  31. package/vendor/cli/dist/connectors/_google/discovery/sheets_v4.json +1 -0
  32. package/vendor/cli/dist/connectors/_google/discovery/tasks_v1.json +1 -0
  33. package/vendor/cli/dist/connectors/_google/discovery/youtube_v3.json +1 -0
  34. package/vendor/cli/dist/connectors/_google/discovery.ts +442 -0
  35. package/vendor/cli/dist/connectors/_google/errors.ts +91 -0
  36. package/vendor/cli/dist/connectors/_google/list-feed.ts +223 -0
  37. package/vendor/cli/dist/connectors/_google/policies.ts +127 -0
  38. package/vendor/cli/dist/connectors/agentid.ts +43 -0
  39. package/vendor/cli/dist/connectors/chat-user-identity.ts +2 -1
  40. package/vendor/cli/dist/connectors/github-automation-events.ts +9 -0
  41. package/vendor/cli/dist/connectors/github-identity.ts +28 -3
  42. package/vendor/cli/dist/connectors/github.ts +101 -59
  43. package/vendor/cli/dist/connectors/google_calendar.ts +207 -719
  44. package/vendor/cli/dist/connectors/google_drive.ts +16 -2
  45. package/vendor/cli/dist/connectors/google_gmail.ts +51 -33
  46. package/vendor/cli/dist/connectors/herdr.ts +406 -0
  47. package/vendor/cli/dist/connectors/jira.ts +6 -6
  48. package/vendor/cli/dist/connectors/linear.ts +7 -4
  49. package/vendor/cli/dist/connectors/postgres.ts +27 -2
  50. package/vendor/cli/dist/connectors/tiktok-inbox-page.js +230 -0
  51. package/vendor/cli/dist/connectors/tiktok-web-page.js +211 -0
  52. package/vendor/cli/dist/connectors/tiktok_web.ts +286 -0
  53. package/vendor/cli/dist/connectors/whatsapp-web-adapter.js +228 -10
  54. package/vendor/cli/dist/connectors/whatsapp-web-helpers.ts +47 -14
  55. package/vendor/cli/dist/connectors/whatsapp-web-identity.ts +121 -0
  56. package/vendor/cli/dist/connectors/whatsapp_web.ts +170 -29
  57. package/vendor/cli/dist/connectors/x.ts +276 -136
  58. package/vendor/cli/dist/index.js +1 -37
  59. package/vendor/cli/dist/internal/context.d.ts +10 -0
  60. package/vendor/cli/dist/internal/context.js +26 -16
  61. package/vendor/cli/dist/internal/node-version.d.ts +1 -1
  62. package/vendor/cli/dist/internal/node-version.js +1 -1
  63. package/vendor/cli/dist/internal/oauth.d.ts +3 -1
  64. package/vendor/cli/dist/internal/oauth.js +4 -3
  65. package/vendor/cli/dist/internal/runtime-components.d.ts +9 -0
  66. package/vendor/cli/dist/internal/runtime-components.js +67 -2
  67. package/vendor/cli/dist/mac-auth.js +17 -1
  68. package/vendor/cli/dist/providers.json +1 -1
  69. package/vendor/cli/dist/runtime-components.json +4 -4
  70. package/vendor/cli/dist/templates/AGENTS.md.tmpl +11 -4
  71. package/vendor/cli/dist/templates/README.md.tmpl +1 -1
  72. package/vendor/cli/dist/vendor/ora/.bun-tag-fde20e9a6df212fa +0 -0
  73. package/vendor/cli/dist/vendor/ora/index.d.ts +332 -0
  74. package/vendor/cli/dist/vendor/ora/index.js +424 -0
  75. package/vendor/cli/dist/vendor/ora/license +9 -0
  76. package/vendor/cli/dist/vendor/ora/package.json +64 -0
  77. package/vendor/cli/dist/vendor/ora/readme.md +329 -0
  78. package/vendor/cli/package.json +2 -2
  79. package/vendor/connector-sdk/dist/browser-requirement.d.ts +36 -0
  80. package/vendor/connector-sdk/dist/browser-requirement.js +60 -0
  81. package/vendor/connector-sdk/dist/connector-runtime.d.ts +3 -1
  82. package/vendor/connector-sdk/dist/connector-runtime.js +10 -0
  83. package/vendor/connector-sdk/dist/connector-types.d.ts +159 -45
  84. package/vendor/connector-sdk/dist/define-connector.d.ts +4 -2
  85. package/vendor/connector-sdk/dist/define-connector.js +3 -0
  86. package/vendor/connector-sdk/dist/index.d.ts +5 -2
  87. package/vendor/connector-sdk/dist/index.js +1 -0
  88. package/vendor/connector-sdk/dist/reaction-client-types.d.ts +16 -21
  89. package/vendor/connector-sdk/dist/reaction-client-types.typecheck.d.ts +5 -0
  90. package/vendor/connector-sdk/package.json +5 -1
  91. package/vendor/connector-worker/dist/agent-turn/guest-entry.js +31 -27
  92. package/vendor/connector-worker/dist/agent-turn/guest.bundle.js +131 -185
  93. package/vendor/connector-worker/dist/agent-turn/memory.d.ts +3 -2
  94. package/vendor/connector-worker/dist/agent-turn/memory.js +3 -20
  95. package/vendor/connector-worker/dist/agent-turn/types.d.ts +3 -15
  96. package/vendor/connector-worker/dist/agent-turn/workspace.d.ts +2 -2
  97. package/vendor/connector-worker/dist/agent-turn/workspace.js +2 -4
  98. package/vendor/connector-worker/dist/daemon/action-monitor.d.ts +12 -0
  99. package/vendor/connector-worker/dist/daemon/action-monitor.js +25 -0
  100. package/vendor/connector-worker/dist/daemon/agent-turn.js +0 -9
  101. package/vendor/connector-worker/dist/daemon/builtins/index.d.ts +12 -0
  102. package/vendor/connector-worker/dist/daemon/builtins/index.js +61 -1
  103. package/vendor/connector-worker/dist/daemon/builtins/os-shell.d.ts +2 -1
  104. package/vendor/connector-worker/dist/daemon/builtins/os-shell.js +40 -27
  105. package/vendor/connector-worker/dist/daemon/client.d.ts +5 -1
  106. package/vendor/connector-worker/dist/daemon/client.js +3 -0
  107. package/vendor/connector-worker/dist/daemon/device-concurrency.d.ts +8 -0
  108. package/vendor/connector-worker/dist/daemon/device-concurrency.js +13 -0
  109. package/vendor/connector-worker/dist/daemon/executor.d.ts +1 -1
  110. package/vendor/connector-worker/dist/daemon/executor.js +48 -117
  111. package/vendor/connector-worker/dist/daemon/log.d.ts +2 -0
  112. package/vendor/connector-worker/dist/daemon/log.js +23 -2
  113. package/vendor/connector-worker/dist/daemon/mac-device-daemon.d.ts +20 -4
  114. package/vendor/connector-worker/dist/daemon/mac-device-daemon.js +53 -13
  115. package/vendor/connector-worker/dist/daemon/native-bridge/client.d.ts +6 -0
  116. package/vendor/connector-worker/dist/daemon/native-bridge/client.js +15 -0
  117. package/vendor/connector-worker/dist/daemon/native-bridge/executor.js +2 -0
  118. package/vendor/connector-worker/dist/daemon/native-bridge/protocol.d.ts +1 -1
  119. package/vendor/connector-worker/dist/daemon/native-bridge/protocol.js +1 -0
  120. package/vendor/connector-worker/dist/daemon/poll-loop.d.ts +3 -0
  121. package/vendor/connector-worker/dist/daemon/poll-loop.js +5 -1
  122. package/vendor/connector-worker/dist/daemon/start.d.ts +1 -0
  123. package/vendor/connector-worker/dist/daemon/start.js +12 -5
  124. package/vendor/connector-worker/dist/executor/interface.d.ts +34 -2
  125. package/vendor/connector-worker/dist/executor/isolate.js +66 -15
  126. package/vendor/connector-worker/dist/executor/redact.d.ts +1 -0
  127. package/vendor/connector-worker/dist/executor/redact.js +97 -26
  128. package/vendor/connector-worker/dist/executor/runtime.d.ts +7 -0
  129. package/vendor/connector-worker/dist/executor/runtime.js +26 -0
  130. package/vendor/connector-worker/dist/isolate/bridge.js +3 -1
  131. package/vendor/connector-worker/dist/mac-device-daemon.js +10 -3
  132. package/vendor/connector-worker/package.json +2 -2
  133. package/vendor/core/dist/agent-policy.js +1 -1
  134. package/vendor/core/dist/agent-store.d.ts +2 -0
  135. package/vendor/core/dist/agent-tooling.d.ts +1 -1
  136. package/vendor/core/dist/agent-tooling.js +1 -1
  137. package/vendor/core/dist/capabilities.js +2 -0
  138. package/vendor/core/dist/contracts/agent-settings.d.ts +0 -11
  139. package/vendor/core/dist/contracts/agent-settings.js +1 -7
  140. package/vendor/core/dist/contracts/tools/collection-presentation.d.ts +93 -0
  141. package/vendor/core/dist/contracts/tools/collection-presentation.js +88 -0
  142. package/vendor/core/dist/contracts/tools/collection-selection.d.ts +47 -0
  143. package/vendor/core/dist/contracts/tools/collection-selection.js +74 -0
  144. package/vendor/core/dist/contracts/tools/manage-agents.d.ts +10 -4
  145. package/vendor/core/dist/contracts/tools/manage-auth-profiles.d.ts +1 -1
  146. package/vendor/core/dist/contracts/tools/manage-auth-profiles.js +5 -1
  147. package/vendor/core/dist/contracts/tools/manage-automations.d.ts +19 -4
  148. package/vendor/core/dist/contracts/tools/manage-automations.js +25 -8
  149. package/vendor/core/dist/contracts/tools/manage-connections.d.ts +1 -0
  150. package/vendor/core/dist/contracts/tools/manage-connections.js +3 -0
  151. package/vendor/core/dist/contracts/tools/manage-entity-schema.d.ts +11 -0
  152. package/vendor/core/dist/contracts/tools/manage-entity-schema.js +42 -3
  153. package/vendor/core/dist/contracts/tools/manage-entity.d.ts +181 -152
  154. package/vendor/core/dist/contracts/tools/manage-entity.js +118 -162
  155. package/vendor/core/dist/contracts/tools/manage-operations.d.ts +41 -3
  156. package/vendor/core/dist/contracts/tools/manage-operations.js +40 -2
  157. package/vendor/core/dist/contracts/tools/manage-views.d.ts +182 -7
  158. package/vendor/core/dist/contracts/tools/manage-views.js +49 -13
  159. package/vendor/core/dist/contracts/tools/read-knowledge.d.ts +11 -2
  160. package/vendor/core/dist/contracts/tools/read-knowledge.js +23 -3
  161. package/vendor/core/dist/contracts/tools/save-memory.d.ts +3 -6
  162. package/vendor/core/dist/contracts/tools/save-memory.js +2 -6
  163. package/vendor/core/dist/contracts/tools/view-attach.d.ts +2 -1
  164. package/vendor/core/dist/contracts/tools/view-attach.js +7 -2
  165. package/vendor/core/dist/contracts/worker/protocol.d.ts +122 -28
  166. package/vendor/core/dist/contracts/worker/protocol.js +81 -17
  167. package/vendor/core/dist/index.d.ts +3 -4
  168. package/vendor/core/dist/index.js +3 -6
  169. package/vendor/core/dist/json-template.d.ts +6 -10
  170. package/vendor/core/dist/json-template.js +5 -9
  171. package/vendor/core/dist/logger.js +11 -5
  172. package/vendor/core/dist/shell-safety.d.ts +9 -0
  173. package/vendor/core/dist/shell-safety.js +154 -0
  174. package/vendor/core/dist/suggestions.d.ts +1 -1
  175. package/vendor/core/dist/suggestions.js +1 -1
  176. package/vendor/core/dist/tool-trace-summary.d.ts +1 -1
  177. package/vendor/core/dist/tool-trace-summary.js +1 -1
  178. package/vendor/core/dist/types.d.ts +1 -3
  179. package/vendor/core/dist/utils/diagnostic-scrubber.d.ts +7 -0
  180. package/vendor/core/dist/utils/{sentry-scrubber.js → diagnostic-scrubber.js} +25 -53
  181. package/vendor/core/dist/worker/auth.d.ts +44 -6
  182. package/vendor/core/dist/worker/auth.js +44 -11
  183. package/vendor/core/package.json +15 -6
  184. package/vendor/ora/.bun-tag-fde20e9a6df212fa +0 -0
  185. package/vendor/ora/index.d.ts +332 -0
  186. package/vendor/ora/index.js +424 -0
  187. package/vendor/ora/license +9 -0
  188. package/vendor/ora/package.json +53 -0
  189. package/vendor/ora/readme.md +329 -0
  190. package/vendor/cli/dist/commands/telemetry.d.ts +0 -10
  191. package/vendor/cli/dist/commands/telemetry.js +0 -66
  192. package/vendor/core/dist/sentry.d.ts +0 -26
  193. package/vendor/core/dist/sentry.js +0 -133
  194. package/vendor/core/dist/tool-policy.d.ts +0 -74
  195. package/vendor/core/dist/tool-policy.js +0 -305
  196. package/vendor/core/dist/utils/sentry-scrubber.d.ts +0 -29
@@ -19,6 +19,7 @@ export class WorkerPollLoop {
19
19
  execute;
20
20
  beforeIdlePoll;
21
21
  failClosedOnPollAuthError;
22
+ onActiveJobsChange;
22
23
  running = false;
23
24
  admittingJobs = true;
24
25
  activeJobs = 0;
@@ -35,6 +36,7 @@ export class WorkerPollLoop {
35
36
  this.execute = options.execute;
36
37
  this.beforeIdlePoll = options.beforeIdlePoll;
37
38
  this.failClosedOnPollAuthError = options.failClosedOnPollAuthError === true;
39
+ this.onActiveJobsChange = options.onActiveJobsChange;
38
40
  }
39
41
  async start() {
40
42
  if (this.running) {
@@ -46,7 +48,7 @@ export class WorkerPollLoop {
46
48
  }
47
49
  if (!this.admittingJobs)
48
50
  return;
49
- log.info('[daemon] Starting worker daemon...');
51
+ log.info(`[daemon] Starting worker daemon (max concurrent jobs: ${this.maxConcurrentJobs})...`);
50
52
  this.running = true;
51
53
  while (this.running) {
52
54
  if (this.activeJobs === 0)
@@ -135,6 +137,7 @@ export class WorkerPollLoop {
135
137
  return undefined;
136
138
  }
137
139
  this.activeJobs++;
140
+ this.onActiveJobsChange?.(this.activeJobs);
138
141
  Promise.resolve()
139
142
  .then(() => this.execute(job))
140
143
  .catch((err) => {
@@ -142,6 +145,7 @@ export class WorkerPollLoop {
142
145
  })
143
146
  .finally(() => {
144
147
  this.activeJobs--;
148
+ this.onActiveJobsChange?.(this.activeJobs);
145
149
  this.capacityVersion++;
146
150
  this.wakePoll?.(true);
147
151
  });
@@ -30,6 +30,7 @@ export declare function resolveDaemonLaunchContext(opts: Pick<DaemonStartOptions
30
30
  platform: string | undefined;
31
31
  interactiveSession: InteractiveSession | undefined;
32
32
  };
33
+ export declare function resolveDaemonMaxConcurrentJobs(platform: string | undefined, env?: NodeJS.ProcessEnv, hostThreads?: number): number | undefined;
33
34
  /**
34
35
  * Validate the options and boot the daemon. Throws a user-facing `Error` on
35
36
  * bad input; the caller prints it and exits non-zero.
@@ -11,6 +11,7 @@ import { CONNECTOR_HTTP_AUTH_CAPABILITY, EXECUTION_BACKENDS, } from '@lobu/core/
11
11
  import { assertExternalDepsResolvable } from '../compile/index.js';
12
12
  import { buildConnectorWorkerEnv } from '../env.js';
13
13
  import { assertConnectorRuntimeLoadable } from '../self-check/index.js';
14
+ import { defaultDeviceMaxConcurrentJobs } from './device-concurrency.js';
14
15
  import { DEVICE_MANIFESTS_BY_PLATFORM } from './device-manifests.js';
15
16
  import { startDaemon } from './index.js';
16
17
  import { log, setDebug } from './log.js';
@@ -50,6 +51,14 @@ export function resolveDaemonLaunchContext(opts, env = process.env, sessionsDir)
50
51
  interactiveSession: detected,
51
52
  };
52
53
  }
54
+ export function resolveDaemonMaxConcurrentJobs(platform, env = process.env, hostThreads) {
55
+ const configured = env.WORKER_MAX_CONCURRENT_JOBS
56
+ ? Math.max(1, Number.parseInt(env.WORKER_MAX_CONCURRENT_JOBS, 10))
57
+ : undefined;
58
+ if (configured !== undefined && Number.isFinite(configured))
59
+ return configured;
60
+ return platform ? defaultDeviceMaxConcurrentJobs(hostThreads) : undefined;
61
+ }
53
62
  /**
54
63
  * Validate the options and boot the daemon. Throws a user-facing `Error` on
55
64
  * bad input; the caller prints it and exits non-zero.
@@ -138,11 +147,9 @@ export async function startDaemonCommand(opts) {
138
147
  };
139
148
  log.info(`[cli] Starting worker daemon (ID: ${workerId}, API: ${opts.apiUrl})`);
140
149
  const env = buildConnectorWorkerEnv();
141
- const maxConcurrentJobs = process.env.WORKER_MAX_CONCURRENT_JOBS
142
- ? Math.max(1, Number.parseInt(process.env.WORKER_MAX_CONCURRENT_JOBS, 10))
143
- : undefined;
150
+ const maxConcurrentJobs = resolveDaemonMaxConcurrentJobs(platform);
144
151
  if (platform) {
145
- log.info(`[cli] device mode: platform=${platform} capabilities=${capabilities.join(',') || '(none)'}`);
152
+ log.info(`[cli] device mode: platform=${platform} capabilities=${capabilities.join(',') || '(none)'} max_concurrent_jobs=${maxConcurrentJobs}`);
146
153
  if (opts.activeOrg) {
147
154
  const deviceUrl = `${opts.apiUrl.replace(/\/+$/, '')}/${encodeURIComponent(opts.activeOrg)}/connectors/device/${encodeURIComponent(workerId)}`;
148
155
  log.info(`[cli] Manage action permissions (Approval vs Auto) at: ${deviceUrl}`);
@@ -160,7 +167,7 @@ export async function startDaemonCommand(opts) {
160
167
  ...(platform ? { platform } : {}),
161
168
  ...(label ? { label } : {}),
162
169
  ...(platform ? { manifests: DEVICE_MANIFESTS_BY_PLATFORM[platform] ?? [] } : {}),
163
- ...(Number.isFinite(maxConcurrentJobs) ? { maxConcurrentJobs } : {}),
170
+ ...(maxConcurrentJobs ? { maxConcurrentJobs } : {}),
164
171
  backendCapacity,
165
172
  ...(opts.workerCredentialMaintenance
166
173
  ? { workerCredentialMaintenance: opts.workerCredentialMaintenance }
@@ -1,5 +1,6 @@
1
+ import type { ConnectorOperationRequest, ConnectorOperationResult } from '@lobu/connector-sdk';
1
2
  import type { AgentTurnEvent, AgentTurnInput, AgentTurnOutput, AgentTurnSteer, RuntimeExecRequest, RuntimeExecResult } from '../agent-turn/types.js';
2
- import type { AuthResult, ConnectorWebhookSchema, EventEnvelope, QueryContext, SyncCredentials, WebhookRegistration } from '@lobu/connector-sdk';
3
+ import type { AuthResult, ConnectorBrowserRequirement, ConnectorWebhookSchema, EventEnvelope, FeedReadMatch, QueryContext, SyncCredentials, WebhookRegistration } from '@lobu/connector-sdk';
3
4
  import type { ConnectorHttpRequest, ConnectorHttpResponse } from '@lobu/core/contracts/worker/protocol';
4
5
  /**
5
6
  * Executor mode discriminator. The executor speaks the same V1 SDK shapes
@@ -7,6 +8,8 @@ import type { ConnectorHttpRequest, ConnectorHttpResponse } from '@lobu/core/con
7
8
  * in, `SyncResult` / `ActionResult` / `AuthResult` out, no envelope.
8
9
  */
9
10
  export type ExecutorJob = {
11
+ /** Gateway-issued resource grant; not connector config. */
12
+ browser?: ConnectorBrowserRequirement;
10
13
  /** HTTP credentials stay in the gateway; every fetch uses the host hook. */
11
14
  httpAuth?: boolean;
12
15
  } & ({
@@ -28,6 +31,16 @@ export type ExecutorJob = {
28
31
  credentials: SyncCredentials | null;
29
32
  sessionState: Record<string, unknown> | null;
30
33
  env: Record<string, string | undefined>;
34
+ } | {
35
+ /** Listener setup only; records are delivered by the browser notification transport. */
36
+ mode: 'observe';
37
+ feedId: number;
38
+ feedKey: string;
39
+ checkpoint: Record<string, unknown> | null;
40
+ config: Record<string, unknown>;
41
+ credentials: SyncCredentials | null;
42
+ sessionState: Record<string, unknown> | null;
43
+ env: Record<string, string | undefined>;
31
44
  } | {
32
45
  mode: 'authenticate';
33
46
  config: Record<string, unknown>;
@@ -37,6 +50,7 @@ export type ExecutorJob = {
37
50
  mode: 'query';
38
51
  query: string;
39
52
  exactMatch?: QueryContext['exactMatch'];
53
+ selection?: QueryContext['selection'];
40
54
  config: Record<string, unknown>;
41
55
  credentials: SyncCredentials | null;
42
56
  sessionState: Record<string, unknown> | null;
@@ -67,6 +81,7 @@ export type ExecutorJob = {
67
81
  column: string;
68
82
  order: 'asc' | 'desc';
69
83
  };
84
+ match?: FeedReadMatch;
70
85
  } | {
71
86
  mode: 'webhook_register';
72
87
  config: Record<string, unknown>;
@@ -81,6 +96,15 @@ export type ExecutorJob = {
81
96
  credentials: SyncCredentials | null;
82
97
  sessionState: Record<string, unknown> | null;
83
98
  env: Record<string, string | undefined>;
99
+ } | {
100
+ mode: 'webhook_record';
101
+ feedKey: string;
102
+ eventType: string;
103
+ payload: unknown;
104
+ receivedAt: string;
105
+ /** The feed instance config only. */
106
+ config: Record<string, unknown>;
107
+ env: Record<string, string | undefined>;
84
108
  } | {
85
109
  mode: 'webhook_unregister';
86
110
  config: Record<string, unknown>;
@@ -96,6 +120,8 @@ export type ExecutorJob = {
96
120
  * connector commits them, never collected onto the result.
97
121
  */
98
122
  export type ExecutorResult = {
123
+ mode: 'observe';
124
+ } | {
99
125
  mode: 'sync';
100
126
  /** How the pass ended; see the SDK's `SyncResult.status`. */
101
127
  status: 'complete' | 'more';
@@ -118,6 +144,7 @@ export type ExecutorResult = {
118
144
  } | {
119
145
  mode: 'read';
120
146
  rows: Record<string, unknown>[];
147
+ rowCursors?: string[];
121
148
  columns?: {
122
149
  name: string;
123
150
  type: string;
@@ -145,6 +172,9 @@ export type ExecutorResult = {
145
172
  } | {
146
173
  mode: 'agent_turn';
147
174
  turn: AgentTurnOutput;
175
+ } | {
176
+ mode: 'webhook_record';
177
+ event: EventEnvelope | null;
148
178
  } | {
149
179
  mode: 'webhook_unregister';
150
180
  };
@@ -189,7 +219,7 @@ export interface ExecutionHooks {
189
219
  }) => Promise<Record<string, unknown>>;
190
220
  /**
191
221
  * Sync runs: connector code invoked
192
- * `ctx.sessionState.chrome_dispatcher.dispatch(actionKey, actionInput)`.
222
+ * `ctx.browser.dispatch(actionKey, actionInput)`.
193
223
  * The host (connector-worker daemon) forwards the call to the gateway
194
224
  * (POST /api/workers/dispatch-chrome-action), which inserts a chrome
195
225
  * connector action run, waits for the paired Owletto extension to claim
@@ -197,6 +227,8 @@ export interface ExecutionHooks {
197
227
  * reject when no extension is reachable.
198
228
  */
199
229
  onChromeDispatch?: (actionKey: string, actionInput: Record<string, unknown>) => Promise<Record<string, unknown>>;
230
+ /** Action runs: delegate through the existing operation admission and device execution path. */
231
+ onOperationExecute?: (request: ConnectorOperationRequest) => Promise<ConnectorOperationResult>;
200
232
  }
201
233
  /**
202
234
  * Pluggable executor interface. The canonical implementation is `IsolateExecutor`;
@@ -23,6 +23,7 @@
23
23
  * requires a Node builtin is rejected before any isolate work with
24
24
  * `IsolateLaneIneligibleError`.
25
25
  */
26
+ import { BROWSER_VERIFY_OPERATION, constrainBrowserInput } from '@lobu/connector-sdk';
26
27
  import net from 'node:net';
27
28
  import tls from 'node:tls';
28
29
  import { decideEgress } from '@lobu/connector-sdk/egress-policy';
@@ -30,6 +31,7 @@ import { isReservedIp, stripIpv6Brackets } from '@lobu/connector-sdk/ip-reachabi
30
31
  import { normalizeDomainPattern } from '@lobu/core';
31
32
  import { CredentialVault } from '../egress/credentials.js';
32
33
  import { CONNECTOR_HTTP_MAX_BYTES } from '@lobu/core/contracts/worker/protocol';
34
+ import { isConnectorOperationRequest } from '@lobu/core/contracts/tools/manage-operations';
33
35
  import { EgressDispatcher, fetchPublicUrl, MalformedHostError, parseExemptHosts, PrivateAddressError, resolveEgressAddresses, } from '../egress/transport.js';
34
36
  import { IsolateHost, IsolateHostError } from '../isolate/bridge.js';
35
37
  import { assertIsolateEligible } from '../isolate/eligibility.js';
@@ -100,6 +102,12 @@ const GUEST_RUNNER = String.raw `
100
102
  return null;
101
103
  }
102
104
 
105
+ function operations() {
106
+ return { execute: function (request) {
107
+ return H.async('executeOperation', JSON.stringify(request)).then(function (json) { return JSON.parse(json); });
108
+ }};
109
+ }
110
+
103
111
  function chromeDispatcher() {
104
112
  return {
105
113
  dispatch: function (actionKey, actionInput) {
@@ -110,12 +118,6 @@ const GUEST_RUNNER = String.raw `
110
118
  };
111
119
  }
112
120
 
113
- function withDispatcher(sessionState) {
114
- var out = Object.assign({}, sessionState || {});
115
- out.chrome_dispatcher = chromeDispatcher();
116
- return out;
117
- }
118
-
119
121
  // One commit may carry more events than one bridge message should. Every
120
122
  // chunk but the last travels without a checkpoint, so the cursor moves only
121
123
  // with the chunk that completes the page: an earlier chunk that lands alone
@@ -162,10 +164,16 @@ const GUEST_RUNNER = String.raw `
162
164
  }
163
165
 
164
166
  if (job.mode === 'action') {
167
+ if (job.actionKey === ${JSON.stringify(BROWSER_VERIFY_OPERATION)} && job.browser) {
168
+ var verified = await chromeDispatcher().dispatch(${JSON.stringify(BROWSER_VERIFY_OPERATION)}, {});
169
+ return { mode: 'action', output: verified };
170
+ }
165
171
  var actionResult = await instance.execute({
172
+ operations: operations(),
166
173
  actionKey: job.actionKey,
167
174
  input: job.actionInput,
168
- sessionState: withDispatcher(job.sessionState),
175
+ browser: job.browser ? chromeDispatcher() : undefined,
176
+ sessionState: Object.assign({}, job.sessionState || {}),
169
177
  credentials: job.credentials,
170
178
  config: mergedConfig
171
179
  });
@@ -184,6 +192,18 @@ const GUEST_RUNNER = String.raw `
184
192
  return { mode: 'webhook_register', registration: registration, webhookScheme: webhookScheme };
185
193
  }
186
194
 
195
+ if (job.mode === 'webhook_record') {
196
+ var recordFeed = instance.definition && instance.definition.feeds && instance.definition.feeds[job.feedKey];
197
+ var recordWebhook = recordFeed && recordFeed.webhook;
198
+ if (!recordWebhook || recordWebhook.kind !== 'record' || typeof recordWebhook.normalize !== 'function') {
199
+ throw new Error("feed '" + job.feedKey + "' does not record webhook deliveries");
200
+ }
201
+ var recorded = await recordWebhook.normalize(job.payload, {
202
+ feedKey: job.feedKey, eventType: job.eventType, config: mergedConfig, receivedAt: job.receivedAt
203
+ });
204
+ return { mode: 'webhook_record', event: recorded || null };
205
+ }
206
+
187
207
  if (job.mode === 'webhook_unregister') {
188
208
  await instance.unregisterWebhook({
189
209
  config: mergedConfig, credentials: job.credentials, sessionState: job.sessionState, externalId: job.externalId
@@ -192,25 +212,42 @@ const GUEST_RUNNER = String.raw `
192
212
  }
193
213
 
194
214
  if (job.mode === 'query') {
195
- if (job.exactMatch && !(instance.definition.queryCapabilities && instance.definition.queryCapabilities.exactMatch === true)) {
215
+ var queryCapabilities = instance.definition && instance.definition.queryCapabilities;
216
+ var supportsSelection = queryCapabilities && queryCapabilities.selection === true;
217
+ if (job.selection && (job.selection.search || (job.selection.filters && job.selection.filters.length)) && !supportsSelection) {
218
+ throw Object.assign(new Error('Connector does not support collection selection queries'), { status: 400 });
219
+ }
220
+ if (job.exactMatch && !(queryCapabilities && queryCapabilities.exactMatch === true)) {
196
221
  throw Object.assign(new Error('Connector does not support exact-match queries'), { status: 400 });
197
222
  }
198
223
  var queryResult = await instance.query({
199
224
  query: job.query, config: mergedConfig, credentials: job.credentials, sessionState: job.sessionState,
200
- limit: job.limit, offset: job.offset, sort: job.sort, exactMatch: job.exactMatch
225
+ limit: job.limit, offset: job.offset, sort: job.sort, exactMatch: job.exactMatch, selection: supportsSelection ? job.selection : undefined
201
226
  });
202
227
  return { mode: 'query', rows: (queryResult && queryResult.rows) || [], columns: queryResult && queryResult.columns, total: queryResult && queryResult.total };
203
228
  }
204
229
 
230
+ if (job.mode === 'observe') {
231
+ await instance.observe({
232
+ feedId: job.feedId, feedKey: job.feedKey, checkpoint: job.checkpoint,
233
+ config: mergedConfig, credentials: job.credentials, browser: job.browser ? chromeDispatcher() : undefined,
234
+ sessionState: Object.assign({}, job.sessionState || {}),
235
+ env: job.env
236
+ });
237
+ return { mode: 'observe' };
238
+ }
239
+
205
240
  if (job.mode === 'read') {
206
241
  var readResult = await instance.read({
207
242
  feedId: job.feedId === null ? undefined : job.feedId, feedKey: job.feedKey, query: job.query, cursor: job.cursor,
208
243
  window: job.window,
209
- config: mergedConfig, credentials: job.credentials, sessionState: job.sessionState,
210
- limit: job.limit, offset: job.offset, sort: job.sort
244
+ config: mergedConfig, credentials: job.credentials, browser: job.browser ? chromeDispatcher() : undefined,
245
+ sessionState: Object.assign({}, job.sessionState || {}),
246
+ limit: job.limit, offset: job.offset, sort: job.sort, match: job.match
211
247
  });
212
248
  return {
213
249
  mode: 'read', rows: (readResult && readResult.rows) || [], columns: readResult && readResult.columns,
250
+ rowCursors: readResult && readResult.rowCursors,
214
251
  total: readResult && readResult.total, nextCursor: readResult && readResult.nextCursor, hasMore: readResult && readResult.hasMore,
215
252
  window: readResult && readResult.window
216
253
  };
@@ -223,7 +260,8 @@ const GUEST_RUNNER = String.raw `
223
260
  checkpoint: job.checkpoint,
224
261
  credentials: job.credentials,
225
262
  entityIds: job.entityIds,
226
- sessionState: withDispatcher(job.sessionState),
263
+ browser: job.browser ? chromeDispatcher() : undefined,
264
+ sessionState: Object.assign({}, job.sessionState || {}),
227
265
  commit: commit
228
266
  });
229
267
  // A commit the connector fired without awaiting still belongs to this pass.
@@ -730,9 +768,22 @@ export class IsolateExecutor {
730
768
  });
731
769
  return JSON.stringify(signal ?? {});
732
770
  },
771
+ executeOperation: async (requestJson) => {
772
+ if (job.mode !== 'action' || !hooks?.onOperationExecute) {
773
+ throw new Error('Connector operations are not available in this execution context');
774
+ }
775
+ if (hooks.signal?.aborted)
776
+ throw new Error('Connector operation cancelled');
777
+ const request = parseGuestJson(requestJson, 'executeOperation');
778
+ if (!isConnectorOperationRequest(request))
779
+ throw new Error('Invalid connector operation request');
780
+ return JSON.stringify(await hooks.onOperationExecute(request));
781
+ },
733
782
  dispatchChromeAction: async (actionKey, inputJson) => {
783
+ if (!job.browser)
784
+ throw new Error('Browser access was not granted for this connection');
734
785
  if (!hooks?.onChromeDispatch) {
735
- throw new Error('chrome_dispatcher is not available in this execution context (no onChromeDispatch hook)');
786
+ throw new Error('ctx.browser is not available in this execution context (no onChromeDispatch hook)');
736
787
  }
737
788
  const parsed = parseGuestJson(inputJson, 'dispatchChromeAction');
738
789
  const input = parsed && typeof parsed === 'object' ? parsed : {};
@@ -740,12 +791,12 @@ export class IsolateExecutor {
740
791
  let timer;
741
792
  const timeoutPromise = new Promise((_, reject) => {
742
793
  timer = setTimeout(() => {
743
- reject(new Error(`chrome_dispatcher.dispatch('${keyStr}') exceeded 120000ms; IPC may be wedged`));
794
+ reject(new Error(`ctx.browser.dispatch('${keyStr}') exceeded 120000ms; IPC may be wedged`));
744
795
  }, 120_000);
745
796
  });
746
797
  try {
747
798
  const output = await Promise.race([
748
- hooks.onChromeDispatch(keyStr, input),
799
+ hooks.onChromeDispatch(keyStr, constrainBrowserInput(job.browser, keyStr, input)),
749
800
  timeoutPromise,
750
801
  ]);
751
802
  return JSON.stringify(output ?? {});
@@ -5,6 +5,7 @@
5
5
  * real credential into the runs table. Add new patterns here when a connector
6
6
  * surfaces a new sensitive shape.
7
7
  */
8
+ export declare function isSecretOutputKey(key: string): boolean;
8
9
  export declare function redactOutput(text: string): string;
9
10
  /**
10
11
  * Streaming redactor for live tee to parent stdout/stderr. Buffers up to the
@@ -6,11 +6,99 @@
6
6
  * surfaces a new sensitive shape.
7
7
  */
8
8
  const REDACTED = '[REDACTED]';
9
- // Value charset for assignment-style secrets: word + URL-safe base64 + the
10
- // dot/dollar/percent that show up in OAuth tokens (e.g. ya29.a0AfH6SM…) and
11
- // signed cookies. Excludes whitespace, quote, brace, and bracket so the
12
- // pattern stops at the boundary of the value.
13
- const SECRET_VALUE = `[\\w\\-.~+/=:%$]{12,}`;
9
+ // Keep this module dependency-free: it is also bundled into connector isolates.
10
+ // Match credential suffixes even in concatenated names such as PGPASSWORD.
11
+ // The token scanner bounds the work; requiring a prefix delimiter loses secrets.
12
+ const SECRET_KEY = /(?:api[_-]?key|access[_-]?token|refresh[_-]?token|id[_-]?token|auth[_-]?token|client[_-]?secret|secret(?:[_-]access)?[_-]?key|private[_-]?key|token|secret|password|passwd|credentials?|authorization|auth|bearer|cookies?|set[_-]cookie|session[_-]?id)s?$/i;
13
+ export function isSecretOutputKey(key) {
14
+ const normalized = key.replace(/([a-z0-9])([A-Z])/g, '$1_$2');
15
+ return SECRET_KEY.test(key) || SECRET_KEY.test(normalized) ||
16
+ (key.toUpperCase().includes('AWS_') && /(?:KEY|TOKEN|SECRET)$/i.test(key));
17
+ }
18
+ function quotedValueEnd(text, start, delimiter) {
19
+ const quote = delimiter.at(-1);
20
+ const escapes = delimiter.length - 1;
21
+ // A quote closes embedded JSON only at the opening delimiter's escaping layer.
22
+ let end = start;
23
+ while (end < text.length) {
24
+ const runStart = end;
25
+ while (text[end] === '\\')
26
+ end++;
27
+ if (text[end] === quote && (end - runStart) % (2 * (escapes + 1)) === escapes) {
28
+ return end - escapes;
29
+ }
30
+ if (end < text.length)
31
+ end++;
32
+ }
33
+ return end;
34
+ }
35
+ // Consume whole key tokens once, then scan only explicitly assigned secret values.
36
+ // A length threshold misses short passwords; unbounded key-search regexes can
37
+ // repeatedly rescan long malformed log lines.
38
+ function redactAssignments(text) {
39
+ const keys = /[\w.-]+/g;
40
+ const assignment = /(\\*["'])?\s*[:=]\s*(\\*["'])?/y;
41
+ const authScheme = /(?:Bearer|Basic)\s+/iy;
42
+ const parts = [];
43
+ let copied = 0;
44
+ let key;
45
+ while ((key = keys.exec(text))) {
46
+ if (!isSecretOutputKey(key[0]))
47
+ continue;
48
+ assignment.lastIndex = keys.lastIndex;
49
+ const separator = assignment.exec(text);
50
+ if (!separator)
51
+ continue;
52
+ const start = assignment.lastIndex;
53
+ const delimiter = separator[2];
54
+ let end = start;
55
+ let replacement = REDACTED;
56
+ if (!delimiter && text.startsWith(REDACTED, start)) {
57
+ keys.lastIndex = start + REDACTED.length;
58
+ continue;
59
+ }
60
+ if (delimiter) {
61
+ end = quotedValueEnd(text, start, delimiter);
62
+ }
63
+ else if (text[start] === '{' || text[start] === '[') {
64
+ // Secret containers hide every descendant, even those with ordinary keys.
65
+ let depth = 0;
66
+ do {
67
+ const quoteStart = end;
68
+ while (text[end] === '\\')
69
+ end++;
70
+ if (text[end] === '"' || text[end] === "'") {
71
+ const quote = text.slice(quoteStart, end + 1);
72
+ end = quotedValueEnd(text, end + 1, quote) + quote.length;
73
+ continue;
74
+ }
75
+ if (text[end] === '{' || text[end] === '[')
76
+ depth++;
77
+ if (text[end] === '}' || text[end] === ']')
78
+ depth--;
79
+ end++;
80
+ } while (depth > 0 && end < text.length);
81
+ const quote = separator[1] ?? '"';
82
+ replacement = `${quote}${REDACTED}${quote}`;
83
+ }
84
+ else {
85
+ // An unquoted authentication value includes its scheme and credential.
86
+ // Removing only the scheme would hide it from later token redaction.
87
+ authScheme.lastIndex = start;
88
+ if (authScheme.test(text))
89
+ end = authScheme.lastIndex;
90
+ while (end < text.length && !/[\s,;&}\]"']/.test(text[end]))
91
+ end++;
92
+ }
93
+ if (end > start) {
94
+ parts.push(text.slice(copied, start), replacement);
95
+ copied = end;
96
+ }
97
+ keys.lastIndex = end;
98
+ }
99
+ parts.push(text.slice(copied));
100
+ return parts.join('');
101
+ }
14
102
  const PATTERNS = [
15
103
  // HTTP Authorization header (e.g. "Authorization: Bearer abc...") — match
16
104
  // the rest of the line so multi-token schemes like "Bearer xxx" get caught.
@@ -23,34 +111,17 @@ const PATTERNS = [
23
111
  { regex: /eyJ[\w\-]+\.[\w\-]+\.[\w\-]+/g, replacement: REDACTED },
24
112
  // Google OAuth access token shape (ya29.<varies>) — high-confidence.
25
113
  { regex: /ya29\.[\w\-.]{20,}/g, replacement: REDACTED },
26
- // URI userinfo: `scheme://user:pass@host` — redact the password segment.
27
- // Captures any scheme; replaces password while preserving structure.
114
+ // Bound the scheme search so a long non-URI token is not rescanned at every
115
+ // character. Retain the scheme, username and host for diagnostics.
28
116
  {
29
- regex: /([a-z][a-z0-9+\-.]*:\/\/[^:/\s]+):([^@/\s]+)@/gi,
117
+ regex: /([a-z][a-z0-9+.-]{0,63}:\/\/[^:/\s]+):([^@/\s]+)@/gi,
30
118
  replacement: `$1:${REDACTED}@`,
31
119
  },
32
- // CH_API_KEY=value (literal env-var key from the connector ecosystem)
33
- {
34
- regex: /(CH_API_KEY)(["'\s:=]+["']?)([\w\-]+)(["']?)/gi,
35
- replacement: `$1$2${REDACTED}$4`,
36
- },
37
- // AWS_<SOMETHING>_KEY / AWS_<SOMETHING>_TOKEN env-style.
38
- {
39
- regex: new RegExp(`(AWS_[A-Z0-9_]*(?:KEY|TOKEN|SECRET))(["'\\s:=]+["']?)(${SECRET_VALUE})(["']?)`, 'g'),
40
- replacement: `$1$2${REDACTED}$4`,
41
- },
42
- // JSON/YAML/env-var style `api_key=...`, `apikey: "..."`, `access_token: ...`,
43
- // `secret = "..."`, `refresh_token: ...`, `id_token=...`, `_authToken: ...`,
44
- // `password: "..."`, `client_secret=...`.
45
- {
46
- regex: new RegExp(`((?:api[_-]?key|apikey|access[_-]?token|refresh[_-]?token|id[_-]?token|_?auth[_-]?token|client[_-]?secret|secret|password))(["'\\s:=]+["']?)(${SECRET_VALUE})(["']?)`, 'gi'),
47
- replacement: `$1$2${REDACTED}$4`,
48
- },
49
120
  ];
50
121
  export function redactOutput(text) {
51
122
  if (!text)
52
123
  return text;
53
- let result = text;
124
+ let result = redactAssignments(text);
54
125
  for (const { regex, replacement } of PATTERNS) {
55
126
  result = result.replace(regex, replacement);
56
127
  }
@@ -1,3 +1,5 @@
1
+ import type { EventEnvelope } from '@lobu/connector-sdk';
2
+ import type { ContentItem } from '@lobu/core/contracts/worker/protocol';
1
3
  import type { ExecutionHooks, ExecutorJob, ExecutorResult, SyncExecutor } from './interface.js';
2
4
  /**
3
5
  * Top-level entry point used by the daemon executor. Just delegates to the
@@ -18,4 +20,9 @@ export declare function executeCompiledConnector(params: {
18
20
  * unrestricted; an EMPTY list denies everything. */
19
21
  allowedDomains?: readonly string[];
20
22
  }): Promise<ExecutorResult>;
23
+ /**
24
+ * Convert a V1 EventEnvelope (the SDK's standard sync output) into the
25
+ * gateway-bound ContentItem shape (without an embedding).
26
+ */
27
+ export declare function envelopeToContentItem(event: EventEnvelope): ContentItem;
21
28
  //# sourceMappingURL=runtime.d.ts.map
@@ -9,4 +9,30 @@ export async function executeCompiledConnector(params) {
9
9
  (await selectExecutor({ timeoutMs: params.timeoutMs, allowedDomains: params.allowedDomains }));
10
10
  return executor.execute(params.compiledCode, params.job, params.hooks);
11
11
  }
12
+ /**
13
+ * Convert a V1 EventEnvelope (the SDK's standard sync output) into the
14
+ * gateway-bound ContentItem shape (without an embedding).
15
+ */
16
+ export function envelopeToContentItem(event) {
17
+ const occurredAtIso = event.occurred_at instanceof Date
18
+ ? event.occurred_at.toISOString()
19
+ : event.occurred_at;
20
+ return {
21
+ id: event.origin_id,
22
+ title: event.title,
23
+ payload_type: event.payload_type,
24
+ payload_text: event.payload_text,
25
+ payload_data: event.payload_data,
26
+ attachments: event.attachments,
27
+ author_name: event.author_name,
28
+ occurred_at: occurredAtIso,
29
+ source_url: event.source_url ?? undefined,
30
+ score: typeof event.score === 'number' ? event.score : 0,
31
+ metadata: event.metadata ?? {},
32
+ origin_parent_id: event.origin_parent_id ?? undefined,
33
+ origin_type: event.origin_type,
34
+ semantic_type: event.semantic_type ?? event.origin_type,
35
+ automation_signals: event.automation_signals,
36
+ };
37
+ }
12
38
  //# sourceMappingURL=runtime.js.map
@@ -185,7 +185,9 @@ export class IsolateHost {
185
185
  return await script.run(this.context, {
186
186
  promise: true,
187
187
  copy: true,
188
- ...(options.timeoutMs > 0 ? { timeout: options.timeoutMs } : {}),
188
+ // The host's single deadline covers compilation, synchronous work,
189
+ // and continuations after await. A second V8 deadline at the same
190
+ // instant races the typed termination and leaks a guest-error result.
189
191
  });
190
192
  }
191
193
  catch (error) {
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env bun
2
2
  import packageJson from '../package.json' with { type: 'json' };
3
3
  import { configureCliSupervisorCommand, runPackagedCliSupervisor, } from './daemon/automation-process.js';
4
- import { INTERNAL_ACP_ADAPTER_ARG, macDeviceDaemonMetadata, packagedDaemonArgs, runMacDeviceDaemon, validateMacDeviceDaemonOptions, } from './daemon/mac-device-daemon.js';
4
+ import { INTERNAL_ACP_ADAPTER_ARG, MAC_DAEMON_CREDENTIAL_REJECTED_EXIT, macDeviceDaemonExitCode, macDeviceDaemonMetadata, packagedDaemonArgs, runMacDeviceDaemon, validateMacDeviceDaemonOptions, } from './daemon/mac-device-daemon.js';
5
5
  import { NATIVE_BRIDGE_PROTOCOL } from './daemon/native-bridge/protocol.js';
6
6
  const VERSION = packageJson.version;
7
7
  const INTERNAL_CLI_SUPERVISOR_ARG = '--internal-cli-supervisor';
@@ -19,7 +19,8 @@ Options:
19
19
  --api-url <url> Worker API origin (or API_URL)
20
20
  --worker-id <id> Device identity (default: macos:<hostname>)
21
21
  --poll-interval-ms <ms> Poll interval (default: 10000)
22
- --max-concurrent-jobs <n> Maximum active Automations (default: 1)
22
+ --max-concurrent-jobs <n> Maximum active runs (default: half the host's
23
+ threads, clamped to 2-8)
23
24
  --default-agent-kind <kind> Agent fallback for Automations without a kind
24
25
  --supervised-stdio Treat stdin EOF as a supervised-parent shutdown
25
26
  --no-poll Validate the executable without contacting a server
@@ -179,6 +180,12 @@ async function start() {
179
180
  }
180
181
  start().catch((error) => {
181
182
  process.stderr.write(`error: ${error instanceof Error ? error.message : String(error)}\n`);
182
- process.exitCode = 1;
183
+ const exitCode = macDeviceDaemonExitCode(error);
184
+ // The supervised stdin stays open until the app observes our exit. Exiting
185
+ // also triggers the CLI supervisors' parent-loss cleanup and native-run
186
+ // cancellation in the app; waiting for stdio EOF would deadlock relinking.
187
+ if (exitCode === MAC_DAEMON_CREDENTIAL_REJECTED_EXIT)
188
+ process.exit(exitCode);
189
+ process.exitCode = exitCode;
183
190
  });
184
191
  //# sourceMappingURL=mac-device-daemon.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobu/connector-worker",
3
- "version": "21.2.1",
3
+ "version": "22.0.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.0"
73
+ "undici": "7.29.1"
74
74
  },
75
75
  "optionalDependencies": {
76
76
  "isolated-vm": "^6.2.0",
@@ -28,7 +28,7 @@ exports.CUSTOM_TOOL_METADATA = {
28
28
  description: "Post a message to one of your conversations. Pass a conversation handle (from list_conversations) to post to the channel, or a thread handle (returned by a previous send_message) to reply in that thread. This is how an automated/scheduled run speaks in its channel.",
29
29
  },
30
30
  present_event: {
31
- description: "Render an existing Lobu event in the current conversation through its declared json_template. Use the event id returned by knowledge.save; do not hand-author platform card JSON or action ids.",
31
+ description: "Present an existing Lobu event as a summary and Open event link in the current conversation. Custom interactions open in its React view. Use the event id returned by knowledge.save; do not hand-author platform card JSON or action ids.",
32
32
  },
33
33
  schedule_followup: {
34
34
  description: "Schedule one durable future wake-up for yourself in the current conversation. The server fixes the agent and destination from the signed turn; provide a stable idempotency key so retries do not duplicate the wake-up.",