@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
@@ -75,7 +75,6 @@ Local dev:
75
75
  validate Validate lobu.config.ts
76
76
  doctor Health checks (deps, DB, pgvector, ports, keys)
77
77
  runtime install [...] Preinstall runtime components for offline use
78
- telemetry Show / toggle anonymous error reporting
79
78
  opencode-plugin <action> Install, inspect, or remove interactive OpenCode support
80
79
 
81
80
  Cloud:
@@ -122,20 +121,13 @@ Memory:
122
121
  .option("--memory <choice>", "Memory backend: none | lobu-cloud | lobu-custom")
123
122
  .option("--memory-url <url>", "Custom memory MCP URL (with --memory lobu-custom)")
124
123
  .option("--otel-endpoint <url>", "OpenTelemetry collector endpoint")
125
- .option("--sentry", "Enable Sentry error reporting")
126
- .option("--no-sentry", "Disable Sentry without prompting")
127
124
  .option("--hosted-slack", "Use the hosted Lobu Slack bot (no bot token) in lobu.config.ts")
128
125
  .option("--no-hosted-slack", "Skip the hosted Slack bot without prompting")
129
126
  .option("--list-providers", "Print available provider ids from config/providers.json and exit")
130
127
  .option("--from-org [slug]", "Bootstrap a re-appliable project from an existing org (defaults to active session)")
131
128
  .option("--url <url>", "Server URL override (with --from-org)")
132
129
  .option("--skip-install", "Scaffold files without installing dependencies (run npm install or bun install later)")
133
- .action(async (name,
134
- // Commander's raw shape: `sentry` is a tristate (true=--sentry,
135
- // false=--no-sentry, undefined=neither) and `fromOrg` is string|true.
136
- // Every other field maps 1:1 onto InitOptions, so we spread and only
137
- // normalize those two below.
138
- options) => {
130
+ .action(async (name, options) => {
139
131
  const { initCommand } = await import("./commands/init.js");
140
132
  // `--from-org` with no value is `true`; normalize to "" (active org).
141
133
  const fromOrg = options.fromOrg === undefined
@@ -145,8 +137,6 @@ Memory:
145
137
  : options.fromOrg;
146
138
  await initCommand(process.cwd(), name, {
147
139
  ...options,
148
- sentry: options.sentry === true,
149
- noSentry: options.sentry === false,
150
140
  fromOrg,
151
141
  });
152
142
  });
@@ -696,32 +686,6 @@ Memory:
696
686
  const { doctorCommand } = await import("./commands/doctor.js");
697
687
  await doctorCommand(options);
698
688
  });
699
- // ─── telemetry ──────────────────────────────────────────────────────
700
- const telemetry = program
701
- .command("telemetry")
702
- .description("Show or toggle anonymous error reporting (Sentry)");
703
- telemetry
704
- .command("status", { isDefault: true })
705
- .description("Show whether telemetry is on or off")
706
- .action(async () => {
707
- const { telemetryStatusCommand } = await import("./commands/telemetry.js");
708
- await telemetryStatusCommand();
709
- });
710
- telemetry
711
- .command("on")
712
- .description("Enable telemetry (writes SENTRY_DSN to .env)")
713
- .option("--dsn <dsn>", "Custom Sentry DSN (defaults to Lobu's)")
714
- .action(async (options) => {
715
- const { telemetryOnCommand } = await import("./commands/telemetry.js");
716
- await telemetryOnCommand(options);
717
- });
718
- telemetry
719
- .command("off")
720
- .description("Disable telemetry (removes SENTRY_DSN from .env)")
721
- .action(async () => {
722
- const { telemetryOffCommand } = await import("./commands/telemetry.js");
723
- await telemetryOffCommand();
724
- });
725
689
  // ─── memory ─────────────────────────────────────────────────────────
726
690
  const memory = program
727
691
  .command("memory")
@@ -58,6 +58,16 @@ export declare function getServerConfig(contextName?: string): Promise<LobuServe
58
58
  * (`LobuContextIdentity.origin(of:)`).
59
59
  */
