@lobu/runtime-device 20.0.1 → 20.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 (39) hide show
  1. package/dist/component.json +1 -1
  2. package/dist/dependencies.bun.lock +8 -8
  3. package/npm-shrinkwrap.json +32 -32
  4. package/package.json +1 -1
  5. package/vendor/cli/dist/commands/_lib/apply/map-config.js +7 -3
  6. package/vendor/cli/dist/commands/call.d.ts +2 -1
  7. package/vendor/cli/dist/commands/call.js +8 -2
  8. package/vendor/cli/dist/commands/dev.js +2 -2
  9. package/vendor/cli/dist/commands/doctor.js +3 -12
  10. package/vendor/cli/dist/commands/init.js +15 -3
  11. package/vendor/cli/dist/commands/memory/_lib/errors.d.ts +12 -0
  12. package/vendor/cli/dist/commands/memory/_lib/errors.js +21 -0
  13. package/vendor/cli/dist/commands/memory/run.js +7 -1
  14. package/vendor/cli/dist/commands/telemetry.js +2 -11
  15. package/vendor/cli/dist/commands/token.js +20 -3
  16. package/vendor/cli/dist/connectors/chat-user-identity.ts +45 -0
  17. package/vendor/cli/dist/connectors/google-identity.ts +107 -0
  18. package/vendor/cli/dist/connectors/google_drive.ts +36 -151
  19. package/vendor/cli/dist/connectors/google_gmail.ts +149 -0
  20. package/vendor/cli/dist/connectors/microsoft_outlook.ts +193 -0
  21. package/vendor/cli/dist/connectors/slack-identity.ts +20 -0
  22. package/vendor/cli/dist/internal/credentials.js +8 -0
  23. package/vendor/cli/dist/internal/env-file.d.ts +8 -0
  24. package/vendor/cli/dist/internal/env-file.js +21 -0
  25. package/vendor/cli/dist/runtime-components.json +4 -4
  26. package/vendor/cli/package.json +1 -1
  27. package/vendor/connector-sdk/dist/file-output.d.ts +97 -0
  28. package/vendor/connector-sdk/dist/file-output.js +176 -0
  29. package/vendor/connector-sdk/dist/index.d.ts +2 -0
  30. package/vendor/connector-sdk/dist/index.js +1 -0
  31. package/vendor/connector-sdk/package.json +1 -1
  32. package/vendor/connector-worker/dist/executor/isolate.js +6 -1
  33. package/vendor/connector-worker/package.json +1 -1
  34. package/vendor/core/dist/classify-error.js +50 -2
  35. package/vendor/core/dist/constants.d.ts +13 -6
  36. package/vendor/core/dist/constants.js +22 -8
  37. package/vendor/core/dist/errors.d.ts +20 -0
  38. package/vendor/core/dist/errors.js +21 -1
  39. package/vendor/core/package.json +1 -1
