@lobu/runtime-device 22.0.0 → 24.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 (115) hide show
  1. package/dist/component.json +1 -1
  2. package/dist/dependencies.bun.lock +33 -30
  3. package/npm-shrinkwrap.json +140 -124
  4. package/package.json +2 -1
  5. package/vendor/cli/dist/bundled-skills/lobu/SKILL.md +74 -1
  6. package/vendor/cli/dist/commands/_lib/apply/apply-cmd.js +9 -11
  7. package/vendor/cli/dist/commands/_lib/apply/client.d.ts +3 -11
  8. package/vendor/cli/dist/commands/_lib/apply/client.js +3 -3
  9. package/vendor/cli/dist/commands/_lib/apply/desired-state.d.ts +0 -6
  10. package/vendor/cli/dist/commands/_lib/apply/desired-state.js +6 -15
  11. package/vendor/cli/dist/commands/_lib/apply/diff.js +1 -0
  12. package/vendor/cli/dist/commands/_lib/apply/map-config.js +8 -0
  13. package/vendor/cli/dist/commands/_lib/view-bundler.d.ts +2 -9
  14. package/vendor/cli/dist/commands/_lib/view-bundler.js +25 -97
  15. package/vendor/cli/dist/config/define.d.ts +8 -0
  16. package/vendor/cli/dist/connectors/README.md +15 -2
  17. package/vendor/cli/dist/connectors/google_gmail.ts +1 -0
  18. package/vendor/cli/dist/connectors/jira-helpers.ts +313 -0
  19. package/vendor/cli/dist/connectors/jira.ts +29 -221
  20. package/vendor/cli/dist/connectors/linkedin-browser-script.ts +13 -0
  21. package/vendor/cli/dist/connectors/linkedin-draft-page.js +104 -0
  22. package/vendor/cli/dist/connectors/linkedin-drafts.ts +73 -0
  23. package/vendor/cli/dist/connectors/linkedin-identity.ts +32 -0
  24. package/vendor/cli/dist/connectors/linkedin-inbox-adapter.js +1182 -0
  25. package/vendor/cli/dist/connectors/linkedin-inbox.ts +156 -0
  26. package/vendor/cli/dist/connectors/linkedin-like.ts +114 -0
  27. package/vendor/cli/dist/connectors/linkedin-takeout.ts +577 -0
  28. package/vendor/cli/dist/connectors/linkedin.ts +4017 -0
  29. package/vendor/cli/dist/connectors/reddit.ts +92 -20
  30. package/vendor/cli/dist/connectors/slack.ts +1 -0
  31. package/vendor/cli/dist/connectors/takeout-utils.ts +240 -0
  32. package/vendor/cli/dist/connectors/tiktok-inbox-page.js +9 -9
  33. package/vendor/cli/dist/connectors/tiktok-web-page.js +21 -15
  34. package/vendor/cli/dist/connectors/tiktok_web.ts +63 -30
  35. package/vendor/cli/dist/connectors/whatsapp-web-adapter.js +104 -574
  36. package/vendor/cli/dist/connectors/whatsapp-web-helpers.ts +30 -444
  37. package/vendor/cli/dist/connectors/whatsapp-web-identity.ts +20 -6
  38. package/vendor/cli/dist/connectors/whatsapp_web.ts +46 -646
  39. package/vendor/cli/dist/connectors/x-dm-adapter.js +556 -0
  40. package/vendor/cli/dist/connectors/x-identity.ts +33 -2
  41. package/vendor/cli/dist/connectors/x.ts +266 -120
  42. package/vendor/cli/dist/runtime-components.json +4 -4
  43. package/vendor/cli/dist/templates/AGENTS.md.tmpl +12 -5
  44. package/vendor/cli/package.json +1 -1
  45. package/vendor/connector-sdk/dist/browser-handoff-banner.d.ts +39 -0
  46. package/vendor/connector-sdk/dist/browser-handoff-banner.js +175 -0
  47. package/vendor/connector-sdk/dist/browser-source-read.d.ts +52 -0
  48. package/vendor/connector-sdk/dist/browser-source-read.js +107 -0
  49. package/vendor/connector-sdk/dist/connector-types.d.ts +10 -0
  50. package/vendor/connector-sdk/dist/index.d.ts +3 -0
  51. package/vendor/connector-sdk/dist/index.js +2 -0
  52. package/vendor/connector-sdk/package.json +9 -1
  53. package/vendor/connector-worker/dist/agent-turn/gateway-tools.d.ts +2 -2
  54. package/vendor/connector-worker/dist/agent-turn/gateway-tools.js +2 -2
  55. package/vendor/connector-worker/dist/agent-turn/guest-entry.js +49 -8
  56. package/vendor/connector-worker/dist/agent-turn/guest.bundle.js +650 -448
  57. package/vendor/connector-worker/dist/agent-turn/native-session.d.ts +12 -0
  58. package/vendor/connector-worker/dist/agent-turn/native-session.js +32 -6
  59. package/vendor/connector-worker/dist/agent-turn/types.d.ts +24 -3
  60. package/vendor/connector-worker/dist/daemon/agent-turn.js +5 -1
  61. package/vendor/connector-worker/dist/daemon/automation.d.ts +4 -11
  62. package/vendor/connector-worker/dist/daemon/automation.js +26 -21
  63. package/vendor/connector-worker/dist/daemon/client.d.ts +2 -4
  64. package/vendor/connector-worker/dist/daemon/client.js +0 -3
  65. package/vendor/connector-worker/dist/daemon/executor.js +0 -3
  66. package/vendor/connector-worker/dist/daemon/mac-device-daemon.d.ts +4 -3
  67. package/vendor/connector-worker/dist/daemon/mac-device-daemon.js +4 -10
  68. package/vendor/connector-worker/dist/daemon/native-bridge/executor.js +27 -25
  69. package/vendor/connector-worker/dist/daemon/start.js +3 -15
  70. package/vendor/connector-worker/dist/daemon/terminal-failure.js +0 -11
  71. package/vendor/connector-worker/dist/daemon/worker-id.d.ts +17 -0
  72. package/vendor/connector-worker/dist/daemon/worker-id.js +22 -0
  73. package/vendor/connector-worker/dist/isolate/prelude.js +93 -44
  74. package/vendor/connector-worker/dist/mac-device-daemon.js +14 -26
  75. package/vendor/connector-worker/package.json +1 -1
  76. package/vendor/core/dist/agent-policy.js +0 -3
  77. package/vendor/core/dist/agent-tooling.d.ts +1 -1
  78. package/vendor/core/dist/agent-tooling.js +3 -1
  79. package/vendor/core/dist/capabilities.d.ts +1 -1
  80. package/vendor/core/dist/capabilities.js +0 -1
  81. package/vendor/core/dist/connector-query-errors.d.ts +32 -0
  82. package/vendor/core/dist/connector-query-errors.js +41 -1
  83. package/vendor/core/dist/contracts/agent-settings.d.ts +6 -2
  84. package/vendor/core/dist/contracts/agent-settings.js +12 -1
  85. package/vendor/core/dist/contracts/tools/manage-conversations.js +2 -2
  86. package/vendor/core/dist/contracts/tools/manage-feeds.d.ts +14 -0
  87. package/vendor/core/dist/contracts/tools/manage-feeds.js +17 -0
  88. package/vendor/core/dist/contracts/tools/manage-views.d.ts +53 -234
  89. package/vendor/core/dist/contracts/tools/manage-views.js +50 -76
  90. package/vendor/core/dist/contracts/tools/view-attach.d.ts +5 -8
  91. package/vendor/core/dist/contracts/tools/view-attach.js +14 -31
  92. package/vendor/core/dist/contracts/tools/view-definition.d.ts +21 -0
  93. package/vendor/core/dist/contracts/tools/view-definition.js +165 -0
  94. package/vendor/core/dist/contracts/worker/protocol.d.ts +47 -133
  95. package/vendor/core/dist/contracts/worker/protocol.js +33 -62
  96. package/vendor/core/dist/device-pin-tombstones.d.ts +44 -0
  97. package/vendor/core/dist/device-pin-tombstones.js +57 -0
  98. package/vendor/core/dist/index.d.ts +3 -2
  99. package/vendor/core/dist/index.js +3 -1
  100. package/vendor/core/dist/logger.js +10 -25
  101. package/vendor/core/dist/suggestions.d.ts +15 -2
  102. package/vendor/core/dist/suggestions.js +48 -3
  103. package/vendor/core/dist/types.d.ts +26 -0
  104. package/vendor/core/dist/types.js +5 -0
  105. package/vendor/core/dist/utils/diagnostic-scrubber.js +258 -21
  106. package/vendor/core/dist/worker/wire.d.ts +0 -10
  107. package/vendor/core/package.json +16 -10
  108. package/vendor/postgres/cf/src/connection.js +18 -0
  109. package/vendor/postgres/cjs/src/connection.js +18 -0
  110. package/vendor/postgres/src/connection.js +18 -0
  111. package/vendor/connector-worker/dist/daemon/device-chat.d.ts +0 -9
  112. package/vendor/connector-worker/dist/daemon/device-chat.js +0 -61
  113. package/vendor/core/dist/contracts/worker/device-chat.d.ts +0 -4
  114. package/vendor/core/dist/contracts/worker/device-chat.js +0 -26
  115. /package/vendor/postgres/{.bun-tag-f39dafdb2305d504 → .bun-tag-2f292c6554a8475e} +0 -0
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * Single source of truth for the device/connector-worker job protocol:
6
6
  * `POST /api/workers/poll`, `/api/workers/complete`, `/complete-action`,
