@lobu/runtime-device 23.0.0 → 24.1.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 (67) hide show
  1. package/dist/component.json +1 -1
  2. package/dist/dependencies.bun.lock +30 -27
  3. package/npm-shrinkwrap.json +131 -115
  4. package/package.json +2 -1
  5. package/vendor/cli/dist/bundled-skills/lobu/SKILL.md +73 -0
  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 +36 -119
  15. package/vendor/cli/dist/config/define.d.ts +8 -0
  16. package/vendor/cli/dist/connectors/README.md +1 -1
  17. package/vendor/cli/dist/connectors/linkedin-inbox-adapter.js +4 -7
  18. package/vendor/cli/dist/connectors/linkedin.ts +53 -34
  19. package/vendor/cli/dist/connectors/reddit.ts +92 -20
  20. package/vendor/cli/dist/connectors/slack.ts +1 -0
  21. package/vendor/cli/dist/connectors/whatsapp-web-adapter.js +41 -11
  22. package/vendor/cli/dist/connectors/whatsapp-web-helpers.ts +1 -1
  23. package/vendor/cli/dist/connectors/whatsapp_web.ts +2 -2
  24. package/vendor/cli/dist/connectors/x-dm-adapter.js +65 -30
  25. package/vendor/cli/dist/connectors/x-identity.ts +5 -3
  26. package/vendor/cli/dist/runtime-components.json +4 -4
  27. package/vendor/cli/dist/templates/AGENTS.md.tmpl +10 -3
  28. package/vendor/cli/package.json +1 -1
  29. package/vendor/connector-sdk/package.json +1 -1
  30. package/vendor/connector-worker/dist/agent-turn/gateway-tools.d.ts +2 -2
  31. package/vendor/connector-worker/dist/agent-turn/gateway-tools.js +2 -2
  32. package/vendor/connector-worker/dist/agent-turn/guest-entry.js +34 -2
  33. package/vendor/connector-worker/dist/agent-turn/guest.bundle.js +362 -300
  34. package/vendor/connector-worker/dist/agent-turn/native-session.d.ts +12 -0
  35. package/vendor/connector-worker/dist/agent-turn/native-session.js +32 -6
  36. package/vendor/connector-worker/dist/agent-turn/types.d.ts +24 -3
  37. package/vendor/connector-worker/dist/daemon/agent-turn.js +5 -1
  38. package/vendor/connector-worker/dist/daemon/automation-acp.js +23 -11
  39. package/vendor/connector-worker/dist/daemon/automation.js +20 -15
  40. package/vendor/connector-worker/dist/isolate/prelude.js +93 -44
  41. package/vendor/connector-worker/package.json +1 -1
  42. package/vendor/core/dist/agent-policy.js +0 -3
  43. package/vendor/core/dist/agent-tooling.d.ts +1 -1
  44. package/vendor/core/dist/agent-tooling.js +3 -1
  45. package/vendor/core/dist/contracts/agent-settings.d.ts +6 -2
  46. package/vendor/core/dist/contracts/agent-settings.js +12 -1
  47. package/vendor/core/dist/contracts/tools/manage-views.d.ts +53 -234
  48. package/vendor/core/dist/contracts/tools/manage-views.js +50 -76
  49. package/vendor/core/dist/contracts/tools/view-attach.d.ts +5 -8
  50. package/vendor/core/dist/contracts/tools/view-attach.js +14 -31
  51. package/vendor/core/dist/contracts/tools/view-definition.d.ts +21 -0
  52. package/vendor/core/dist/contracts/tools/view-definition.js +165 -0
  53. package/vendor/core/dist/contracts/tools/view-runtime.d.ts +74 -0
  54. package/vendor/core/dist/contracts/tools/view-runtime.js +86 -0
  55. package/vendor/core/dist/contracts/worker/protocol.d.ts +39 -2
  56. package/vendor/core/dist/contracts/worker/protocol.js +24 -1
  57. package/vendor/core/dist/index.d.ts +1 -1
  58. package/vendor/core/dist/index.js +2 -1
  59. package/vendor/core/dist/suggestions.d.ts +15 -2
  60. package/vendor/core/dist/suggestions.js +48 -3
  61. package/vendor/core/dist/types.d.ts +26 -0
  62. package/vendor/core/dist/types.js +5 -0
  63. package/vendor/core/package.json +16 -5
  64. package/vendor/postgres/cf/src/connection.js +18 -0
  65. package/vendor/postgres/cjs/src/connection.js +18 -0
  66. package/vendor/postgres/src/connection.js +18 -0
  67. /package/vendor/postgres/{.bun-tag-f39dafdb2305d504 → .bun-tag-2f292c6554a8475e} +0 -0
