@lobu/runtime-device 21.2.1 → 22.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 (196) hide show
  1. package/dist/component.json +1 -1
  2. package/dist/dependencies.bun.lock +91 -83
  3. package/npm-shrinkwrap.json +492 -438
  4. package/package.json +12 -2
  5. package/vendor/cli/dist/commands/_lib/apply/apply-cmd.js +5 -6
  6. package/vendor/cli/dist/commands/_lib/apply/client.d.ts +1 -0
  7. package/vendor/cli/dist/commands/_lib/apply/client.js +26 -7
  8. package/vendor/cli/dist/commands/_lib/apply/desired-state.d.ts +9 -1
  9. package/vendor/cli/dist/commands/_lib/apply/diff.d.ts +1 -0
  10. package/vendor/cli/dist/commands/_lib/apply/diff.js +46 -4
  11. package/vendor/cli/dist/commands/_lib/apply/map-config.js +18 -38
  12. package/vendor/cli/dist/commands/_lib/init-from-org/bootstrap.js +5 -17
  13. package/vendor/cli/dist/commands/init.d.ts +0 -2
  14. package/vendor/cli/dist/commands/init.js +0 -27
  15. package/vendor/cli/dist/commands/login.d.ts +17 -0
  16. package/vendor/cli/dist/commands/login.js +43 -17
  17. package/vendor/cli/dist/commands/memory/_lib/errors.d.ts +0 -8
  18. package/vendor/cli/dist/commands/memory/_lib/errors.js +0 -12
  19. package/vendor/cli/dist/commands/memory/_lib/mcp.js +6 -6
  20. package/vendor/cli/dist/commands/memory/_lib/seed-cmd.js +4 -10
  21. package/vendor/cli/dist/config/define.d.ts +21 -15
  22. package/vendor/cli/dist/config/define.js +2 -2
  23. package/vendor/cli/dist/connectors/README.md +7 -5
  24. package/vendor/cli/dist/connectors/_google/actions.ts +270 -0
  25. package/vendor/cli/dist/connectors/_google/discovery/calendar_v3.json +1 -0
  26. package/vendor/cli/dist/connectors/_google/discovery/chat_v1.json +1 -0
  27. package/vendor/cli/dist/connectors/_google/discovery/docs_v1.json +1 -0
  28. package/vendor/cli/dist/connectors/_google/discovery/drive_v3.json +1 -0
  29. package/vendor/cli/dist/connectors/_google/discovery/gmail_v1.json +1 -0
  30. package/vendor/cli/dist/connectors/_google/discovery/people_v1.json +1 -0
  31. package/vendor/cli/dist/connectors/_google/discovery/sheets_v4.json +1 -0
  32. package/vendor/cli/dist/connectors/_google/discovery/tasks_v1.json +1 -0
  33. package/vendor/cli/dist/connectors/_google/discovery/youtube_v3.json +1 -0
  34. package/vendor/cli/dist/connectors/_google/discovery.ts +442 -0
  35. package/vendor/cli/dist/connectors/_google/errors.ts +91 -0
  36. package/vendor/cli/dist/connectors/_google/list-feed.ts +223 -0
  37. package/vendor/cli/dist/connectors/_google/policies.ts +127 -0
  38. package/vendor/cli/dist/connectors/agentid.ts +43 -0
  39. package/vendor/cli/dist/connectors/chat-user-identity.ts +2 -1
  40. package/vendor/cli/dist/connectors/github-automation-events.ts +9 -0
  41. package/vendor/cli/dist/connectors/github-identity.ts +28 -3
  42. package/vendor/cli/dist/connectors/github.ts +101 -59
  43. package/vendor/cli/dist/connectors/google_calendar.ts +207 -719
  44. package/vendor/cli/dist/connectors/google_drive.ts +16 -2
  45. package/vendor/cli/dist/connectors/google_gmail.ts +51 -33
  46. package/vendor/cli/dist/connectors/herdr.ts +406 -0
  47. package/vendor/cli/dist/connectors/jira.ts +6 -6
  48. package/vendor/cli/dist/connectors/linear.ts +7 -4
  49. package/vendor/cli/dist/connectors/postgres.ts +27 -2
  50. package/vendor/cli/dist/connectors/tiktok-inbox-page.js +230 -0
  51. package/vendor/cli/dist/connectors/tiktok-web-page.js +211 -0
  52. package/vendor/cli/dist/connectors/tiktok_web.ts +286 -0
  53. package/vendor/cli/dist/connectors/whatsapp-web-adapter.js +228 -10
  54. package/vendor/cli/dist/connectors/whatsapp-web-helpers.ts +47 -14
  55. package/vendor/cli/dist/connectors/whatsapp-web-identity.ts +121 -0
  56. package/vendor/cli/dist/connectors/whatsapp_web.ts +170 -29
  57. package/vendor/cli/dist/connectors/x.ts +276 -136
  58. package/vendor/cli/dist/index.js +1 -37
  59. package/vendor/cli/dist/internal/context.d.ts +10 -0
  60. package/vendor/cli/dist/internal/context.js +26 -16
  61. package/vendor/cli/dist/internal/node-version.d.ts +1 -1
  62. package/vendor/cli/dist/internal/node-version.js +1 -1
  63. package/vendor/cli/dist/internal/oauth.d.ts +3 -1
  64. package/vendor/cli/dist/internal/oauth.js +4 -3
  65. package/vendor/cli/dist/internal/runtime-components.d.ts +9 -0
  66. package/vendor/cli/dist/internal/runtime-components.js +67 -2
  67. package/vendor/cli/dist/mac-auth.js +17 -1
  68. package/vendor/cli/dist/providers.json +1 -1
  69. package/vendor/cli/dist/runtime-components.json +4 -4
  70. package/vendor/cli/dist/templates/AGENTS.md.tmpl +11 -4
  71. package/vendor/cli/dist/templates/README.md.tmpl +1 -1
  72. package/vendor/cli/dist/vendor/ora/.bun-tag-fde20e9a6df212fa +0 -0
  73. package/vendor/cli/dist/vendor/ora/index.d.ts +332 -0
  74. package/vendor/cli/dist/vendor/ora/index.js +424 -0
  75. package/vendor/cli/dist/vendor/ora/license +9 -0
  76. package/vendor/cli/dist/vendor/ora/package.json +64 -0
  77. package/vendor/cli/dist/vendor/ora/readme.md +329 -0
  78. package/vendor/cli/package.json +2 -2
  79. package/vendor/connector-sdk/dist/browser-requirement.d.ts +36 -0
  80. package/vendor/connector-sdk/dist/browser-requirement.js +60 -0
  81. package/vendor/connector-sdk/dist/connector-runtime.d.ts +3 -1
  82. package/vendor/connector-sdk/dist/connector-runtime.js +10 -0
  83. package/vendor/connector-sdk/dist/connector-types.d.ts +159 -45
  84. package/vendor/connector-sdk/dist/define-connector.d.ts +4 -2
  85. package/vendor/connector-sdk/dist/define-connector.js +3 -0
  86. package/vendor/connector-sdk/dist/index.d.ts +5 -2
  87. package/vendor/connector-sdk/dist/index.js +1 -0
  88. package/vendor/connector-sdk/dist/reaction-client-types.d.ts +16 -21
  89. package/vendor/connector-sdk/dist/reaction-client-types.typecheck.d.ts +5 -0
  90. package/vendor/connector-sdk/package.json +5 -1
  91. package/vendor/connector-worker/dist/agent-turn/guest-entry.js +31 -27
  92. package/vendor/connector-worker/dist/agent-turn/guest.bundle.js +131 -185
  93. package/vendor/connector-worker/dist/agent-turn/memory.d.ts +3 -2
  94. package/vendor/connector-worker/dist/agent-turn/memory.js +3 -20
  95. package/vendor/connector-worker/dist/agent-turn/types.d.ts +3 -15
  96. package/vendor/connector-worker/dist/agent-turn/workspace.d.ts +2 -2
  97. package/vendor/connector-worker/dist/agent-turn/workspace.js +2 -4
  98. package/vendor/connector-worker/dist/daemon/action-monitor.d.ts +12 -0
  99. package/vendor/connector-worker/dist/daemon/action-monitor.js +25 -0
  100. package/vendor/connector-worker/dist/daemon/agent-turn.js +0 -9
  101. package/vendor/connector-worker/dist/daemon/builtins/index.d.ts +12 -0
  102. package/vendor/connector-worker/dist/daemon/builtins/index.js +61 -1
  103. package/vendor/connector-worker/dist/daemon/builtins/os-shell.d.ts +2 -1
  104. package/vendor/connector-worker/dist/daemon/builtins/os-shell.js +40 -27
  105. package/vendor/connector-worker/dist/daemon/client.d.ts +5 -1
  106. package/vendor/connector-worker/dist/daemon/client.js +3 -0
  107. package/vendor/connector-worker/dist/daemon/device-concurrency.d.ts +8 -0
  108. package/vendor/connector-worker/dist/daemon/device-concurrency.js +13 -0
  109. package/vendor/connector-worker/dist/daemon/executor.d.ts +1 -1
  110. package/vendor/connector-worker/dist/daemon/executor.js +48 -117
  111. package/vendor/connector-worker/dist/daemon/log.d.ts +2 -0
  112. package/vendor/connector-worker/dist/daemon/log.js +23 -2
  113. package/vendor/connector-worker/dist/daemon/mac-device-daemon.d.ts +20 -4
  114. package/vendor/connector-worker/dist/daemon/mac-device-daemon.js +53 -13
  115. package/vendor/connector-worker/dist/daemon/native-bridge/client.d.ts +6 -0
  116. package/vendor/connector-worker/dist/daemon/native-bridge/client.js +15 -0
  117. package/vendor/connector-worker/dist/daemon/native-bridge/executor.js +2 -0
  118. package/vendor/connector-worker/dist/daemon/native-bridge/protocol.d.ts +1 -1
  119. package/vendor/connector-worker/dist/daemon/native-bridge/protocol.js +1 -0
  120. package/vendor/connector-worker/dist/daemon/poll-loop.d.ts +3 -0
  121. package/vendor/connector-worker/dist/daemon/poll-loop.js +5 -1
  122. package/vendor/connector-worker/dist/daemon/start.d.ts +1 -0
  123. package/vendor/connector-worker/dist/daemon/start.js +12 -5
  124. package/vendor/connector-worker/dist/executor/interface.d.ts +34 -2
  125. package/vendor/connector-worker/dist/executor/isolate.js +66 -15
  126. package/vendor/connector-worker/dist/executor/redact.d.ts +1 -0
  127. package/vendor/connector-worker/dist/executor/redact.js +97 -26
  128. package/vendor/connector-worker/dist/executor/runtime.d.ts +7 -0
  129. package/vendor/connector-worker/dist/executor/runtime.js +26 -0
  130. package/vendor/connector-worker/dist/isolate/bridge.js +3 -1
  131. package/vendor/connector-worker/dist/mac-device-daemon.js +10 -3
  132. package/vendor/connector-worker/package.json +2 -2
  133. package/vendor/core/dist/agent-policy.js +1 -1
  134. package/vendor/core/dist/agent-store.d.ts +2 -0
  135. package/vendor/core/dist/agent-tooling.d.ts +1 -1
  136. package/vendor/core/dist/agent-tooling.js +1 -1
  137. package/vendor/core/dist/capabilities.js +2 -0
  138. package/vendor/core/dist/contracts/agent-settings.d.ts +0 -11
  139. package/vendor/core/dist/contracts/agent-settings.js +1 -7
  140. package/vendor/core/dist/contracts/tools/collection-presentation.d.ts +93 -0
  141. package/vendor/core/dist/contracts/tools/collection-presentation.js +88 -0
  142. package/vendor/core/dist/contracts/tools/collection-selection.d.ts +47 -0
  143. package/vendor/core/dist/contracts/tools/collection-selection.js +74 -0
  144. package/vendor/core/dist/contracts/tools/manage-agents.d.ts +10 -4
  145. package/vendor/core/dist/contracts/tools/manage-auth-profiles.d.ts +1 -1
  146. package/vendor/core/dist/contracts/tools/manage-auth-profiles.js +5 -1
  147. package/vendor/core/dist/contracts/tools/manage-automations.d.ts +19 -4
  148. package/vendor/core/dist/contracts/tools/manage-automations.js +25 -8
  149. package/vendor/core/dist/contracts/tools/manage-connections.d.ts +1 -0
  150. package/vendor/core/dist/contracts/tools/manage-connections.js +3 -0
  151. package/vendor/core/dist/contracts/tools/manage-entity-schema.d.ts +11 -0
  152. package/vendor/core/dist/contracts/tools/manage-entity-schema.js +42 -3
  153. package/vendor/core/dist/contracts/tools/manage-entity.d.ts +181 -152
  154. package/vendor/core/dist/contracts/tools/manage-entity.js +118 -162
  155. package/vendor/core/dist/contracts/tools/manage-operations.d.ts +41 -3
  156. package/vendor/core/dist/contracts/tools/manage-operations.js +40 -2
  157. package/vendor/core/dist/contracts/tools/manage-views.d.ts +182 -7
  158. package/vendor/core/dist/contracts/tools/manage-views.js +49 -13
  159. package/vendor/core/dist/contracts/tools/read-knowledge.d.ts +11 -2
  160. package/vendor/core/dist/contracts/tools/read-knowledge.js +23 -3
  161. package/vendor/core/dist/contracts/tools/save-memory.d.ts +3 -6
  162. package/vendor/core/dist/contracts/tools/save-memory.js +2 -6
  163. package/vendor/core/dist/contracts/tools/view-attach.d.ts +2 -1
  164. package/vendor/core/dist/contracts/tools/view-attach.js +7 -2
  165. package/vendor/core/dist/contracts/worker/protocol.d.ts +122 -28
  166. package/vendor/core/dist/contracts/worker/protocol.js +81 -17
  167. package/vendor/core/dist/index.d.ts +3 -4
  168. package/vendor/core/dist/index.js +3 -6
  169. package/vendor/core/dist/json-template.d.ts +6 -10
  170. package/vendor/core/dist/json-template.js +5 -9
  171. package/vendor/core/dist/logger.js +11 -5
  172. package/vendor/core/dist/shell-safety.d.ts +9 -0
  173. package/vendor/core/dist/shell-safety.js +154 -0
  174. package/vendor/core/dist/suggestions.d.ts +1 -1
  175. package/vendor/core/dist/suggestions.js +1 -1
  176. package/vendor/core/dist/tool-trace-summary.d.ts +1 -1
  177. package/vendor/core/dist/tool-trace-summary.js +1 -1
  178. package/vendor/core/dist/types.d.ts +1 -3
  179. package/vendor/core/dist/utils/diagnostic-scrubber.d.ts +7 -0
  180. package/vendor/core/dist/utils/{sentry-scrubber.js → diagnostic-scrubber.js} +25 -53
  181. package/vendor/core/dist/worker/auth.d.ts +44 -6
  182. package/vendor/core/dist/worker/auth.js +44 -11
  183. package/vendor/core/package.json +15 -6
  184. package/vendor/ora/.bun-tag-fde20e9a6df212fa +0 -0
  185. package/vendor/ora/index.d.ts +332 -0
  186. package/vendor/ora/index.js +424 -0
  187. package/vendor/ora/license +9 -0
  188. package/vendor/ora/package.json +53 -0
  189. package/vendor/ora/readme.md +329 -0
  190. package/vendor/cli/dist/commands/telemetry.d.ts +0 -10
  191. package/vendor/cli/dist/commands/telemetry.js +0 -66
  192. package/vendor/core/dist/sentry.d.ts +0 -26
  193. package/vendor/core/dist/sentry.js +0 -133
  194. package/vendor/core/dist/tool-policy.d.ts +0 -74
  195. package/vendor/core/dist/tool-policy.js +0 -305
  196. package/vendor/core/dist/utils/sentry-scrubber.d.ts +0 -29
