@lobu/runtime-device 20.0.0 → 20.0.1

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 (59) hide show
  1. package/dist/component.json +1 -1
  2. package/dist/dependencies.bun.lock +5 -5
  3. package/npm-shrinkwrap.json +23 -23
  4. package/package.json +1 -1
  5. package/vendor/cli/dist/commands/_lib/apply/apply-cmd.js +14 -4
  6. package/vendor/cli/dist/commands/_lib/apply/deployment.js +1 -1
  7. package/vendor/cli/dist/commands/_lib/apply/desired-state.d.ts +10 -3
  8. package/vendor/cli/dist/commands/_lib/apply/desired-state.js +45 -6
  9. package/vendor/cli/dist/commands/_lib/apply/diff.d.ts +3 -0
  10. package/vendor/cli/dist/commands/_lib/apply/diff.js +10 -3
  11. package/vendor/cli/dist/commands/_lib/apply/map-config.js +17 -12
  12. package/vendor/cli/dist/commands/_lib/apply/shared.d.ts +6 -2
  13. package/vendor/cli/dist/commands/_lib/apply/shared.js +11 -4
  14. package/vendor/cli/dist/commands/call.js +9 -3
  15. package/vendor/cli/dist/commands/dev.js +2 -1
  16. package/vendor/cli/dist/commands/doctor.d.ts +6 -0
  17. package/vendor/cli/dist/commands/doctor.js +26 -0
  18. package/vendor/cli/dist/commands/init.d.ts +3 -1
  19. package/vendor/cli/dist/commands/init.js +26 -15
  20. package/vendor/cli/dist/commands/memory/_lib/mcp.d.ts +0 -6
  21. package/vendor/cli/dist/commands/memory/_lib/mcp.js +1 -14
  22. package/vendor/cli/dist/commands/org.js +8 -0
  23. package/vendor/cli/dist/commands/whoami.d.ts +1 -0
  24. package/vendor/cli/dist/commands/whoami.js +10 -4
  25. package/vendor/cli/dist/config/define.d.ts +21 -6
  26. package/vendor/cli/dist/config/define.js +4 -0
  27. package/vendor/cli/dist/connectors/chat-automation-events.ts +33 -0
  28. package/vendor/cli/dist/connectors/discord.ts +2 -0
  29. package/vendor/cli/dist/connectors/gchat.ts +2 -0
  30. package/vendor/cli/dist/connectors/google_drive.ts +210 -40
  31. package/vendor/cli/dist/connectors/slack-automation-events.ts +0 -31
  32. package/vendor/cli/dist/connectors/slack.ts +2 -2
  33. package/vendor/cli/dist/connectors/teams.ts +2 -0
  34. package/vendor/cli/dist/connectors/telegram.ts +2 -0
  35. package/vendor/cli/dist/connectors/whatsapp.ts +2 -0
  36. package/vendor/cli/dist/index.js +3 -1
  37. package/vendor/cli/dist/internal/gateway-url.d.ts +4 -4
  38. package/vendor/cli/dist/internal/gateway-url.js +4 -4
  39. package/vendor/cli/dist/mac-auth.js +3 -1
  40. package/vendor/cli/dist/runtime-components.json +4 -4
  41. package/vendor/cli/package.json +1 -1
  42. package/vendor/connector-sdk/dist/index.d.ts +1 -1
  43. package/vendor/connector-sdk/dist/logger.js +4 -1
  44. package/vendor/connector-sdk/dist/reaction-sdk.d.ts +9 -0
  45. package/vendor/connector-sdk/package.json +1 -1
  46. package/vendor/connector-worker/dist/agent-turn/guest.bundle.js +13 -1
  47. package/vendor/connector-worker/dist/agent-turn/workspace.d.ts +9 -0
  48. package/vendor/connector-worker/dist/agent-turn/workspace.js +27 -1
  49. package/vendor/connector-worker/dist/daemon/client.d.ts +8 -2
  50. package/vendor/connector-worker/dist/daemon/client.js +3 -2
  51. package/vendor/connector-worker/dist/daemon/poll-loop.d.ts +1 -0
  52. package/vendor/connector-worker/dist/daemon/poll-loop.js +20 -2
  53. package/vendor/connector-worker/package.json +1 -1
  54. package/vendor/core/dist/contracts/tools/manage-automations.d.ts +16 -0
  55. package/vendor/core/dist/contracts/tools/manage-automations.js +12 -3
  56. package/vendor/core/dist/contracts/worker/protocol.d.ts +9 -0
  57. package/vendor/core/dist/contracts/worker/protocol.js +10 -1
  58. package/vendor/core/dist/logger.js +4 -2
  59. package/vendor/core/package.json +1 -1