@@ -19,16 +19,25 @@
19
19
  * provider credential and the MCP route accepts it as the bearer.
20
20
  */
21
21
  import { mcpToolResult, toolImageBudget } from '@lobu/plugin-toolkit';
22
+ import { FOLLOW_UP_SUGGESTIONS_PROMPT, parseFollowUpSuggestions } from '@lobu/core/agent-tooling';
22
23
  import { createGatewayTools } from './gateway-tools.js';
23
24
  import { createTurnMediaTools } from './media-tools.js';
24
25
  import { createTurnMemoryHooks } from './memory.js';
25
26
  import { estimatePromptTokenCost, memoryFlushDue, MEMORY_FLUSH_STATE_CUSTOM_TYPE } from '@lobu/core/memory-flush';
26
27
  import { isRetrievalTool, summarizeToolTrace } from '@lobu/core/tool-trace-summary';
27
- import { createNativeSession, nativeSessionJsonl, promptNativeSession } from './native-session.js';
28
+ import { askAside, createNativeSession, nativeSessionJsonl, promptNativeSession } from './native-session.js';
28
29
  import { MAX_TOOL_CALLS_PER_TURN } from './types.js';
29
30
  import { createWorkspace, INPUT_DIR, SKILLS_DIR, } from './workspace.js';
30
31
  /** Third-party MCP server on the other side of the gateway: generous, never forever. */
31
32
  const TOOL_CALL_TIMEOUT_MS = 120_000;
33
+ /**
34
+ * The follow-up chips request. It runs after the answer has streamed and
35
+ * before the turn completes, so this bounds how much later the reply is
36
+ * marked done; a slower model simply yields no chips.
37
+ */
38
+ const FOLLOW_UPS_TIMEOUT_MS = 10_000;
39
+ /** A chips reply is a few short JSON objects. */
40
+ const FOLLOW_UPS_MAX_TOKENS = 400;
32
41
  /**
33
42
  * What of a tool's output the host sees in the event stream.
34
43
  *
@@ -454,7 +463,7 @@ export async function runAgentTurn(input, emit, takeSteering = () => [], runtime
454
463
  // another request every time and an answer could still follow `ask_user`.
455
464
  //
456
465
  // `block` keeps its job — a sibling scheduled in the same batch must not
457
- // RUN, since `suggest_actions`/`send_message` post to the user — and
466
+ // RUN, since `send_message` posts to the user — and
458
467
  // `agent.abort()` is what ends generation. Pi's own `terminate` hint cannot
459
468
  // do it here: `shouldTerminateToolBatch` needs every result in the batch to
460
469
  // set it, and a blocked call is short-circuited as `kind:'immediate'`, which
@@ -743,6 +752,28 @@ export async function runAgentTurn(input, emit, takeSteering = () => [], runtime
743
752
  }
744
753
  if (ended)
745
754
  throw new Error(ended);
755
+ // Follow-up chips, asked of the model that just answered. They ride the
756
+ // result, so the gateway delivers them with the reply: embedded on web's
757
+ // `complete`, posted after the reply on chat, and dropped if a guardrail
758
+ // blocks it. Skipped when the turn already handed control back
759
+ // (`ask_user`), posted its answer in-band, or answered steered follow-ups
760
+ // as well — each of those inputs completes on its own.
761
+ let suggestions = [];
762
+ if (input.tools?.followUps && !askedUser && !repliedInBand && steeredMessages.size === 0 && finalText.trim()) {
763
+ try {
764
+ const reply = await askAside(session, credential, FOLLOW_UP_SUGGESTIONS_PROMPT, {
765
+ maxTokens: FOLLOW_UPS_MAX_TOKENS,
766
+ signal: AbortSignal.timeout(FOLLOW_UPS_TIMEOUT_MS),
767
+ });
768
+ suggestions = parseFollowUpSuggestions(reply);
769
+ }
770
+ catch (error) {
771
+ // Chips are optional: a slow or failed request leaves the answer as is.
772
+ console.warn('follow-up suggestions failed; the turn completes without them', {
773
+ error: error instanceof Error ? error.message : String(error),
774
+ });
775
+ }
776
+ }
746
777
  return {
747
778
  // The answer is the last assistant message WITH TEXT after each user
748
779
  // message, not the accumulated stream: a model that narrates before a
@@ -792,6 +823,7 @@ export async function runAgentTurn(input, emit, takeSteering = () => [], runtime
792
823
  }];
793
824
  }),
794
825
  ...(repliedInBand ? { repliedInBand: true } : {}),
826
+ ...(suggestions.length > 0 ? { suggestions } : {}),
795
827
  };
796
828
  }
797
829
  finally {