7
- * `/complete-embeddings`, `/complete-automation`, `/complete-chat`,
7
+ * `/complete-embeddings`, `/complete-automation`, `/complete-agent-turn`,
8
8
  * `/emit-auth-artifact`, `/poll-auth-signal`, `/stream`, and the chrome-action
9
9
  * dispatch.
10
10
  *
@@ -26,10 +26,10 @@
26
26
  * not change that boundary, it only types what already crosses it.
27
27
  */
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.ExecuteConnectorOperationRequestSchema = exports.HeartbeatRequestSchema = exports.AGENT_TURN_BRIDGE_BYTES = exports.TURN_DELTA_MAX_CHARS = exports.PollAuthSignalResponseSchema = exports.PollAuthSignalRequestSchema = exports.EmitAuthArtifactRequestSchema = exports.CompleteAgentTurnResponseSchema = exports.CompleteAgentTurnRequestSchema = exports.AGENT_TURN_INPUT_MAX = exports.TURN_TOOL_EVENT_QUEUE_MAX = exports.TurnToolEventSchema = exports.TURN_TOOL_OUTPUT_MAX_CHARS = exports.CompleteDeviceChatResponseSchema = exports.CompleteDeviceChatRequestSchema = exports.CompleteAutomationResponseSchema = exports.CompleteAutomationRequestSchema = exports.CompleteAuthRequestSchema = exports.CompleteEmbeddingsRequestSchema = exports.EmbeddingEntrySchema = exports.EmbedEventSchema = exports.CompleteActionRequestSchema = exports.CompleteRequestSchema = exports.StreamBatchSchema = exports.ContentItemSchema = exports.ActivatePageResponseSchema = exports.ActivatePageRequestSchema = exports.PollResponseSchema = exports.FeedSourceAckSchema = exports.AgentTurnPollPayloadSchema = exports.DeviceChatPollPayloadSchema = exports.DEVICE_CHAT_MAX_CONTEXT_LENGTH = exports.DeviceChatHistoryMessageSchema = exports.AutomationPollPayloadSchema = exports.AutomationPollContextSchema = exports.AutomationPollEventSchema = exports.AutomationPollMetaSchema = exports.AutomationExecutionConfigSchema = exports.PollRequestSchema = exports.WORKER_POLL_MAX_WAIT_SECONDS = exports.FeedNotificationSchema = exports.EXECUTION_BACKENDS = exports.OAuthCredentialsSchema = exports.WorkerExitDiagnosticsSchema = exports.WorkerExitReasonSchema = exports.RunTypeSchema = exports.ConnectorHttpRequestSchema = exports.SourceAttributionSchema = exports.CONNECTOR_HTTP_MAX_BYTES = exports.CONNECTOR_HTTP_AUTH_CAPABILITY = void 0;
30
- exports.HeartbeatResponseSchema = exports.DispatchChromeActionResponseSchema = exports.DispatchChromeActionRequestSchema = void 0;
29
+ exports.HeartbeatResponseSchema = exports.DispatchChromeActionResponseSchema = exports.DispatchChromeActionRequestSchema = exports.ExecuteConnectorOperationRequestSchema = exports.HeartbeatRequestSchema = exports.AGENT_TURN_BRIDGE_BYTES = exports.TURN_DELTA_MAX_CHARS = exports.PollAuthSignalResponseSchema = exports.PollAuthSignalRequestSchema = exports.EmitAuthArtifactRequestSchema = exports.CompleteAgentTurnResponseSchema = exports.CompleteAgentTurnRequestSchema = exports.AGENT_TURN_INPUT_MAX = exports.TURN_TOOL_EVENT_QUEUE_MAX = exports.TurnToolEventSchema = exports.TURN_TOOL_OUTPUT_MAX_CHARS = exports.CompleteAutomationResponseSchema = exports.CompleteAutomationRequestSchema = exports.CompleteAuthRequestSchema = exports.CompleteEmbeddingsRequestSchema = exports.EmbeddingEntrySchema = exports.EmbedEventSchema = exports.CompleteActionRequestSchema = exports.CompleteRequestSchema = exports.StreamBatchSchema = exports.ContentItemSchema = exports.ActivatePageResponseSchema = exports.ActivatePageRequestSchema = exports.PollResponseSchema = exports.FeedSourceAckSchema = exports.AgentTurnPollPayloadSchema = exports.AutomationPollPayloadSchema = exports.AutomationPollContextSchema = exports.AutomationPollEventSchema = exports.AutomationPollMetaSchema = exports.AutomationExecutionConfigSchema = exports.PollRequestSchema = exports.WORKER_POLL_MAX_WAIT_SECONDS = exports.FeedNotificationSchema = exports.EXECUTION_BACKENDS = exports.OAuthCredentialsSchema = exports.WorkerExitDiagnosticsSchema = exports.WorkerExitReasonSchema = exports.RunTypeSchema = exports.ConnectorHttpRequestSchema = exports.SourceAttributionSchema = exports.CONNECTOR_HTTP_MAX_BYTES = exports.CONNECTOR_HTTP_AUTH_CAPABILITY = void 0;
31
30
  exports.defaultBackendCapacity = defaultBackendCapacity;