@@ -147,10 +147,22 @@ const TEXTUAL_MIME_TYPES = new Set([
147
147
  * This is NOT the artifact limit — it is an embedding-cost limit. Every event's
148
148
  * payload is chunked and embedded, so a 10 MB CSV inlined here would produce
149
149
  * hundreds of vectors of almost no retrieval value. Files above the cap sync as
150
- * metadata and their content is fetched on demand through `get_file_content`.
150
+ * metadata and their content is fetched on demand through `download_file`.
151
151
  */
152
152
  const MAX_INLINE_TEXT_BYTES = 256 * 1024;
153
153
 
154
+ /**
155
+ * Default and ceiling for the text `download_file` echoes back inline.
156
+ *
157
+ * Inlining is a convenience for the caller that wants to READ a small file
158
+ * without a second fetch through the artifact's `download_url`. It is not the
159
+ * transport: the attachment is published either way. The ceiling exists because
160
+ * inline content lands in an agent's context verbatim, where a multi-megabyte
161
+ * blob is worse than useless — the `download_url` is the path for anything big.
162
+ */
163
+ const DEFAULT_INLINE_CONTENT_BYTES = 256 * 1024;
164
+ const MAX_INLINE_CONTENT_BYTES = 1024 * 1024;
165
+
154
166
  /**
155
167
  * Grace window subtracted from `last_sync_at` before deciding a file's content
156
168
  * is unchanged.
@@ -163,7 +175,11 @@ const MAX_INLINE_TEXT_BYTES = 256 * 1024;
163
175
  */
164
176
  const CONTENT_SKEW_GRACE_MS = 5 * 60 * 1000;
165
177
 
166
- /** Google's own hard cap on `files.export`. Requesting more returns a 403. */
178
+ /**
179
+ * Ceiling on anything this connector pulls in one piece — Google's own hard cap
180
+ * on `files.export` (requesting more returns a 403), reused as the `alt=media`
181
+ * download ceiling so both content paths refuse at the same size.
182
+ */
167
183
  const MAX_EXPORT_BYTES = 10 * 1024 * 1024;
168
184
 
169
185
  /** Field mask for files.list / changes.list. Drive v3 returns almost nothing without it. */
@@ -228,6 +244,27 @@ function decodeTruncated(encoded: Uint8Array, maxBytes: number): string {
228
244
  return '';
229
245
  }
230
246
 
247
+ /**
248
+ * Decode downloaded bytes as text and cut them to the inline budget.
249
+ *
250
+ * The decode comes FIRST because `decodeTruncated` requires well-formed UTF-8
251
+ * (it hands back nothing rather than manufacture a U+FFFD), and a downloaded
252
+ * file is not required to be any such thing — a latin-1 CSV would otherwise
253
+ * inline as an empty string, the exact "looks like an empty file" outcome this
254
+ * connector refuses everywhere else. Decoding lossily once and re-encoding
255
+ * gives the truncator the input it documents, and makes a truncated file read
256
+ * the same as the first page of an untruncated one.
257
+ */
258
+ function inlineText(
259
+ bytes: Uint8Array,
260
+ maxBytes: number
261
+ ): { content: string; truncated: boolean } {
262
+ const text = new TextDecoder('utf-8').decode(bytes);
263
+ const encoded = new TextEncoder().encode(text);
264
+ if (encoded.byteLength <= maxBytes) return { content: text, truncated: false };
265
+ return { content: decodeTruncated(encoded, maxBytes), truncated: true };
266
+ }
267
+
231
268
  function exportMimeTypeFor(mimeType: string | undefined): string | undefined {
232
269
  if (!mimeType) return undefined;
233
270
  return EXPORT_MIME_TYPES[mimeType];
@@ -423,25 +460,27 @@ export default class GoogleDriveConnector extends ConnectorRuntime<
423
460
  },
424
461
  },
425
462
  actions: {
426
- get_file_content: {
427
- key: 'get_file_content',
463
+ download_file: {
464
+ key: 'download_file',
428
465
  kind: 'read',
429
466
  requiresApproval: false,
430
- name: 'Get File Content',
467
+ name: 'Download File',
431
468
  description:
432
- 'Read one Drive file as text. Google Docs/Sheets/Slides are exported (text/plain, CSV); other files are downloaded as-is. Binary files are rejected rather than returned as mojibake.',
469
+ 'Download one Drive file. Google Docs/Sheets/Slides are exported (text/plain, CSV); everything else is downloaded as-is, binary included. The bytes are published as an attachment with a `download_url` a device can fetch, and small text files are ALSO returned inline as `content` so they can be read without a second call.',
433
470
  requiredScopes: ['https://www.googleapis.com/auth/drive.readonly'],
434
471
  inputSchema: {
435
472
  type: 'object',
436
473
  required: ['file_id'],
437
474
  properties: {
438
- file_id: { type: 'string', description: 'Drive file ID to read.' },
439
- max_bytes: {
475
+ file_id: {
476
+ type: 'string',
477
+ description: 'Drive file ID to download.',
478
+ },
479
+ inline_max_bytes: {
440
480
  type: 'integer',
441
- minimum: 1,
442
- maximum: MAX_EXPORT_BYTES,
443
- description:
444
- 'Truncate the returned text to this many bytes (default 1048576).',
481
+ minimum: 0,
482
+ maximum: MAX_INLINE_CONTENT_BYTES,
483
+ description: `Return text content inline when the file is at most this many bytes (default ${DEFAULT_INLINE_CONTENT_BYTES}, max ${MAX_INLINE_CONTENT_BYTES}). Binary files are never inlined. 0 disables inlining; the attachment is still published.`,
445
484
  },
446
485
  },
447
486
  },
@@ -831,8 +870,8 @@ export default class GoogleDriveConnector extends ConnectorRuntime<
831
870
  const http = this.client(token);
832
871
 
833
872
  switch (ctx.actionKey) {
834
- case 'get_file_content':
835
- return await this.getFileContent(http, ctx.input);
873
+ case 'download_file':
874
+ return await this.downloadFile(http, ctx.input);
836
875
  case 'get_file':
837
876
  return await this.getFile(http, ctx.input);
838
877
  default:
@@ -860,16 +899,33 @@ export default class GoogleDriveConnector extends ConnectorRuntime<
860
899
  return { success: true, output: this.driveFileToRow(file) };
861
900
  }
862
901
 
863
- private async getFileContent(
902
+ /**
903
+ * Download a file's bytes and publish them as an attachment.
904
+ *
905
+ * The bytes always go out as an attachment, so the gateway stores them and
906
+ * hands back a `download_url` — that is the path a device or sandbox uses,
907
+ * and it is why binary is no longer refused here. Inline `content` is an
908
+ * extra for the small-text case only: a caller that just wants to read a
909
+ * config file should not have to make a second request for it.
910
+ *
911
+ * Nothing here enforces the gateway's attachment size cap. The gateway owns
912
+ * that limit and reports what it refused in `attachments_rejected`;
913
+ * duplicating the number on this side of the boundary would just let the two
914
+ * drift apart.
915
+ */
916
+ private async downloadFile(
864
917
  http: HttpClient,
865
918
  input: Record<string, unknown>
866
919
  ): Promise<ActionResult> {
867
920
  const fileId = input.file_id as string;
868
921
  if (!fileId) return { success: false, error: 'file_id is required.' };
869
922
 
870
- const maxBytes = Math.min(
871
- (input.max_bytes as number) ?? 1024 * 1024,
872
- MAX_EXPORT_BYTES
923
+ const requestedInline = input.inline_max_bytes;
924
+ const inlineMaxBytes = Math.min(
925
+ typeof requestedInline === 'number' && Number.isFinite(requestedInline) && requestedInline >= 0
926
+ ? requestedInline
927
+ : DEFAULT_INLINE_CONTENT_BYTES,
928
+ MAX_INLINE_CONTENT_BYTES
873
929
  );
874
930
 
875
931
  const file = await this.fetchFileMetadata(http, fileId);
@@ -877,22 +933,51 @@ export default class GoogleDriveConnector extends ConnectorRuntime<
877
933
  return { success: false, error: `Drive file not found: ${fileId}` };
878
934
  }
879
935
 
880
- const fetched = await this.fetchTextContent(http, file, maxBytes);
936
+ const fetched = await this.fetchFileBytes(http, file);
881
937
  if (!fetched.ok) {
882
938
  return { success: false, error: fetched.error };
883
939
  }
884
940
 
941
+ const filename = file.name ?? file.id;
942
+ // `kind` is deliberately omitted: the gateway infers it from the media type
943
+ // (`inferKindFromMime`), so there is one rule rather than two that can
944
+ // disagree about what counts as an image.
945
+ const attachment = {
946
+ filename,
947
+ mime_type: fetched.contentType,
948
+ data: fetched.bytes.toString('base64'),
949
+ size_bytes: fetched.bytes.length,
950
+ };
951
+
952
+ // Text is TRUNCATED to the inline budget rather than withheld: an agent
953
+ // peeking at a large log or CSV is better served by its first page than by
954
+ // being told to go fetch a URL. The attachment always carries the whole
955
+ // file, so truncating here loses nothing.
956
+ const textual =
957
+ fetched.exportedAs !== undefined || isTextualMimeType(file.mimeType);
958
+ const inline = inlineMaxBytes > 0 && textual ? inlineText(fetched.bytes, inlineMaxBytes) : undefined;
959
+
885
960
  return {
886
961
  success: true,
887
962
  output: {
888
963
  file_id: file.id,
889
- name: file.name ?? '',
964
+ name: filename,
890
965
  mime_type: file.mimeType ?? '',
891
966
  exported_as: fetched.exportedAs,
892
- truncated: fetched.truncated,
893
- byte_count: fetched.byteCount,
894
- line_count: fetched.text.length === 0 ? 0 : fetched.text.split('\n').length,
895
- content: fetched.text,
967
+ size_bytes: fetched.bytes.length,
968
+ attachments: [attachment],
969
+ ...(inline
970
+ ? {
971
+ content: inline.content,
972
+ content_truncated: inline.truncated,
973
+ line_count:
974
+ inline.content.length === 0 ? 0 : inline.content.split('\n').length,
975
+ }
976
+ : {
977
+ content_omitted_reason: textual
978
+ ? 'inlining disabled'
979
+ : 'file is binary; fetch it through the attachment download_url',
980
+ }),
896
981
  },
897
982
  };
898
983
  }
@@ -901,12 +986,106 @@ export default class GoogleDriveConnector extends ConnectorRuntime<
901
986
  // Content fetching
902
987
  // -------------------------------------------------------------------------
903
988
 
989
+ /**
990
+ * Decide how a file's content is retrieved: `files.export` for a Google-native
991
+ * doc, `alt=media` for everything else.
992
+ *
993
+ * Shared by the bytes and text paths so the two can never disagree about
994
+ * which URL a given file needs, or about which items have no content at all.
995
+ */
996
+ private contentRequest(
997
+ file: DriveFile
998
+ ): { ok: true; url: string; exportMime?: string } | { ok: false; error: string } {
999
+ const exportMime = exportMimeTypeFor(file.mimeType);
1000
+
1001
+ if (isGoogleNative(file.mimeType) && !exportMime) {
1002
+ return {
1003
+ ok: false,
1004
+ error: `Google Drive item of type ${file.mimeType} has no text export (folders, shortcuts and forms carry no content).`,
1005
+ };
1006
+ }
1007
+
1008
+ return {
1009
+ ok: true,
1010
+ url: exportMime
1011
+ ? `${this.BASE_URL}/files/${encodeURIComponent(file.id)}/export?mimeType=${encodeURIComponent(exportMime)}`
1012
+ : `${this.BASE_URL}/files/${encodeURIComponent(file.id)}?alt=media&supportsAllDrives=true`,
1013
+ ...(exportMime ? { exportMime } : {}),
1014
+ };
1015
+ }
1016
+
1017
+ /**
1018
+ * Fetch a file's raw bytes, binary included.
1019
+ *
1020
+ * Unlike `fetchTextContent` this never decodes, so a PDF or an image survives
1021
+ * intact on its way to the artifact store. Google-native docs still go through
1022
+ * `files.export`, because their "raw" bytes are not a document.
1023
+ */
1024
+ private async fetchFileBytes(
1025
+ http: HttpClient,
1026
+ file: DriveFile
1027
+ ): Promise<
1028
+ | { ok: true; bytes: Buffer; contentType: string; exportedAs?: string }
1029
+ | { ok: false; error: string }
1030
+ > {
1031
+ const request = this.contentRequest(file);
1032
+ if (!request.ok) return request;
1033
+
1034
+ // Refuse before fetching. The isolate buffers the whole body, then base64s
1035
+ // it to cross the host boundary at 4/3 the size, so an unbounded download
1036
+ // is an out-of-memory kill rather than an error the caller can read.
1037
+ // MAX_EXPORT_BYTES sits above the gateway's own attachment cap on purpose:
1038
+ // the gateway stays the authority on what is too big to store, and this
1039
+ // only stops what cannot physically make the trip.
1040
+ const declaredSize = parseSize(file.size);
1041
+ if (declaredSize !== undefined && declaredSize > MAX_EXPORT_BYTES) {
1042
+ return {
1043
+ ok: false,
1044
+ error: `File ${file.name ?? file.id} is ${declaredSize} bytes, above the ${MAX_EXPORT_BYTES}-byte download limit.`,
1045
+ };
1046
+ }
1047
+
1048
+ const response = await http.raw(request.url);
1049
+ if (!response.ok) {
1050
+ return {
1051
+ ok: false,
1052
+ error: `Drive ${request.exportMime ? 'files.export' : 'files.get'} error (${response.status}): ${await response.text()}`,
1053
+ };
1054
+ }
1055
+
1056
+ const bytes = Buffer.from(await response.arrayBuffer());
1057
+ if (bytes.length > MAX_EXPORT_BYTES) {
1058
+ // Drive omits `size` for native docs, so the export path only learns the
1059
+ // real size here. Same refusal, after the fact.
1060
+ return {
1061
+ ok: false,
1062
+ error: `File ${file.name ?? file.id} returned ${bytes.length} bytes, above the ${MAX_EXPORT_BYTES}-byte download limit.`,
1063
+ };
1064
+ }
1065
+ if (bytes.length === 0) {
1066
+ return { ok: false, error: `Drive file ${file.name ?? file.id} is empty.` };
1067
+ }
1068
+
1069
+ return {
1070
+ ok: true,
1071
+ bytes,
1072
+ contentType:
1073
+ request.exportMime ??
1074
+ response.headers.get('content-type')?.split(';')[0]?.trim() ??
1075
+ file.mimeType ??
1076
+ 'application/octet-stream',
1077
+ ...(request.exportMime ? { exportedAs: request.exportMime } : {}),
1078
+ };
1079
+ }
1080
+
904
1081
  /**
905
1082
  * Fetch a file's text, choosing export vs. direct download by MIME type.
906
1083
  *
907
1084
  * Binary files are refused rather than decoded: running a PDF through
908
1085
  * `response.text()` yields replacement characters that look like content to
909
- * a model and would be indistinguishable from a genuinely empty file.
1086
+ * a model and would be indistinguishable from a genuinely empty file. This
1087
+ * path feeds the FEED, where the text is embedded; `download_file` uses
1088
+ * `fetchFileBytes` and has no such restriction.
910
1089
  */
911
1090
  private async fetchTextContent(
912
1091
  http: HttpClient,
@@ -922,27 +1101,18 @@ export default class GoogleDriveConnector extends ConnectorRuntime<
922
1101
  }
923
1102
  | { ok: false; error: string }
924
1103
  > {
925
- const exportMime = exportMimeTypeFor(file.mimeType);
926
-
927
- if (isGoogleNative(file.mimeType) && !exportMime) {
928
- return {
929
- ok: false,
930
- error: `Google Drive item of type ${file.mimeType} has no text export (folders, shortcuts and forms carry no content).`,
931
- };
932
- }
1104
+ const request = this.contentRequest(file);
1105
+ if (!request.ok) return request;
1106
+ const exportMime = request.exportMime;
933
1107
 
934
1108
  if (!exportMime && !isTextualMimeType(file.mimeType)) {
935
1109
  return {
936
1110
  ok: false,
937
- error: `File ${file.name ?? file.id} is binary (${file.mimeType ?? 'unknown type'}); its bytes are not text and were not decoded.`,
1111
+ error: `File ${file.name ?? file.id} is binary (${file.mimeType ?? 'unknown type'}); its bytes are not text and were not decoded. Use download_file to fetch it.`,
938
1112
  };
939
1113
  }
940
1114
 
941
- const url = exportMime
942
- ? `${this.BASE_URL}/files/${encodeURIComponent(file.id)}/export?mimeType=${encodeURIComponent(exportMime)}`
943
- : `${this.BASE_URL}/files/${encodeURIComponent(file.id)}?alt=media&supportsAllDrives=true`;
944
-
945
- const response = await http.raw(url);
1115
+ const response = await http.raw(request.url);
946
1116
  if (!response.ok) {
947
1117
  return {
948
1118
  ok: false,
@@ -1076,7 +1246,7 @@ export default class GoogleDriveConnector extends ConnectorRuntime<
1076
1246
  // The failure is RECORDED rather than retried. A file that syncs once and
1077
1247
  // never changes again is never revisited, so a silent miss would be
1078
1248
  // permanent and indistinguishable from "this file has no text by design".
1079
- // `content_error` makes the two tellable apart, and the `get_file_content`
1249
+ // `content_error` makes the two tellable apart, and the `download_file`
1080
1250
  // action can still fetch on demand — which is the recovery path, not a
1081
1251
  // retry queue whose state would grow without bound.
1082
1252
  if (includeContent && this.shouldInlineContent(file, lastSyncAt)) {
@@ -1,34 +1,3 @@
1
- import type { ConnectorAutomationEvent } from "@lobu/connector-sdk";
2
-
3
- export const SLACK_AUTOMATION_EVENTS: ConnectorAutomationEvent[] = [
4
- {
5
- key: "message.created",
6
- label: "A message is sent",
7
- description: "Runs for messages in the selected Slack conversation scope.",
8
- resourceType: "channel",
9
- filterSchema: {
10
- type: "object",
11
- properties: {
12
- channel_id: {
13
- type: "string",
14
- title: "Channel",
15
- description: "Optional channel or direct-message identifier.",
16
- },
17
- mention_only: {
18
- type: "boolean",
19
- title: "Only when mentioned",
20
- },
21
- },
22
- },
23
- capabilities: { steering: true, replyToSource: true },
24
- defaults: {
25
- execution: "turn",
26
- activeRun: "steer",
27
- output: "reply_to_source",
28
- },
29
- },
30
- ];
31
-
32
1
  interface SlackMessageEvent {
33
2
  type?: string;
34
3
  channel?: string;
@@ -30,7 +30,7 @@ import {
30
30
  type ConnectorDefinition,
31
31
  IntegrationConnector,
32
32
  } from "@lobu/connector-sdk";
33
- import { SLACK_AUTOMATION_EVENTS } from "./slack-automation-events.js";
33
+ import { CHAT_AUTOMATION_EVENTS } from "./chat-automation-events.js";
34
34
 
35
35
  /**
36
36
  * Bot scopes requested by `/slack/install`. The Slack manifest does not drive
@@ -82,7 +82,7 @@ export default class SlackConnector extends IntegrationConnector {
82
82
  description:
83
83
  "Connect a Slack workspace to Lobu. Mention the bot, DM it, or run /lobu in any channel to drive a sandboxed agent.",
84
84
  version: "1.0.0",
85
- automationEvents: SLACK_AUTOMATION_EVENTS,
85
+ automationEvents: CHAT_AUTOMATION_EVENTS,
86
86
  faviconDomain: "slack.com",
87
87
  webhook: {
88
88
  // App-level delivery: one webhook is configured ONCE on the Slack app, and
@@ -2,11 +2,13 @@ import {
2
2
  type ConnectorDefinition,
3
3
  IntegrationConnector,
4
4
  } from "@lobu/connector-sdk";
5
+ import { CHAT_AUTOMATION_EVENTS } from "./chat-automation-events.js";
5
6
 
6
7
  export default class TeamsConnector extends IntegrationConnector {
7
8
  readonly definition: ConnectorDefinition = {
8
9
  key: "teams",
9
10
  kind: "integration",
11
+ automationEvents: CHAT_AUTOMATION_EVENTS,
10
12
  name: "Microsoft Teams",
11
13
  description: "Connect a Microsoft Teams bot to Lobu.",
12
14
  version: "1.0.0",
@@ -2,11 +2,13 @@ import {
2
2
  type ConnectorDefinition,
3
3
  IntegrationConnector,
4
4
  } from "@lobu/connector-sdk";
5
+ import { CHAT_AUTOMATION_EVENTS } from "./chat-automation-events.js";
5
6
 
6
7
  export default class TelegramConnector extends IntegrationConnector {
7
8
  readonly definition: ConnectorDefinition = {
8
9
  key: "telegram",
9
10
  kind: "integration",
11
+ automationEvents: CHAT_AUTOMATION_EVENTS,
10
12
  name: "Telegram",
11
13
  description: "Connect a Telegram bot and route chats to Lobu agents.",
12
14
  version: "1.0.0",
@@ -2,11 +2,13 @@ import {
2
2
  type ConnectorDefinition,
3
3
  IntegrationConnector,
4
4
  } from "@lobu/connector-sdk";
5
+ import { CHAT_AUTOMATION_EVENTS } from "./chat-automation-events.js";
5
6
 
6
7
  export default class WhatsAppConnector extends IntegrationConnector {
7
8
  readonly definition: ConnectorDefinition = {
8
9
  key: "whatsapp",
9
10
  kind: "integration",
11
+ automationEvents: CHAT_AUTOMATION_EVENTS,
10
12
  name: "WhatsApp Cloud",
11
13
  description: "Connect a WhatsApp Cloud API phone number to Lobu.",
12
14
  version: "1.0.0",
@@ -129,6 +129,7 @@ Memory:
129
129
  .option("--list-providers", "Print available provider ids from config/providers.json and exit")
130
130
  .option("--from-org [slug]", "Bootstrap a re-appliable project from an existing org (defaults to active session)")
131
131
  .option("--url <url>", "Server URL override (with --from-org)")
132
+ .option("--skip-install", "Scaffold files without installing dependencies (run npm install or bun install later)")
132
133
  .action(async (name,
133
134
  // Commander's raw shape: `sentry` is a tristate (true=--sentry,
134
135
  // false=--no-sentry, undefined=neither) and `fromOrg` is string|true.
@@ -263,7 +264,8 @@ Memory:
263
264
  withCommonOpts(program
264
265
  .command("whoami")
265
266
  .description("Show current user and linked agent")
266
- .option("--json", "Emit machine-readable session JSON (for Owletto Mac)")).action(async (options) => {
267
+ .option("--json", "Emit machine-readable session JSON (for Owletto Mac)")
268
+ .option("--include-tokens", "Include raw auth tokens (trusted local clients only)")).action(async (options) => {
267
269
  const { whoamiCommand } = await import("./commands/whoami.js");
268
270
  await whoamiCommand(options);
269
271
  });
@@ -1,10 +1,10 @@
1
1
  export declare const GATEWAY_DEFAULT_URL = "http://localhost:8787";
2
2
  /**
3
3
  * The embedded Lobu server mounts its public Agent API (`/api/v1/agents/*`,
4
- * `/api/docs`) under this path prefix — see `packages/server/src/server.ts`'s
5
- * `app.route('/lobu', ...)`. Every deployment (local `lobu run`, app.lobu.ai,
6
- * community.lobu.ai) follows this layout: the org-scoped admin REST API and
7
- * OAuth live at the origin, the Agent API lives at `<origin>/lobu`.
4
+ * `/api/docs`) under this path prefix — see `buildWrapperApp` in
5
+ * `packages/server/src/server-lifecycle.ts`. Every deployment (local `lobu run`,
6
+ * app.lobu.ai, community.lobu.ai) follows this layout: the org-scoped admin
7
+ * REST API and OAuth live at the origin, the Agent API lives at `<origin>/lobu`.
8
8
  */
9
9
  export declare const GATEWAY_AGENT_API_PREFIX = "/lobu";
10
10
  /**
@@ -4,10 +4,10 @@ import { parseEnvContent } from "./env-file.js";
4
4
  export const GATEWAY_DEFAULT_URL = "http://localhost:8787";
5
5
  /**
6
6
  * The embedded Lobu server mounts its public Agent API (`/api/v1/agents/*`,
7
- * `/api/docs`) under this path prefix — see `packages/server/src/server.ts`'s
8
- * `app.route('/lobu', ...)`. Every deployment (local `lobu run`, app.lobu.ai,
9
- * community.lobu.ai) follows this layout: the org-scoped admin REST API and
10
- * OAuth live at the origin, the Agent API lives at `<origin>/lobu`.
7
+ * `/api/docs`) under this path prefix — see `buildWrapperApp` in
8
+ * `packages/server/src/server-lifecycle.ts`. Every deployment (local `lobu run`,
9
+ * app.lobu.ai, community.lobu.ai) follows this layout: the org-scoped admin
10
+ * REST API and OAuth live at the origin, the Agent API lives at `<origin>/lobu`.
11
11
  */
12
12
  export const GATEWAY_AGENT_API_PREFIX = "/lobu";
13
13
  /**
@@ -41,7 +41,9 @@ async function runMacAuthCli(argv = process.argv) {
41
41
  .option("-c, --context <name>", "Use a named context")
42
42
  .option("--json", "Emit machine-readable session JSON")
43
43
  .action(async (options) => {
44
- await whoamiCommand(options);
44
+ // This entrypoint is bundled inside Owletto and is the trusted native
45
+ // credential bridge. The general `lobu whoami --json` stays token-free.
46
+ await whoamiCommand({ ...options, includeTokens: true });
45
47
  });
46
48
  try {
47
49
  await program.parseAsync([...argv]);
@@ -5,7 +5,7 @@
5
5
  "server": "dist/server.bundle.mjs",
6
6
  "embeddingsServer": "dist/embeddings-server.mjs"
7
7
  },
8
- "version": "20.0.0",
8
+ "version": "20.0.1",
9
9
  "verify": "dist/verify.mjs"
10
10
  },
11
11
  "device": {
@@ -16,7 +16,7 @@
16
16
  "connector": "node_modules/@lobu/cli/dist/commands/connector.js",
17
17
  "worker": "node_modules/@lobu/connector-worker/dist/bin.js"
18
18
  },
19
- "version": "20.0.0",
19
+ "version": "20.0.1",
20
20
  "verify": "dist/verify.mjs"
21
21
  },
22
22
  "postgres": {
@@ -24,7 +24,7 @@
24
24
  "entries": {
25
25
  "postgres": "dist/index.mjs"
26
26
  },
27
- "version": "20.0.0",
27
+ "version": "20.0.1",
28
28
  "verify": "dist/verify.mjs"
29
29
  },
30
30
  "embeddings": {
@@ -32,7 +32,7 @@
32
32
  "entries": {
33
33
  "embeddings": "dist/embeddings.js"
34
34
  },
35
- "version": "20.0.0",
35
+ "version": "20.0.1",
36
36
  "verify": "dist/verify.mjs"
37
37
  }
38
38
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobu/cli",
3
- "version": "20.0.0",
3
+ "version": "20.0.1",
4
4
  "description": "CLI for deploying and managing AI agents on Lobu",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -39,7 +39,7 @@ export type { ExtensionDomScrapeResult, ExtensionScrapeConfig, ExtensionScrapeOb
39
39
  export { extensionDomScrape } from './extension-dom-scrape.js';
40
40
  export type { ChromeActionDispatcher, ChromeActionInput, ChromeActionOutput, ExtensionNetworkConfig, ExtensionNetworkPattern, ExtensionNetworkResult, InterceptedResponse, NavigateObservation, NetworkInterceptDrainObservation, NetworkInterceptStartObservation, } from './extension-network.js';
41
41
  export { extensionNetworkSync } from './extension-network.js';
42
- export type { ReactionContext } from './reaction-sdk.js';
42
+ export type { AutomationScriptContext, ReactionContext, } from './reaction-sdk.js';
43
43
  export type { ReactionClient } from './reaction-client-types.js';
44
44
  export type { CardElement, KnowledgeDeleteInput, KnowledgeReadInput, KnowledgeSaveInput, KnowledgeSaveResult, KnowledgeSearchInput, NotificationsSendInput, NotificationsSendResult, } from './reaction-client-types.js';
45
45
  export type { ConnectionListInput } from '@lobu/core/contracts/tools/manage-connections';
@@ -55,8 +55,11 @@ function formatMessage(level, serviceName, message, args) {
55
55
  // pino-style: logger.info({ meta }, 'message')
56
56
  if (typeof message === 'object' && message !== null && !Array.isArray(message) && !(message instanceof Error)) {
57
57
  if (rest.length > 0 && typeof rest[0] === 'string') {
58
+ // Keep the metadata object as a trailing arg so it still renders.
59
+ // Slicing it away accepted the signature and then dropped the payload,
60
+ // leaving a connector diagnostic with its message but no fields.
58
61
  msgStr = rest[0];
59
- rest = rest.slice(1);
62
+ rest = [message, ...rest.slice(1)];
60
63
  }
61
64
  else {
62
65
  msgStr = safeStringify(message);
@@ -46,4 +46,13 @@ export interface ReactionContext {
46
46
  /** Stable workspace slug for relative app permalinks. */
47
47
  organization_slug: string;
48
48
  }
49
+ /** Context of a script executing the Automation itself, before completion. */
50
+ export interface AutomationScriptContext extends Omit<ReactionContext, 'extracted_data' | 'window'> {
51
+ window: Omit<ReactionContext['window'], 'content_analyzed'>;
52
+ /**
53
+ * Durable event activations, frozen when the run is claimed. Empty for
54
+ * scheduled and manual runs.
55
+ */
56
+ trigger_signals: unknown[];
57
+ }
49
58
  //# sourceMappingURL=reaction-sdk.d.ts.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobu/connector-sdk",
3
- "version": "20.0.0",
3
+ "version": "20.0.1",
4
4
  "description": "Lobu memory SDK — build pluggable connectors for Lobu memory",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -79370,6 +79370,7 @@ function Z7(e) {
79370
79370
 
79371
79371
  // dist/agent-turn/workspace.js
79372
79372
  var WORKSPACE_ROOT = "/workspace";
79373
+ var WORKSPACE_WRITE_BUDGET_BYTES = 64 * 1024 * 1024;
79373
79374
  var INPUT_DIR = `${WORKSPACE_ROOT}/input`;
79374
79375
  var SKILLS_DIR = `${WORKSPACE_ROOT}/.skills`;
79375
79376
  var LS_LIMIT = 500;
@@ -79516,9 +79517,20 @@ function createWorkspace(names, bashPolicy, remote) {
79516
79517
  }
79517
79518
  return absolute;
79518
79519
  };
79520
+ const writeSizes = /* @__PURE__ */ new Map();
79521
+ let writtenBytes = 0;
79519
79522
  const writeFile = async (path6, content) => {
79520
79523
  await ready;
79521
- await fs2.writeFile(resolve7(path6), content);
79524
+ const absolute = resolve7(path6);
79525
+ const newSize = Buffer.byteLength(content);
79526
+ const previousSize = writeSizes.get(absolute) ?? 0;
79527
+ const projected = writtenBytes - previousSize + newSize;
79528
+ if (projected > WORKSPACE_WRITE_BUDGET_BYTES) {
79529
+ throw new Error(`Refusing to write ${formatSize(newSize)} to ${path6}: this turn's workspace is limited to ${formatSize(WORKSPACE_WRITE_BUDGET_BYTES)} total and already holds ${formatSize(writtenBytes)}. Write smaller content or split it across turns.`);
79530
+ }
79531
+ await fs2.writeFile(absolute, content);
79532
+ writeSizes.set(absolute, newSize);
79533
+ writtenBytes = projected;
79522
79534
  };
79523
79535
  const seed = async (files) => {
79524
79536
  await ready;
@@ -21,6 +21,15 @@ import { InMemoryFs } from 'just-bash/browser';
21
21
  import type { AgentTurnBashPolicy, AgentTurnBuiltinTool, RuntimeExecRequest, RuntimeExecResult } from './types.js';
22
22
  /** Where a turn's files live; also the shell's working directory. */
23
23
  export declare const WORKSPACE_ROOT = "/workspace";
24
+ /**
25
+ * Total bytes the write and edit tools may place in one turn's workspace: an
26
+ * eighth of the isolate's default 512MB heap, and far above a real turn's
27
+ * files (the largest session transcript measured across 2050 real rows is
28
+ * 633KB, `gateway/services/transcript-snapshot.ts`). A runaway write then
29
+ * refuses with an error the model can act on, instead of an OOM that kills
30
+ * the whole turn.
31
+ */
32
+ export declare const WORKSPACE_WRITE_BUDGET_BYTES: number;
24
33
  /**
25
34
  * Where the turn's own attachments are seeded. The name is part of the
26
35
  * agent-visible contract: the system prompt lists each upload by this path.