@@ -57,6 +57,8 @@ export interface ConnectionSettings {
57
57
  export interface StoredConnection {
58
58
  id: string;
59
59
  platform: string;
60
+ /** Verified Lobu creator, recorded on first insert and preserved on updates. */
61
+ createdBy?: string;
60
62
  agentId?: string;
61
63
  /**
62
64
  * Organization id this connection belongs to. Optional in the type for
@@ -8,7 +8,7 @@
8
8
  * importing the barrel is what made those packages unbundleable, not anything
9
9
  * in the tools themselves.
10
10
  *
11
- * Everything re-exported here is pure. Same standing rule as `tool-policy.ts`:
11
+ * Everything re-exported here is pure. Same standing rule as `shell-safety.ts`:
12
12
  * never grow a Node import or a root `@lobu/core` import in this module or the
13
13
  * modules it names, or the isolate lane loses its gateway tools with no
14
14
  * compile error to say so — `assertIsolateEligible` catches it at run time.
@@ -9,7 +9,7 @@
9
9
  * importing the barrel is what made those packages unbundleable, not anything
10
10
  * in the tools themselves.
11
11
  *
12
- * Everything re-exported here is pure. Same standing rule as `tool-policy.ts`:
12
+ * Everything re-exported here is pure. Same standing rule as `shell-safety.ts`:
13
13
  * never grow a Node import or a root `@lobu/core` import in this module or the
14
14
  * modules it names, or the isolate lane loses its gateway tools with no
15
15
  * compile error to say so — `assertIsolateEligible` catches it at run time.
@@ -48,6 +48,8 @@ exports.MAC_DEVICE_CAPABILITIES = [
48
48
  // existing instructions-only/legacy session handling.
49
49
  "automations.execute",
50
50
  "screentime",
51
+ // Advertised only by Mac builds released before the Local Folder removal.
52
+ // Drop with the `local.directory` platform allowance in device-manifests.ts.
51
53
  "local_directory",
52
54
  "healthkit",
53
55
  "photos",
@@ -35,12 +35,6 @@ export declare const NixConfigSchema: import("@sinclair/typebox").TObject<{
35
35
  packages: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
36
36
  }>;
37
37
  export type NixConfig = Static<typeof NixConfigSchema>;
38
- export declare const ToolsConfigSchema: import("@sinclair/typebox").TObject<{
39
- allowedTools: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
40
- deniedTools: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
41
- strictMode: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
42
- }>;
43
- export type ToolsConfig = Static<typeof ToolsConfigSchema>;
44
38
  export declare const GuardrailStageSchema: import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<"input" | "output" | "pre-tool" | "egress">[]>;
45
39
  /**
46
40
  * Operator-authored guardrail on an agent.
@@ -142,11 +136,6 @@ export declare const AgentSettingsStoredSchema: import("@sinclair/typebox").TObj
142
136
  thinkingLevel: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"off">, import("@sinclair/typebox").TLiteral<"low">, import("@sinclair/typebox").TLiteral<"medium">, import("@sinclair/typebox").TLiteral<"high">]>>;
143
137
  }>>;
144
138
  }>>;
145
- toolsConfig: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
146
- allowedTools: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
147
- deniedTools: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
148
- strictMode: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
149
- }>>;
150
139
  guardrails: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
151
140
  guardrailsInline: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
152
141
  name: import("@sinclair/typebox").TString;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AgentSettingsStoredSchema = exports.SkillsConfigSchema = exports.SkillConfigSchema = exports.AgentInlineGuardrailSchema = exports.GuardrailStageSchema = exports.ToolsConfigSchema = exports.NixConfigSchema = exports.NetworkConfigSchema = void 0;
3
+ exports.AgentSettingsStoredSchema = exports.SkillsConfigSchema = exports.SkillConfigSchema = exports.AgentInlineGuardrailSchema = exports.GuardrailStageSchema = exports.NixConfigSchema = exports.NetworkConfigSchema = void 0;
4
4
  /**
5
5
  * AgentSettings TypeBox contract family — the single source for the agent
6
6
  * settings shape across every surface (declarative, CLI apply, admin tools,
@@ -37,11 +37,6 @@ exports.NixConfigSchema = typebox_1.Type.Object({
37
37
  flakeUrl: typebox_1.Type.Optional(typebox_1.Type.String()),
38
38
  packages: typebox_1.Type.Optional(typebox_1.Type.Array(typebox_1.Type.String())),
39
39
  });
40
- exports.ToolsConfigSchema = typebox_1.Type.Object({
41
- allowedTools: typebox_1.Type.Optional(typebox_1.Type.Array(typebox_1.Type.String())),
42
- deniedTools: typebox_1.Type.Optional(typebox_1.Type.Array(typebox_1.Type.String())),
43
- strictMode: typebox_1.Type.Optional(typebox_1.Type.Boolean()),
44
- });
45
40
  // GuardrailStage lives in guardrails/types.ts as the canonical union. The
46
41
  // schema mirrors it exactly; if the union grows, the _StageCheck assertion
47
42
  // below fails at compile time. (TypeBox can't derive from a TS type at
@@ -130,7 +125,6 @@ exports.AgentSettingsStoredSchema = typebox_1.Type.Object({
130
125
  userMd: typebox_1.Type.Optional(typebox_1.Type.String()),
131
126
  identityMd: typebox_1.Type.Optional(typebox_1.Type.String()),
132
127
  skillsConfig: typebox_1.Type.Optional(exports.SkillsConfigSchema),
133
- toolsConfig: typebox_1.Type.Optional(exports.ToolsConfigSchema),
134
128
  guardrails: typebox_1.Type.Optional(typebox_1.Type.Array(typebox_1.Type.String())),
135
129
  guardrailsInline: typebox_1.Type.Optional(typebox_1.Type.Array(exports.AgentInlineGuardrailSchema)),
136
130
  sandboxId: typebox_1.Type.Optional(typebox_1.Type.String()),
@@ -0,0 +1,93 @@
1
+ import { type Static } from "@sinclair/typebox";
2
+ import { type CollectionSelection } from "./collection-selection";
3
+ /** Presentation metadata travels through the existing entity schema. */
4
+ export declare const COLLECTION_PRESENTATION_KEY = "x-lobu-collection";
5
+ export declare const COLLECTION_PRESET_QUERY_KEY = "$preset";
6
+ export declare const COLLECTION_TABLE_QUERY_KEY = "$table";
7
+ declare const TableSchema: import("@sinclair/typebox").TObject<{
8
+ columns: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
9
+ sort: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
10
+ field: import("@sinclair/typebox").TString;
11
+ order: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"asc">, import("@sinclair/typebox").TLiteral<"desc">]>;
12
+ }>>;
13
+ }>;
14
+ declare const PresetSchema: import("@sinclair/typebox").TObject<{
15
+ key: import("@sinclair/typebox").TString;
16
+ label: import("@sinclair/typebox").TString;
17
+ selection: import("@sinclair/typebox").TObject<{
18
+ search: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
19
+ filters: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
20
+ field: import("@sinclair/typebox").TString;
21
+ op: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"eq">, import("@sinclair/typebox").TLiteral<"neq">]>;
22
+ value: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TBoolean, import("@sinclair/typebox").TNull]>;
23
+ }>, import("@sinclair/typebox").TObject<{
24
+ field: import("@sinclair/typebox").TString;
25
+ op: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"lt">, import("@sinclair/typebox").TLiteral<"lte">, import("@sinclair/typebox").TLiteral<"gt">, import("@sinclair/typebox").TLiteral<"gte">]>;
26
+ value: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber]>;
27
+ }>]>>>;
28
+ segment: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
29
+ }>;
30
+ table: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
31
+ columns: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
32
+ sort: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
33
+ field: import("@sinclair/typebox").TString;
34
+ order: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"asc">, import("@sinclair/typebox").TLiteral<"desc">]>;
35
+ }>>;
36
+ }>>;
37
+ relativeDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
38
+ field: import("@sinclair/typebox").TString;
39
+ fromDays: import("@sinclair/typebox").TInteger;
40
+ toDays: import("@sinclair/typebox").TInteger;
41
+ timeZone: import("@sinclair/typebox").TString;
42
+ }>>;
43
+ }>;
44
+ export declare const CollectionPresentationSchema: import("@sinclair/typebox").TObject<{
45
+ presets: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
46
+ key: import("@sinclair/typebox").TString;
47
+ label: import("@sinclair/typebox").TString;
48
+ selection: import("@sinclair/typebox").TObject<{
49
+ search: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
50
+ filters: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
51
+ field: import("@sinclair/typebox").TString;
52
+ op: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"eq">, import("@sinclair/typebox").TLiteral<"neq">]>;
53
+ value: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TBoolean, import("@sinclair/typebox").TNull]>;
54
+ }>, import("@sinclair/typebox").TObject<{
55
+ field: import("@sinclair/typebox").TString;
56
+ op: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"lt">, import("@sinclair/typebox").TLiteral<"lte">, import("@sinclair/typebox").TLiteral<"gt">, import("@sinclair/typebox").TLiteral<"gte">]>;
57
+ value: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber]>;
58
+ }>]>>>;
59
+ segment: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
60
+ }>;
61
+ table: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
62
+ columns: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
63
+ sort: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
64
+ field: import("@sinclair/typebox").TString;
65
+ order: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"asc">, import("@sinclair/typebox").TLiteral<"desc">]>;
66
+ }>>;
67
+ }>>;
68
+ relativeDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
69
+ field: import("@sinclair/typebox").TString;
70
+ fromDays: import("@sinclair/typebox").TInteger;
71
+ toDays: import("@sinclair/typebox").TInteger;
72
+ timeZone: import("@sinclair/typebox").TString;
73
+ }>>;
74
+ }>>>;
75
+ table: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
76
+ columns: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
77
+ sort: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
78
+ field: import("@sinclair/typebox").TString;
79
+ order: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"asc">, import("@sinclair/typebox").TLiteral<"desc">]>;
80
+ }>>;
81
+ }>>;
82
+ /** Read-only SDK script. Receives `input: { field, collection }`; returns
83
+ * { connection, sql } for a bounded query_sql read of { value, count } rows.
84
+ * Both calls run as the viewer; this binding grants no source access. */
85
+ facetQuery: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
86
+ }>;
87
+ export type CollectionPresentation = Static<typeof CollectionPresentationSchema>;
88
+ export type CollectionPreset = Static<typeof PresetSchema>;
89
+ export type CollectionTable = Static<typeof TableSchema>;
90
+ export declare function parseCollectionPresentation(raw: unknown): CollectionPresentation;
91
+ export declare function resolveCollectionPreset(preset: CollectionPreset, now?: Date): CollectionSelection;
92
+ export {};
93
+ //# sourceMappingURL=collection-presentation.d.ts.map
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CollectionPresentationSchema = exports.COLLECTION_TABLE_QUERY_KEY = exports.COLLECTION_PRESET_QUERY_KEY = exports.COLLECTION_PRESENTATION_KEY = void 0;
4
+ exports.parseCollectionPresentation = parseCollectionPresentation;
5
+ exports.resolveCollectionPreset = resolveCollectionPreset;
6
+ const typebox_1 = require("@sinclair/typebox");
7
+ const value_1 = require("@sinclair/typebox/value");
8
+ const collection_selection_1 = require("./collection-selection");
9
+ /** Presentation metadata travels through the existing entity schema. */
10
+ exports.COLLECTION_PRESENTATION_KEY = "x-lobu-collection";
11
+ exports.COLLECTION_PRESET_QUERY_KEY = "$preset";
12
+ exports.COLLECTION_TABLE_QUERY_KEY = "$table";
13
+ const Field = typebox_1.Type.String({
14
+ pattern: "^[A-Za-z_][A-Za-z0-9_]*$",
15
+ maxLength: 120,
16
+ });
17
+ const TableSchema = typebox_1.Type.Object({
18
+ columns: typebox_1.Type.Optional(typebox_1.Type.Array(Field, { maxItems: 100, uniqueItems: true })),
19
+ sort: typebox_1.Type.Optional(typebox_1.Type.Object({
20
+ field: Field,
21
+ order: typebox_1.Type.Union([typebox_1.Type.Literal("asc"), typebox_1.Type.Literal("desc")]),
22
+ }, { additionalProperties: false })),
23
+ }, { additionalProperties: false });
24
+ const PresetSchema = typebox_1.Type.Object({
25
+ key: typebox_1.Type.String({ pattern: "^[a-z0-9]+(?:-[a-z0-9]+)*$", maxLength: 120 }),
26
+ label: typebox_1.Type.String({ minLength: 1, maxLength: 120 }),
27
+ selection: collection_selection_1.CollectionSelectionSchema,
28
+ table: typebox_1.Type.Optional(TableSchema),
29
+ relativeDate: typebox_1.Type.Optional(typebox_1.Type.Object({
30
+ field: Field,
31
+ fromDays: typebox_1.Type.Integer({ minimum: -3660, maximum: 3660 }),
32
+ toDays: typebox_1.Type.Integer({ minimum: -3660, maximum: 3660 }),
33
+ timeZone: typebox_1.Type.String({ minLength: 1, maxLength: 100 }),
34
+ }, { additionalProperties: false })),
35
+ }, { additionalProperties: false });
36
+ exports.CollectionPresentationSchema = typebox_1.Type.Object({
37
+ presets: typebox_1.Type.Optional(typebox_1.Type.Array(PresetSchema, { maxItems: 32 })),
38
+ table: typebox_1.Type.Optional(TableSchema),
39
+ /** Read-only SDK script. Receives `input: { field, collection }`; returns
40
+ * { connection, sql } for a bounded query_sql read of { value, count } rows.
41
+ * Both calls run as the viewer; this binding grants no source access. */
42
+ facetQuery: typebox_1.Type.Optional(typebox_1.Type.String({ minLength: 1, maxLength: 64000 })),
43
+ }, { additionalProperties: false });
44
+ function parseCollectionPresentation(raw) {
45
+ if (!value_1.Value.Check(exports.CollectionPresentationSchema, raw))
46
+ throw new Error("Invalid collection presentation configuration");
47
+ const keys = new Set();
48
+ for (const preset of raw.presets ?? []) {
49
+ if (keys.has(preset.key))
50
+ throw new Error(`Duplicate collection preset: ${preset.key}`);
51
+ keys.add(preset.key);
52
+ if (preset.relativeDate) {
53
+ if ((preset.selection.filters?.length ?? 0) > 30)
54
+ throw new Error("Relative date presets support at most 30 other filters");
55
+ if (preset.relativeDate.fromDays > preset.relativeDate.toDays)
56
+ throw new Error("Relative date range is reversed");
57
+ // Intl validates IANA timezone names, including UTC.
58
+ new Intl.DateTimeFormat("en", {
59
+ timeZone: preset.relativeDate.timeZone,
60
+ }).format();
61
+ }
62
+ }
63
+ return raw;
64
+ }
65
+ function resolveCollectionPreset(preset, now = new Date()) {
66
+ const selection = structuredClone(preset.selection);
67
+ if (!preset.relativeDate)
68
+ return selection;
69
+ const { field, fromDays, toDays, timeZone } = preset.relativeDate;
70
+ const parts = new Intl.DateTimeFormat("en", {
71
+ timeZone,
72
+ year: "numeric",
73
+ month: "2-digit",
74
+ day: "2-digit",
75
+ }).formatToParts(now);
76
+ const part = (key) => Number(parts.find((item) => item.type === key)?.value);
77
+ const day = Date.UTC(part("year"), part("month") - 1, part("day"));
78
+ const date = (offset) => new Date(day + offset * 86400000).toISOString().slice(0, 10);
79
+ return {
80
+ ...selection,
81
+ filters: [
82
+ ...(selection.filters ?? []),
83
+ { field, op: "gte", value: date(fromDays) },
84
+ { field, op: "lte", value: date(toDays) },
85
+ ],
86
+ };
87
+ }
88
+ //# sourceMappingURL=collection-presentation.js.map
@@ -0,0 +1,47 @@
1
+ import { type Static } from "@sinclair/typebox";
2
+ export declare const COLLECTION_QUERY_KEY = "$collection";
3
+ declare const AttributeValueSchema: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TBoolean, import("@sinclair/typebox").TNull]>;
4
+ export type AttributeValue = Static<typeof AttributeValueSchema>;
5
+ /** Conjunction only. Fields are schema attributes, never SQL expressions. */
6
+ declare const AttributeFilterSchema: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
7
+ field: import("@sinclair/typebox").TString;
8
+ op: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"eq">, import("@sinclair/typebox").TLiteral<"neq">]>;
9
+ value: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TBoolean, import("@sinclair/typebox").TNull]>;
10
+ }>, import("@sinclair/typebox").TObject<{
11
+ field: import("@sinclair/typebox").TString;
12
+ op: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"lt">, import("@sinclair/typebox").TLiteral<"lte">, import("@sinclair/typebox").TLiteral<"gt">, import("@sinclair/typebox").TLiteral<"gte">]>;
13
+ value: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber]>;
14
+ }>]>;
15
+ export type AttributeFilter = Static<typeof AttributeFilterSchema>;
16
+ export declare const AttributeFiltersSchema: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
17
+ field: import("@sinclair/typebox").TString;
18
+ op: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"eq">, import("@sinclair/typebox").TLiteral<"neq">]>;
19
+ value: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TBoolean, import("@sinclair/typebox").TNull]>;
20
+ }>, import("@sinclair/typebox").TObject<{
21
+ field: import("@sinclair/typebox").TString;
22
+ op: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"lt">, import("@sinclair/typebox").TLiteral<"lte">, import("@sinclair/typebox").TLiteral<"gt">, import("@sinclair/typebox").TLiteral<"gte">]>;
23
+ value: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber]>;
24
+ }>]>>;
25
+ /** Host-owned selection, independent of a view's sorting/layout parameters. */
26
+ export declare const CollectionSelectionSchema: import("@sinclair/typebox").TObject<{
27
+ search: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
28
+ filters: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
29
+ field: import("@sinclair/typebox").TString;
30
+ op: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"eq">, import("@sinclair/typebox").TLiteral<"neq">]>;
31
+ value: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TBoolean, import("@sinclair/typebox").TNull]>;
32
+ }>, import("@sinclair/typebox").TObject<{
33
+ field: import("@sinclair/typebox").TString;
34
+ op: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"lt">, import("@sinclair/typebox").TLiteral<"lte">, import("@sinclair/typebox").TLiteral<"gt">, import("@sinclair/typebox").TLiteral<"gte">]>;
35
+ value: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber]>;
36
+ }>]>>>;
37
+ segment: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
38
+ }>;
39
+ export type CollectionSelection = Static<typeof CollectionSelectionSchema>;
40
+ export declare const CollectionWhenSchema: import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TBoolean, import("@sinclair/typebox").TNull]>>;
41
+ type CollectionWhen = Static<typeof CollectionWhenSchema>;
42
+ /** Malformed URL/host input must never silently become an unfiltered read. */
43
+ export declare function parseCollectionSelection(raw: unknown): CollectionSelection;
44
+ /** Tab applicability is descriptive, never an authorization boundary. */
45
+ export declare function selectionImplies(selection: CollectionSelection, when: CollectionWhen): boolean;
46
+ export {};
47
+ //# sourceMappingURL=collection-selection.d.ts.map
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CollectionWhenSchema = exports.CollectionSelectionSchema = exports.AttributeFiltersSchema = exports.COLLECTION_QUERY_KEY = void 0;
4
+ exports.parseCollectionSelection = parseCollectionSelection;
5
+ exports.selectionImplies = selectionImplies;
6
+ const typebox_1 = require("@sinclair/typebox");
7
+ const value_1 = require("@sinclair/typebox/value");
8
+ exports.COLLECTION_QUERY_KEY = "$collection";
9
+ const Field = typebox_1.Type.String({
10
+ pattern: "^[A-Za-z_][A-Za-z0-9_]*$",
11
+ maxLength: 120,
12
+ });
13
+ const AttributeValueSchema = typebox_1.Type.Union([
14
+ typebox_1.Type.String({ maxLength: 2000 }),
15
+ typebox_1.Type.Number(),
16
+ typebox_1.Type.Boolean(),
17
+ typebox_1.Type.Null(),
18
+ ]);
19
+ /** Conjunction only. Fields are schema attributes, never SQL expressions. */
20
+ const AttributeFilterSchema = typebox_1.Type.Union([
21
+ typebox_1.Type.Object({
22
+ field: Field,
23
+ op: typebox_1.Type.Union([typebox_1.Type.Literal("eq"), typebox_1.Type.Literal("neq")]),
24
+ value: AttributeValueSchema,
25
+ }, { additionalProperties: false }),
26
+ typebox_1.Type.Object({
27
+ field: Field,
28
+ op: typebox_1.Type.Union([
29
+ typebox_1.Type.Literal("lt"),
30
+ typebox_1.Type.Literal("lte"),
31
+ typebox_1.Type.Literal("gt"),
32
+ typebox_1.Type.Literal("gte"),
33
+ ]),
34
+ value: typebox_1.Type.Union([typebox_1.Type.String({ maxLength: 2000 }), typebox_1.Type.Number()]),
35
+ }, { additionalProperties: false }),
36
+ ]);
37
+ exports.AttributeFiltersSchema = typebox_1.Type.Array(AttributeFilterSchema, {
38
+ maxItems: 32,
39
+ });
40
+ /** Host-owned selection, independent of a view's sorting/layout parameters. */
41
+ exports.CollectionSelectionSchema = typebox_1.Type.Object({
42
+ search: typebox_1.Type.Optional(typebox_1.Type.String({ maxLength: 512 })),
43
+ filters: typebox_1.Type.Optional(exports.AttributeFiltersSchema),
44
+ segment: typebox_1.Type.Optional(typebox_1.Type.String({ minLength: 1, maxLength: 120 })),
45
+ }, { additionalProperties: false });
46
+ exports.CollectionWhenSchema = typebox_1.Type.Record(Field, AttributeValueSchema, {
47
+ maxProperties: 32,
48
+ additionalProperties: false,
49
+ });
50
+ /** Malformed URL/host input must never silently become an unfiltered read. */
51
+ function parseCollectionSelection(raw) {
52
+ if (raw === undefined)
53
+ return {};
54
+ let value = raw;
55
+ if (typeof raw === "string") {
56
+ if (raw.length > 80000)
57
+ throw new Error("Collection selection is too large");
58
+ try {
59
+ value = JSON.parse(raw);
60
+ }
61
+ catch {
62
+ throw new Error("Invalid collection selection JSON");
63
+ }
64
+ }
65
+ if (!value_1.Value.Check(exports.CollectionSelectionSchema, value)) {
66
+ throw new Error("Invalid collection selection: use search and typed attribute filters");
67
+ }
68
+ return value;
69
+ }
70
+ /** Tab applicability is descriptive, never an authorization boundary. */
71
+ function selectionImplies(selection, when) {
72
+ return Object.entries(when).every(([field, value]) => selection.filters?.some((filter) => filter.field === field && filter.op === "eq" && filter.value === value));
73
+ }
74
+ //# sourceMappingURL=collection-selection.js.map
@@ -73,11 +73,16 @@ export interface AgentRecord {
73
73
  */
74
74
  export type ModelSource = "agent" | "org_default" | "none";
75
75
  export interface AgentModelInfo {
76
- /** The effective model ref that would be used, or null when none resolves. */
76
+ /** The configured model ref before provider fallback, or null when none resolves. */
77
77
  effective_model: string | null;
78
78
  /** Which layer supplied `effective_model`. */
79
79
  source: ModelSource;
80
- /** True when no model resolves — the agent cannot run until one is set. */
80
+ /**
81
+ * True when no model resolves or the cloud provider preflight rejects every
82
+ * listed candidate using the agent owner's credentials. Provider checks run
83
+ * when the gateway catalog is available; false does not guarantee a
84
+ * successful run or describe device-local execution.
85
+ */
81
86
  not_runnable: boolean;
82
87
  }
83
88
  export type ManageAgentsResult = {
@@ -93,8 +98,9 @@ export type ManageAgentsResult = {
93
98
  created: boolean;
94
99
  /**
95
100
  * The agent's model after create. `not_runnable: true` is the actionable
96
- * signal that no model resolved (no `default_model` given and no org
97
- * default) — set one with a `default_model` on create/update.
101
+ * signal that no runnable model resolved (no `default_model` given and
102
+ * no org default, or the model's provider is not connected) — set a
103
+ * routable `default_model` on create/update or connect its provider.
98
104
  */
99
105
  model: AgentModelInfo;
100
106
  } | {
@@ -79,7 +79,7 @@ export declare const ManageAuthProfilesResultSchema: import("@sinclair/typebox")
79
79
  cookie_count: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
80
80
  auth_cookie_name: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>>;
81
81
  is_expired: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
82
- auth_mode: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"cookies">, import("@sinclair/typebox").TLiteral<"empty">]>>;
82
+ auth_mode: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"cookies">, import("@sinclair/typebox").TLiteral<"live">, import("@sinclair/typebox").TLiteral<"empty">]>>;
83
83
  }>, import("@sinclair/typebox").TObject<{
84
84
  action: import("@sinclair/typebox").TLiteral<"create_auth_profile">;
85
85
  auth_profile: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>>;
@@ -147,7 +147,11 @@ exports.ManageAuthProfilesResultSchema = typebox_1.Type.Union([
147
147
  cookie_count: typebox_1.Type.Optional(typebox_1.Type.Integer()),
148
148
  auth_cookie_name: typebox_1.Type.Optional(typebox_1.Type.Union([typebox_1.Type.String(), typebox_1.Type.Null()])),
149
149
  is_expired: typebox_1.Type.Optional(typebox_1.Type.Boolean()),
150
- auth_mode: typebox_1.Type.Optional(typebox_1.Type.Union([typebox_1.Type.Literal("cookies"), typebox_1.Type.Literal("empty")])),
150
+ auth_mode: typebox_1.Type.Optional(typebox_1.Type.Union([
151
+ typebox_1.Type.Literal("cookies"),
152
+ typebox_1.Type.Literal("live"),
153
+ typebox_1.Type.Literal("empty"),
154
+ ])),
151
155
  }),
152
156
  typebox_1.Type.Object({
153
157
  action: typebox_1.Type.Literal("create_auth_profile"),
@@ -118,6 +118,13 @@ export type AutomationEntityOutput = Static<typeof AutomationEntityOutputSchema>
118
118
  * convention two concurrent runs can silently break. Rows carrying no identity
119
119
  * are inert — never a supersede target — so a keyed output cannot capture an
120
120
  * unrelated event that happens to share metadata.
121
+ *
122
+ * A row may carry `entity_ids` to link that event to its own records instead
123
+ * of the Automation's bound entities (replace, not add). Linkage is not part
124
+ * of the identity, so a later version of a key carries its own row's
125
+ * `entity_ids`. One output array cannot emit the same key twice even for
126
+ * different entities. Put the record's id in a metadata key field when each
127
+ * record needs its own current event.
121
128
  */
122
129
  export declare const AutomationEventOutputSchema: import("@sinclair/typebox").TObject<{
123
130
  event: import("@sinclair/typebox").TString;
@@ -141,12 +148,18 @@ export declare const AutomationScriptExecutorSchema: import("@sinclair/typebox")
141
148
  params: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>>;
142
149
  }>;
143
150
  export type AutomationScriptExecutor = Static<typeof AutomationScriptExecutorSchema>;
151
+ export declare const AutomationExternalExecutorSchema: import("@sinclair/typebox").TObject<{
152
+ kind: import("@sinclair/typebox").TLiteral<"external">;
153
+ }>;
154
+ export type AutomationExecutor = AutomationScriptExecutor | Static<typeof AutomationExternalExecutorSchema>;
144
155
  export declare const AutomationExecutionConfigSchema: import("@sinclair/typebox").TObject<{
145
- executor: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
156
+ executor: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
146
157
  kind: import("@sinclair/typebox").TLiteral<"script">;
147
158
  source: import("@sinclair/typebox").TString;
148
159
  params: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>>;
149
- }>>;
160
+ }>, import("@sinclair/typebox").TObject<{
161
+ kind: import("@sinclair/typebox").TLiteral<"external">;
162
+ }>]>>;
150
163
  timeout_seconds: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
151
164
  max_budget_usd: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
152
165
  model: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
@@ -249,11 +262,13 @@ export declare const ManageAutomationsSchema: import("@sinclair/typebox").TObjec
249
262
  min_cooldown_seconds: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
250
263
  model_config: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>;
251
264
  execution_config: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TNull, import("@sinclair/typebox").TObject<{
252
- executor: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
265
+ executor: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
253
266
  kind: import("@sinclair/typebox").TLiteral<"script">;
254
267
  source: import("@sinclair/typebox").TString;
255
268
  params: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>>;
256
- }>>;
269
+ }>, import("@sinclair/typebox").TObject<{
270
+ kind: import("@sinclair/typebox").TLiteral<"external">;
271
+ }>]>>;
257
272
  timeout_seconds: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
