@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
@@ -1337,6 +1337,7 @@ var exports = module.exports;
1337
1337
  });
1338
1338
  Response.prototype._consume = function () {
1339
1339
  if (this.bodyUsed) return Promise.reject(new TypeError('Body is unusable: Body has already been read'));
1340
+ if (this._stream && this._stream.locked) return Promise.reject(new TypeError('Body is unusable: Body is locked'));
1340
1341
  this._bodyUsed = true;
1341
1342
  if (this._stream) return readAllBytes(this._stream);
1342
1343
  return Promise.resolve(this._bytes || new Uint8Array(0));
@@ -1355,6 +1356,7 @@ var exports = module.exports;
1355
1356
  };
1356
1357
  Response.prototype.clone = function () {
1357
1358
  if (this.bodyUsed) throw new TypeError('Response.clone: Body has already been consumed.');
1359
+ if (this._stream && this._stream.locked) throw new TypeError('Response.clone: Body is locked.');
1358
1360
  // Cloning a streamed body means teeing it, which nothing on this lane
1359
1361
  // does; a guest-constructed body still has its bytes to copy.
1360
1362
  if (this._bytes === null && this._stream !== null) throw new TypeError('Response.clone: a streamed body cannot be cloned on the isolate lane');
@@ -1921,26 +1923,31 @@ var exports = module.exports;
1921
1923
  // ---------------------------------------------------------------------------
1922
1924
  function ReadableStream(underlyingSource) {
1923
1925
  this._source = underlyingSource || {};
1924
- // Set by the first read; Response.bodyUsed reports it.
1926
+ // Set by the first read or a cancel; Response.bodyUsed reports it.
1925
1927
  this._disturbed = false;
1926
- }
1927
- ReadableStream.prototype.getReader = function () {
1928
+ this._locked = false;
1929
+ // Source state outlives a reader's lock, including buffered chunks and
1930
+ // terminal outcomes. Reacquiring a reader must not restart the source.
1928
1931
  var self = this;
1929
1932
  var queue = [];
1930
1933
  var waiters = [];
1931
1934
  var isClosed = false;
1935
+ var isErrored = false;
1932
1936
  var streamError = null;
1933
1937
 
1934
1938
  function settleWaiters(result) {
1935
- while (waiters.length > 0) waiters.shift()(result);
1939
+ while (waiters.length > 0) waiters.shift().resolve(result);
1940
+ }
1941
+ function rejectWaiters(err) {
1942
+ while (waiters.length > 0) waiters.shift().reject(err);
1936
1943
  }
1937
1944
 
1938
1945
  var controller = {
1939
1946
  enqueue: function (chunk) {
1940
- // A chunk the source still delivers after a close or a cancel is
1941
- // dropped: every read from that point on already reports done.
1942
- if (isClosed) return;
1943
- if (waiters.length > 0) waiters.shift()({ value: chunk, done: false });
1947
+ // A chunk the source still delivers after a close, a cancel or an
1948
+ // error is dropped: every read from that point on already settled.
1949
+ if (isClosed || isErrored) return;
1950
+ if (waiters.length > 0) waiters.shift().resolve({ value: chunk, done: false });
1944
1951
  else queue.push(chunk);
1945
1952
  },
1946
1953
  close: function () {
@@ -1952,54 +1959,96 @@ var exports = module.exports;
1952
1959
  // is dropped, so a read from then on still reports done. The fetch
1953
1960
  // body reaches this when a cancel kills its in-flight pull, which
1954
1961
  // answers with an AbortError only after the cancel has ended the stream.
1955
- if (isClosed) return;
1962
+ if (isClosed || isErrored) return;
1963
+ isErrored = true;
1956
1964
  streamError = err;
1957
- if (waiters.length > 0) settleWaiters(Promise.reject(err));
1965
+ queue.length = 0;
1966
+ rejectWaiters(err);
1958
1967
  }
1959
1968
  };
1960
1969
 
1961
- if (this._source && this._source.start) {
1962
- this._source.start(controller);
1963
- }
1970
+ this._read = function () {
1971
+ self._disturbed = true;
1972
+ if (isErrored) return Promise.reject(streamError);
1973
+ if (queue.length > 0) {
1974
+ return Promise.resolve({ value: queue.shift(), done: false });
1975
+ }
1976
+ if (isClosed) {
1977
+ return Promise.resolve({ value: undefined, done: true });
1978
+ }
1979
+ // The waiter is registered BEFORE pull(), because a source that
1980
+ // enqueues synchronously would otherwise push into the queue while no
1981
+ // waiter was registered and leave this read hanging forever. Reads
1982
+ // queue in order: each pull answers the oldest waiter.
1983
+ var waiter = new Promise(function (resolve, reject) {
1984
+ waiters.push({ resolve: resolve, reject: reject });
1985
+ });
1986
+ if (self._source.pull) {
1987
+ try {
1988
+ Promise.resolve(self._source.pull(controller)).catch(controller.error);
1989
+ } catch (err) {
1990
+ controller.error(err);
1991
+ }
1992
+ }
1993
+ return waiter;
1994
+ };
1995
+ this._release = function () {
1996
+ rejectWaiters(new TypeError('ReadableStream reader has been released'));
1997
+ };
1998
+ // Cancelling ends the stream: the queue is dropped and every read from
1999
+ // here on reports done. Without that a later read would pull the source
2000
+ // again -- for a fetch body or a socket, a read on what the cancel just
2001
+ // released. A reader and the stream itself both cancel through here.
2002
+ this._cancel = function (reason) {
2003
+ self._disturbed = true;
2004
+ if (isErrored) return Promise.reject(streamError);
2005
+ if (isClosed && queue.length === 0) return Promise.resolve();
2006
+ isClosed = true;
2007
+ queue.length = 0;
2008
+ settleWaiters({ value: undefined, done: true });
2009
+ try {
2010
+ return Promise.resolve(self._source.cancel ? self._source.cancel(reason) : undefined).then(function () {});
2011
+ } catch (err) {
2012
+ return Promise.reject(err);
2013
+ }
2014
+ };
1964
2015
 
2016
+ if (this._source.start) {
2017
+ Promise.resolve(this._source.start(controller)).catch(controller.error);
2018
+ }
2019
+ }
2020
+ Object.defineProperty(ReadableStream.prototype, 'locked', {
2021
+ get: function () { return this._locked; },
2022
+ enumerable: true
2023
+ });
2024
+ ReadableStream.prototype.getReader = function () {
2025
+ if (this._locked) throw new TypeError('ReadableStream is locked to a reader');
2026
+ this._locked = true;
2027
+ var self = this;
2028
+ var released = false;
1965
2029
  return {
1966
2030
  read: function () {
1967
- self._disturbed = true;
1968
- if (streamError) return Promise.reject(streamError);
1969
- if (queue.length > 0) {
1970
- return Promise.resolve({ value: queue.shift(), done: false });
1971
- }
1972
- if (isClosed) {
1973
- return Promise.resolve({ value: undefined, done: true });
1974
- }
1975
- // The waiter is registered BEFORE pull(), because a source that
1976
- // enqueues synchronously would otherwise push into the queue while no
1977
- // waiter was registered and leave this read hanging forever. Reads
1978
- // queue in order: each pull answers the oldest waiter.
1979
- var waiter = new Promise(function (resolve) {
1980
- waiters.push(resolve);
1981
- });
1982
- if (self._source && self._source.pull) {
1983
- self._source.pull(controller);
1984
- }
1985
- return waiter;
2031
+ if (released) return Promise.reject(new TypeError('ReadableStream reader has been released'));
2032
+ return self._read();
2033
+ },
2034
+ releaseLock: function () {
2035
+ if (released) return;
2036
+ released = true;
2037
+ self._locked = false;
2038
+ self._release();
1986
2039
  },
1987
- releaseLock: function () {},
1988
- // Cancelling ends the stream: the queue is dropped and every read from
1989
- // here on reports done. Without that a later read would pull the source
1990
- // again -- for a fetch body or a socket, a read on what the cancel just
1991
- // released.
1992
2040
  cancel: function (reason) {
1993
- isClosed = true;
1994
- queue.length = 0;
1995
- settleWaiters({ value: undefined, done: true });
1996
- if (self._source && self._source.cancel) {
1997
- return Promise.resolve(self._source.cancel(reason));
1998
- }
1999
- return Promise.resolve();
2041
+ if (released) return Promise.reject(new TypeError('ReadableStream reader has been released'));
2042
+ return self._cancel(reason);
2000
2043
  }
2001
2044
  };
2002
2045
  };
2046
+ // "await res.body.cancel()" drops a body nobody will read, a retried 503
2047
+ // for one; refused while a reader holds the lock, as on every runtime.
2048
+ ReadableStream.prototype.cancel = function (reason) {
2049
+ if (this._locked) return Promise.reject(new TypeError('Cannot cancel a ReadableStream that is locked to a reader'));
2050
+ return this._cancel(reason);
2051
+ };
2003
2052
  global.ReadableStream = ReadableStream;
2004
2053
 
2005
2054
  function WritableStream(underlyingSink) {
@@ -86,6 +86,12 @@ function option(options, key) {
86
86
  throw new Error(`--${key} requires a value`);
87
87
  return value;
88
88
  }
89
+ function parsePositiveInt(raw, flag) {
90
+ if (!/^[1-9]\d*$/.test(raw)) {
91
+ throw new Error(`${flag} must be a positive integer (got '${raw}')`);
92
+ }
93
+ return Number(raw);
94
+ }
89
95
  async function main() {
90
96
  const args = process.argv.slice(2);
91
97
  const raw = parseArgs(args);
@@ -94,8 +100,6 @@ async function main() {
94
100
  return;
95
101
  }
96
102
  if (raw.version) {
97
- if (raw.version !== true)
98
- throw new Error('--version does not accept a value');
99
103
  process.stdout.write(`${JSON.stringify(macDeviceDaemonMetadata(VERSION))}\n`);
100
104
  return;
101
105
  }
@@ -107,44 +111,28 @@ async function main() {
107
111
  const defaultAgentKind = option(raw, 'default-agent-kind');
108
112
  const supervisedStdio = raw['supervised-stdio'] === true;
109
113
  const debug = raw.debug === true;
110
- if (raw.debug !== undefined && !debug)
111
- throw new Error('--debug does not accept a value');
112
- if (raw['no-poll'] !== undefined && !noPoll) {
113
- throw new Error('--no-poll does not accept a value');
114
- }
115
- if (raw['supervised-stdio'] !== undefined && !supervisedStdio) {
116
- throw new Error('--supervised-stdio does not accept a value');
117
- }
118
114
  const options = {
119
115
  apiUrl,
120
116
  workerId,
121
117
  workerApiToken: process.env.WORKER_API_TOKEN,
122
118
  version: VERSION,
123
- ...(pollInterval ? { pollIntervalMs: Number(pollInterval) } : {}),
124
- ...(maxConcurrent ? { maxConcurrentJobs: Number(maxConcurrent) } : {}),
119
+ ...(pollInterval
120
+ ? { pollIntervalMs: parsePositiveInt(pollInterval, '--poll-interval-ms') }
121
+ : {}),
122
+ ...(maxConcurrent
123
+ ? { maxConcurrentJobs: parsePositiveInt(maxConcurrent, '--max-concurrent-jobs') }
124
+ : {}),
125
125
  ...(defaultAgentKind ? { defaultAgentKind: defaultAgentKind } : {}),
126
126
  debug,
127
127
  noPoll,
128
128
  supervisedStdio,
129
129
  };
130
- if (pollInterval) {
131
- if (!/^[1-9]\d*$/.test(pollInterval)) {
132
- throw new Error(`--poll-interval-ms must be a positive integer (got '${pollInterval}')`);
133
- }
134
- options.pollIntervalMs = Number(pollInterval);
135
- }
136
- if (maxConcurrent) {
137
- if (!/^[1-9]\d*$/.test(maxConcurrent)) {
138
- throw new Error(`--max-concurrent-jobs must be a positive integer (got '${maxConcurrent}')`);
139
- }
140
- options.maxConcurrentJobs = Number(maxConcurrent);
141
- }
142
- validateMacDeviceDaemonOptions(options);
130
+ const validated = validateMacDeviceDaemonOptions(options);
143
131
  if (noPoll) {
144
132
  process.stdout.write(`${JSON.stringify(macDeviceDaemonMetadata(VERSION))}\n`);
145
133
  return;
146
134
  }
147
- await runMacDeviceDaemon(options);
135
+ await runMacDeviceDaemon(validated);
148
136
  }
149
137
  async function start() {
150
138
  if (process.argv[2] === INTERNAL_CLI_SUPERVISOR_ARG) {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobu/connector-worker",
3
- "version": "22.0.0",
3
+ "version": "24.0.0",
4
4
  "description": "Self-hosted worker for Lobu memory — connectors and embedding generation",
5
5
  "type": "module",
6
6
  "bin": {
@@ -42,9 +42,6 @@ exports.CUSTOM_TOOL_METADATA = {
42
42
  delete_message: {
43
43
  description: "Delete a message the bot itself sent, addressed by a conversation or thread handle + message id. Only the bot's own messages can be deleted.",
44
44
  },
45
- suggest_actions: {
46
- description: 'Offer optional follow-up actions as tappable chips when the user asks for suggested next steps, or when a concrete choice would help them proceed. Default to a plain text reply: skip routine answers, acknowledgements, corrections, status updates, and requests you already completed, and respect an explicit ask for no suggestions or a closed topic. Do not invent extra work, repeat actions already offered, or defer work you should do now. One useful action is enough and 4 is the ceiling — never pad the list. Call at most once per turn. Each `message` is sent verbatim as the user\'s next turn, so write it in the user\'s voice ("Show me the diff", not "I can show you the diff"). This posts immediately, independently of the final reply, so each suggestion must make sense on its own. Non-blocking; finish your reply normally.',
47
- },
48
45
  };
49
46
  /** Every always-on rule, narrowed per turn by `renderAlwaysOnToolPolicyRulesFor`. */
50
47
  exports.TOOL_RULES = [
@@ -14,7 +14,7 @@
14
14
  * compile error to say so — `assertIsolateEligible` catches it at run time.
15
15
  */
16
16
  export { CUSTOM_TOOL_METADATA, type CustomToolMetadata, getCustomToolDescription, renderAlwaysOnToolPolicyRulesFor, } from "./agent-policy";
17
- export { sanitizeSuggestionPrompts, SUGGESTION_LIMITS, type SuggestedPrompt, } from "./suggestions";
17
+ export { FOLLOW_UP_SUGGESTIONS_PROMPT, parseFollowUpSuggestions, sanitizeSuggestionPrompts, SUGGESTION_LIMITS, type SuggestedPrompt, } from "./suggestions";
18
18
  /**
19
19
  * What a tool logs, without saying how. The worker lane passes core's winston
20
20
  * logger; the isolate guest passes its own console-backed one. Structurally
@@ -15,7 +15,7 @@
15
15
  * compile error to say so — `assertIsolateEligible` catches it at run time.
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.SUGGESTION_LIMITS = exports.sanitizeSuggestionPrompts = exports.renderAlwaysOnToolPolicyRulesFor = exports.getCustomToolDescription = exports.CUSTOM_TOOL_METADATA = void 0;
18
+ exports.SUGGESTION_LIMITS = exports.sanitizeSuggestionPrompts = exports.parseFollowUpSuggestions = exports.FOLLOW_UP_SUGGESTIONS_PROMPT = exports.renderAlwaysOnToolPolicyRulesFor = exports.getCustomToolDescription = exports.CUSTOM_TOOL_METADATA = void 0;
19
19
  exports.withLobuFileParameters = withLobuFileParameters;
20
20
  const typebox_1 = require("@sinclair/typebox");
21
21
  var agent_policy_1 = require("./agent-policy");
@@ -23,6 +23,8 @@ Object.defineProperty(exports, "CUSTOM_TOOL_METADATA", { enumerable: true, get:
23
23
  Object.defineProperty(exports, "getCustomToolDescription", { enumerable: true, get: function () { return agent_policy_1.getCustomToolDescription; } });
24
24
  Object.defineProperty(exports, "renderAlwaysOnToolPolicyRulesFor", { enumerable: true, get: function () { return agent_policy_1.renderAlwaysOnToolPolicyRulesFor; } });
25
25
  var suggestions_1 = require("./suggestions");
26
+ Object.defineProperty(exports, "FOLLOW_UP_SUGGESTIONS_PROMPT", { enumerable: true, get: function () { return suggestions_1.FOLLOW_UP_SUGGESTIONS_PROMPT; } });
27
+ Object.defineProperty(exports, "parseFollowUpSuggestions", { enumerable: true, get: function () { return suggestions_1.parseFollowUpSuggestions; } });
26
28
  Object.defineProperty(exports, "sanitizeSuggestionPrompts", { enumerable: true, get: function () { return suggestions_1.sanitizeSuggestionPrompts; } });
27
29
  Object.defineProperty(exports, "SUGGESTION_LIMITS", { enumerable: true, get: function () { return suggestions_1.SUGGESTION_LIMITS; } });
28
30
  const fileToolSchemas = {
@@ -1,7 +1,7 @@
1
1
  export declare const BROWSER_CAPABILITIES: readonly ["browser.tabs", "browser.scripting", "browser.history", "browser.bookmarks", "browser.downloads", "browser.notifications", "browser.debugger"];
2
2
  export declare const OS_CAPABILITIES: readonly ["os.shell", "os.files", "os.notifications"];
3
3
  export declare const IOS_CAPABILITIES: readonly ["ios.notifications", "ios.share-sheet", "ios.files"];
4
- export declare const MAC_DEVICE_CAPABILITIES: readonly ["automations.execute", "screentime", "local_directory", "healthkit", "photos", "calendar", "reminders", "system_audio", "computer_use"];
4
+ export declare const MAC_DEVICE_CAPABILITIES: readonly ["automations.execute", "screentime", "local_directory", "healthkit", "photos", "calendar", "reminders", "computer_use"];
5
5
  export declare const HEADLESS_CAPABILITIES: readonly ["os.shell", "os.files", "automations.execute"];
6
6
  export interface CapabilityAuthorizationResult {
7
7
  authorized: string[];
@@ -55,7 +55,6 @@ exports.MAC_DEVICE_CAPABILITIES = [
55
55
  "photos",
56
56
  "calendar",
57
57
  "reminders",
58
- "system_audio",
59
58
  "computer_use",
60
59
  ];
61
60
  // A server/VM with no UI or browser (the herdr box, a CI node, a k8s pod).
@@ -20,6 +20,8 @@
20
20
  export type ToolErrorCode =
21
21
  /** No auth profile configured for a connector that requires one. */
22
22
  "AUTH_MISSING"
23
+ /** Browser work stopped; an explicit bounded recovery or human handoff is required. */
24
+ | "BROWSER_INTERRUPTED"
23
25
  /** Credentials were rejected by the upstream (HTTP 401/403). */
24
26
  | "AUTH_INVALID"
25
27
  /** Connector / feed / connection / resource does not exist (HTTP 404). */
@@ -104,4 +106,34 @@ export interface ToolErrorSignal {
104
106
  * should source their retry decision from `isRetryable(classifyToolError(...))`.
105
107
  */
106
108
  export declare function classifyToolError(signal: ToolErrorSignal): ToolErrorCode;
109
+ /** Produced at the connector's page boundary, never inferred from error prose. */
110
+ declare const PAGE_INTERRUPTION_REASON_VALUES: readonly ["challenge_required", "login_required", "account_mismatch", "loading_failure"];
111
+ export type BrowserInterruptionReason = (typeof PAGE_INTERRUPTION_REASON_VALUES)[number] | "timeout" | "recovery_unavailable";
112
+ export interface BrowserRecovery {
113
+ recovery_id: string;
114
+ expires_at: string;
115
+ tab_id: number;
116
+ target_id: string;
117
+ window_id: number;
118
+ device_worker_id: string;
119
+ chrome_connection_id: number;
120
+ }
121
+ export declare class BrowserInterruptionError extends ToolError {
122
+ readonly reason: BrowserInterruptionReason;
123
+ readonly recovery?: BrowserRecovery | undefined;
124
+ constructor(reason: BrowserInterruptionReason, message: string, recovery?: BrowserRecovery | undefined);
125
+ toJSON(): {
126
+ recovery?: BrowserRecovery | undefined;
127
+ reason: BrowserInterruptionReason;
128
+ code: ToolErrorCode;
129
+ retryable: boolean;
130
+ message: string;
131
+ call_id?: string;
132
+ };
133
+ }
134
+ export declare function browserPageInterruption(value: unknown): {
135
+ reason: BrowserInterruptionReason;
136
+ message: string;
137
+ } | undefined;
138
+ export {};
107
139
  //# sourceMappingURL=connector-query-errors.d.ts.map
@@ -19,16 +19,21 @@
19
19
  * pick the right code; the catalog is the single source of truth for retryability.
20
20
  */
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
- exports.ToolError = exports.TOOL_ERRORS = void 0;
22
+ exports.BrowserInterruptionError = exports.ToolError = exports.TOOL_ERRORS = void 0;
23
23
  exports.isRetryable = isRetryable;
24
24
  exports.toToolErrorCode = toToolErrorCode;
25
25
  exports.isToolError = isToolError;
26
26
  exports.classifyToolError = classifyToolError;
27
+ exports.browserPageInterruption = browserPageInterruption;
27
28
  exports.TOOL_ERRORS = {
28
29
  AUTH_MISSING: {
29
30
  retryable: false,
30
31
  message: "No auth profile is configured for this connector.",
31
32
  },
33
+ BROWSER_INTERRUPTED: {
34
+ retryable: false,
35
+ message: "Browser reading was interrupted; see interruption.reason for the next step.",
36
+ },
32
37
  AUTH_INVALID: {
33
38
  retryable: false,
34
39
  message: "The connector's credentials were rejected.",
@@ -189,4 +194,39 @@ function classifyToolError(signal) {
189
194
  }
190
195
  return "INTERNAL";
191
196
  }
197
+ /** Produced at the connector's page boundary, never inferred from error prose. */
198
+ const PAGE_INTERRUPTION_REASON_VALUES = [
199
+ "challenge_required",
200
+ "login_required",
201
+ "account_mismatch",
202
+ "loading_failure",
203
+ ];
204
+ const PAGE_INTERRUPTION_REASONS = new Set(PAGE_INTERRUPTION_REASON_VALUES);
205
+ class BrowserInterruptionError extends ToolError {
206
+ constructor(reason, message, recovery) {
207
+ super("BROWSER_INTERRUPTED", message);
208
+ this.reason = reason;
209
+ this.recovery = recovery;
210
+ }
211
+ toJSON() {
212
+ return {
213
+ ...super.toJSON(),
214
+ reason: this.reason,
215
+ ...(this.recovery ? { recovery: this.recovery } : {}),
216
+ };
217
+ }
218
+ }
219
+ exports.BrowserInterruptionError = BrowserInterruptionError;
220
+ function browserPageInterruption(value) {
221
+ const marker = value?.__lobu_browser_interruption;
222
+ if (!marker ||
223
+ typeof marker.reason !== "string" ||
224
+ !PAGE_INTERRUPTION_REASONS.has(marker.reason) ||
225
+ typeof marker.message !== "string")
226
+ return undefined;
227
+ return {
228
+ reason: marker.reason,
229
+ message: marker.message.slice(0, 1000),
230
+ };
231
+ }
192
232
  //# sourceMappingURL=connector-query-errors.js.map
@@ -66,7 +66,7 @@ export declare const AgentInlineGuardrailSchema: import("@sinclair/typebox").TOb
66
66
  /**
67
67
  * For `judge` pre-tool: optional tool-name filter (run only for these tools).
68
68
  * For `require-tool`: the tool name(s) that must appear in this turn's
69
- * `toolsUsed` (manual, e.g. `["suggest_actions"]`).
69
+ * `toolsUsed` (manual, e.g. `["send_message"]`).
70
70
  */
71
71
  tools: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
72
72
  domains: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
@@ -149,7 +149,7 @@ export declare const AgentSettingsStoredSchema: import("@sinclair/typebox").TObj
149
149
  /**
150
150
  * For `judge` pre-tool: optional tool-name filter (run only for these tools).
151
151
  * For `require-tool`: the tool name(s) that must appear in this turn's
152
- * `toolsUsed` (manual, e.g. `["suggest_actions"]`).
152
+ * `toolsUsed` (manual, e.g. `["send_message"]`).
153
153
  */
154
154
  tools: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
155
155
  domains: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
@@ -157,6 +157,10 @@ export declare const AgentSettingsStoredSchema: import("@sinclair/typebox").TObj
157
157
  sandboxId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
158
158
  verboseLogging: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
159
159
  showToolCalls: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
160
+ starters: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
161
+ title: import("@sinclair/typebox").TString;
162
+ message: import("@sinclair/typebox").TString;
163
+ }>>>;
160
164
  updatedAt: import("@sinclair/typebox").TNumber;
161
165
  }>;
162
166
  export type AgentSettingsStored = Static<typeof AgentSettingsStoredSchema>;
@@ -76,7 +76,7 @@ exports.AgentInlineGuardrailSchema = typebox_1.Type.Object({
76
76
  /**
77
77
  * For `judge` pre-tool: optional tool-name filter (run only for these tools).
78
78
  * For `require-tool`: the tool name(s) that must appear in this turn's
79
- * `toolsUsed` (manual, e.g. `["suggest_actions"]`).
79
+ * `toolsUsed` (manual, e.g. `["send_message"]`).
80
80
  */
81
81
  tools: typebox_1.Type.Optional(typebox_1.Type.Array(typebox_1.Type.String())),
82
82
  domains: typebox_1.Type.Optional(typebox_1.Type.Array(typebox_1.Type.String())),
@@ -106,6 +106,16 @@ exports.SkillConfigSchema = typebox_1.Type.Object({
106
106
  exports.SkillsConfigSchema = typebox_1.Type.Object({
107
107
  skills: typebox_1.Type.Array(exports.SkillConfigSchema),
108
108
  });
109
+ /**
110
+ * Conversation starters an agent offers on an empty chat (web) and as Slack
111
+ * assistant thread-start prompts. Same `{title,message}` shape as follow-up
112
+ * chips; three at most so the empty state stays a short, tappable row.
113
+ */
114
+ const AGENT_STARTERS_MAX = 3;
115
+ const AgentStarterSchema = typebox_1.Type.Object({
116
+ title: typebox_1.Type.String({ minLength: 1, maxLength: 72 }),
117
+ message: typebox_1.Type.String({ minLength: 1, maxLength: 2000 }),
118
+ });
109
119
  // ── AgentSettingsStored ─────────────────────────────────────────────────────
110
120
  /**
111
121
  * What the DB persists (the `agents` row's settings jsonb columns). EXCLUDES
@@ -130,6 +140,7 @@ exports.AgentSettingsStoredSchema = typebox_1.Type.Object({
130
140
  sandboxId: typebox_1.Type.Optional(typebox_1.Type.String()),
131
141
  verboseLogging: typebox_1.Type.Optional(typebox_1.Type.Boolean()),
132
142
  showToolCalls: typebox_1.Type.Optional(typebox_1.Type.Boolean()),
143
+ starters: typebox_1.Type.Optional(typebox_1.Type.Array(AgentStarterSchema, { maxItems: AGENT_STARTERS_MAX })),
133
144
  updatedAt: typebox_1.Type.Number(),
134
145
  });
135
146
  //# sourceMappingURL=agent-settings.js.map
@@ -24,11 +24,11 @@ exports.ListConversationsAction = typebox_1.Type.Object({
24
24
  });
25
25
  exports.GetConversationAction = typebox_1.Type.Object({
26
26
  action: typebox_1.Type.Literal("get", {
27
- description: "Fetch one conversation by its (platform, conversation_id).",
27
+ description: "Fetch one conversation by id, optionally scoped to a platform.",
28
28
  }),
29
29
  agent_id: AgentId,
30
30
  platform: typebox_1.Type.Optional(typebox_1.Type.String({
31
- description: 'Conversation platform ("web" for app-owned conversations, or a channel platform like "slack"). Defaults to "web".',
31
+ description: 'Conversation platform ("web" for app-owned conversations, or a channel platform like "slack"). When omitted, resolves a unique active match for this agent across platforms; ambiguous ids return not found.',
32
32
  })),
33
33
  conversation_id: ConversationId,
34
34
  });
@@ -17,6 +17,7 @@ export declare const ReadFeedAction: import("@sinclair/typebox").TObject<{
17
17
  export declare const ReadFeedsAction: import("@sinclair/typebox").TObject<{
18
18
  action: import("@sinclair/typebox").TLiteral<"read_feeds">;
19
19
  reads: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
20
+ recovery_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
20
21
  feed_id: import("@sinclair/typebox").TInteger;
21
22
  query: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
22
23
  limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
@@ -104,6 +105,18 @@ export declare const ManageFeedsResultSchema: import("@sinclair/typebox").TUnion
104
105
  error: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
105
106
  error_code: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
106
107
  retryable: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
108
+ interruption: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
109
+ reason: import("@sinclair/typebox").TString;
110
+ recovery: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
111
+ recovery_id: import("@sinclair/typebox").TString;
112
+ expires_at: import("@sinclair/typebox").TString;
113
+ tab_id: import("@sinclair/typebox").TInteger;
114
+ target_id: import("@sinclair/typebox").TString;
115
+ window_id: import("@sinclair/typebox").TInteger;
116
+ device_worker_id: import("@sinclair/typebox").TString;
117
+ chrome_connection_id: import("@sinclair/typebox").TInteger;
118
+ }>>;
119
+ }>>;
107
120
  }>>;
108
121
  failures: import("@sinclair/typebox").TInteger;
109
122
  timeout_ms: import("@sinclair/typebox").TInteger;
@@ -148,6 +161,7 @@ export declare const ManageFeedsSchema: import("@sinclair/typebox").TUnion<[impo
148
161
  }>, import("@sinclair/typebox").TObject<{
149
162
  action: import("@sinclair/typebox").TLiteral<"read_feeds">;
150
163
  reads: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
164
+ recovery_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
151
165
  feed_id: import("@sinclair/typebox").TInteger;
152
166
  query: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
153
167
  limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
@@ -33,6 +33,11 @@ exports.ReadFeedAction = typebox_1.Type.Object({
33
33
  feed_id: typebox_1.Type.Number({ description: "Feed ID" }),
34
34
  });
35
35
  const FeedSourceRead = typebox_1.Type.Object({
36
+ recovery_id: typebox_1.Type.Optional(typebox_1.Type.String({
37
+ minLength: 1,
38
+ maxLength: 128,
39
+ description: "Consume a recovery handoff once for the identical source request, on its retained tab. The expected account is verified again.",
40
+ })),
36
41
  feed_id: typebox_1.Type.Integer({
37
42
  minimum: 1,
38
43
  description: "Feed ID to query at its source.",
@@ -183,6 +188,18 @@ exports.ManageFeedsResultSchema = typebox_1.Type.Union([
183
188
  error: typebox_1.Type.Optional(typebox_1.Type.String()),
184
189
  error_code: typebox_1.Type.Optional(typebox_1.Type.String()),
185
190
  retryable: typebox_1.Type.Optional(typebox_1.Type.Boolean()),
191
+ interruption: typebox_1.Type.Optional(typebox_1.Type.Object({
192
+ reason: typebox_1.Type.String(),
193
+ recovery: typebox_1.Type.Optional(typebox_1.Type.Object({
194
+ recovery_id: typebox_1.Type.String(),
195
+ expires_at: typebox_1.Type.String(),
196
+ tab_id: typebox_1.Type.Integer(),
197
+ target_id: typebox_1.Type.String(),
198
+ window_id: typebox_1.Type.Integer(),
199
+ device_worker_id: typebox_1.Type.String(),
200
+ chrome_connection_id: typebox_1.Type.Integer(),
201
+ })),
202
+ })),
186
203
  })),
187
204
  failures: typebox_1.Type.Integer(),
188
205
  timeout_ms: typebox_1.Type.Integer(),