32
31
  const typebox_1 = require("@sinclair/typebox");
32
+ const suggestions_1 = require("../../suggestions");
33
33
  const manage_operations_1 = require("../tools/manage-operations");
34
34
  exports.CONNECTOR_HTTP_AUTH_CAPABILITY = "http_auth";
35
35
  exports.CONNECTOR_HTTP_MAX_BYTES = 4 * 1024 * 1024;
@@ -81,15 +81,13 @@ exports.RunTypeSchema = typebox_1.Type.Union([
81
81
  typebox_1.Type.Literal("sync"),
82
82
  typebox_1.Type.Literal("action"),
83
83
  typebox_1.Type.Literal("automation"),
84
- typebox_1.Type.Literal("chat_message"),
85
84
  typebox_1.Type.Literal("embed_backfill"),
86
85
  typebox_1.Type.Literal("auth"),
87
86
  /**
88
87
  * One conversation turn executed as one isolate job, claimed only by a fleet
89
88
  * worker that advertises the lane and run through `IsolateExecutor`. Distinct
90
- * from `chat_message`, a lobu-queue row the gateway drains to a subprocess
91
- * worker — or, when the agent is device-pinned, hands to that device through
92
- * this same poll. A daemon that predates this lane must never claim an
89
+ * from `chat_message`, a lobu-queue row the gateway drains itself and never
90
+ * hands to a poller. A daemon that predates this lane must never claim an
93
91
  * `agent_turn`: its dispatch would fall through to a connector sync.
94
92
  */
95
93
  typebox_1.Type.Literal("agent_turn"),
@@ -274,7 +272,7 @@ exports.AutomationPollEventSchema = typebox_1.Type.Object({
274
272
  fired_at: typebox_1.Type.String(),
275
273
  payload: typebox_1.Type.Optional(typebox_1.Type.Record(typebox_1.Type.String(), typebox_1.Type.Unknown())),
276
274
  });
277
- /** Identity context for a device-local CLI run (automation or chat). */
275
+ /** Identity context for a device-local Automation CLI run. */
278
276
  exports.AutomationPollContextSchema = typebox_1.Type.Object({
279
277
  device: typebox_1.Type.Object({ worker_id: typebox_1.Type.Optional(typebox_1.Type.String()) }),
280
278
  user: typebox_1.Type.Object({
@@ -311,37 +309,6 @@ exports.AutomationPollPayloadSchema = typebox_1.Type.Object({
311
309
  event: exports.AutomationPollEventSchema,
312
310
  context: exports.AutomationPollContextSchema,
313
311
  });
314
- /** One bounded prior turn shipped to a stateless device CLI. */
315
- exports.DeviceChatHistoryMessageSchema = typebox_1.Type.Object({
316
- role: typebox_1.Type.Union([typebox_1.Type.Literal("user"), typebox_1.Type.Literal("assistant")]),
317
- content: typebox_1.Type.String({ maxLength: 16000 }),
318
- });
319
- /**
320
- * Cap on the device chat envelope's `ephemeral_context`. Exported because the
321
- * producer must agree with it BEFORE enqueueing: the server-side planner keeps
322
- * an Automation whose composed instructions exceed this bound on the durable
323
- * background lane rather than shipping a device turn the poll route would
324
- * silently truncate.
325
- */
326
- exports.DEVICE_CHAT_MAX_CONTEXT_LENGTH = 2048;
327
- /** Device-local chat execution metadata. Conversation ownership stays with `agent.id`. */
328
- exports.DeviceChatPollPayloadSchema = typebox_1.Type.Object({
329
- chat: typebox_1.Type.Object({
330
- agent_kind: typebox_1.Type.String({ minLength: 1, maxLength: 64 }),
331
- execution_config: typebox_1.Type.Optional(exports.AutomationExecutionConfigSchema),
332
- message: typebox_1.Type.String({ maxLength: 32000 }),
333
- ephemeral_context: typebox_1.Type.Optional(typebox_1.Type.String({ maxLength: exports.DEVICE_CHAT_MAX_CONTEXT_LENGTH })),
334
- history: typebox_1.Type.Array(exports.DeviceChatHistoryMessageSchema, { maxItems: 12 }),
335
- agent: typebox_1.Type.Object({
336
- id: typebox_1.Type.String({ minLength: 1 }),
337
- name: typebox_1.Type.Optional(typebox_1.Type.String()),
338
- identity_md: typebox_1.Type.Optional(typebox_1.Type.String()),
339
- soul_md: typebox_1.Type.Optional(typebox_1.Type.String()),
340
- user_md: typebox_1.Type.Optional(typebox_1.Type.String()),
341
- }),
342
- }),
343
- context: exports.AutomationPollContextSchema,
344
- });
345
312
  /**
346
313
  * `payload` of an agent-turn poll response.
347
314
  *
@@ -505,6 +472,14 @@ exports.AgentTurnPollPayloadSchema = typebox_1.Type.Object({
505
472
  * stays off unless the caller explicitly requests an effort level.
506
473
  */
507
474
  reasoning: typebox_1.Type.Optional(typebox_1.Type.Boolean()),
475
+ /**
476
+ * pi-ai's `Model.thinkingLevelMap`: the provider's name for each
477
+ * thinking level, `null` where the model does not serve that level.
478
+ * gpt-5-mini maps `off` to `null` because it cannot turn reasoning off;
479
+ * without the map pi-ai sends `effort: "none"` and OpenAI rejects it.
480
+ * Absent → pi-ai's own defaults.
481
+ */
482
+ thinking_level_map: typebox_1.Type.Optional(typebox_1.Type.Record(typebox_1.Type.String(), typebox_1.Type.Union([typebox_1.Type.String(), typebox_1.Type.Null()]))),
508
483
  /**
509
484
  * The modalities this model accepts, in pi-ai's own `Model.input`
510
485
  * vocabulary and resolved from pi-ai's model registry — NOT guessed
@@ -560,7 +535,7 @@ exports.AgentTurnPollPayloadSchema = typebox_1.Type.Object({
560
535
  remote_runtime: typebox_1.Type.Optional(typebox_1.Type.Object({ provider_id: typebox_1.Type.String({ minLength: 1 }) })),
561
536
  /**
562
537
  * The gateway tools available for this turn, by NAME only —
563
- * `ask_user`, `send_message`, `suggest_actions` and the rest of
538
+ * `ask_user`, `send_message` and the rest of
564
539
  * `@lobu/plugin-conversations`. The guest runs that package's own
565
540
  * implementation, so the route, the request body and the schema live
566
541
  * there and never on this wire; sending a name the package does not
@@ -592,6 +567,12 @@ exports.AgentTurnPollPayloadSchema = typebox_1.Type.Object({
592
567
  conversation_id: typebox_1.Type.String({ minLength: 1 }),
593
568
  platform: typebox_1.Type.String({ minLength: 1 }),
594
569
  })),
570
+ /**
571
+ * Ask the turn's own model for follow-up chips after it answers and
572
+ * return them with the completion. Set by the gateway only for a
573
+ * human-facing turn; absent → no chips.
574
+ */
575
+ follow_ups: typebox_1.Type.Optional(typebox_1.Type.Literal(true)),
595
576
  })),
596
577
  /**
597
578
  * Long-term memory for this turn: `@lobu/plugin-memory`'s recall hook
@@ -724,15 +705,11 @@ exports.PollResponseSchema = typebox_1.Type.Object({
724
705
  /** Owning org of a claimed device-local CLI run. */
725
706
  organization_id: typebox_1.Type.Optional(typebox_1.Type.String()),
726
707
  /**
727
- * Device-local CLI envelope for `automation` or `chat_message` runs. The
728
- * gateway composes the prompt context and the device reports through the
729
- * matching completion endpoint. No connector code or credentials are shipped.
708
+ * Envelope for an `automation` run (a device-local CLI) or an `agent_turn`
709
+ * run. The gateway composes the prompt context and the worker reports
710
+ * through the matching completion endpoint. No connector code is shipped.
730
711
  */
731
- payload: typebox_1.Type.Optional(typebox_1.Type.Union([
732
- exports.AutomationPollPayloadSchema,
733
- exports.DeviceChatPollPayloadSchema,
734
- exports.AgentTurnPollPayloadSchema,
735
- ])),
712
+ payload: typebox_1.Type.Optional(typebox_1.Type.Union([exports.AutomationPollPayloadSchema, exports.AgentTurnPollPayloadSchema])),
736
713
  });
737
714
  exports.ActivatePageRequestSchema = typebox_1.Type.Object({
738
715
  worker_id: typebox_1.Type.String({ minLength: 1 }),
@@ -879,20 +856,6 @@ exports.CompleteAutomationResponseSchema = typebox_1.Type.Object({
879
856
  run_id: typebox_1.Type.Optional(typebox_1.Type.Union([typebox_1.Type.Integer(), typebox_1.Type.Null()])),
880
857
  idempotent: typebox_1.Type.Optional(typebox_1.Type.Union([typebox_1.Type.Boolean(), typebox_1.Type.Null()])),
881
858
  });
882
- /** `POST .../complete-chat` terminal report for a `chat_message` turn. */
883
- exports.CompleteDeviceChatRequestSchema = typebox_1.Type.Object({
884
- worker_id: typebox_1.Type.String(),
885
- output: typebox_1.Type.Optional(typebox_1.Type.String()),
886
- error: typebox_1.Type.Optional(typebox_1.Type.Union([typebox_1.Type.String(), typebox_1.Type.Null()])),
887
- exit_code: typebox_1.Type.Optional(typebox_1.Type.Union([typebox_1.Type.Integer(), typebox_1.Type.Null()])),
888
- exit_signal: typebox_1.Type.Optional(typebox_1.Type.Union([typebox_1.Type.String(), typebox_1.Type.Null()])),
889
- exit_reason: typebox_1.Type.Optional(exports.WorkerExitReasonSchema),
890
- });
891
- exports.CompleteDeviceChatResponseSchema = typebox_1.Type.Object({
892
- ok: typebox_1.Type.Boolean(),
893
- status: typebox_1.Type.Union([typebox_1.Type.Literal("completed"), typebox_1.Type.Literal("failed")]),
894
- idempotent: typebox_1.Type.Optional(typebox_1.Type.Boolean()),
895
- });
896
859
  /**
897
860
  * `POST /api/workers/complete-agent-turn`.
898
861
  *
@@ -1021,6 +984,14 @@ exports.CompleteAgentTurnRequestSchema = typebox_1.Type.Object({
1021
984
  * (`chat-response-bridge`) already acts on it.
1022
985
  */
1023
986
  replied_in_band: typebox_1.Type.Optional(typebox_1.Type.Boolean()),
987
+ /**
988
+ * Follow-up chips for the owner's answer, proposed by the same model after it
989
+ * answered (`tools.follow_ups`). The worker is untrusted, so the completion
990
+ * route re-sanitizes them; the gateway delivers them with the reply.
991
+ */
992
+ suggestions: typebox_1.Type.Optional(typebox_1.Type.Array(typebox_1.Type.Object({ title: typebox_1.Type.String(), message: typebox_1.Type.String() }), {
993
+ maxItems: suggestions_1.SUGGESTION_LIMITS.maxPrompts,
994
+ })),
1024
995
  /**
1025
996
  * Tool traces that finished too late to ride a heartbeat, oldest first.
1026
997
  *
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Device-pin tombstones on `connections.error_message`.
3
+ *
4
+ * DELETE /api/me/devices and PATCH device org-move un-pin connections and
5
+ * stamp a fixed error string so the UI can explain why a connector stopped.
6
+ * When a device re-registers / is re-pinned, every restore path MUST clear
7
+ * those strings — otherwise the connection is `active` + green while the
8
+ * header still shows red "Device was removed".
9
+ *
10
+ * Single source of truth for the stamp/clear literals and the live-pin
11
+ * predicate. The gateway (`packages/server/src/utils/device-pin-tombstones.ts`,
12
+ * which adds the DB clear) and the Owletto client
13
+ * (`packages/owletto/src/lib/device-pin-tombstone.ts`, which adds the display
14
+ * mask) both re-export this module. Keep stamp and clear sites on these exact
15
+ * literals.
16
+ */
17
+ /** Exact `connections.error_message` values written when a device pin is torn down. */
18
+ export declare const DEVICE_PIN_TOMBSTONE_MESSAGES: readonly ["Device was removed", "Device was moved to another workspace"];
19
+ export type DevicePinTombstoneMessage = (typeof DEVICE_PIN_TOMBSTONE_MESSAGES)[number];
20
+ export declare const DEVICE_REMOVED_TOMBSTONE: DevicePinTombstoneMessage;
21
+ export declare const DEVICE_MOVED_TOMBSTONE: DevicePinTombstoneMessage;
22
+ export declare function isDevicePinTombstone(message: string | null | undefined): message is DevicePinTombstoneMessage;
23
+ /**
24
+ * True when a listed connection still has a live device_workers row for its pin
25
+ * (join populated `device_last_seen_at` / handle). Tombstone should not be shown.
26
+ */
27
+ export declare function connectionHasLiveDevicePin(row: {
28
+ device_worker_id?: string | null;
29
+ device_last_seen_at?: string | Date | null;
30
+ device_worker_handle?: string | null;
31
+ device_label?: string | null;
32
+ }): boolean;
33
+ /**
34
+ * Effective error for API responses: suppress pin-tombstones once a device is
35
+ * pinned again (even if a write path forgot to clear the column).
36
+ */
37
+ export declare function effectiveConnectionErrorMessage(row: {
38
+ error_message?: string | null;
39
+ device_worker_id?: string | null;
40
+ device_last_seen_at?: string | Date | null;
41
+ device_worker_handle?: string | null;
42
+ device_label?: string | null;
43
+ }): string | null;
44
+ //# sourceMappingURL=device-pin-tombstones.d.ts.map
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ /**
3
+ * Device-pin tombstones on `connections.error_message`.
4
+ *
5
+ * DELETE /api/me/devices and PATCH device org-move un-pin connections and
6
+ * stamp a fixed error string so the UI can explain why a connector stopped.
7
+ * When a device re-registers / is re-pinned, every restore path MUST clear
8
+ * those strings — otherwise the connection is `active` + green while the
9
+ * header still shows red "Device was removed".
10
+ *
11
+ * Single source of truth for the stamp/clear literals and the live-pin
12
+ * predicate. The gateway (`packages/server/src/utils/device-pin-tombstones.ts`,
13
+ * which adds the DB clear) and the Owletto client
14
+ * (`packages/owletto/src/lib/device-pin-tombstone.ts`, which adds the display
15
+ * mask) both re-export this module. Keep stamp and clear sites on these exact
16
+ * literals.
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.DEVICE_MOVED_TOMBSTONE = exports.DEVICE_REMOVED_TOMBSTONE = exports.DEVICE_PIN_TOMBSTONE_MESSAGES = void 0;
20
+ exports.isDevicePinTombstone = isDevicePinTombstone;
21
+ exports.connectionHasLiveDevicePin = connectionHasLiveDevicePin;
22
+ exports.effectiveConnectionErrorMessage = effectiveConnectionErrorMessage;
23
+ /** Exact `connections.error_message` values written when a device pin is torn down. */
24
+ exports.DEVICE_PIN_TOMBSTONE_MESSAGES = [
25
+ "Device was removed",
26
+ "Device was moved to another workspace",
27
+ ];
28
+ exports.DEVICE_REMOVED_TOMBSTONE = "Device was removed";
29
+ exports.DEVICE_MOVED_TOMBSTONE = "Device was moved to another workspace";
30
+ function isDevicePinTombstone(message) {
31
+ return (typeof message === "string" &&
32
+ exports.DEVICE_PIN_TOMBSTONE_MESSAGES.includes(message));
33
+ }
34
+ /**
35
+ * True when a listed connection still has a live device_workers row for its pin
36
+ * (join populated `device_last_seen_at` / handle). Tombstone should not be shown.
37
+ */
38
+ function connectionHasLiveDevicePin(row) {
39
+ if (!row.device_worker_id)
40
+ return false;
41
+ // Any of these being set means the LEFT JOIN to device_workers matched.
42
+ return (row.device_last_seen_at != null ||
43
+ row.device_worker_handle != null ||
44
+ row.device_label != null);
45
+ }
46
+ /**
47
+ * Effective error for API responses: suppress pin-tombstones once a device is
48
+ * pinned again (even if a write path forgot to clear the column).
49
+ */
50
+ function effectiveConnectionErrorMessage(row) {
51
+ const msg = row.error_message ?? null;
52
+ if (isDevicePinTombstone(msg) && connectionHasLiveDevicePin(row)) {
53
+ return null;
54
+ }
55
+ return msg;
56
+ }
57
+ //# sourceMappingURL=device-pin-tombstones.js.map
@@ -12,6 +12,7 @@ export type { CommandContext, CommandDefinition } from "./command-registry";
12
12
  export { CommandRegistry } from "./command-registry";
13
13
  export * from "./connector-query-errors";
14
14
  export * from "./constants";
15
+ export * from "./device-pin-tombstones";
15
16
  export * from "./contracts/interaction-envelope";
16
17
  export * from "./credentials";
17
18
  export * from "./classify-error";
@@ -31,7 +32,7 @@ export * from "./secret-refs";
31
32
  export * from "./reserved";
32
33
  export { extractTraceId, generateTraceId } from "./trace";
33
34
  export type { AgentErrorContext, AgentInlineGuardrail, AgentOptions, AuthProfile, ConversationMessage, DeclaredCredential, HistoryMessage, InstructionContext, InstructionProvider, LogLevel, McpOAuthConfig, NetworkConfig, NixConfig, RegistryEntry, SessionContext, SkillConfig, SkillsConfig, SuggestedPrompt, ThinkingLevel, ThreadResponsePayload, } from "./types";
34
- export { hasCredentialSource } from "./types";
35
+ export { hasCredentialSource, isRefreshSuspended } from "./types";
35
36
  export { SUGGESTION_LIMITS, sanitizeSuggestionPrompts } from "./types";
36
37
  export type { BaseMessage } from "./types/message";
37
38
  export * from "./utils/encryption";
@@ -48,6 +49,6 @@ export { slugify } from "./utils/slug";
48
49
  export * from "./utils/urls";
49
50
  export * from "./worker/auth";
50
51
  export type { WorkerTransport, WorkerTransportConfig, } from "./worker/transport";
51
- export type { DeviceExecutionTarget, JobType, MessagePayload, QueuedMessage, } from "./worker/wire";
52
+ export type { JobType, MessagePayload, QueuedMessage, } from "./worker/wire";
52
53
  export { withLobuFileParameters } from "./agent-tooling";
53
54
  //# sourceMappingURL=index.d.ts.map
@@ -16,7 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
17
17
  };
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.withLobuFileParameters = exports.slugify = exports.titleFromSessionJsonl = exports.parseSessionEntries = exports.entryToMessage = exports.sanitizeSuggestionPrompts = exports.SUGGESTION_LIMITS = exports.hasCredentialSource = exports.generateTraceId = exports.extractTraceId = exports.SDK_COMPAT_PROTOCOLS = exports.resolveSdkCompat = exports.isSdkCompat = exports.withSpan = exports.withChildSpan = exports.shutdownTracing = exports.SpanStatusCode = exports.SpanKind = exports.runInSpanContext = exports.initTracing = exports.getTracer = exports.getTraceparent = exports.getCurrentSpan = exports.flushTracing = exports.createSpan = exports.createRootSpan = exports.createChildSpan = exports.renderSkillMemorySection = exports.renderFallbackSystemContext = exports.BaseInstructionProvider = exports.CommandRegistry = exports.inferGrantKind = void 0;
19
+ exports.withLobuFileParameters = exports.slugify = exports.titleFromSessionJsonl = exports.parseSessionEntries = exports.entryToMessage = exports.sanitizeSuggestionPrompts = exports.SUGGESTION_LIMITS = exports.isRefreshSuspended = exports.hasCredentialSource = exports.generateTraceId = exports.extractTraceId = exports.SDK_COMPAT_PROTOCOLS = exports.resolveSdkCompat = exports.isSdkCompat = exports.withSpan = exports.withChildSpan = exports.shutdownTracing = exports.SpanStatusCode = exports.SpanKind = exports.runInSpanContext = exports.initTracing = exports.getTracer = exports.getTraceparent = exports.getCurrentSpan = exports.flushTracing = exports.createSpan = exports.createRootSpan = exports.createChildSpan = exports.renderSkillMemorySection = exports.renderFallbackSystemContext = exports.BaseInstructionProvider = exports.CommandRegistry = exports.inferGrantKind = void 0;
20
20
  __exportStar(require("./agent-policy"), exports);
21
21
  __exportStar(require("./tool-trace-summary"), exports);
22
22
  __exportStar(require("./shell-safety"), exports);
@@ -30,6 +30,7 @@ var command_registry_1 = require("./command-registry");
30
30
  Object.defineProperty(exports, "CommandRegistry", { enumerable: true, get: function () { return command_registry_1.CommandRegistry; } });
31
31
  __exportStar(require("./connector-query-errors"), exports);
32
32
  __exportStar(require("./constants"), exports);
33
+ __exportStar(require("./device-pin-tombstones"), exports);
33
34
  // Interaction-envelope wire literals (tool_approval resourceKind / attribution).
34
35
  // Deep import `@lobu/core/contracts/interaction-envelope` also works under
35
36
  // bundler/NodeNext resolution; plugin packages with classic `moduleResolution:
@@ -83,6 +84,7 @@ Object.defineProperty(exports, "extractTraceId", { enumerable: true, get: functi
83
84
  Object.defineProperty(exports, "generateTraceId", { enumerable: true, get: function () { return trace_1.generateTraceId; } });
84
85
  var types_1 = require("./types");
85
86
  Object.defineProperty(exports, "hasCredentialSource", { enumerable: true, get: function () { return types_1.hasCredentialSource; } });
87
+ Object.defineProperty(exports, "isRefreshSuspended", { enumerable: true, get: function () { return types_1.isRefreshSuspended; } });
86
88
  var types_2 = require("./types");
87
89
  Object.defineProperty(exports, "SUGGESTION_LIMITS", { enumerable: true, get: function () { return types_2.SUGGESTION_LIMITS; } });
88
90
  Object.defineProperty(exports, "sanitizeSuggestionPrompts", { enumerable: true, get: function () { return types_2.sanitizeSuggestionPrompts; } });
@@ -11,30 +11,9 @@ const USE_WINSTON_LOGGER = process.env.USE_WINSTON_LOGGER === "true";
11
11
  const USE_JSON_FORMAT = process.env.LOG_FORMAT === "json";
12
12
  const winston_1 = __importDefault(require("winston"));
13
13
  const diagnostic_scrubber_1 = require("./utils/diagnostic-scrubber");
14
- const SENSITIVE_LOG_KEY_PATTERN = /(?:credential|secret|token|password|api(?:_|-)?key|authorization)/i;
15
- function createRedactingReplacer() {
16
- const seen = new WeakSet();
17
- return (key, value) => {
18
- if (SENSITIVE_LOG_KEY_PATTERN.test(key))
19
- return "[REDACTED]";
20
- if (value instanceof Error) {
21
- return {
22
- name: value.name,
23
- message: value.message,
24
- stack: value.stack,
25
- };
26
- }
27
- if (typeof value === "object" && value !== null) {
28
- if (seen.has(value))
29
- return "[Circular Reference]";
30
- seen.add(value);
31
- }
32
- return value;
33
- };
34
- }
35
14
  function safeStringify(value, space) {
36
15
  try {
37
- return JSON.stringify((0, diagnostic_scrubber_1.scrubDiagnosticValue)(value), createRedactingReplacer(), space);
16
+ return JSON.stringify((0, diagnostic_scrubber_1.scrubDiagnosticValue)(value), null, space);
38
17
  }
39
18
  catch {
40
19
  return "[unserializable]";
@@ -63,7 +42,9 @@ function createConsoleLogger(serviceName) {
63
42
  // Keep the metadata object as a trailing arg so it still renders.
64
43
  // Slicing it away accepted the signature and then dropped the payload,
65
44
  // emptying every structured diagnostic that uses this call shape.
66
- msgStr = args[0];
45
+ // The message itself is a string, so it takes the same boundary
46
+ // scrubbing as any other string message.
47
+ msgStr = (0, diagnostic_scrubber_1.scrubDiagnosticValue)(args[0]);
67
48
  args = [message, ...args.slice(1)];
68
49
  }
69
50
  else {
@@ -72,7 +53,11 @@ function createConsoleLogger(serviceName) {
72
53
  }
73
54
  }
74
55
  else {
75
- msgStr = String(message);
56
+ // Everything else funnels through String() here: plain strings,
57
+ // Errors, and top-level arrays (their join is just message text).
58
+ // Scrub the converted text — the removed final scrub used to cover
59
+ // all of these, and that coverage now lives here.
60
+ msgStr = (0, diagnostic_scrubber_1.scrubDiagnosticValue)(String(message));
76
61
  }
77
62
  if (USE_JSON_FORMAT) {
78
63
  return safeStringify({
@@ -90,7 +75,7 @@ function createConsoleLogger(serviceName) {
90
75
  if (args.length > 0) {
91
76
  msgStr += ` ${safeStringify(args.length === 1 ? args[0] : args)}`;
92
77
  }
93
- return `[${timestamp.replace("T", " ").slice(0, 19)}] [${lvl}] [${serviceName}] ${(0, diagnostic_scrubber_1.scrubDiagnosticValue)(msgStr)}`;
78
+ return `[${timestamp.replace("T", " ").slice(0, 19)}] [${lvl}] [${serviceName}] ${msgStr}`;
94
79
  };
95
80
  return {
96
81
  error: (message, ...args) => {
@@ -31,9 +31,22 @@ export declare const SUGGESTION_LIMITS: {
31
31
  * Normalize an untrusted `prompts` value into at most {@link SUGGESTION_LIMITS}
32
32
  * valid `{title,message}` entries. Trims BEFORE capping length (so leading
33
33
  * whitespace can't yield an empty displayed title), drops malformed/empty
34
- * entries, and returns `[]` for any non-array input. Shared by the agent tool
35
- * and the gateway route so the worker (untrusted) and the server enforce one
34
+ * entries, and returns `[]` for any non-array input. Shared by the worker
35
+ * and completion route so the worker (untrusted) and the server enforce one
36
36
  * identical contract.
37
37
  */
38
38
  export declare function sanitizeSuggestionPrompts(value: unknown): SuggestedPrompt[];
39
+ /**
40
+ * The follow-up question asked after a human-facing turn's reply, on the same
41
+ * session and model that wrote it. Asked as a side request — never appended to
42
+ * the conversation — so the model can use the user's language and preferences
43
+ * retained in its current context. Reusing the prefix enables prompt caching.
44
+ */
45
+ export declare const FOLLOW_UP_SUGGESTIONS_PROMPT: string;
46
+ /**
47
+ * The chips in a reply to {@link FOLLOW_UP_SUGGESTIONS_PROMPT}, sanitized.
48
+ * Tolerates a markdown fence or prose around the object by parsing from the
49
+ * first `{` to the last `}`; anything unparseable is no suggestions.
50
+ */
51
+ export declare function parseFollowUpSuggestions(reply: string): SuggestedPrompt[];
39
52
  //# sourceMappingURL=suggestions.d.ts.map
@@ -9,8 +9,9 @@
9
9
  * `@lobu/core` import here.
10
10
  */
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.SUGGESTION_LIMITS = void 0;
12
+ exports.FOLLOW_UP_SUGGESTIONS_PROMPT = exports.SUGGESTION_LIMITS = void 0;
13
13
  exports.sanitizeSuggestionPrompts = sanitizeSuggestionPrompts;
14
+ exports.parseFollowUpSuggestions = parseFollowUpSuggestions;
14
15
  /** Limits enforced wherever suggestions enter or leave durable storage.
15
16
  * `maxTitleChars` counts UTF-16 code units, matching how Slack measures its
16
17
  * 75-char button-text cap (the tightest limit a title reaches on a surface this
@@ -28,8 +29,8 @@ exports.SUGGESTION_LIMITS = {
28
29
  * Normalize an untrusted `prompts` value into at most {@link SUGGESTION_LIMITS}
29
30
  * valid `{title,message}` entries. Trims BEFORE capping length (so leading
30
31
  * whitespace can't yield an empty displayed title), drops malformed/empty
31
- * entries, and returns `[]` for any non-array input. Shared by the agent tool
32
- * and the gateway route so the worker (untrusted) and the server enforce one
32
+ * entries, and returns `[]` for any non-array input. Shared by the worker
33
+ * and completion route so the worker (untrusted) and the server enforce one
33
34
  * identical contract.
34
35
  */
35
36
  function sanitizeSuggestionPrompts(value) {
@@ -59,6 +60,50 @@ function sanitizeSuggestionPrompts(value) {
59
60
  }
60
61
  return out;
61
62
  }
63
+ /**
64
+ * The follow-up question asked after a human-facing turn's reply, on the same
65
+ * session and model that wrote it. Asked as a side request — never appended to
66
+ * the conversation — so the model can use the user's language and preferences
67
+ * retained in its current context. Reusing the prefix enables prompt caching.
68
+ */
69
+ exports.FOLLOW_UP_SUGGESTIONS_PROMPT = [
70
+ "Before the user replies: decide whether your last reply needs follow-up action chips the user can tap.",
71
+ 'Default to {"prompts":[]} when your reply leaves nothing open.',
72
+ 'If your reply offers concrete next steps ("If you want, I can …", "Want me to …?"), turn up to three distinct offers into chips.',
73
+ "Otherwise offer a chip only for a concrete next step your reply leaves open that would help the user proceed.",
74
+ "Return no suggestions for routine answers, acknowledgements, corrections, a finished request with nothing left open, a question the user must answer in their own words, or a reply that closes the topic, and none at all if the user asked for no suggestions.",
75
+ "Do not invent extra work or add a generic offer to explore further.",
76
+ "When useful next steps remain, return 1-3 distinct actions. A single useful action is enough; never pad the list.",
77
+ "",
78
+ 'Each item is {"title","message"}:',
79
+ '- "title": a short tappable label, at most 20 characters.',
80
+ '- "message": the full message sent verbatim AS THE USER if tapped.',
81
+ "",
82
+ "Write both in the language the user writes in. Write `message` in the user's voice, as a request to you:",
83
+ ' good: "Show me the diff" bad: "I can show you the diff"',
84
+ 'Do not call any tool. Reply with STRICT JSON {"prompts":[{"title":"...","message":"..."}]} and nothing else.',
85
+ ].join("\n");
86
+ /**
87
+ * The chips in a reply to {@link FOLLOW_UP_SUGGESTIONS_PROMPT}, sanitized.
88
+ * Tolerates a markdown fence or prose around the object by parsing from the
89
+ * first `{` to the last `}`; anything unparseable is no suggestions.
90
+ */
91
+ function parseFollowUpSuggestions(reply) {
92
+ const start = reply.indexOf("{");
93
+ const end = reply.lastIndexOf("}");
94
+ if (start < 0 || end <= start)
95
+ return [];
96
+ let parsed;
97
+ try {
98
+ parsed = JSON.parse(reply.slice(start, end + 1));
99
+ }
100
+ catch {
101
+ return [];
102
+ }
103
+ if (!parsed || typeof parsed !== "object")
104
+ return [];
105
+ return sanitizeSuggestionPrompts(parsed.prompts);
106
+ }
62
107
  /**
63
108
  * Truncate to at most `maxUnits` UTF-16 code units without splitting a
64
109
  * surrogate pair. Counting code POINTS would undercount against platform caps
@@ -1,4 +1,5 @@
1
1
  import type { SecretRef } from "./secret-refs";
2
+ import type { SuggestedPrompt } from "./suggestions";
2
3
  /**
3
4
  * Unified authentication profile for any model provider.
4
5
  * Persisted per-(userId, agentId) by the gateway's UserAuthProfileStore;
@@ -30,9 +31,23 @@ export interface AuthProfile {
30
31
  /** Durable secret reference for the refresh token. */
31
32
  refreshTokenRef?: SecretRef;
32
33
  accountId?: string;
34
+ /**
35
+ * Refresh suspension set by the token-refresh job when the provider
36
+ * reports the grant itself is dead (`invalid_grant`). Suspended profiles
37
+ * are excluded from token refresh and credential selection until the user
38
+ * reconnects, which writes fresh metadata without this field.
39
+ */
40
+ refreshSuspended?: {
41
+ /** Provider OAuth error code that killed the grant. */
42
+ code: string;
43
+ /** Epoch ms when the suspension was recorded. */
44
+ at: number;
45
+ };
33
46
  };
34
47
  createdAt: number;
35
48
  }
49
+ /** True when the token-refresh job suspended this profile's grant as dead. */
50
+ export declare function isRefreshSuspended(profile: AuthProfile): boolean;
36
51
  /** True if the profile has any credential source (resolved or ref). */
37
52
  export declare function hasCredentialSource(profile: AuthProfile): boolean;
38
53
  /**
@@ -234,6 +249,17 @@ export interface ThreadResponsePayload {
234
249
  * duplicate of the reply and must always surface.
235
250
  */
236
251
  repliedInBand?: boolean;
252
+ /**
253
+ * Follow-up chips for this reply, proposed by the model that wrote it. Set
254
+ * only on the COMPLETION row; delivered with the reply once output
255
+ * guardrails pass.
256
+ */
257
+ suggestions?: SuggestedPrompt[];
258
+ /**
259
+ * The agent_turn `runs.id` that produced this terminal row. Orders a late
260
+ * terminal against newer turns of the same conversation.
261
+ */
262
+ turnRunId?: number;
237
263
  /**
238
264
  * Raw error message. When provider context is available, the gateway labels
239
265
  * the source and unwraps the common JSON message envelope without rewording
@@ -1,7 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SUGGESTION_LIMITS = exports.sanitizeSuggestionPrompts = void 0;
4
+ exports.isRefreshSuspended = isRefreshSuspended;
4
5
  exports.hasCredentialSource = hasCredentialSource;
6
+ /** True when the token-refresh job suspended this profile's grant as dead. */
7
+ function isRefreshSuspended(profile) {
8
+ return Boolean(profile.metadata?.refreshSuspended);
9
+ }
5
10
  /** True if the profile has any credential source (resolved or ref). */
6
11
  function hasCredentialSource(profile) {
7
12
  return Boolean(profile.credential || profile.credentialRef);