258
273
  max_budget_usd: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
259
274
  model: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ListAutomationsResultSchema = exports.ListAutomationsSchema = exports.ManageAutomationsResultSchema = exports.AutomationTriggerResultSchema = exports.AutomationTriggerExecutionSchema = exports.AutomationClaimNextWindowResultSchema = exports.AutomationClaimNextWindowContextSchema = exports.ManageAutomationsPromotedEntitySchema = exports.ManageAutomationsFeedbackItemSchema = exports.ManageAutomationsDeleteResultSchema = exports.ManageAutomationsSchema = exports.AutomationSkillSchema = exports.SourceSchema = exports.AutomationDeliveryTargetSchema = exports.AutomationExecutionConfigSchema = exports.AutomationScriptExecutorSchema = exports.AutomationOutputsSchema = exports.AutomationOutputSchema = exports.AutomationEventOutputSchema = exports.AutomationEntityOutputSchema = exports.AutomationSourceSchema = exports.AutomationTriggerSchema = exports.AutomationScheduleTriggerSchema = exports.AutomationWorkspaceEventTriggerSchema = exports.AutomationEventTriggerSchema = void 0;
3
+ exports.ListAutomationsResultSchema = exports.ListAutomationsSchema = exports.ManageAutomationsResultSchema = exports.AutomationTriggerResultSchema = exports.AutomationTriggerExecutionSchema = exports.AutomationClaimNextWindowResultSchema = exports.AutomationClaimNextWindowContextSchema = exports.ManageAutomationsPromotedEntitySchema = exports.ManageAutomationsFeedbackItemSchema = exports.ManageAutomationsDeleteResultSchema = exports.ManageAutomationsSchema = exports.AutomationSkillSchema = exports.SourceSchema = exports.AutomationDeliveryTargetSchema = exports.AutomationExecutionConfigSchema = exports.AutomationExternalExecutorSchema = exports.AutomationScriptExecutorSchema = exports.AutomationOutputsSchema = exports.AutomationOutputSchema = exports.AutomationEventOutputSchema = exports.AutomationEntityOutputSchema = exports.AutomationSourceSchema = exports.AutomationTriggerSchema = exports.AutomationScheduleTriggerSchema = exports.AutomationWorkspaceEventTriggerSchema = exports.AutomationEventTriggerSchema = void 0;
4
4
  exports.resolvedEventExecution = resolvedEventExecution;
