@lobu/runtime-device 22.0.0 → 24.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/component.json +1 -1
- package/dist/dependencies.bun.lock +33 -30
- package/npm-shrinkwrap.json +140 -124
- package/package.json +2 -1
- package/vendor/cli/dist/bundled-skills/lobu/SKILL.md +74 -1
- package/vendor/cli/dist/commands/_lib/apply/apply-cmd.js +9 -11
- package/vendor/cli/dist/commands/_lib/apply/client.d.ts +3 -11
- package/vendor/cli/dist/commands/_lib/apply/client.js +3 -3
- package/vendor/cli/dist/commands/_lib/apply/desired-state.d.ts +0 -6
- package/vendor/cli/dist/commands/_lib/apply/desired-state.js +6 -15
- package/vendor/cli/dist/commands/_lib/apply/diff.js +1 -0
- package/vendor/cli/dist/commands/_lib/apply/map-config.js +8 -0
- package/vendor/cli/dist/commands/_lib/view-bundler.d.ts +2 -9
- package/vendor/cli/dist/commands/_lib/view-bundler.js +25 -97
- package/vendor/cli/dist/config/define.d.ts +8 -0
- package/vendor/cli/dist/connectors/README.md +15 -2
- package/vendor/cli/dist/connectors/google_gmail.ts +1 -0
- package/vendor/cli/dist/connectors/jira-helpers.ts +313 -0
- package/vendor/cli/dist/connectors/jira.ts +29 -221
- package/vendor/cli/dist/connectors/linkedin-browser-script.ts +13 -0
- package/vendor/cli/dist/connectors/linkedin-draft-page.js +104 -0
- package/vendor/cli/dist/connectors/linkedin-drafts.ts +73 -0
- package/vendor/cli/dist/connectors/linkedin-identity.ts +32 -0
- package/vendor/cli/dist/connectors/linkedin-inbox-adapter.js +1182 -0
- package/vendor/cli/dist/connectors/linkedin-inbox.ts +156 -0
- package/vendor/cli/dist/connectors/linkedin-like.ts +114 -0
- package/vendor/cli/dist/connectors/linkedin-takeout.ts +577 -0
- package/vendor/cli/dist/connectors/linkedin.ts +4017 -0
- package/vendor/cli/dist/connectors/reddit.ts +92 -20
- package/vendor/cli/dist/connectors/slack.ts +1 -0
- package/vendor/cli/dist/connectors/takeout-utils.ts +240 -0
- package/vendor/cli/dist/connectors/tiktok-inbox-page.js +9 -9
- package/vendor/cli/dist/connectors/tiktok-web-page.js +21 -15
- package/vendor/cli/dist/connectors/tiktok_web.ts +63 -30
- package/vendor/cli/dist/connectors/whatsapp-web-adapter.js +104 -574
- package/vendor/cli/dist/connectors/whatsapp-web-helpers.ts +30 -444
- package/vendor/cli/dist/connectors/whatsapp-web-identity.ts +20 -6
- package/vendor/cli/dist/connectors/whatsapp_web.ts +46 -646
- package/vendor/cli/dist/connectors/x-dm-adapter.js +556 -0
- package/vendor/cli/dist/connectors/x-identity.ts +33 -2
- package/vendor/cli/dist/connectors/x.ts +266 -120
- package/vendor/cli/dist/runtime-components.json +4 -4
- package/vendor/cli/dist/templates/AGENTS.md.tmpl +12 -5
- package/vendor/cli/package.json +1 -1
- package/vendor/connector-sdk/dist/browser-handoff-banner.d.ts +39 -0
- package/vendor/connector-sdk/dist/browser-handoff-banner.js +175 -0
- package/vendor/connector-sdk/dist/browser-source-read.d.ts +52 -0
- package/vendor/connector-sdk/dist/browser-source-read.js +107 -0
- package/vendor/connector-sdk/dist/connector-types.d.ts +10 -0
- package/vendor/connector-sdk/dist/index.d.ts +3 -0
- package/vendor/connector-sdk/dist/index.js +2 -0
- package/vendor/connector-sdk/package.json +9 -1
- package/vendor/connector-worker/dist/agent-turn/gateway-tools.d.ts +2 -2
- package/vendor/connector-worker/dist/agent-turn/gateway-tools.js +2 -2
- package/vendor/connector-worker/dist/agent-turn/guest-entry.js +49 -8
- package/vendor/connector-worker/dist/agent-turn/guest.bundle.js +650 -448
- package/vendor/connector-worker/dist/agent-turn/native-session.d.ts +12 -0
- package/vendor/connector-worker/dist/agent-turn/native-session.js +32 -6
- package/vendor/connector-worker/dist/agent-turn/types.d.ts +24 -3
- package/vendor/connector-worker/dist/daemon/agent-turn.js +5 -1
- package/vendor/connector-worker/dist/daemon/automation.d.ts +4 -11
- package/vendor/connector-worker/dist/daemon/automation.js +26 -21
- package/vendor/connector-worker/dist/daemon/client.d.ts +2 -4
- package/vendor/connector-worker/dist/daemon/client.js +0 -3
- package/vendor/connector-worker/dist/daemon/executor.js +0 -3
- package/vendor/connector-worker/dist/daemon/mac-device-daemon.d.ts +4 -3
- package/vendor/connector-worker/dist/daemon/mac-device-daemon.js +4 -10
- package/vendor/connector-worker/dist/daemon/native-bridge/executor.js +27 -25
- package/vendor/connector-worker/dist/daemon/start.js +3 -15
- package/vendor/connector-worker/dist/daemon/terminal-failure.js +0 -11
- package/vendor/connector-worker/dist/daemon/worker-id.d.ts +17 -0
- package/vendor/connector-worker/dist/daemon/worker-id.js +22 -0
- package/vendor/connector-worker/dist/isolate/prelude.js +93 -44
- package/vendor/connector-worker/dist/mac-device-daemon.js +14 -26
- package/vendor/connector-worker/package.json +1 -1
- package/vendor/core/dist/agent-policy.js +0 -3
- package/vendor/core/dist/agent-tooling.d.ts +1 -1
- package/vendor/core/dist/agent-tooling.js +3 -1
- package/vendor/core/dist/capabilities.d.ts +1 -1
- package/vendor/core/dist/capabilities.js +0 -1
- package/vendor/core/dist/connector-query-errors.d.ts +32 -0
- package/vendor/core/dist/connector-query-errors.js +41 -1
- package/vendor/core/dist/contracts/agent-settings.d.ts +6 -2
- package/vendor/core/dist/contracts/agent-settings.js +12 -1
- package/vendor/core/dist/contracts/tools/manage-conversations.js +2 -2
- package/vendor/core/dist/contracts/tools/manage-feeds.d.ts +14 -0
- package/vendor/core/dist/contracts/tools/manage-feeds.js +17 -0
- package/vendor/core/dist/contracts/tools/manage-views.d.ts +53 -234
- package/vendor/core/dist/contracts/tools/manage-views.js +50 -76
- package/vendor/core/dist/contracts/tools/view-attach.d.ts +5 -8
- package/vendor/core/dist/contracts/tools/view-attach.js +14 -31
- package/vendor/core/dist/contracts/tools/view-definition.d.ts +21 -0
- package/vendor/core/dist/contracts/tools/view-definition.js +165 -0
- package/vendor/core/dist/contracts/worker/protocol.d.ts +47 -133
- package/vendor/core/dist/contracts/worker/protocol.js +33 -62
- package/vendor/core/dist/device-pin-tombstones.d.ts +44 -0
- package/vendor/core/dist/device-pin-tombstones.js +57 -0
- package/vendor/core/dist/index.d.ts +3 -2
- package/vendor/core/dist/index.js +3 -1
- package/vendor/core/dist/logger.js +10 -25
- package/vendor/core/dist/suggestions.d.ts +15 -2
- package/vendor/core/dist/suggestions.js +48 -3
- package/vendor/core/dist/types.d.ts +26 -0
- package/vendor/core/dist/types.js +5 -0
- package/vendor/core/dist/utils/diagnostic-scrubber.js +258 -21
- package/vendor/core/dist/worker/wire.d.ts +0 -10
- package/vendor/core/package.json +16 -10
- package/vendor/postgres/cf/src/connection.js +18 -0
- package/vendor/postgres/cjs/src/connection.js +18 -0
- package/vendor/postgres/src/connection.js +18 -0
- package/vendor/connector-worker/dist/daemon/device-chat.d.ts +0 -9
- package/vendor/connector-worker/dist/daemon/device-chat.js +0 -61
- package/vendor/core/dist/contracts/worker/device-chat.d.ts +0 -4
- package/vendor/core/dist/contracts/worker/device-chat.js +0 -26
- /package/vendor/postgres/{.bun-tag-f39dafdb2305d504 → .bun-tag-2f292c6554a8475e} +0 -0
|
@@ -60,7 +60,7 @@ Use ClientSDK through Lobu MCP or `lobu memory exec` with the explicit cloud con
|
|
|
60
60
|
|
|
61
61
|
If managed auth supplied a `local_bootstrap_command`, use the project it generated. Otherwise run `npx @lobu/cli@latest init` with the confirmed name and provider. Postgres is built in, so `lobu run` starts an embedded database; ask for `DATABASE_URL` only if the user chooses external Postgres. Read the generated `AGENTS.md` completely before editing `lobu.config.ts`. Use the canonical reference at `https://github.com/lobu-ai/lobu/blob/main/examples/lobu-crm/lobu.config.ts` when needed; do not assume that example exists in the new project's filesystem. Briefly explain how the chosen feed may use checkpoints to collect incrementally, emits events, builds shared entity memory, and gives both chat and Automations the same governed context.
|
|
62
62
|
|
|
63
|
-
`feeds_schema.<feed>.eventKinds` are the default Automation trigger catalog for feed connectors: every declared kind is a subscribable event type (`event_type` = the kind slug) for any feed that emits the kind. A feed's first successful non-dry sync establishes its baseline without activation; later inserts of a matching kind activate subscribers. Feed-scoped filtering is not yet available (events dedupe by connection + origin id, so a `feed_key` match would miss origins first seen by another feed). `automation_events` (now derived from eventKinds when a connector declares none) is the trigger picker's list. If no declared kind matches the use case, use a scheduled Automation with a bounded named SQL source and read event text from `payload_text`. Validate the query against the running local schema before relying on it. If `feeds_schema` is empty, do not invent or trigger a feed; chat integrations such as Slack can deliver incoming messages directly. For Slack or Telegram, prefer `defineConnection` with `credentialMode: "hosted"` so no bot token is required; `lobu run` prints the exact hosted-workspace join URL, own-workspace install URL when available, and short-lived link command. This hosted chat path requires a cloud session and the agent applied to that cloud workspace; the link targets the cloud agent. It does not create a local Slack data connection or prove local Slack search. Use those returned values instead of constructing URLs. A printed `/lobu link <code>` is one-time: redeem it in the first selected DM or channel. In an installed workspace whose installer is linked to Lobu, bind each additional surface with `/lobu link <agent-id>`; otherwise generate a fresh code for that surface. Mention Lobu in a channel test and verify the App Home separately. Lobu email login and Slack installation are separate: the email link authorizes Lobu CLI access, while an existing-workspace install requires the user or workspace admin to approve Slack's OAuth screen. Never describe Slack consent as an email approval. Use `credentialMode: "byo"` only if the user chooses their own app. Tell the user once which remaining secrets are required and add only `secret("ENV_NAME")` placeholders to config. Never open or request permission to read `.env`; inspect `.env.example` when present and declared secret placeholder names only. Never read, print, invent, or paste a real secret into source or chat.
|
|
63
|
+
`feeds_schema.<feed>.eventKinds` are the default Automation trigger catalog for feed connectors: every declared kind is a subscribable event type (`event_type` = the kind slug) for any feed that emits the kind. A feed's first successful non-dry sync establishes its baseline without activation; later inserts of a matching kind activate subscribers. A kind with `updatedEvent: true` also offers `<kind>.updated` for supersedes whose `occurred_at` strictly advances past the previous head. The original kind stays insert-only; unchanged rows, volatile-only updates and same-time reformats stay quiet. Subscribe to both types for new items and later activity. Feed-scoped filtering is not yet available (events dedupe by connection + origin id, so a `feed_key` match would miss origins first seen by another feed). `automation_events` (now derived from eventKinds when a connector declares none) is the trigger picker's list. If no declared kind matches the use case, use a scheduled Automation with a bounded named SQL source and read event text from `payload_text`. Validate the query against the running local schema before relying on it. If `feeds_schema` is empty, do not invent or trigger a feed; chat integrations such as Slack can deliver incoming messages directly. For Slack or Telegram, prefer `defineConnection` with `credentialMode: "hosted"` so no bot token is required; `lobu run` prints the exact hosted-workspace join URL, own-workspace install URL when available, and short-lived link command. This hosted chat path requires a cloud session and the agent applied to that cloud workspace; the link targets the cloud agent. It does not create a local Slack data connection or prove local Slack search. Use those returned values instead of constructing URLs. A printed `/lobu link <code>` is one-time: redeem it in the first selected DM or channel. In an installed workspace whose installer is linked to Lobu, bind each additional surface with `/lobu link <agent-id>`; otherwise generate a fresh code for that surface. Mention Lobu in a channel test and verify the App Home separately. Lobu email login and Slack installation are separate: the email link authorizes Lobu CLI access, while an existing-workspace install requires the user or workspace admin to approve Slack's OAuth screen. Never describe Slack consent as an email approval. Use `credentialMode: "byo"` only if the user chooses their own app. Tell the user once which remaining secrets are required and add only `secret("ENV_NAME")` placeholders to config. Never open or request permission to read `.env`; inspect `.env.example` when present and declared secret placeholder names only. Never read, print, invent, or paste a real secret into source or chat.
|
|
64
64
|
|
|
65
65
|
If the user wants the agent to know people in Slack, ask whether that means conversation participants, members of bound channels, or the full workspace directory. Installing the app proves none of those by itself. Verify the selected scope by inspecting the people or member entities Lobu actually materialized and by asking the agent a roster question. If human-readable names or non-participants are unavailable, identify that exact product gap; never claim the complete workspace directory was synced.
|
|
66
66
|
|
|
@@ -150,6 +150,7 @@ const ticket = defineEntityType({
|
|
|
150
150
|
properties: {
|
|
151
151
|
subject: {
|
|
152
152
|
type: "string",
|
|
153
|
+
title: "Subject",
|
|
153
154
|
"x-table-label": "Subject",
|
|
154
155
|
"x-table-column": true,
|
|
155
156
|
},
|
|
@@ -164,6 +165,8 @@ export default defineConfig({
|
|
|
164
165
|
});
|
|
165
166
|
```
|
|
166
167
|
|
|
168
|
+
The entity schema also renders the record page form. Give every array `items` and every object `properties` (bare ones render as raw JSON), put the label in `title` and help text in `description`, mark derived fields `readOnly: true`, and declare every field an Automation writes.
|
|
169
|
+
|
|
167
170
|
Seed data records still live as YAML under `./data`. Then seed or operate the memory workspace with:
|
|
168
171
|
|
|
169
172
|
```bash
|
|
@@ -222,6 +225,76 @@ The normal MCP surface is intentionally small. Flat administrative tools are not
|
|
|
222
225
|
|
|
223
226
|
Search before create to avoid duplicates. Prefer a read or dry run before mutations, never fabricate returned URLs or identifiers, and never delete from `events`; supersede or tombstone instead.
|
|
224
227
|
|
|
228
|
+
## Custom Views
|
|
229
|
+
|
|
230
|
+
Views are custom React panels attached to entity types, records, events, or the workspace Data hub. They render in the web app and MCP hosts (Claude and other MCP Apps hosts); chat channels get links to views, not the views themselves. Author them in `views/<type>/<key>.tsx` and ship with `lobu apply` (list them via `viewFromFile` in `defineConfig`), or set single-file sources over MCP with `manage_views` (owner/admin only).
|
|
231
|
+
|
|
232
|
+
Module shape (the server resolves React, React DOM, `@lobu/views` and `@lobu/views/components`; other dependencies need the CLI path with `node_modules` present):
|
|
233
|
+
|
|
234
|
+
```tsx
|
|
235
|
+
import { defineView, sql, useAction, useParams, useQuery } from "@lobu/views";
|
|
236
|
+
import {
|
|
237
|
+
Card,
|
|
238
|
+
DataTable,
|
|
239
|
+
EmptyState,
|
|
240
|
+
ErrorState,
|
|
241
|
+
FilterBar,
|
|
242
|
+
LoadingState,
|
|
243
|
+
SearchField,
|
|
244
|
+
TruncatedNotice,
|
|
245
|
+
} from "@lobu/views/components";
|
|
246
|
+
|
|
247
|
+
export const view = defineView({
|
|
248
|
+
key: "pipeline",
|
|
249
|
+
attach: [{ collection: "deal" }],
|
|
250
|
+
params: { stage: { type: "string", default: "open" } },
|
|
251
|
+
actions: { markWon: { emits: "deal.won" } },
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
export default function Pipeline() {
|
|
255
|
+
const [params, setParams] = useParams();
|
|
256
|
+
const deals = useQuery<Array<{ id: string; title: string }>>(
|
|
257
|
+
sql`SELECT id, title FROM deal WHERE stage = ${params.stage} LIMIT 100`
|
|
258
|
+
);
|
|
259
|
+
const markWon = useAction("markWon");
|
|
260
|
+
const rows = deals.data ?? [];
|
|
261
|
+
// Keep the filter mounted across query states: an early return on
|
|
262
|
+
// loading/error would unmount the focused input on every keystroke
|
|
263
|
+
// (each keystroke re-queries). Render states inline instead.
|
|
264
|
+
return (
|
|
265
|
+
<Card
|
|
266
|
+
title="Pipeline"
|
|
267
|
+
actions={<button type="button" onClick={() => markWon({})}>Mark won</button>}
|
|
268
|
+
>
|
|
269
|
+
<FilterBar><SearchField label="Stage" value={String(params.stage)} onChange={(v) => setParams({ stage: v })} /></FilterBar>
|
|
270
|
+
{deals.loading && <LoadingState text="Loading deals…" />}
|
|
271
|
+
{deals.error && <ErrorState message={deals.error} errorCode={deals.errorCode} />}
|
|
272
|
+
{!deals.loading && !deals.error && rows.length === 0 && (
|
|
273
|
+
<EmptyState title="No deals in this stage." />
|
|
274
|
+
)}
|
|
275
|
+
{!deals.loading && !deals.error && rows.length > 0 && (
|
|
276
|
+
<DataTable columns={[{ key: "title", header: "Title" }]} rows={rows} keyOf={(r) => r.id} />
|
|
277
|
+
)}
|
|
278
|
+
{deals.truncated && <TruncatedNotice shown={rows.length} />}
|
|
279
|
+
</Card>
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
`defineView` is the view's only declaration: `key`, optional `name` (defaults to the key) and `description`, `attach`, `params` and `actions` are read from it, never passed separately, so `manage_views` `set` takes just the source. Write it out as a literal (no variables, spreads or `${}` templates): the server reads it without running the module.
|
|
285
|
+
|
|
286
|
+
`attach` lists the pages a view appears on, one per entry: `{ record: "deal" }` is a card on every deal's page above its activity (`{ record: "deal", id: 7 }` pins one record), `{ collection: "deal", when? }` a tab on the deal list page, `{ workspace: true }` a Data hub tab, `{ event: "deal.won", type? }` one event's page. One view can list several pages and branch on `useScope()` when it answers the same question at each scale. A record card renders with `useHost().displayMode === "inline"` inside `container.maxHeight` (the host clips past it): render a summary there with a "See all" that calls `requestDisplayMode("fullscreen")`, and the full view when `displayMode` is `"fullscreen"` (the peek, a full page, a tab).
|
|
287
|
+
|
|
288
|
+
Rules that are load-bearing, not style:
|
|
289
|
+
|
|
290
|
+
- Reads go through `useQuery` (`sql`, a `query_sdk` script string, or a read-only `tool()`). `query_sql` allows 500 rows max with a 5 second timeout — branch on the typed `errorCode` (e.g. `UPSTREAM_TIMEOUT`), never on message text, and render `truncated` honestly instead of passing partial data off as complete. Each `query_sql` cell is bounded too: strings keep their first 4,000 Unicode code points plus "… [truncated]"; JSON values over 16 KiB become `{ _truncated: true, bytes }` (attachments become null with `attachments_truncated`). `truncatedColumns` names the affected columns. Select smaller elements or fields, for example one array element per row with `jsonb_array_elements(...)`, and paginate as needed; each returned cell is still subject to these limits.
|
|
291
|
+
- Never aggregate history in a view: no `GROUP BY`, `DISTINCT ON`, per-row regexp, or leading-wildcard `LIKE` over `events` or other growing tables. For "latest state" views, have an Automation maintain keyed event outputs (each run supersedes the previous event with the same key) and read the current head with `read_knowledge`.
|
|
292
|
+
- Writes go only through declared view actions (`useAction` → `invoke_view_action`), which emit the declared event kind and can activate workspace-triggered Automations. Action `value` payloads are capped at 4000 JSON chars — save content first, then pass the id. A subject shown from a superseded event rejects with 409; refetch and ask the user to re-confirm rather than retrying blindly.
|
|
293
|
+
- Link with `Link` from `@lobu/views/components` (or `useHost().openLink`): `href="<type>/<slug>"` opens that record in the workspace, a full URL opens a new tab. A plain `<a href>` goes nowhere inside the sandboxed frame.
|
|
294
|
+
- Views run in a sandboxed frame with no direct network: no fetch, no third-party calls at runtime. Bundle shared code via the CLI path; the MCP `manage_views` path compiles `react` + `@lobu/views` (+components) only.
|
|
295
|
+
- Never early-return the whole view on loading/error: each filter keystroke re-queries, so an early return unmounts the focused input mid-typing. Keep filters mounted and render query states inline in the results area.
|
|
296
|
+
- Params sync to the URL on Lobu hosts only; elsewhere they stay frame-local. `refetch()` re-reads on demand; only Lobu hosts push live data-changed refreshes.
|
|
297
|
+
|
|
225
298
|
## Connectors, Feeds, and Operations
|
|
226
299
|
|
|
227
300
|
Connectors are the primary integration path for third-party services. The
|
|
@@ -556,25 +556,20 @@ export async function executePlan(ctx, pendingAuth) {
|
|
|
556
556
|
printText(chalk.yellow(`Warning: ${warning}`));
|
|
557
557
|
}
|
|
558
558
|
}
|
|
559
|
-
// 2b) Views — shipped from the load-time bundle (source + browser bundle
|
|
560
|
-
//
|
|
561
|
-
//
|
|
562
|
-
// hash the server will compute.
|
|
559
|
+
// 2b) Views — shipped from the load-time bundle (source + browser bundle,
|
|
560
|
+
// hashed with the server's function; the server reads the declaration
|
|
561
|
+
// from the source). No re-bundling here: the diff already compared the
|
|
562
|
+
// exact hash the server will compute.
|
|
563
563
|
for (const row of rowsByKind("view")) {
|
|
564
564
|
if (row.kind !== "view")
|
|
565
565
|
continue;
|
|
566
566
|
if (!row.desired)
|
|
567
567
|
continue;
|
|
568
568
|
const result = await ctx.client.setView({
|
|
569
|
-
key: row.id,
|
|
570
|
-
name: row.desired.key,
|
|
571
569
|
source_code: row.desired.sourceCode,
|
|
572
570
|
compiled_code: row.desired.compiledCode,
|
|
573
571
|
source_files: row.desired.sourceFiles,
|
|
574
572
|
dependencies: row.desired.dependencies,
|
|
575
|
-
attach: row.desired.attach,
|
|
576
|
-
params: row.desired.params,
|
|
577
|
-
actions: row.desired.actions,
|
|
578
573
|
});
|
|
579
574
|
const kb = (Buffer.byteLength(row.desired.compiledCode, "utf8") / 1024).toFixed(0);
|
|
580
575
|
printText(renderProgress(row.verb, "view", row.id, `${result.written ? "(pushed" : "(unchanged"}, ${kb} KB)`));
|
|
@@ -1285,8 +1280,11 @@ async function applyProject(opts, prepared) {
|
|
|
1285
1280
|
// Provider API keys live outside the resource diff (the secret value isn't
|
|
1286
1281
|
// serialized into any plan row), so a key-only `.env` change produces an
|
|
1287
1282
|
// all-noop plan. Detect declared keys so the apply isn't short-circuited and
|
|
1288
|
-
// the keys aren't silently dropped.
|
|
1289
|
-
|
|
1283
|
+
// the keys aren't silently dropped. Keys are declared on agents, so they
|
|
1284
|
+
// belong to the agents family: `--only memory` must never push one (a push
|
|
1285
|
+
// can create the org provider row).
|
|
1286
|
+
const hasProviderKeys = opts.only !== "memory" &&
|
|
1287
|
+
state.agents.some((a) => a.providerKeys.length > 0);
|
|
1290
1288
|
if (plan.counts.create === 0 &&
|
|
1291
1289
|
plan.counts.update === 0 &&
|
|
1292
1290
|
plan.counts.delete === 0 &&
|
|
@@ -125,18 +125,10 @@ export interface RemoteView {
|
|
|
125
125
|
updated_at: string;
|
|
126
126
|
}
|
|
127
127
|
export interface SetViewPayload {
|
|
128
|
-
key: string;
|
|
129
|
-
name?: string;
|
|
130
|
-
description?: string;
|
|
131
128
|
source_code: string;
|
|
132
129
|
compiled_code?: string;
|
|
133
130
|
source_files?: SourceFiles;
|
|
134
131
|
dependencies?: SourceDependencies;
|
|
135
|
-
attach: Array<Record<string, unknown>>;
|
|
136
|
-
params: Record<string, unknown>;
|
|
137
|
-
actions: Record<string, {
|
|
138
|
-
emits: string;
|
|
139
|
-
}>;
|
|
140
132
|
}
|
|
141
133
|
export interface RemoteAutomation {
|
|
142
134
|
slug: string;
|
|
@@ -372,9 +364,9 @@ export declare class ApplyClient {
|
|
|
372
364
|
/** Applied views (metadata only — the list never returns bundles). */
|
|
373
365
|
listViews(): Promise<RemoteView[]>;
|
|
374
366
|
/**
|
|
375
|
-
* Store a view: source + CLI-bundled browser bundle
|
|
376
|
-
* from the
|
|
377
|
-
* executable artifact is a server-side no-op).
|
|
367
|
+
* Store a view: source + CLI-bundled browser bundle. The server reads the
|
|
368
|
+
* view's key, attach, params and actions from the source. Returns whether a
|
|
369
|
+
* write happened (same executable artifact is a server-side no-op).
|
|
378
370
|
*/
|
|
379
371
|
setView(payload: SetViewPayload): Promise<{
|
|
380
372
|
written: boolean;
|
|
@@ -293,9 +293,9 @@ export class ApplyClient {
|
|
|
293
293
|
return body.views ?? [];
|
|
294
294
|
}
|
|
295
295
|
/**
|
|
296
|
-
* Store a view: source + CLI-bundled browser bundle
|
|
297
|
-
* from the
|
|
298
|
-
* executable artifact is a server-side no-op).
|
|
296
|
+
* Store a view: source + CLI-bundled browser bundle. The server reads the
|
|
297
|
+
* view's key, attach, params and actions from the source. Returns whether a
|
|
298
|
+
* write happened (same executable artifact is a server-side no-op).
|
|
299
299
|
*/
|
|
300
300
|
async setView(payload) {
|
|
301
301
|
const { body } = await this.request("POST", `/api/${this.orgSlug}/manage_views`, {
|
|
@@ -248,12 +248,6 @@ export interface DesiredView extends RetainedSource {
|
|
|
248
248
|
sourceFile: string;
|
|
249
249
|
/** Browser IIFE bundle (react, bridge, relative files, view npm deps). */
|
|
250
250
|
compiledCode: string;
|
|
251
|
-
/** Metadata extracted from the module itself. */
|
|
252
|
-
attach: Array<Record<string, unknown>>;
|
|
253
|
-
params: Record<string, unknown>;
|
|
254
|
-
actions: Record<string, {
|
|
255
|
-
emits: string;
|
|
256
|
-
}>;
|
|
257
251
|
}
|
|
258
252
|
export interface DesiredAgent {
|
|
259
253
|
metadata: DesiredAgentMetadata;
|
|
@@ -496,22 +496,16 @@ async function resolveViewSources(sources, cwd) {
|
|
|
496
496
|
}
|
|
497
497
|
const bundled = await bundleViewFromFile(abs, baseDir);
|
|
498
498
|
sourceCode = bundled.sourceFiles.files[bundled.sourceFiles.entrypoint];
|
|
499
|
-
const key = bundled.
|
|
499
|
+
const { key, name, description, attach, params, actions } = bundled.definition;
|
|
500
500
|
if (seen.has(key)) {
|
|
501
501
|
throw new ValidationError(`duplicate view key "${key}" in lobu.config.ts — each viewFromFile must resolve to a unique key`);
|
|
502
502
|
}
|
|
503
503
|
seen.add(key);
|
|
504
|
-
// Hash EXACTLY what the server will store:
|
|
505
|
-
//
|
|
506
|
-
//
|
|
507
|
-
//
|
|
508
|
-
//
|
|
509
|
-
// Same function, same inputs: same hash.
|
|
510
|
-
const name = key;
|
|
511
|
-
const description = "";
|
|
512
|
-
const attach = JSON.parse(JSON.stringify(bundled.metadata.attach));
|
|
513
|
-
const params = JSON.parse(JSON.stringify(bundled.metadata.params));
|
|
514
|
-
const actions = JSON.parse(JSON.stringify(bundled.metadata.actions));
|
|
504
|
+
// Hash EXACTLY what the server will store: the declaration comes from
|
|
505
|
+
// the same reader the server runs on save (defaults applied there), plus
|
|
506
|
+
// the digest of the bundle produced above (which carries the relative
|
|
507
|
+
// imports the entry source alone omits). Same function, same inputs:
|
|
508
|
+
// same hash.
|
|
515
509
|
views.push({
|
|
516
510
|
key,
|
|
517
511
|
sourcePath: abs,
|
|
@@ -530,9 +524,6 @@ async function resolveViewSources(sources, cwd) {
|
|
|
530
524
|
compiledCode: bundled.compiledCode,
|
|
531
525
|
sourceFiles: bundled.sourceFiles,
|
|
532
526
|
dependencies: bundled.dependencies,
|
|
533
|
-
attach,
|
|
534
|
-
params,
|
|
535
|
-
actions,
|
|
536
527
|
});
|
|
537
528
|
}
|
|
538
529
|
return views.sort((a, b) => a.sourceFile.localeCompare(b.sourceFile));
|
|
@@ -32,6 +32,7 @@ const AGENT_SETTINGS_FIELD_POLICY = {
|
|
|
32
32
|
sandboxId: "unsupported",
|
|
33
33
|
verboseLogging: "unsupported",
|
|
34
34
|
showToolCalls: "unsupported",
|
|
35
|
+
starters: "mapped",
|
|
35
36
|
};
|
|
36
37
|
void AGENT_SETTINGS_FIELD_POLICY;
|
|
37
38
|
import { CronExpressionParser } from "cron-parser";
|
|
@@ -231,6 +232,12 @@ function mapAgent(agent, env, required) {
|
|
|
231
232
|
if (agent.nixPackages?.length) {
|
|
232
233
|
settings.nixConfig = { packages: [...new Set(agent.nixPackages)] };
|
|
233
234
|
}
|
|
235
|
+
if (agent.starters !== undefined) {
|
|
236
|
+
settings.starters = agent.starters.map(({ title, message }) => ({
|
|
237
|
+
title,
|
|
238
|
+
message,
|
|
239
|
+
}));
|
|
240
|
+
}
|
|
234
241
|
const providerKeys = [];
|
|
235
242
|
for (const provider of agent.providers ?? []) {
|
|
236
243
|
if (provider.key === undefined)
|
|
@@ -282,6 +289,7 @@ function mapAgent(agent, env, required) {
|
|
|
282
289
|
sandboxId: settings.sandboxId,
|
|
283
290
|
verboseLogging: settings.verboseLogging,
|
|
284
291
|
showToolCalls: settings.showToolCalls,
|
|
292
|
+
starters: settings.starters,
|
|
285
293
|
};
|
|
286
294
|
void _exhaustive;
|
|
287
295
|
return { metadata, settings, providerKeys };
|
|
@@ -1,15 +1,8 @@
|
|
|
1
1
|
import type { RetainedSource } from "@lobu/core/contracts/tools/source-files";
|
|
2
|
-
|
|
3
|
-
key: string;
|
|
4
|
-
attach: Array<Record<string, unknown>>;
|
|
5
|
-
params: Record<string, unknown>;
|
|
6
|
-
actions: Record<string, {
|
|
7
|
-
emits: string;
|
|
8
|
-
}>;
|
|
9
|
-
}
|
|
2
|
+
import { type ViewDefinitionRecord } from "@lobu/core/contracts/tools/view-definition";
|
|
10
3
|
export interface BundledView extends RetainedSource {
|
|
11
4
|
compiledCode: string;
|
|
12
|
-
|
|
5
|
+
definition: ViewDefinitionRecord;
|
|
13
6
|
}
|
|
14
7
|
/**
|
|
15
8
|
* Bundle the view at `entry` (absolute path) for the browser. Throws when the
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* The module shape is exactly one: `export const view = defineView({ key,
|
|
5
5
|
* attach, … })` plus a default-export component (hooks inside, no document
|
|
6
|
-
* access).
|
|
6
|
+
* access). One esbuild pass, plus a read of the declaration:
|
|
7
7
|
* 1. browser IIFE bundle of a SYNTHETIC entry that mounts the two exports
|
|
8
8
|
* (`mountView(view, Default)`) — what the server stores as
|
|
9
9
|
* `compiled_code` and inlines into the view shell. Bundled here, where
|
|
@@ -11,65 +11,18 @@
|
|
|
11
11
|
* use), because the server has no file context for relative imports or
|
|
12
12
|
* view npm deps. The server compiles plain sources itself through the
|
|
13
13
|
* same mount on its own bootstrap.
|
|
14
|
-
* 2.
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
14
|
+
* 2. the entry's `defineView({...})` literal, read without running the module
|
|
15
|
+
* by the same `readViewDefinition` the server uses on save, so the CLI's
|
|
16
|
+
* plan hashes exactly what the server stores. The declaration lives in the
|
|
17
|
+
* file, never in the config.
|
|
18
18
|
*
|
|
19
|
-
* Anything else (no `view` export, no default component,
|
|
20
|
-
* here rather than rendering a blank frame in prod.
|
|
19
|
+
* Anything else (no `view` export, no default component, a non-literal
|
|
20
|
+
* declaration) fails loud here rather than rendering a blank frame in prod.
|
|
21
21
|
*/
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import { pathToFileURL } from "node:url";
|
|
26
|
-
import { build } from "esbuild";
|
|
22
|
+
import { basename, dirname, resolve } from "node:path";
|
|
23
|
+
import { readViewDefinition, } from "@lobu/core/contracts/tools/view-definition";
|
|
24
|
+
import { build, transform } from "esbuild";
|
|
27
25
|
import { createSourceCapture } from "../../internal/connector-compiler.js";
|
|
28
|
-
const VIEW_KEY_RE = /^[a-z0-9][a-z0-9-]{0,63}$/;
|
|
29
|
-
const RUNTIME_MODULE_RE = /(^|\/)lobu-views(\.tsx?)?$|^@lobu\/views$/;
|
|
30
|
-
const metadataStub = {
|
|
31
|
-
name: "lobu-views-metadata-stub",
|
|
32
|
-
setup(b) {
|
|
33
|
-
b.onResolve({ filter: RUNTIME_MODULE_RE }, () => ({
|
|
34
|
-
path: "lobu-views-stub",
|
|
35
|
-
namespace: "lobu-views-stub",
|
|
36
|
-
}));
|
|
37
|
-
b.onLoad({ filter: /.*/, namespace: "lobu-views-stub" }, () => ({
|
|
38
|
-
loader: "js",
|
|
39
|
-
contents: `
|
|
40
|
-
export function defineView(def) {
|
|
41
|
-
if (!def || typeof def.key !== "string" || !def.key) {
|
|
42
|
-
throw new Error("defineView({ key, attach, ... }) requires a non-empty key");
|
|
43
|
-
}
|
|
44
|
-
return def;
|
|
45
|
-
}
|
|
46
|
-
export function mountView() { throw new Error("mountView is not called by view modules: export const view = defineView({ ... }) plus a default-export component"); }
|
|
47
|
-
const noHook = () => { throw new Error("hooks are not available at metadata-extraction time"); };
|
|
48
|
-
export const useParams = noHook, useScope = noHook, useHost = noHook,
|
|
49
|
-
useQuery = noHook, useAction = noHook;
|
|
50
|
-
export function Provider() { throw new Error("not available at metadata-extraction time"); }
|
|
51
|
-
export function sql(strings, ...values) { return { kind: "sql", text: String(strings[0] ?? "") }; }
|
|
52
|
-
export function tool(name, args = {}) { return { kind: "tool", name, args }; }
|
|
53
|
-
export function escapeLiteral(value) { return String(value); }
|
|
54
|
-
export const defaultsFor = () => ({}), coerceParams = (_def, raw) => raw ?? {};
|
|
55
|
-
`,
|
|
56
|
-
}));
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
function readViewExport(ns, entry) {
|
|
60
|
-
const view = ns?.view;
|
|
61
|
-
if (!view || typeof view !== "object") {
|
|
62
|
-
throw new Error(`${entry}: the module must export const view = defineView({ key, attach, ... })`);
|
|
63
|
-
}
|
|
64
|
-
const { key } = view;
|
|
65
|
-
if (typeof key !== "string" || !key) {
|
|
66
|
-
throw new Error(`${entry}: defineView({ key, attach, ... }) requires a non-empty key`);
|
|
67
|
-
}
|
|
68
|
-
return {
|
|
69
|
-
view: { ...view, key },
|
|
70
|
-
hasDefault: typeof ns?.default === "function",
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
26
|
/**
|
|
74
27
|
* Bundle the view at `entry` (absolute path) for the browser. Throws when the
|
|
75
28
|
* module has no `view` export, no default-export component, or an invalid
|
|
@@ -103,49 +56,24 @@ export async function bundleViewFromFile(entry, projectRoot) {
|
|
|
103
56
|
throw new Error(`${entry}: view bundle compiled to empty output`);
|
|
104
57
|
}
|
|
105
58
|
assertBundlePortable(compiledCode, entry);
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
target: ["node22"],
|
|
113
|
-
jsx: "automatic",
|
|
114
|
-
plugins: [capture.plugin, metadataStub],
|
|
115
|
-
define: { "process.env.NODE_ENV": '"production"' },
|
|
116
|
-
logLevel: "silent",
|
|
117
|
-
});
|
|
118
|
-
const tmp = await mkdtemp(join(tmpdir(), "lobu-view-meta-"));
|
|
59
|
+
const source = capture.source();
|
|
60
|
+
const entrySource = source.sourceFiles.files[source.sourceFiles.entrypoint];
|
|
61
|
+
if (entrySource === undefined) {
|
|
62
|
+
throw new Error(`${entry}: the view entry was not captured`);
|
|
63
|
+
}
|
|
64
|
+
let definition;
|
|
119
65
|
try {
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
throw new Error(`${entry}: the module must have a default-export component`);
|
|
127
|
-
}
|
|
128
|
-
if (!VIEW_KEY_RE.test(def.key)) {
|
|
129
|
-
throw new Error(`${entry}: defineView key ${JSON.stringify(def.key)} must match /^[a-z0-9][a-z0-9-]{0,63}$/`);
|
|
130
|
-
}
|
|
131
|
-
return {
|
|
132
|
-
compiledCode,
|
|
133
|
-
...capture.source(),
|
|
134
|
-
metadata: {
|
|
135
|
-
key: def.key,
|
|
136
|
-
attach: Array.isArray(def.attach) ? def.attach : [],
|
|
137
|
-
params: def.params && typeof def.params === "object"
|
|
138
|
-
? def.params
|
|
139
|
-
: {},
|
|
140
|
-
actions: def.actions && typeof def.actions === "object"
|
|
141
|
-
? def.actions
|
|
142
|
-
: {},
|
|
143
|
-
},
|
|
144
|
-
};
|
|
66
|
+
const { code } = await transform(entrySource, {
|
|
67
|
+
loader: "tsx",
|
|
68
|
+
jsx: "automatic",
|
|
69
|
+
logLevel: "silent",
|
|
70
|
+
});
|
|
71
|
+
definition = readViewDefinition(code);
|
|
145
72
|
}
|
|
146
|
-
|
|
147
|
-
|
|
73
|
+
catch (error) {
|
|
74
|
+
throw new Error(`${entry}: ${error.message}`);
|
|
148
75
|
}
|
|
76
|
+
return { compiledCode, ...source, definition };
|
|
149
77
|
}
|
|
150
78
|
/**
|
|
151
79
|
* The `lobu run` watch set for one view: the entry plus every file esbuild
|
|
@@ -737,6 +737,14 @@ export interface Agent {
|
|
|
737
737
|
guardrails?: string[];
|
|
738
738
|
/** Nix packages provisioned into the worker environment. */
|
|
739
739
|
nixPackages?: string[];
|
|
740
|
+
/**
|
|
741
|
+
* Up to three conversation starters, shown on an empty web chat and as
|
|
742
|
+
* Slack assistant thread-start prompts. `message` is sent as the user.
|
|
743
|
+
*/
|
|
744
|
+
starters?: Array<{
|
|
745
|
+
title: string;
|
|
746
|
+
message: string;
|
|
747
|
+
}>;
|
|
740
748
|
}
|
|
741
749
|
export declare function defineAgent(config: Omit<Agent, "kind">): Agent;
|
|
742
750
|
/**
|
|
@@ -252,7 +252,19 @@ feeds: {
|
|
|
252
252
|
}
|
|
253
253
|
```
|
|
254
254
|
|
|
255
|
-
A feed's `eventKinds` are also the **default Automation trigger catalog**. The first successful non-dry sync establishes a baseline without activation; later inserts whose kind matches a declared `eventKinds` key activate subscribers. A non-empty `automationEvents` declaration (camelCase in `ConnectorDefinition`, persisted as `automation_events` in the catalog) replaces that derived catalog in the trigger picker. Keys
|
|
255
|
+
A feed's `eventKinds` are also the **default Automation trigger catalog**. The first successful non-dry sync establishes a baseline without activation; later inserts whose kind matches a declared `eventKinds` key activate subscribers. A non-empty `automationEvents` declaration (camelCase in `ConnectorDefinition`, persisted as `automation_events` in the catalog) replaces that derived catalog in the trigger picker. Keys outside the feed kinds and their opted-in updated types fire only when the emitted `EventEnvelope` carries matching `automation_signals`.
|
|
256
|
+
|
|
257
|
+
Set `eventKinds.<kind>.updatedEvent: true` to also expose a distinct `<kind>.updated`
|
|
258
|
+
trigger (for example, Gmail's `thread.updated`). After the baseline, it fires when
|
|
259
|
+
ingestion supersedes the source item with changed durable content and strictly
|
|
260
|
+
newer `occurred_at` than the previous head. Use source activity time, not a scheduled
|
|
261
|
+
start time. Unchanged rows, volatile-only counter updates and same-time reformats
|
|
262
|
+
stay quiet. The original `<kind>` trigger remains insert-only; subscribe to both
|
|
263
|
+
types for new items and later activity. Literal kinds declared by any feed of the
|
|
264
|
+
connector win slug collisions, and composite keys over 100 characters are omitted.
|
|
265
|
+
The optional boolean persists unchanged in `connector_definitions.feeds_schema`;
|
|
266
|
+
existing definitions without it retain their semantics. Explicit `automationEvents`
|
|
267
|
+
still replace the derived picker catalog, so include the updated key there if used.
|
|
256
268
|
|
|
257
269
|
## Syncing Data
|
|
258
270
|
|
|
@@ -544,9 +556,10 @@ For source-backed bundled connectors, the worker recompiles a `.ts` file after i
|
|
|
544
556
|
|-----------|------|-------|---------|
|
|
545
557
|
| `github` | app_installation/oauth/env_keys | issues, PRs, comments, discussions, commits, stargazers | create/comment/close/reopen issues; create/merge PRs |
|
|
546
558
|
| `hackernews` | none | stories, front page, comments | - |
|
|
559
|
+
| `linkedin` | browser/none | notifications, inbox messages, home feed, company updates, jobs; Data Export requires an injected CSV reader | send direct-message replies; like; prepare message/post/comment drafts |
|
|
547
560
|
| `market.quotes` | none | - | quote (read-only, quotes returned to the caller, never persisted) |
|
|
548
561
|
| `producthunt` | env_keys | posts & comments | - |
|
|
549
|
-
| `reddit` | oauth/none | posts, comments, user activity | - |
|
|
562
|
+
| `reddit` | oauth/none | posts, comments, user activity, home feed | - |
|
|
550
563
|
| `rss` | none | articles | - |
|
|
551
564
|
| `x` | browser/oauth | tweets, own posts, likes, bookmarks, DMs, home timeline | prepare reply |
|
|
552
565
|
| `youtube` | oauth (Google) | liked videos, playlists, subscriptions, videos | search, get_video, search_liked_videos, list_playlists, get_playlist |
|