@@ -954,7 +954,12 @@ export class IsolateExecutor {
954
954
  throw this.guestError(guestFatal, redactedTail());
955
955
  if (error instanceof IsolateHostError) {
956
956
  if (error.kind === 'timeout') {
957
- throw new ConnectorExecutionError(withTail(`Feed execution timed out after ${this.options.timeoutMs}ms`), {
957
+ // Not "Feed execution": this executor runs feeds, connector
958
+ // actions AND agent turns, and a chat user whose turn timed out
959
+ // was being told a feed had failed. The classifier maps both
960
+ // spellings (classify-error.ts) so a mid-rollout worker still
961
+ // classifies.
962
+ throw new ConnectorExecutionError(withTail(`Execution timed out after ${this.options.timeoutMs}ms`), {
958
963
  exitCode: null,
959
964
  exitSignal: null,
960
965
  outputTail: redactedTail(),
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobu/connector-worker",
3
- "version": "20.0.1",
3
+ "version": "20.1.0",
4
4
  "description": "Self-hosted worker for Lobu memory — connectors and embedding generation",
5
5
  "type": "module",
6
6
  "bin": {
@@ -51,6 +51,19 @@ function classifyErrorMessage(message) {
51
51
  // accurate, visible "didn't finish responding in time" message.
52
52
  if (/wall-clock budget of \d+ms exceeded/.test(message))
53
53
  return errors_js_1.AgentErrorCode.WORKER_UNRESPONSIVE;
54
+ // The isolate EXECUTOR's timeout, which is a different path from the host
55
+ // wall-clock kill above and was never classified: `IsolateExecutor` throws
56
+ // "Execution timed out after <n>ms" when `host.run` exceeds its budget. Same
57
+ // event class, same remediation, so it takes the same code — without it the
58
+ // user read a raw "…timed out after 600000ms" with no CTA (11 agent turns in
59
+ // the 30 days to 2026-09-15, all of them wedged for the full 600s).
60
+ //
61
+ // The leading `(?:Feed )?` is not optional politeness: that message said
62
+ // "Feed execution timed out" until this change, workers deploy on their own
63
+ // cadence, and the server classifies whatever text the worker sent. Matching
64
+ // both spellings keeps a mid-rollout worker's failures classified.
65
+ if (/(?:feed )?execution timed out after \d+ms/i.test(message))
66
+ return errors_js_1.AgentErrorCode.WORKER_UNRESPONSIVE;
54
67
  // Provider usage/rate limit. Covers "429 Weekly/Monthly Limit
55
68
  // Exhausted", generic rate-limit/quota phrasings, and a bare 429. Placed
56
69
  // before PROVIDER_AUTH because a rate-limited request can also echo auth-ish
@@ -63,7 +76,21 @@ function classifyErrorMessage(message) {
63
76
  // JSON blob in the user's chat.
64
77
  if (errors_js_1.PROVIDER_BALANCE_EXHAUSTED.test(message))
65
78
  return errors_js_1.AgentErrorCode.PROVIDER_QUOTA_EXHAUSTED;
66
- if (/weekly\/monthly limit exhausted|limit exhausted|rate[-\s]?limit|quota (?:exceeded|exhausted)|too many requests|\b429\b|resource_exhausted/i.test(message))
79
+ // `usage limit` is ChatGPT subscription wording ("You have hit your ChatGPT
80
+ // usage limit (pro plan)."). It was the single largest unclassified failure
81
+ // in prod over the 30 days to 2026-09-15 — 47 of the 52 runs the provider
82
+ // had refused and the platform blamed on the agent, across both agent turns
83
+ // and Automation runs — and being unclassified cost three things at once: the
84
+ // run was blamed on the agent (`outcome = agent_error`), the user got the
85
+ // raw provider sentence with no "Manage provider" CTA, and the failure
86
+ // dodged the PROVIDER_* alert.
87
+ //
88
+ // It belongs HERE and not in `PROVIDER_BALANCE_EXHAUSTED` above: a
89
+ // subscription usage limit is WINDOWED — the provider names its own reset,
90
+ // hours or days out — while that union parks an Automation for a flat day
91
+ // regardless. Parking a windowed limit on a balance schedule would be a
92
+ // worse bug than the one this fixes.
93
+ if (errors_js_1.PROVIDER_WINDOWED_QUOTA.test(message))
67
94
  return errors_js_1.AgentErrorCode.PROVIDER_QUOTA_EXHAUSTED;
68
95
  // Gemini can end a turn with this provider-side tool-call rejection instead
69
96
  // of a usable stop reason. Keep the match specific: other finish reasons can
@@ -109,7 +136,28 @@ function classifyErrorMessage(message) {
109
136
  // reaches here from an upstream provider, so its length is not ours to
110
137
  // trust. Lazy stops at the first " not found" and the bound caps the walk;
111
138
  // spaces stay allowed so a quoted multi-word id still classifies.
112
- if (/not a valid model|unknown model|model [^\n]{0,120}? not found/i.test(message))
139
+ //
140
+ // `access to model denied` / `eligible for using the model` is the provider
141
+ // refusing THIS account this model ("403 Access to model denied. Please make
142
+ // sure you are eligible for using the model.", seen in prod on agent turns).
143
+ // The credential is good and every other model still works, so this is the
144
+ // model class and not PROVIDER_AUTH: "Choose model" is the remediation that
145
+ // actually unblocks the user, where "Reconnect provider" would send them to
146
+ // re-auth a credential that is already valid.
147
+ //
148
+ // The model exists but cannot serve THIS request: OpenAI answers
149
+ // "404 This model is only supported in v1/responses and not in
150
+ // v1/chat/completions.", OpenRouter "404 No endpoints found that support tool
151
+ // use." Both are a model/capability mismatch the user fixes by picking a
152
+ // different model, so they take the model code and its "Choose model" CTA
153
+ // rather than reading as an agent crash.
154
+ //
155
+ // Unlike the other entries here these were reproduced locally (a live turn
156
+ // against `openai/o1-pro` and `openrouter/openai/o1-pro` on 2026-09-15), not
157
+ // observed in prod — the 90-day corpus has no agent-turn 404 of either shape.
158
+ // Replaying that corpus with these patterns moves nothing, which is the
159
+ // evidence they do not over-match real traffic.
160
+ if (/not a valid model|unknown model|model [^\n]{0,120}? not found|access to model denied|eligible for using the model|model is only supported in|no endpoints found that support/i.test(message))
113
161
  return errors_js_1.AgentErrorCode.PROVIDER_UNKNOWN_MODEL;
114
162
  // model-resolver.ts / session-runner.ts throw this when a non-OpenAI
115
163
  // provider cannot be routed through the Lobu gateway proxy. This is usually a
@@ -23,13 +23,20 @@ export declare const TIME: {
23
23
  */
24
24
  export declare const MCP_PROTOCOL_VERSION = "2025-11-25";
25
25
  /**
26
- * Chat platforms Lobu operates a hosted bot for. A project connection using
27
- * one of these connector keys with `credentialMode: "hosted"` is reached by
28
- * redeeming a `/lobu link <code>` claim; the user never supplies a bot token.
26
+ * Every chat platform Lobu ships a connector for — the connectors declaring
27
+ * `x-lobu-chat-platform` in their options schema. A `connectors/*-chat-platforms`
28
+ * guard test keeps this in step with those declarations.
29
+ *
30
+ * This answers "is this connector a chat platform", which is all a CLIENT can
31
+ * know. It deliberately does NOT answer "does Lobu run a hosted bot for it" —
32
+ * that depends on whether a hosted preview connection exists in the deployment,
33
+ * which only the server can see, and which it reports with a specific 400.
34
+ * Conflating the two is what previously hard-rejected Google Chat in `lobu
35
+ * apply` while happily minting Telegram codes that nothing could redeem.
29
36
  */
30
- export declare const HOSTED_CHAT_PLATFORMS: readonly ["slack", "telegram"];
31
- export type HostedChatPlatform = (typeof HOSTED_CHAT_PLATFORMS)[number];
32
- export declare function isHostedChatPlatform(type: string): type is HostedChatPlatform;
37
+ export declare const CHAT_PLATFORMS: readonly ["slack", "telegram", "gchat", "discord", "teams", "whatsapp"];
38
+ export type ChatPlatform = (typeof CHAT_PLATFORMS)[number];
39
+ export declare function isChatPlatform(type: string): type is ChatPlatform;
33
40
  export declare const DEFAULTS: {
34
41
  /** Default session TTL in milliseconds */
35
42
  readonly SESSION_TTL_MS: number;
@@ -5,8 +5,8 @@
5
5
  * These are platform-agnostic and used by core, gateway, and platform adapters
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.DEFAULTS = exports.HOSTED_CHAT_PLATFORMS = exports.MCP_PROTOCOL_VERSION = exports.TIME = void 0;
9
- exports.isHostedChatPlatform = isHostedChatPlatform;
8
+ exports.DEFAULTS = exports.CHAT_PLATFORMS = exports.MCP_PROTOCOL_VERSION = exports.TIME = void 0;
9
+ exports.isChatPlatform = isChatPlatform;
10
10
  // Time constants (milliseconds)
11
11
  exports.TIME = {
12
12
  /** One hour in milliseconds */
@@ -28,13 +28,27 @@ exports.TIME = {
28
28
  */
29
29
  exports.MCP_PROTOCOL_VERSION = "2025-11-25";
30
30
  /**
31
- * Chat platforms Lobu operates a hosted bot for. A project connection using
32
- * one of these connector keys with `credentialMode: "hosted"` is reached by
33
- * redeeming a `/lobu link <code>` claim; the user never supplies a bot token.
31
+ * Every chat platform Lobu ships a connector for — the connectors declaring
32
+ * `x-lobu-chat-platform` in their options schema. A `connectors/*-chat-platforms`
33
+ * guard test keeps this in step with those declarations.
34
+ *
35
+ * This answers "is this connector a chat platform", which is all a CLIENT can
36
+ * know. It deliberately does NOT answer "does Lobu run a hosted bot for it" —
37
+ * that depends on whether a hosted preview connection exists in the deployment,
38
+ * which only the server can see, and which it reports with a specific 400.
39
+ * Conflating the two is what previously hard-rejected Google Chat in `lobu
40
+ * apply` while happily minting Telegram codes that nothing could redeem.
34
41
  */
35
- exports.HOSTED_CHAT_PLATFORMS = ["slack", "telegram"];
36
- function isHostedChatPlatform(type) {
37
- return exports.HOSTED_CHAT_PLATFORMS.includes(type);
42
+ exports.CHAT_PLATFORMS = [
43
+ "slack",
44
+ "telegram",
45
+ "gchat",
46
+ "discord",
47
+ "teams",
48
+ "whatsapp",
49
+ ];
50
+ function isChatPlatform(type) {
51
+ return exports.CHAT_PLATFORMS.includes(type);
38
52
  }
39
53
  // Default configuration values
40
54
  exports.DEFAULTS = {
@@ -178,6 +178,26 @@ export declare const AGENT_ERRORS: Record<AgentErrorCode, AgentErrorSpec>;
178
178
  * self-heal, often within the minute.
179
179
  */
180
180
  export declare const PROVIDER_BALANCE_EXHAUSTED: RegExp;
181
+ /**
182
+ * Provider says: not now — a WINDOWED limit that self-heals, as opposed to the
183
+ * balance wall above. A bare 429, a rate limit, an exhausted plan window, or a
184
+ * subscription usage limit.
185
+ *
186
+ * Hoisted here for exactly the reason {@link PROVIDER_BALANCE_EXHAUSTED} was.
187
+ * This alternation was maintained as three independent literals — the turn
188
+ * classifier (`classify-error.ts`), the device schedule parker
189
+ * (`deviceProviderQuotaResetNotBefore`) and the server's own `INFRA_PATTERNS`
190
+ * — and drifted the same way the balance list did: the device parker learned
191
+ * ChatGPT's `usage limit` and the other two did not, so over the 30 days to
192
+ * 2026-09-15, 47 runs the provider had refused were recorded as the agent's
193
+ * fault, rendered to the user with no remediation CTA, and dodged the
194
+ * PROVIDER_* alert.
195
+ *
196
+ * Keep windowed wording ONLY. These must classify as quota but must NOT reach
197
+ * the day-park: they often clear within the minute, and the caller decides the
198
+ * horizon from the provider's own named reset.
199
+ */
200
+ export declare const PROVIDER_WINDOWED_QUOTA: RegExp;
181
201
  /** Parse an `AgentErrorCode` from an unknown value (payload/DB boundary). */
182
202
  export declare function toAgentErrorCode(value: unknown): AgentErrorCode | undefined;
183
203
  //# sourceMappingURL=errors.d.ts.map
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PROVIDER_BALANCE_EXHAUSTED = exports.AGENT_ERRORS = exports.AgentErrorCode = exports.ConfigError = exports.ConversationOwnedElsewhereError = exports.OrchestratorError = exports.ErrorCode = exports.WorkspaceError = exports.WorkerError = exports.BaseError = void 0;
3
+ exports.PROVIDER_WINDOWED_QUOTA = exports.PROVIDER_BALANCE_EXHAUSTED = exports.AGENT_ERRORS = exports.AgentErrorCode = exports.ConfigError = exports.ConversationOwnedElsewhereError = exports.OrchestratorError = exports.ErrorCode = exports.WorkspaceError = exports.WorkerError = exports.BaseError = void 0;
4
4
  exports.getErrorMessage = getErrorMessage;
5
5
  exports.toAgentErrorCode = toAgentErrorCode;
6
6
  /**
@@ -253,6 +253,26 @@ exports.AGENT_ERRORS = {
253
253
  * self-heal, often within the minute.
254
254
  */
255
255
  exports.PROVIDER_BALANCE_EXHAUSTED = /credit balance is too low|insufficient (?:credits?|balance|funds|quota)\b|no resource package|billing_hard_limit_reached|payment required|exceeded your current quota|out of credits?\b|no credits remaining/i;
256
+ /**
257
+ * Provider says: not now — a WINDOWED limit that self-heals, as opposed to the
258
+ * balance wall above. A bare 429, a rate limit, an exhausted plan window, or a
259
+ * subscription usage limit.
260
+ *
261
+ * Hoisted here for exactly the reason {@link PROVIDER_BALANCE_EXHAUSTED} was.
262
+ * This alternation was maintained as three independent literals — the turn
263
+ * classifier (`classify-error.ts`), the device schedule parker
264
+ * (`deviceProviderQuotaResetNotBefore`) and the server's own `INFRA_PATTERNS`
265
+ * — and drifted the same way the balance list did: the device parker learned
266
+ * ChatGPT's `usage limit` and the other two did not, so over the 30 days to
267
+ * 2026-09-15, 47 runs the provider had refused were recorded as the agent's
268
+ * fault, rendered to the user with no remediation CTA, and dodged the
269
+ * PROVIDER_* alert.
270
+ *
271
+ * Keep windowed wording ONLY. These must classify as quota but must NOT reach
272
+ * the day-park: they often clear within the minute, and the caller decides the
273
+ * horizon from the provider's own named reset.
274
+ */
275
+ exports.PROVIDER_WINDOWED_QUOTA = /limit exhausted|usage limit|rate[-\s]?limit|quota (?:exceeded|exhausted)|too many requests|\b429\b|resource_exhausted/i;
256
276
  /** Parse an `AgentErrorCode` from an unknown value (payload/DB boundary). */
257
277
  function toAgentErrorCode(value) {
258
278
  if (typeof value !== "string")
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobu/core",
3
- "version": "20.0.1",
3
+ "version": "20.1.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Core types and utilities for Lobu agent platform",
6
6
  "repository": {