60
60
  export declare function apiUrlToGatewayOrigin(url: string): string;
61
+ /**
62
+ * Origin that serves the tool API (`/api/{org}/{tool}`) behind an MCP URL.
63
+ *
64
+ * The hosted MCP resource `https://lobu.ai/mcp` is an edge proxy for `/mcp`
65
+ * only (it is the RFC 8707 resource identifier, deliberately not the gateway
66
+ * host), so a tool call built from its origin answers 405. The hosted gateway
67
+ * serves the tool API behind it; every other installation serves both from
68
+ * one origin.
69
+ */
70
+ export declare function toolApiOriginForMcpUrl(mcpUrl: string): string;
61
71
  export declare function findContextByUrl(apiUrl: string): Promise<ResolvedContext | undefined>;
62
72
  /**
63
73
  * Find the named context whose API URL belongs to the same gateway origin.
@@ -359,6 +359,21 @@ export function apiUrlToGatewayOrigin(url) {
359
359
  return normalizeApiUrl(url);
360
360
  }
361
361
  }
362
+ /**
363
+ * Origin that serves the tool API (`/api/{org}/{tool}`) behind an MCP URL.
364
+ *
365
+ * The hosted MCP resource `https://lobu.ai/mcp` is an edge proxy for `/mcp`
366
+ * only (it is the RFC 8707 resource identifier, deliberately not the gateway
367
+ * host), so a tool call built from its origin answers 405. The hosted gateway
368
+ * serves the tool API behind it; every other installation serves both from
369
+ * one origin.
370
+ */
371
+ export function toolApiOriginForMcpUrl(mcpUrl) {
372
+ const origin = apiUrlToGatewayOrigin(mcpUrl);
373
+ return origin === apiUrlToGatewayOrigin(DEFAULT_LOBU_MCP_URL)
374
+ ? apiUrlToGatewayOrigin(DEFAULT_CONTEXT_URL)
375
+ : origin;
376
+ }
362
377
  export async function findContextByUrl(apiUrl) {
363
378
  const config = await loadContextConfig();
364
379
  const normalizedSearch = normalizeApiUrl(apiUrl);
@@ -421,26 +436,21 @@ export async function findContextByMemoryUrl(memoryUrl) {
421
436
  }
422
437
  return undefined;
423
438
  }
