@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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobu/runtime-device",
3
- "version": "21.2.1",
3
+ "version": "22.0.0",
4
4
  "type": "module",
5
5
  "license": "BUSL-1.1",
6
6
  "repository": {
@@ -20,11 +20,21 @@
20
20
  "sharp": "^0.35.3"
21
21
  },
22
22
  "dependencies": {
23
+ "chalk": "^5.3.0",
24
+ "cli-cursor": "^5.0.0",
25
+ "cli-spinners": "^2.9.2",
26
+ "is-interactive": "^2.0.0",
27
+ "is-unicode-supported": "^2.0.0",
28
+ "log-symbols": "^6.0.0",
29
+ "stdin-discarder": "^0.2.2",
30
+ "string-width": "^7.2.0",
31
+ "strip-ansi": "^7.1.0",
23
32
  "@lobu/connector-sdk": "file:vendor/connector-sdk",
24
33
  "postgres": "file:vendor/postgres",
25
34
  "turndown": "7.2.2",
26
35
  "@lobu/cli": "file:vendor/cli",
27
36
  "@lobu/connector-worker": "file:vendor/connector-worker",
28
- "@lobu/core": "file:vendor/core"
37
+ "@lobu/core": "file:vendor/core",
38
+ "ora": "file:vendor/ora"
29
39
  }
30
40
  }