5
5
  exports.normalizeWorkspaceEventTrigger = normalizeWorkspaceEventTrigger;
6
6
  exports.normalizeAutomationTags = normalizeAutomationTags;
@@ -117,7 +117,10 @@ exports.AutomationScheduleTriggerSchema = typebox_1.Type.Object({
117
117
  active_run: typebox_1.Type.Optional(typebox_1.Type.Literal("coalesce", {
118
118
  default: "coalesce",
119
119
  })),
120
- skip_if_unchanged: typebox_1.Type.Optional(typebox_1.Type.Boolean({ default: true })),
120
+ skip_if_unchanged: typebox_1.Type.Optional(typebox_1.Type.Boolean({
121
+ default: true,
122
+ description: "Native executors may skip unchanged source windows. External executors always receive due windows and decide whether to emit output.",
123
+ })),
121
124
  }, { additionalProperties: false });
122
125
  exports.AutomationTriggerSchema = typebox_1.Type.Union([
123
126
  exports.AutomationEventTriggerSchema,
@@ -178,6 +181,13 @@ exports.AutomationEntityOutputSchema = typebox_1.Type.Object({
178
181
  * convention two concurrent runs can silently break. Rows carrying no identity
179
182
  * are inert — never a supersede target — so a keyed output cannot capture an
180
183
  * unrelated event that happens to share metadata.
184
+ *
185
+ * A row may carry `entity_ids` to link that event to its own records instead
186
+ * of the Automation's bound entities (replace, not add). Linkage is not part
187
+ * of the identity, so a later version of a key carries its own row's
188
+ * `entity_ids`. One output array cannot emit the same key twice even for
189
+ * different entities. Put the record's id in a metadata key field when each
190
+ * record needs its own current event.
181
191
  */
182
192
  exports.AutomationEventOutputSchema = typebox_1.Type.Object({
183
193
  event: typebox_1.Type.String({
@@ -189,7 +199,7 @@ exports.AutomationEventOutputSchema = typebox_1.Type.Object({
189
199
  minItems: 1,
190
200
  maxItems: 4,
191
201
  uniqueItems: true,
192
- description: "One to four metadata fields whose exact values compose each draft's stable identity across Automation runs (e.g. channel + mode for per-channel voice profiles). Every key field must be present in every draft's `metadata` and be a non-blank string, safe integer, or boolean — the type is part of the identity, so 3 and \"3\" are different keys. Changing the fields, their order, or the semantic type changes identity and starts a new chain. When set, each run supersedes the current event carrying the same key values.",
202
+ description: "One to four metadata fields whose exact values compose each draft's stable identity across Automation runs (e.g. channel + mode for per-channel voice profiles). Every key field must be present in every draft's `metadata` and be a non-blank string, safe integer, or boolean — the type is part of the identity, so 3 and \"3\" are different keys. Changing the fields, their order, or the semantic type changes identity and starts a new chain. When set, each run supersedes the current event carrying the same key values. Row `entity_ids` are not part of the identity: include a record id in the key when each record needs its own current event.",
193
203
  })),
194
204
  }, { additionalProperties: false });
195
205
  exports.AutomationOutputSchema = typebox_1.Type.Union([
@@ -200,7 +210,7 @@ exports.AutomationOutputsSchema = typebox_1.Type.Object({}, {
200
210
  additionalProperties: exports.AutomationOutputSchema,
201
211
  minProperties: 1,
202
212
  maxProperties: 20,
203
- description: "Named top-level arrays persisted after a completed window. Entity outputs are validated against their entity type; event rows require content and may include title, metadata, author, source_url, occurred_at, parent_event_id, payload_type, and idempotency_key.",
213
+ description: "Named top-level arrays persisted after a completed window. Entity outputs are validated against their entity type; event rows require content and may include title, metadata, author, source_url, occurred_at, parent_event_id, payload_type, idempotency_key, and entity_ids. entity_ids on a row replace the bound entities of the Automation for that row (omit to keep them); each id must be an entity in the same workspace the run may write, or the completion fails.",
204
214
  });
205
215
  exports.AutomationScriptExecutorSchema = typebox_1.Type.Object({
206
216
  kind: typebox_1.Type.Literal("script"),
@@ -210,8 +220,15 @@ exports.AutomationScriptExecutorSchema = typebox_1.Type.Object({
210
220
  additionalProperties: false,
211
221
  description: "Run this TypeScript module directly in the Automation sandbox. Export default async (ctx, client). The runtime pins the script and window at activation and completes the run only after success. SDK writes retain the owning agent's permissions. Use ctx.window.run_id for retry idempotency.",
212
222
  });
223
+ exports.AutomationExternalExecutorSchema = typebox_1.Type.Object({ kind: typebox_1.Type.Literal("external") }, {
224
+ additionalProperties: false,
225
+ description: "An authorized external MCP client claims and completes this Automation. Manual and schedule window activations only. The schedule remains authoritative; Lobu does not start a hosted agent or device CLI. managed_agent_id may retain the owning delivery principal.",
226
+ });
213
227
  exports.AutomationExecutionConfigSchema = typebox_1.Type.Object({
214
- executor: typebox_1.Type.Optional(exports.AutomationScriptExecutorSchema),
228
+ executor: typebox_1.Type.Optional(typebox_1.Type.Union([
229
+ exports.AutomationScriptExecutorSchema,
230
+ exports.AutomationExternalExecutorSchema,
231
+ ])),
215
232
  timeout_seconds: typebox_1.Type.Optional(typebox_1.Type.Integer({
216
233
  minimum: 1,
217
234
  maximum: 86400,
@@ -244,7 +261,7 @@ exports.AutomationExecutionConfigSchema = typebox_1.Type.Object({
244
261
  })),
245
262
  }, {
246
263
  additionalProperties: false,
247
- description: "[create/update] Per-Automation execution settings: a sandboxed script executor, device-worker CLI flags, or the server-side finalize-nudge budget. Omitted fields fall back to dispatcher/CLI/global defaults; pass null to clear.",
264
+ description: "[create/update] Per-Automation execution settings: an external MCP client, a sandboxed script executor, device-worker CLI flags, or the server-side finalize-nudge budget. Omitted fields fall back to dispatcher/CLI/global defaults; pass null to clear.",
248
265
  });
249
266
  exports.AutomationDeliveryTargetSchema = typebox_1.Type.Object({
250
267
  connection_id: typebox_1.Type.Integer({
@@ -424,7 +441,7 @@ exports.ManageAutomationsSchema = typebox_1.Type.Object({
424
441
  exports.AutomationOutputsSchema,
425
442
  typebox_1.Type.Null(),
426
443
  ], {
427
- description: '[create/create_version] Named durable outputs for window execution. `{ entity, key, name? }` validates and upserts entities; `{ event }` appends standard event drafts. The object key is the top-level extracted_data array name. Event rows require content and may include title, metadata, author, source_url, occurred_at, parent_event_id, payload_type, and idempotency_key. Event triggers on an Automation with outputs must use execution="window". Pass null on create_version to remove all declared outputs.',
444
+ description: '[create/create_version] Named durable outputs for window execution. `{ entity, key, name? }` validates and upserts entities; `{ event }` appends standard event drafts. The object key is the top-level extracted_data array name. Event rows require content and may include title, metadata, author, source_url, occurred_at, parent_event_id, payload_type, idempotency_key, and entity_ids. entity_ids on a row replace the bound entities of the Automation for that row (omit to keep them); each id must be an entity in the same workspace the run may write, or the completion fails. Event triggers on an Automation with outputs must use execution="window". Pass null on create_version to remove all declared outputs.',
428
445
  })),
429
446
  triggers: typebox_1.Type.Optional(typebox_1.Type.Array(exports.AutomationTriggerSchema, {
430
447
  minItems: 0,
@@ -432,7 +449,7 @@ exports.ManageAutomationsSchema = typebox_1.Type.Object({
432
449
  description: "[create/update/create_version] Canonical Automation activations. Use a schedule trigger for cadence and timezone.",
433
450
  })),
434
451
  managed_agent_id: typebox_1.Type.Optional(typebox_1.Type.Union([typebox_1.Type.String({ minLength: 1 }), typebox_1.Type.Null()], {
435
- description: "[create/update] Optional managed agent that executes this Automation's runs (server dispatch lane). Null clears the assignment; an Automation with neither managed_agent_id nor device_worker_id is manual-only and may be completed by an external MCP client. [list] Optional owner filter.",
452
+ description: "[create/update] Optional managed agent that owns this Automation. Normally executes its runs; an explicit external executor retains the agent only as the permission and delivery principal. Null clears the assignment. Without a managed agent, device pin, or external executor, an Automation is manual-only. [list] Optional owner filter.",
436
453
  })),
437
454
  status: typebox_1.Type.Optional(typebox_1.Type.Union([typebox_1.Type.Literal("active"), typebox_1.Type.Literal("archived")], {
438
455
  description: "[list] Optional status filter. Omit to include active Automations only.",