439
+ /**
440
+ * The MCP URL a context's own installation serves. The hosted gateway's MCP
441
+ * resource is `https://lobu.ai/mcp`; every other installation (loopback or
442
+ * self-hosted) serves `/mcp` at its own origin. Falling back to the hosted URL
443
+ * for a self-hosted context would send that context's stored token to the
444
+ * hosted service.
445
+ */
424
446
  function defaultMemoryUrlForContext(context) {
425
447
  if (context?.memoryUrl)
426
448
  return context.memoryUrl;
427
- if (context && isLoopbackContextUrl(context.url)) {
428
- const url = new URL(context.url);
429
- url.pathname = "/mcp";
430
- url.search = "";
431
- url.hash = "";
432
- return url.toString().replace(/\/+$/, "");
433
- }
434
- return DEFAULT_LOBU_MCP_URL;
435
- }
436
- function isLoopbackContextUrl(input) {
437
- try {
438
- const { hostname } = new URL(input);
439
- return (hostname === "localhost" || hostname === "127.0.0.1" || hostname === "::1");
440
- }
441
- catch {
442
- return false;
449
+ const origin = apiUrlToGatewayOrigin(context?.url ?? DEFAULT_CONTEXT_URL);
450
+ if (origin === apiUrlToGatewayOrigin(DEFAULT_CONTEXT_URL)) {
451
+ return DEFAULT_LOBU_MCP_URL;
443
452
  }
453
+ return `${origin}/mcp`;
444
454
  }
445
455
  function contextToResolvedContext(name, context) {
446
456
  return {
@@ -5,7 +5,7 @@
5
5
  * is tied to each Node line's V8 ABI: isolated-vm@6 covers Node 22–24, the
6
6
  * aliased isolated-vm@7 covers Node 26+. Node 25 is an EOL non-LTS line upstream
7
7
  * skipped, so it boots but has no sandbox build. Below 22 nothing works — the
8
- * bundled server's deps (undici via @sentry/node) reference globals absent on
8
+ * bundled server's deps (undici) reference globals absent on
9
9
  * old Node and crash on load.
10
10
  *
11
11
  * The `bin/lobu.js` entrypoint carries an inline copy of the MIN threshold
@@ -5,7 +5,7 @@
5
5
  * is tied to each Node line's V8 ABI: isolated-vm@6 covers Node 22–24, the
6
6
  * aliased isolated-vm@7 covers Node 26+. Node 25 is an EOL non-LTS line upstream
7
7
  * skipped, so it boots but has no sandbox build. Below 22 nothing works — the
8
- * bundled server's deps (undici via @sentry/node) reference globals absent on
8
+ * bundled server's deps (undici) reference globals absent on
9
9
  * old Node and crash on load.
10
10
  *
11
11
  * The `bin/lobu.js` entrypoint carries an inline copy of the MIN threshold
@@ -5,6 +5,8 @@
5
5
  * Lobu-hosted issuers: dynamic client registration (RFC 7591) +
6
6
  * device authorization grant (RFC 8628) + refresh-token grant.
7
7
  */
8
+ /** Registered name of the terminal `lobu` CLI. */
9
+ export declare const LOBU_CLI_CLIENT_NAME = "Lobu CLI";
8
10
  export declare const DEVICE_CODE_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:device_code";
9
11
  export interface OAuthDiscovery {
10
12
  issuer: string;
@@ -62,7 +64,7 @@ export declare function discoverOAuth(apiUrl: string): Promise<OAuthDiscovery>;
62
64
  * `token_endpoint_auth_method: "none"` keeps the CLI from needing to
63
65
  * ship a client secret.
64
66
  */
65
- export declare function registerClient(registrationEndpoint: string, softwareVersion: string): Promise<RegisteredClient>;
67
+ export declare function registerClient(registrationEndpoint: string, softwareVersion: string, clientName: string): Promise<RegisteredClient>;
66
68
  export declare function startDeviceAuthorization(endpoint: string, client: RegisteredClient): Promise<DeviceAuthorization>;
67
69
  type DevicePollResult = {
68
70
  status: "pending";
@@ -5,7 +5,8 @@
5
5
  * Lobu-hosted issuers: dynamic client registration (RFC 7591) +
6
6
  * device authorization grant (RFC 8628) + refresh-token grant.
7
7
  */
8
- const CLIENT_NAME = "Lobu CLI";
8
+ /** Registered name of the terminal `lobu` CLI. */
9
+ export const LOBU_CLI_CLIENT_NAME = "Lobu CLI";
9
10
  const SOFTWARE_ID = "lobu-cli";
10
11
  // `connections:token` is requested explicitly so the resulting login token can
11
12
  // fetch managed-connector access tokens from the cloud (POST
@@ -64,9 +65,9 @@ export async function discoverOAuth(apiUrl) {
64
65
  * `token_endpoint_auth_method: "none"` keeps the CLI from needing to
65
66
  * ship a client secret.
66
67
  */
67
- export async function registerClient(registrationEndpoint, softwareVersion) {
68
+ export async function registerClient(registrationEndpoint, softwareVersion, clientName) {
68
69
  const body = await postJson(registrationEndpoint, {
69
- client_name: CLIENT_NAME,
70
+ client_name: clientName,
70
71
  software_id: SOFTWARE_ID,
71
72
  software_version: softwareVersion,
72
73
  grant_types: [GRANT_DEVICE_CODE, GRANT_REFRESH_TOKEN],
@@ -17,6 +17,15 @@ export interface ComponentInstallOptions {
17
17
  export declare function selectedRuntimeComponents(surface: "server" | "device", env: Record<string, string | undefined>, needsEmbeddings?: boolean): RuntimeComponent[];
18
18
  export declare function runtimeCacheRoot(): string;
19
19
  export declare function runtimePlatformKey(): string;
20
+ /**
21
+ * The first path under a package manager's cache this user cannot write, or
22
+ * null. Checks the cache and two levels below it, which covers the usual
23
+ * breakage: a cache created by an earlier `sudo npm`/root container step, so
24
+ * the top directory looks fine while `_cacache/*` is root-owned. A cache that
25
+ * does not exist yet is checked at its nearest existing parent.
26
+ */
27
+ export declare function findUnwritableCachePath(cacheDir: string): string | null;
28
+ export declare function unwritableCacheMessage(tool: "bun" | "npm", path: string): string;
20
29
  export declare function ensureComponent(component: ComponentDescriptor, options?: ComponentInstallOptions): Promise<string>;
21
30
  export declare function prepareRuntime(surface: "server" | "device", env: Record<string, string | undefined>, options?: ComponentInstallOptions & {
22
31
  localEmbeddings?: boolean;
@@ -1,6 +1,6 @@
1
1
  import { spawn, spawnSync } from "node:child_process";
2
2
  import { createHash } from "node:crypto";
3
- import { existsSync, readFileSync } from "node:fs";
3
+ import { accessSync, constants as fsConstants, existsSync, readdirSync, readFileSync, } from "node:fs";
4
4
  import { copyFile, mkdir, mkdtemp, readFile, readdir, readlink, realpath, rename, rm, symlink, unlink, writeFile, } from "node:fs/promises";
5
5
  import { homedir } from "node:os";
6
6
  import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
@@ -100,8 +100,73 @@ async function downloadArtifact(component, directory, fetchImpl, signal) {
100
100
  });
101
101
  await rm(tarball);
102
102
  }
103
+ /**
104
+ * The first path under a package manager's cache this user cannot write, or
105
+ * null. Checks the cache and two levels below it, which covers the usual
106
+ * breakage: a cache created by an earlier `sudo npm`/root container step, so
107
+ * the top directory looks fine while `_cacache/*` is root-owned. A cache that
108
+ * does not exist yet is checked at its nearest existing parent.
109
+ */
110
+ export function findUnwritableCachePath(cacheDir) {
111
+ let probe = cacheDir;
112
+ while (!existsSync(probe)) {
113
+ const parent = dirname(probe);
114
+ if (parent === probe)
115
+ return null;
116
+ probe = parent;
117
+ }
118
+ const visit = (path, depth) => {
119
+ try {
120
+ accessSync(path, fsConstants.W_OK);
121
+ }
122
+ catch {
123
+ return path;
124
+ }
125
+ if (depth === 0)
126
+ return null;
127
+ let children;
128
+ try {
129
+ children = readdirSync(path, { withFileTypes: true })
130
+ .filter((entry) => entry.isDirectory())
131
+ .map((entry) => join(path, entry.name));
132
+ }
133
+ catch {
134
+ return path;
135
+ }
136
+ for (const child of children) {
137
+ const found = visit(child, depth - 1);
138
+ if (found)
139
+ return found;
140
+ }
141
+ return null;
142
+ };
143
+ return visit(probe, probe === cacheDir ? 2 : 0);
144
+ }
145
+ function packageManagerCacheDir(hasBun) {
146
+ const [command, args] = hasBun
147
+ ? ["bun", ["pm", "cache"]]
148
+ : [
149
+ process.platform === "win32" ? "npm.cmd" : "npm",
150
+ ["config", "get", "cache"],
151
+ ];
152
+ const result = spawnSync(command, args, { encoding: "utf8" });
153
+ const dir = result.status === 0 ? result.stdout.trim() : "";
154
+ return dir && isAbsolute(dir) ? dir : null;
155
+ }
156
+ export function unwritableCacheMessage(tool, path) {
157
+ const variable = tool === "bun" ? "BUN_INSTALL_CACHE_DIR" : "npm_config_cache";
158
+ return [
159
+ `Lobu can't install its runtime: the ${tool} cache at ${path} is not writable by this user.`,
160
+ "This usually means an earlier step ran the package manager as root.",
161
+ `Fix the owner (sudo chown -R "$(id -u):$(id -g)" ${path}) or set ${variable} to a writable directory, then run the command again.`,
162
+ ].join("\n");
163
+ }
103
164
  async function installDependencies(directory, signal) {
104
165
  const hasBun = spawnSync("bun", ["--version"], { stdio: "ignore" }).status === 0;
166
+ const cacheDir = packageManagerCacheDir(hasBun);
167
+ const unwritable = cacheDir ? findUnwritableCachePath(cacheDir) : null;
168
+ if (unwritable)
169
+ throw new Error(unwritableCacheMessage(hasBun ? "bun" : "npm", unwritable));
105
170
  if (hasBun)
106
171
  await copyFile(join(directory, "dist/dependencies.bun.lock"), join(directory, "bun.lock"));
107
172
  const command = hasBun
@@ -127,7 +192,7 @@ async function installDependencies(directory, signal) {
127
192
  child.once("error", reject);
128
193
  child.once("exit", (code, killed) => code === 0
129
194
  ? done()
130
- : reject(new Error(`Runtime dependency installation failed (${code ?? killed})`)));
195
+ : reject(new Error(`Runtime dependency installation failed: \`${command} ${args.join(" ")}\` exited with ${code ?? killed}. Its output is above.`)));
131
196
  });
132
197
  }
133
198
  async function makeRelocatable(directory) {
@@ -3,6 +3,17 @@ import { Command } from "commander";
3
3
  import { loginCommand } from "./commands/login.js";
4
4
  import { logoutCommand } from "./commands/logout.js";
5
5
  import { whoamiCommand } from "./commands/whoami.js";
6
+ /**
7
+ * The approval page names the requester from this registration, so Lobu.app's
8
+ * sign-in shows the app the user just clicked instead of "Lobu CLI".
9
+ */
10
+ const MAC_APP_CLIENT_NAME = "Lobu for Mac";
11
+ /**
12
+ * `lobu:` is the URL scheme the Release Lobu.app registers (the only build
13
+ * that bundles this helper). After approval the browser page links back to
14
+ * the app instead of telling the user to return to a terminal.
15
+ */
16
+ const MAC_APP_RETURN_TO = "lobu://";
6
17
  /**
7
18
  * Small, self-contained CLI surface bundled with Owletto.app. The desktop app
8
19
  * needs auth to remain compatible even when a separately installed global CLI
@@ -26,7 +37,12 @@ async function runMacAuthCli(argv = process.argv) {
26
37
  .option("--email <address>", "Email an out-of-band approval link")
27
38
  .option("--wait-for-approval", "Keep polling for browser approval when supervised without a TTY")
28
39
  .action(async (options) => {
29
- await loginCommand({ ...options, cliVersion: version });
40
+ await loginCommand({
41
+ ...options,
42
+ cliVersion: version,
43
+ clientName: MAC_APP_CLIENT_NAME,
44
+ approvalReturnTo: MAC_APP_RETURN_TO,
45
+ });
30
46
  });
31
47
  program
32
48
  .command("logout")
@@ -420,7 +420,7 @@
420
420
  "upstreamBaseUrl": "https://api.openai.com/v1",
421
421
  "apiKeyInstructions": "Get your API key from <a href=\"https://platform.openai.com/api-keys\" target=\"_blank\" class=\"text-blue-600 hover:underline\">OpenAI Dashboard</a>",
422
422
  "apiKeyPlaceholder": "sk-...",
423
- "sdkCompat": "openai",
423
+ "sdkCompat": "openai-responses",
424
424
  "modalities": ["text", "image", "stt", "tts"],
425
425
  "stt": {
426
426
  "enabled": true,
@@ -5,7 +5,7 @@
5
5
  "server": "dist/server.bundle.mjs",
6
6
  "embeddingsServer": "dist/embeddings-server.mjs"
7
7
  },
8
- "version": "21.2.1",
8
+ "version": "22.0.0",
9
9
  "verify": "dist/verify.mjs"
10
10
  },
11
11
  "device": {
@@ -16,7 +16,7 @@
16
16
  "connector": "node_modules/@lobu/cli/dist/commands/connector.js",
17
17
  "worker": "node_modules/@lobu/connector-worker/dist/bin.js"
18
18
  },
19
- "version": "21.2.1",
19
+ "version": "22.0.0",
20
20
  "verify": "dist/verify.mjs"
21
21
  },
22
22
  "postgres": {
@@ -24,7 +24,7 @@
24
24
  "entries": {
25
25
  "postgres": "dist/index.mjs"
26
26
  },
27
- "version": "21.2.1",
27
+ "version": "22.0.0",
28
28
  "verify": "dist/verify.mjs"
29
29
  },
30
30
  "embeddings": {
@@ -32,7 +32,7 @@
32
32
  "entries": {
33
33
  "embeddings": "dist/embeddings.js"
34
34
  },
35
- "version": "21.2.1",
35
+ "version": "22.0.0",
36
36
  "verify": "dist/verify.mjs"
37
37
  }
38
38
  }
@@ -218,9 +218,9 @@ const gh = defineConnection({
218
218
 
219
219
  **Bundled connector keys** — use the exact key; several are dotted (Gmail is
220
220
  `google.gmail`, not `gmail` or `google_gmail`): `github`, `slack`, `linear`, `jira`, `google.gmail`,
221
- `google.calendar`, `google.drive`, `microsoft.outlook`, `discord`, `teams`, `telegram`, `webhook`,
221
+ `google.calendar`, `google.drive`, `microsoft.outlook`, `discord`, `teams`, `telegram`, `tiktok.web`, `webhook`,
222
222
  `whatsapp`, `gchat`, `rss`, `postgres`,
223
- `hackernews`, `market.quotes`, `reddit`, `x`, `youtube`, `producthunt`.
223
+ `hackernews`, `herdr`, `market.quotes`, `reddit`, `x`, `youtube`, `producthunt`, `agentid`.
224
224
 
225
225
  Device connectors are not in that list: they are advertised by the device at
226
226
  poll time and appear after it grants permission. `os.shell` is one of them —
@@ -359,9 +359,16 @@ boolean. Field order, the Automation, and the output name are part of identity,
359
359
  do not key on editable display labels.
360
360
  Event output rows use the standard draft fields: required `content`,
361
361
  plus optional `title`, `metadata`, `author`, `source_url`, `occurred_at`,
362
- `parent_event_id`, `payload_type`, and `idempotency_key`. Use
362
+ `parent_event_id`, `payload_type`, `idempotency_key`, and `entity_ids`. Use
363
363
  `idempotency_key` when the same real-world source must emit at most once across
364
- runs. Omit `triggers` for a manual-only Automation.
364
+ runs. A row's `entity_ids` replace the Automation's bound entities for that
365
+ row, so one run can link each event to its own record; omit it to keep the
366
+ bound linkage. When supplied, the array must contain distinct positive integer
367
+ IDs and cannot be empty. Every id must be an entity in the same workspace that
368
+ the completing identity may write, or completion fails. `entity_ids` are not
369
+ part of an event output `key`, so include the record's id in a metadata key
370
+ field when each record keeps its own current event. Omit `triggers` for a
371
+ manual-only Automation.
365
372
 
366
373
  ### Wire it together
367
374
 
@@ -46,7 +46,7 @@ Declare chat integrations as project-level `defineConnection(...)` entries in `l
46
46
  Worker execution is controlled by:
47
47
 
48
48
  - Install MCP-backed services as connectors so they inherit connection auth, approval, and audit semantics.
49
- - `defineAgent({ tools: { allowed, denied, strict } })` — configure tool visibility. Connector approvals are managed in Settings → Policies.
49
+ - Action permissions and connector approvals are managed in Settings → Policies.
50
50
  - `defineAgent({ nixPackages })` — pulls binaries onto the `PATH` of the sandbox your agent's `bash` runs in. Shell commands execute in a remote sandbox provisioned per turn, not on the gateway host, so they are isolated from the machine running Lobu.
51
51
 
52
52
  ## Learn More