@@ -851,16 +851,15 @@ export async function executePlan(ctx, pendingAuth) {
851
851
  if (connectionId === undefined) {
852
852
  throw new ApiError(`feed "${feed.feedKey}" references connection "${row.connectionSlug}" which has no remote ID — connection create may have failed`);
853
853
  }
854
- const existingConn = remoteConnBySlug.get(row.connectionSlug);
855
- const remoteFeed = existingConn
856
- ? (ctx.remote.feedsByConnectionId.get(existingConn.id) ?? []).find((f) => f.feed_key === feed.feedKey)
857
- : undefined;
858
- if (remoteFeed && row.verb === "update") {
854
+ // Apply the exact identity selected by the plan, never rematch by feed key.
855
+ if (row.verb === "update") {
856
+ if (!row.remote)
857
+ throw new ApiError(`Feed update "${row.id}" has no planned remote target`);
859
858
  // Same rule as connections and Automations: the diff decides what gets
860
859
  // written. An undeclared cadence or config produces no changed-field, so
861
860
  // it never reaches the wire and the server keeps what the feed has. An
862
861
  // explicit `schedule: null` IS a declared change and still clears it.
863
- await ctx.client.updateFeed(remoteFeed.id, buildUpdatePayload(UPDATE_FIELD_TABLES.feed, row.changedFields, feed));
862
+ await ctx.client.updateFeed(row.remote.id, buildUpdatePayload(UPDATE_FIELD_TABLES.feed, row.changedFields, feed));
864
863
  }
865
864
  else {
866
865
  await ctx.client.createFeed({
@@ -89,6 +89,7 @@ export interface RemoteEntityType {
89
89
  organization_id?: string;
90
90
  }
91
91
  export interface RemoteRelationshipType {
92
+ purpose?: string | null;
92
93
  /** Persistent incarnation id (`entity_relationship_types.id`) — the `owned` identity for deletes. */
93
94
  id?: number;
94
95
  slug: string;
@@ -397,7 +397,7 @@ export class ApplyClient {
397
397
  // `properties`/`required`. Fold them into `metadata_schema` so the schema
398
398
  // actually persists (otherwise every apply re-reports a `properties`
399
399
  // update because the stored schema stays empty).
400
- const { slug, name, description, required, properties, eventKinds, backing, metrics, resolutionPolicy, rulesSource, } = entity;
400
+ const { slug, name, description, required, properties, eventKinds, backing, metrics, resolutionPolicy, collection, rulesSource, } = entity;
401
401
  const payload = { slug };
402
402
  if (name !== undefined)
403
403
  payload.name = name;
@@ -406,6 +406,8 @@ export class ApplyClient {
406
406
  if (properties !== undefined ||
407
407
  required !== undefined ||
408
408
  resolutionPolicy !== undefined ||
409
+ collection !== undefined ||
410
+ clearFacets?.has("collection") ||
409
411
  clearFacets?.has("properties") ||
410
412
  clearFacets?.has("required") ||
411
413
  clearFacets?.has("resolutionPolicy")) {
@@ -418,6 +420,9 @@ export class ApplyClient {
418
420
  for (const [key, value] of Object.entries(schemaExtras ?? {})) {
419
421
  if (HOISTED_SCHEMA_KEYS.has(key))
420
422
  continue;
423
+ if (key === "x-lobu-collection" &&
424
+ (collection !== undefined || clearFacets?.has("collection")))
425
+ continue;
421
426
  // The resolution policy is config-owned when declared, and removed under
422
427
  // prune — either way the declared/cleared value wins over out-of-band.
423
428
  if ((resolutionPolicy !== undefined ||
@@ -455,6 +460,9 @@ export class ApplyClient {
455
460
  payload.metadata_schema = {
456
461
  ...extras,
457
462
  ...(resolutionPolicy ?? {}),
463
+ ...(collection !== undefined
464
+ ? { "x-lobu-collection": collection }
465
+ : {}),
458
466
  type: "object",
459
467
  properties: effectiveProperties ?? {},
460
468
  ...(effectiveRequired && effectiveRequired.length > 0
@@ -973,12 +981,23 @@ export class ApplyClient {
973
981
  }
974
982
  // ── Feeds (managed per-connection) ────────────────────────────────────────
975
983
  async listFeeds(connectionId) {
976
- const body = await this.feedsTool({
977
- action: "list_feeds",
978
- connection_id: connectionId,
979
- limit: 500,
980
- });
981
- return body.feeds ?? [];
984
+ const feeds = [];
985
+ // Identity checks must see every page, including duplicates beyond the first.
986
+ for (;;) {
987
+ const body = await this.feedsTool({
988
+ action: "list_feeds",
989
+ connection_id: connectionId,
990
+ limit: 500,
991
+ offset: feeds.length,
992
+ });
993
+ const page = body.feeds ?? [];
994
+ feeds.push(...page);
995
+ if (!body.has_more)
996
+ return feeds;
997
+ if (page.length === 0) {
998
+ throw new ApiError(`Could not list all feeds for connection ${connectionId}: the server returned an empty page with more feeds remaining. Retry apply.`);
999
+ }
1000
+ }
982
1001
  }
983
1002
  async createFeed(payload) {
984
1003
  const body = await this.feedsTool({
@@ -1,6 +1,7 @@
1
1
  import type { ConnectorDefinition, EntityMetrics } from "@lobu/connector-sdk";
2
2
  import type { AgentSettings } from "@lobu/core";
3
3
  import type { AutomationEventTrigger, AutomationScheduleTrigger, AutomationWorkspaceEventTrigger } from "@lobu/core/contracts/tools/manage-automations";
4
+ import type { CollectionPresentation } from "@lobu/core/contracts/tools/collection-presentation";
4
5
  import type { RetainedSource } from "@lobu/core/contracts/tools/source-files";
5
6
  import type { InferenceCapabilityBlock, InferenceModality, Project } from "../../../config/index.js";
6
7
  import { type AutomationSource, type EntityBacking, type RelationshipRule } from "./shared.js";
@@ -15,6 +16,12 @@ export interface DesiredEntityType {
15
16
  description?: string;
16
17
  required?: string[];
17
18
  properties?: Record<string, unknown>;
19
+ /**
20
+ * The `x-lobu-collection` metadata_schema key. Present only when declared;
21
+ * folded into the upserted metadata_schema and diffed against the remote
22
+ * `schemaExtras`, like {@link resolutionPolicy}.
23
+ */
24
+ collection?: CollectionPresentation;
18
25
  /**
19
26
  * Event kinds (semantic types) for events linked to this type, keyed by
20
27
  * semantic_type — `{ description?, metadataSchema?, jsonTemplate? }`. Present
@@ -55,6 +62,7 @@ export interface DesiredEntityType {
55
62
  metrics?: EntityMetrics;
56
63
  }
57
64
  export interface DesiredRelationshipType {
65
+ purpose?: "identity";
58
66
  slug: string;
59
67
  name?: string;
60
68
  description?: string;
@@ -252,7 +260,7 @@ export interface DesiredAgent {
252
260
  /**
253
261
  * Settings payload destined for `PATCH /:agentId/config`. Built by the mapper
254
262
  * + agent-dir loader: networkConfig, skillsConfig,
255
- * guardrails, toolsConfig, nixConfig,
263
+ * guardrails, nixConfig,
256
264
  * models (ordered `<provider>/<model>` refs),
257
265
  * identityMd/soulMd/userMd.
258
266
  */
@@ -270,6 +270,7 @@ export interface EntityTypeFacets {
270
270
  */
271
271
  export declare const effectiveEntityTypeAfterApply: (d: DesiredEntityType, r: RemoteEntityType | undefined, prune: boolean) => EntityTypeFacets;
272
272
  export interface RelationshipTypeFacets {
273
+ purpose: string | undefined;
273
274
  name: string | undefined;
274
275
  description: string | undefined;
275
276
  rules: unknown[];
@@ -233,7 +233,6 @@ const SETTINGS_FIELDS = [
233
233
  "networkConfig",
234
234
  "nixConfig",
235
235
  "skillsConfig",
236
- "toolsConfig",
237
236
  "guardrails",
238
237
  "models",
239
238
  "soulMd",
@@ -339,6 +338,12 @@ function diffEntityType(desired, remote, prune) {
339
338
  return prune && r.schemaExtras?.["x-lobu-resolution"] !== undefined;
340
339
  },
341
340
  },
341
+ {
342
+ name: "collection",
343
+ changed: (d, r) => d.collection !== undefined
344
+ ? !deepEqual(d.collection, r.schemaExtras?.["x-lobu-collection"])
345
+ : prune && r.schemaExtras?.["x-lobu-collection"] !== undefined,
346
+ },
342
347
  {
343
348
  // Write rules — prune-aware, like eventKinds. Compares SOURCE, never the
344
349
  // compiled artifact: the server owns compilation, so a compiler change
@@ -358,6 +363,10 @@ function diffRelationshipType(desired, remote) {
358
363
  desired,
359
364
  remote,
360
365
  fields: [
366
+ {
367
+ name: "purpose",
368
+ changed: (d, r) => d.purpose !== undefined && d.purpose !== r.purpose,
369
+ },
361
370
  { name: "name", changed: (d, r) => stringChanged(d.name, r.name) },
362
371
  {
363
372
  name: "description",
@@ -452,6 +461,12 @@ function compareEntityTypeThreeWay(desired, remote, attribution, prune) {
452
461
  remote: remote.schemaExtras?.["x-lobu-resolution"],
453
462
  attribution: attribution?.schemaExtras?.["x-lobu-resolution"],
454
463
  },
464
+ {
465
+ field: "collection",
466
+ desired: desired.collection,
467
+ remote: remote.schemaExtras?.["x-lobu-collection"],
468
+ attribution: attribution?.schemaExtras?.["x-lobu-collection"],
469
+ },
455
470
  {
456
471
  field: "rules",
457
472
  desired: desired.rulesSource?.sourceCode,
@@ -486,6 +501,7 @@ function compareEntityTypeThreeWay(desired, remote, attribution, prune) {
486
501
  "metrics",
487
502
  "eventKinds",
488
503
  "resolutionPolicy",
504
+ "collection",
489
505
  "rules",
490
506
  ]);
491
507
  return classifyThreeWay(triples.filter((t) => {
@@ -505,6 +521,12 @@ function compareEntityTypeThreeWay(desired, remote, attribution, prune) {
505
521
  function compareRelationshipTypeThreeWay(desired, remote, attribution) {
506
522
  // name/description are unmanaged when omitted (upsert never clears them).
507
523
  const triples = [
524
+ {
525
+ field: "purpose",
526
+ desired: desired.purpose,
527
+ remote: remote.purpose ?? undefined,
528
+ attribution: attribution?.purpose ?? undefined,
529
+ },
508
530
  {
509
531
  field: "name",
510
532
  desired: desired.name,
@@ -525,7 +547,9 @@ function compareRelationshipTypeThreeWay(desired, remote, attribution) {
525
547
  },
526
548
  ];
527
549
  return classifyThreeWay(triples.filter((t) => t.desired !== undefined ||
528
- (t.field !== "name" && t.field !== "description")));
550
+ (t.field !== "name" &&
551
+ t.field !== "description" &&
552
+ t.field !== "purpose")));
529
553
  }
530
554
  /**
531
555
  * A declared definition against a baseline: the three-way compare. Emits the
@@ -726,6 +750,8 @@ export const effectiveEntityTypeAfterApply = (d, r, prune) => {
726
750
  // policy always overlays (config wins).
727
751
  const schemaExtras = {};
728
752
  for (const [key, value] of Object.entries(r?.schemaExtras ?? {})) {
753
+ if (prune && key === "x-lobu-collection" && d.collection === undefined)
754
+ continue;
729
755
  if (prune &&
730
756
  key === "x-lobu-resolution" &&
731
757
  d.resolutionPolicy === undefined)
@@ -734,6 +760,8 @@ export const effectiveEntityTypeAfterApply = (d, r, prune) => {
734
760
  }
735
761
  if (d.resolutionPolicy)
736
762
  Object.assign(schemaExtras, d.resolutionPolicy);
763
+ if (d.collection !== undefined)
764
+ schemaExtras["x-lobu-collection"] = d.collection;
737
765
  const inherit = (declared, live) => declared !== undefined ? declared : prune ? undefined : live;
738
766
  // Declared keys win; outside prune the remote-only keys survive the rebuild.
739
767
  const declaredProperties = d.properties;
@@ -759,6 +787,7 @@ export const effectiveEntityTypeAfterApply = (d, r, prune) => {
759
787
  };
760
788
  /** The live remote relationship type, in the comparable facet shape. */
761
789
  const remoteRelationshipTypeFacets = (r) => ({
790
+ purpose: r.purpose ?? undefined,
762
791
  name: r.name,
763
792
  description: r.description,
764
793
  rules: r.rules ?? [],
@@ -769,6 +798,7 @@ const remoteRelationshipTypeFacets = (r) => ({
769
798
  * `rules` ARE cleared — `upsertRelationshipType` writes `[]`.
770
799
  */
771
800
  export const effectiveRelationshipTypeAfterApply = (d, r) => ({
801
+ purpose: d.purpose ?? r?.purpose ?? undefined,
772
802
  name: d.name !== undefined ? d.name : r?.name,
773
803
  description: d.description !== undefined ? d.description : r?.description,
774
804
  rules: d.rules ?? [],
@@ -1532,10 +1562,22 @@ export function computeDiff(desired, remote, opts = {}) {
1532
1562
  const remoteFeeds = remoteConn
1533
1563
  ? [...(remoteFeedsByConnectionId.get(remoteConn.id) ?? [])].sort((a, b) => a.feed_key.localeCompare(b.feed_key))
1534
1564
  : [];
1535
- const remoteFeedByKey = new Map(remoteFeeds.map((f) => [f.feed_key, f]));
1565
+ const remoteFeedsByKey = new Map();
1566
+ for (const feed of remoteFeeds) {
1567
+ const matches = remoteFeedsByKey.get(feed.feed_key) ?? [];
1568
+ matches.push(feed);
1569
+ remoteFeedsByKey.set(feed.feed_key, matches);
1570
+ }
1536
1571
  const desiredFeedKeys = new Set(conn.feeds.map((f) => f.feedKey));
1537
1572
  for (const feed of conn.feeds) {
1538
- rows.push(diffFeed(conn.slug, feed, remoteFeedByKey.get(feed.feedKey)));
1573
+ const matches = remoteFeedsByKey.get(feed.feedKey) ?? [];
1574
+ if (matches.length > 1) {
1575
+ throw new ValidationError(`Multiple feeds with key "${feed.feedKey}" exist on connection "${conn.slug}" (IDs: ${matches
1576
+ .map((match) => match.id)
1577
+ .sort((a, b) => a - b)
1578
+ .join(", ")}). Manage these feeds individually in Connectors or remove duplicates before applying this feed. Omitting the feed from config leaves its settings unchanged.`);
1579
+ }
1580
+ rows.push(diffFeed(conn.slug, feed, matches[0]));
1539
1581
  }
1540
1582
  for (const remoteFeed of remoteFeeds) {
1541
1583
  if (!desiredFeedKeys.has(remoteFeed.feed_key)) {
@@ -9,7 +9,9 @@
9
9
  */
10
10
  import { validateEntityMetrics } from "@lobu/connector-sdk/metrics";
11
11
  import { isChatPlatform, normalizeEntityTypeSlug, } from "@lobu/core";
12
+ import { parseCollectionPresentation } from "@lobu/core/contracts/tools/collection-presentation";
12
13
  import { normalizeWorkspaceEventTrigger, resolvedEventExecution, } from "@lobu/core/contracts/tools/manage-automations";
14
+ import { InvalidEntityResolutionPolicyError, parseEntityResolutionPolicy, } from "@lobu/core/contracts/tools/manage-entity-schema";
13
15
  /**
14
16
  * Marker for each stored field's declarative status. Also exhaustive over the
15
17
  * same key set, so a new field with no policy entry also fails to compile.
@@ -25,7 +27,6 @@ const AGENT_SETTINGS_FIELD_POLICY = {
25
27
  userMd: "post-load",
26
28
  identityMd: "post-load",
27
29
  skillsConfig: "post-load",
28
- toolsConfig: "mapped",
29
30
  guardrails: "mapped",
30
31
  guardrailsInline: "unsupported",
31
32
  sandboxId: "unsupported",
@@ -224,19 +225,6 @@ function mapAgent(agent, env, required) {
224
225
  ...(denied.length > 0 ? { deniedDomains: [...new Set(denied)] } : {}),
225
226
  };
226
227
  }
227
- if (agent.tools) {
228
- const toolsConfig = {};
229
- if (agent.tools.allowed?.length) {
230
- toolsConfig.allowedTools = [...new Set(agent.tools.allowed)];
231
- }
232
- if (agent.tools.denied?.length) {
233
- toolsConfig.deniedTools = [...new Set(agent.tools.denied)];
234
- }
235
- if (agent.tools.strict !== undefined)
236
- toolsConfig.strictMode = agent.tools.strict;
237
- if (Object.keys(toolsConfig).length > 0)
238
- settings.toolsConfig = toolsConfig;
239
- }
240
228
  if (agent.guardrails?.length) {
241
229
  settings.guardrails = [...new Set(agent.guardrails)];
242
230
  }
@@ -289,7 +277,6 @@ function mapAgent(agent, env, required) {
289
277
  userMd: settings.userMd,
290
278
  identityMd: settings.identityMd,
291
279
  skillsConfig: settings.skillsConfig,
292
- toolsConfig: settings.toolsConfig,
293
280
  guardrails: settings.guardrails,
294
281
  guardrailsInline: settings.guardrailsInline,
295
282
  sandboxId: settings.sandboxId,
@@ -325,29 +312,15 @@ function mapEntityType(entity) {
325
312
  throw new ValidationError(`entity type "${entity.key}" has invalid metrics: ${errors.join("; ")}`);
326
313
  }
327
314
  }
328
- // Fail loud on malformed resolution rules: the server drops invalid rules,
329
- // which can silently disable the intended matching policy.
330
- if (entity.resolutionPolicy) {
331
- if (!Array.isArray(entity.resolutionPolicy.rules)) {
332
- throw new ValidationError(`entity type "${entity.key}" has invalid resolutionPolicy: expected rules to be an array`);
315
+ // Share the server's complete-policy validation; never weaken composite keys.
316
+ if (entity.resolutionPolicy !== undefined) {
317
+ try {
318
+ parseEntityResolutionPolicy(entity.resolutionPolicy);
333
319
  }
334
- const ruleErrors = entity.resolutionPolicy.rules.flatMap((rule, index) => {
335
- const fields = Array.isArray(rule.fields) &&
336
- rule.fields.every((f) => typeof f === "string" && f.trim())
337
- ? rule.fields
338
- : null;
339
- const normalizerOk = rule.normalizer === "email" ||
340
- rule.normalizer === "phone" ||
341
- rule.normalizer === "exact";
342
- const onMatchOk = rule.onMatch === "auto_merge" || rule.onMatch === "review";
343
- if (fields && fields.length > 0 && normalizerOk && onMatchOk)
344
- return [];
345
- return [
346
- `rule ${index}: expected { fields: string[], normalizer: "email"|"phone"|"exact", onMatch: "auto_merge"|"review" }`,
347
- ];
348
- });
349
- if (ruleErrors.length > 0) {
350
- throw new ValidationError(`entity type "${entity.key}" has invalid resolutionPolicy: ${ruleErrors.join("; ")}`);
320
+ catch (error) {
321
+ if (!(error instanceof InvalidEntityResolutionPolicyError))
322
+ throw error;
323
+ throw new ValidationError(`entity type "${entity.key}" has invalid resolutionPolicy: ${error.message}`);
351
324
  }
352
325
  }
353
326
  return {
@@ -356,6 +329,9 @@ function mapEntityType(entity) {
356
329
  ...(entity.description ? { description: entity.description } : {}),
357
330
  ...(entity.required ? { required: entity.required } : {}),
358
331
  ...(entity.properties ? { properties: entity.properties } : {}),
332
+ ...(entity.collection !== undefined
333
+ ? { collection: parseCollectionPresentation(entity.collection) }
334
+ : {}),
359
335
  // Event kinds included only when declared so a type with none compares equal
360
336
  // on both sides and never churns the diff (mirrors `backing`/`metrics`).
361
337
  ...(entity.eventKinds && Object.keys(entity.eventKinds).length > 0
@@ -394,6 +370,7 @@ function mapEntityType(entity) {
394
370
  function mapRelationshipType(rel) {
395
371
  return {
396
372
  slug: rel.key,
373
+ ...(rel.purpose ? { purpose: rel.purpose } : {}),
397
374
  ...(rel.name ? { name: rel.name } : {}),
398
375
  ...(rel.description ? { description: rel.description } : {}),
399
376
  ...(rel.rules
@@ -418,7 +395,10 @@ function mapAutomationOutputs(outputs) {
418
395
  key: output.key,
419
396
  ...(output.name ? { name: output.name } : {}),
420
397
  }
421
- : { event: output.event },
398
+ : {
399
+ event: output.event,
400
+ ...(output.key ? { key: output.key } : {}),
401
+ },
422
402
  ]));
423
403
  }
424
404
  /** Max skills an Automation may pin on one version (issue #2320 cap). */
@@ -266,23 +266,6 @@ function emitAgent(agent, settings, imports, secrets, minter) {
266
266
  fields.push(`network: ${objectLiteral(netFields, 1)}`);
267
267
  }
268
268
  }
269
- // tools ← toolsConfig.
270
- const tools = settings?.toolsConfig;
271
- if (tools?.allowedTools?.length ||
272
- tools?.deniedTools?.length ||
273
- tools?.strictMode !== undefined) {
274
- const toolFields = [];
275
- if (tools?.allowedTools?.length) {
276
- toolFields.push(`allowed: ${emitValue(tools.allowedTools, 2)}`);
277
- }
278
- if (tools?.deniedTools?.length) {
279
- toolFields.push(`denied: ${emitValue(tools.deniedTools, 2)}`);
280
- }
281
- if (tools?.strictMode !== undefined) {
282
- toolFields.push(`strict: ${tools.strictMode}`);
283
- }
284
- fields.push(`tools: ${objectLiteral(toolFields, 1)}`);
285
- }
286
269
  // guardrails ← guardrails[].
287
270
  if (settings?.guardrails?.length) {
288
271
  fields.push(`guardrails: ${emitValue(settings.guardrails, 1)}`);
@@ -355,6 +338,9 @@ function emitEntityType(e, imports, minter) {
355
338
  if (e.properties && Object.keys(e.properties).length > 0) {
356
339
  fields.push(`properties: ${emitValue(e.properties, 1)}`);
357
340
  }
341
+ if (e.schemaExtras?.["x-lobu-collection"]) {
342
+ fields.push(`collection: ${emitValue(e.schemaExtras["x-lobu-collection"], 1)}`);
343
+ }
358
344
  // Declared metrics round-trip as the four top-level fields on defineEntityType
359
345
  // (not nested under `metrics`). Without this, `init --from-org` → `apply` would
360
346
  // diff metrics as a change and wipe them. (NOTE: `backing` has the same
@@ -380,6 +366,8 @@ function emitEntityType(e, imports, minter) {
380
366
  function emitRelationshipType(r, entityHandles, imports, minter) {
381
367
  imports.use("defineRelationshipType");
382
368
  const fields = [`key: ${str(r.slug)}`];
369
+ if (r.purpose === "identity")
370
+ fields.push(`purpose: "identity"`);
383
371
  if (r.name)
384
372
  fields.push(`name: ${str(r.name)}`);
385
373
  if (r.description)
@@ -9,8 +9,6 @@ export interface InitOptions {
9
9
  memory?: string;
10
10
  memoryUrl?: string;
11
11
  otelEndpoint?: string;
12
- sentry?: boolean;
13
- noSentry?: boolean;
14
12
  hostedSlack?: boolean;
15
13
  listProviders?: boolean;
16
14
  /** Scaffold files without installing project dependencies. */
@@ -467,33 +467,6 @@ export async function initCommand(cwd = process.cwd(), projectNameArg, options =
467
467
  value: otelEndpoint,
468
468
  });
469
469
  }
470
- let enableSentry = false;
471
- if (options.sentry === true) {
472
- enableSentry = true;
473
- }
474
- else if (options.noSentry === true) {
475
- enableSentry = false;
476
- }
477
- else if (!useDefaults) {
478
- enableSentry = await confirm({
479
- message: "Share anonymous error reports with Sentry to help improve Lobu?",
480
- default: false,
481
- });
482
- }
483
- if (enableSentry) {
484
- envSecrets.push({
485
- envVar: "SENTRY_DSN",
486
- value: "https://63abd848f1338116c41d4a8a29091c7c@o4511547660042240.ingest.us.sentry.io/4511547664171008",
487
- });
488
- // The shared community DSN reports into the same Sentry project as the
489
- // hosted deployment, and instrument.ts defaults environment to
490
- // "production" — tag self-hosted installs so their errors are filterable
491
- // and never read as hosted-prod incidents.
492
- envSecrets.push({
493
- envVar: "ENVIRONMENT",
494
- value: "self-host",
495
- });
496
- }
497
470
  let allowedDomains;
498
471
  let disallowedDomains;
499
472
  if (networkPolicy === "open") {
@@ -4,6 +4,17 @@ interface LoginOptions {
4
4
  force?: boolean;
5
5
  /** Forwarded to RFC 7591 dynamic client registration as `software_version`. */
6
6
  cliVersion?: string;
7
+ /**
8
+ * RFC 7591 `client_name` the approval page shows the user. Defaults to the
9
+ * terminal CLI; the helper bundled in Lobu.app passes its own name.
10
+ */
11
+ clientName?: string;
12
+ /**
13
+ * Native deep link the browser approval page sends the user back to once
14
+ * the code is approved (the web page's `return_to`). Absent for the terminal
15
+ * CLI, whose approval page tells the user to return to their terminal.
16
+ */
17
+ approvalReturnTo?: string;
7
18
  /** Suppress spinner output; bail out non-interactively if the server rejects polling. */
8
19
  quiet?: boolean;
9
20
  /**
@@ -20,6 +31,12 @@ interface LoginOptions {
20
31
  */
21
32
  email?: string;
22
33
  }
34
+ /**
35
+ * A device code is single-use and short-lived, and the approval page answers
36
+ * "Invalid or expired" both for an expired code and for one already used, so
37
+ * say up front when this one stops working and what to do after that.
38
+ */
39
+ export declare function codeExpiryLine(deadline: number, now?: number): string;
23
40
  /**
24
41
  * `lobu login` runs the OAuth 2.0 device-code grant against the issuer
25
42
  * advertised at `<apiUrl-origin>/.well-known/oauth-authorization-server`.
@@ -2,15 +2,38 @@ import chalk from "chalk";
2
2
  import open from "open";
3
3
  import ora from "ora";
4
4
  import { clearCredentials, loadCredentials, resolveContext, saveCredentials, } from "../internal/index.js";
5
- import { bumpInterval, DEVICE_CODE_GRANT_TYPE, discoverOAuth, fetchUserInfo, OAuthError, pollDeviceToken, registerClient, revokeToken, startDeviceAuthorization, } from "../internal/oauth.js";
5
+ import { bumpInterval, DEVICE_CODE_GRANT_TYPE, discoverOAuth, fetchUserInfo, LOBU_CLI_CLIENT_NAME, OAuthError, pollDeviceToken, registerClient, revokeToken, startDeviceAuthorization, } from "../internal/oauth.js";
6
+ function withApprovalReturnTo(url, returnTo) {
7
+ if (!returnTo)
8
+ return url;
9
+ try {
10
+ const parsed = new URL(url);
11
+ parsed.searchParams.set("return_to", returnTo);
12
+ return parsed.toString();
13
+ }
14
+ catch {
15
+ return url;
16
+ }
17
+ }
6
18
  /**
7
- * Hard ceiling on the polling loop. RFC 8628 servers typically return
8
- * `expires_in: 600` (10 min), but if the server hands us a much longer
9
- * deadline we still don't want to hammer `/oauth/token` for an hour from
10
- * a backgrounded shell. 5 minutes matches the documented device-code
11
- * expiry and is generous for a human to scan a QR + approve.
19
+ * Bound background polling while allowing Lobu's full 15-minute device-code
20
+ * lifetime. A shorter server-advertised expiry still takes precedence.
21
+ * Stopping earlier can lose a browser approval while its code is still valid.
12
22
  */
13
- const POLL_HARD_TIMEOUT_MS = 5 * 60 * 1000;
23
+ const POLL_HARD_TIMEOUT_MS = 15 * 60 * 1000;
24
+ /**
25
+ * A device code is single-use and short-lived, and the approval page answers
26
+ * "Invalid or expired" both for an expired code and for one already used, so
27
+ * say up front when this one stops working and what to do after that.
28
+ */
29
+ export function codeExpiryLine(deadline, now = Date.now()) {
30
+ const minutes = Math.max(1, Math.round((deadline - now) / 60_000));
31
+ const at = new Date(deadline).toLocaleTimeString([], {
32
+ hour: "2-digit",
33
+ minute: "2-digit",
34
+ });
35
+ return ` This code works once and expires in ${minutes} min (at ${at}). After that, run \`lobu login\` again for a new one.`;
36
+ }
14
37
  /**
15
38
  * `lobu login` runs the OAuth 2.0 device-code grant against the issuer
16
39
  * advertised at `<apiUrl-origin>/.well-known/oauth-authorization-server`.
@@ -62,7 +85,7 @@ export async function loginCommand(options) {
62
85
  }
63
86
  console.log(chalk.dim(`\n Context: ${target.name}`));
64
87
  console.log(chalk.dim(` Issuer: ${discovery.issuer}`));
65
- const client = await tryOAuthStep(() => registerClient(registrationEndpoint, options.cliVersion ?? "unknown"));
88
+ const client = await tryOAuthStep(() => registerClient(registrationEndpoint, options.cliVersion ?? "unknown", options.clientName ?? LOBU_CLI_CLIENT_NAME));
66
89
  if (!client)
67
90
  return;
68
91
  const authorization = await tryOAuthStep(() => startDeviceAuthorization(deviceAuthorizationEndpoint, client));
@@ -72,6 +95,12 @@ export async function loginCommand(options) {
72
95
  // for a human at this terminal, ask the server to email an approval link to
73
96
  // `--email`. Approval happens out of band, so we then poll regardless of TTY.
74
97
  const emailClaim = Boolean(options.email);
98
+ // Cap the wait at the server-advertised lifetime AND our local ceiling.
99
+ // The local ceiling guards against a misconfigured issuer handing us an
100
+ // hour-long deadline that a backgrounded shell would otherwise honour.
101
+ const serverDeadline = Date.now() + authorization.expiresIn * 1000;
102
+ const localDeadline = Date.now() + POLL_HARD_TIMEOUT_MS;
103
+ const deadline = Math.min(serverDeadline, localDeadline);
75
104
  if (emailClaim) {
76
105
  const verificationUrl = authorization.verificationUriComplete ?? authorization.verificationUri;
77
106
  // Support was already verified above, before client/device-code creation.
@@ -87,13 +116,15 @@ export async function loginCommand(options) {
87
116
  console.log(chalk.dim(`\n Sent a confirmation link to ${chalk.white(options.email)}.`));
88
117
  console.log(chalk.dim(` Code: ${chalk.bold.white(authorization.userCode)}`));
89
118
  console.log(chalk.dim(` Fallback approval URL: ${verificationUrl}`));
119
+ console.log(chalk.dim(codeExpiryLine(deadline)));
90
120
  console.log(chalk.dim(" Waiting for the user to approve from their email...\n"));
91
121
  }
92
122
  else {
93
- const verificationUrl = authorization.verificationUriComplete ?? authorization.verificationUri;
123
+ const verificationUrl = withApprovalReturnTo(authorization.verificationUriComplete ?? authorization.verificationUri, options.approvalReturnTo);
94
124
  console.log(chalk.dim("\n Open this URL to approve the login:"));
95
125
  console.log(chalk.cyan(` ${verificationUrl}`));
96
126
  console.log(chalk.dim(` Code: ${chalk.bold.white(authorization.userCode)}`));
127
+ console.log(chalk.dim(codeExpiryLine(deadline)));
97
128
  if (authorization.verificationUriComplete &&
98
129
  authorization.verificationUriComplete !== authorization.verificationUri) {
99
130
  console.log(chalk.dim(` Or visit: ${authorization.verificationUri}\n`));
@@ -132,12 +163,6 @@ export async function loginCommand(options) {
132
163
  const spinner = isInteractive
133
164
  ? ora("Waiting for authorization...").start()
134
165
  : null;
135
- // Cap the wait at the server-advertised lifetime AND our local ceiling.
136
- // The local ceiling guards against a misconfigured issuer handing us an
137
- // hour-long deadline that a backgrounded shell would otherwise honour.
138
- const serverDeadline = Date.now() + authorization.expiresIn * 1000;
139
- const localDeadline = Date.now() + POLL_HARD_TIMEOUT_MS;
140
- const deadline = Math.min(serverDeadline, localDeadline);
141
166
  // If the user kills the spawning shell (SIGHUP) or any supervisor sends
142
167
  // SIGTERM, exit promptly instead of inheriting the orphaned poll loop.
143
168
  // The abortable sleep below wakes immediately when `signal` is set, so we
@@ -233,8 +258,9 @@ export async function loginCommand(options) {
233
258
  return;
234
259
  }
235
260
  spinner?.fail("Login request expired. Run `lobu login` again.");
236
- if (!spinner)
237
- console.log(chalk.red(" Login request expired."));
261
+ if (!spinner) {
262
+ console.log(chalk.red(" Login request expired. Run `lobu login` again."));
263
+ }
238
264
  console.log();
239
265
  process.exitCode = 1;
240
266
  }