@lobu/runtime-device 24.0.0 → 24.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,6 +6,6 @@
6
6
  "connector": "node_modules/@lobu/cli/dist/commands/connector.js",
7
7
  "worker": "node_modules/@lobu/connector-worker/dist/bin.js"
8
8
  },
9
- "version": "24.0.0",
9
+ "version": "24.1.0",
10
10
  "verify": "dist/verify.mjs"
11
11
  }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@lobu/runtime-device",
3
- "version": "24.0.0",
3
+ "version": "24.1.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@lobu/runtime-device",
9
- "version": "24.0.0",
9
+ "version": "24.1.0",
10
10
  "license": "BUSL-1.1",
11
11
  "dependencies": {
12
12
  "@lobu/cli": "file:vendor/cli",
@@ -5866,7 +5866,7 @@
5866
5866
  },
5867
5867
  "vendor/cli": {
5868
5868
  "name": "@lobu/cli",
5869
- "version": "24.0.0",
5869
+ "version": "24.1.0",
5870
5870
  "license": "Apache-2.0",
5871
5871
  "dependencies": {
5872
5872
  "@clack/prompts": "^1.2.0",
@@ -5909,7 +5909,7 @@
5909
5909
  },
5910
5910
  "vendor/connector-sdk": {
5911
5911
  "name": "@lobu/connector-sdk",
5912
- "version": "24.0.0",
5912
+ "version": "24.1.0",
5913
5913
  "license": "BUSL-1.1",
5914
5914
  "dependencies": {
5915
5915
  "@lobu/core": "file:../core",
@@ -5924,7 +5924,7 @@
5924
5924
  },
5925
5925
  "vendor/connector-worker": {
5926
5926
  "name": "@lobu/connector-worker",
5927
- "version": "24.0.0",
5927
+ "version": "24.1.0",
5928
5928
  "license": "BUSL-1.1",
5929
5929
  "dependencies": {
5930
5930
  "@agentclientprotocol/sdk": "1.4.0",
@@ -5950,7 +5950,7 @@
5950
5950
  },
5951
5951
  "vendor/core": {
5952
5952
  "name": "@lobu/core",
5953
- "version": "24.0.0",
5953
+ "version": "24.1.0",
5954
5954
  "license": "Apache-2.0",
5955
5955
  "dependencies": {
5956
5956
  "@opentelemetry/api": "^1.9.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobu/runtime-device",
3
- "version": "24.0.0",
3
+ "version": "24.1.0",
4
4
  "type": "module",
5
5
  "license": "BUSL-1.1",
6
6
  "repository": {
@@ -6,11 +6,12 @@
6
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
- * `compiled_code` and inlines into the view shell. Bundled here, where
10
- * the project's node_modules exists (the same path custom connectors
11
- * use), because the server has no file context for relative imports or
12
- * view npm deps. The server compiles plain sources itself through the
13
- * same mount on its own bootstrap.
9
+ * `compiled_code` and inlines into the view shell after its runtime
10
+ * script. React and `@lobu/views` come from that runtime, never the
11
+ * bundle (`@lobu/core/contracts/tools/view-runtime`), and the entry,
12
+ * options and runtime plugin are shared with the server. Bundled here,
13
+ * where the project's node_modules exists, so a view can also bundle npm
14
+ * deps the server cannot build.
14
15
  * 2. the entry's `defineView({...})` literal, read without running the module
15
16
  * by the same `readViewDefinition` the server uses on save, so the CLI's
16
17
  * plan hashes exactly what the server stores. The declaration lives in the
@@ -21,6 +22,7 @@
21
22
  */
22
23
  import { basename, dirname, resolve } from "node:path";
23
24
  import { readViewDefinition, } from "@lobu/core/contracts/tools/view-definition";
25
+ import { VIEW_BUILD_OPTIONS, VIEW_RUNTIME_MODULES, viewMountEntry, viewRuntimePlugin, } from "@lobu/core/contracts/tools/view-runtime";
24
26
  import { build, transform } from "esbuild";
25
27
  import { createSourceCapture } from "../../internal/connector-compiler.js";
26
28
  /**
@@ -33,23 +35,9 @@ export async function bundleViewFromFile(entry, projectRoot) {
33
35
  const rel = `./${basename(entry)}`;
34
36
  const capture = createSourceCapture(entry, projectRoot);
35
37
  const browser = await build({
36
- plugins: [capture.plugin],
37
- stdin: {
38
- contents: `import { mountView } from "@lobu/views";\nimport * as mod from ${JSON.stringify(rel)};\nmountView(mod.view, mod.default);\n`,
39
- loader: "tsx",
40
- resolveDir: dir,
41
- },
42
- bundle: true,
43
- write: false,
44
- format: "iife",
45
- platform: "browser",
46
- target: ["es2022"],
47
- jsx: "automatic",
48
- minify: true,
49
- sourcemap: false,
50
- legalComments: "none",
51
- define: { "process.env.NODE_ENV": '"production"' },
52
- logLevel: "silent",
38
+ ...VIEW_BUILD_OPTIONS,
39
+ plugins: [capture.plugin, viewRuntimePlugin()],
40
+ stdin: { contents: viewMountEntry(rel), loader: "js", resolveDir: dir },
53
41
  });
54
42
  const compiledCode = browser.outputFiles?.[0]?.text ?? "";
55
43
  if (!compiledCode) {
@@ -94,6 +82,7 @@ export async function collectViewWatchFiles(entry) {
94
82
  write: false,
95
83
  format: "esm",
96
84
  platform: "browser",
85
+ external: [...VIEW_RUNTIME_MODULES],
97
86
  jsx: "automatic",
98
87
  metafile: true,
99
88
  logLevel: "silent",
@@ -31,10 +31,16 @@ export function xDirectMessagesProgram() {
31
31
  const UPDATE_PAGES_PER_PASS = 10;
32
32
  // Matching recent text without a request id is ambiguous, not delivery proof.
33
33
  const RESEND_WINDOW_MS = 10 * 60 * 1000;
34
+ // Reconcile 503 responses before retrying: a failed response can still land.
35
+ const UNAVAILABLE_SEND_RETRY_DELAYS_MS = [3000, 7000];
36
+ // Abort network work before Chrome's 80s awaited-evaluation deadline.
37
+ const SEND_TIMEOUT_MS = 70000;
34
38
  const BATCH_EVENTS = 500;
35
39
  const BATCH_BYTES = 128 * 1024;
36
- function fail(message) {
37
- throw new Error(`X direct messages: ${message}`);
40
+ function fail(message, status) {
41
+ const error = new Error(`X direct messages: ${message}`);
42
+ if (status !== undefined) error.status = status;
43
+ throw error;
38
44
  }
39
45
  function cookie(name) {
40
46
  const raw = document.cookie
@@ -49,13 +55,16 @@ export function xDirectMessagesProgram() {
49
55
  return match[1];
50
56
  }
51
57
  async function request(path, init = {}) {
58
+ init.signal?.throwIfAborted();
52
59
  const self = account();
53
60
  const csrf = cookie("ct0");
54
61
  if (!csrf) fail("Sign in to X in the paired browser");
55
62
  const response = await fetch(path, {
56
63
  credentials: "include",
57
- signal: AbortSignal.timeout(20000),
58
64
  ...init,
65
+ signal: init.signal
66
+ ? AbortSignal.any([init.signal, AbortSignal.timeout(20000)])
67
+ : AbortSignal.timeout(20000),
59
68
  headers: {
60
69
  authorization: WEB_CLIENT_BEARER,
61
70
  "x-csrf-token": csrf,
@@ -73,6 +82,7 @@ export function xDirectMessagesProgram() {
73
82
  }
74
83
  fail(
75
84
  `request failed (HTTP ${response.status}${code === null ? "" : `, X error ${code}`})`,
85
+ response.status,
76
86
  );
77
87
  }
78
88
  const body = await response.json();
@@ -85,10 +95,11 @@ export function xDirectMessagesProgram() {
85
95
  );
86
96
  return body?.inbox_initial_state ?? fail("Inbox state is unavailable");
87
97
  }
88
- async function conversation(conversationId, maxId) {
98
+ async function conversation(conversationId, maxId, signal) {
89
99
  const page = maxId ? `&max_id=${encodeURIComponent(maxId)}` : "";
90
100
  const body = await request(
91
101
  `${DM_API}/conversation/${conversationId}.json?context=FETCH_DM_CONVERSATION&${DM_PARAMS}${page}`,
102
+ signal ? { signal } : {},
92
103
  );
93
104
  return body?.conversation_timeline ?? fail("Conversation is unavailable");
94
105
  }
@@ -294,6 +305,7 @@ export function xDirectMessagesProgram() {
294
305
  }
295
306
  async function send(input) {
296
307
  const self = account();
308
+ const signal = AbortSignal.timeout(SEND_TIMEOUT_MS);
297
309
  const conversationId = String(input.conversation_id ?? "");
298
310
  if (!CONVERSATION_ID.test(conversationId))
299
311
  fail("conversation_id must be an exact X DM conversation id");
@@ -308,41 +320,64 @@ export function xDirectMessagesProgram() {
308
320
  typeof input.idempotency_key === "string" ? input.idempotency_key : "";
309
321
  if (!idempotencyKey) fail("idempotency_key is required");
310
322
  const requestId = await requestIdOf(self, conversationId, idempotencyKey);
323
+ const delivered = (prior) => ({
324
+ sent: true,
325
+ deduplicated: true,
326
+ id: prior.id,
327
+ message_id: prior.message_id,
328
+ conversation_id: conversationId,
329
+ occurred_at: prior.occurred_at,
330
+ });
331
+ const readConversation = () => {
332
+ if (account() !== self) fail("X account changed before the send read");
333
+ return conversation(conversationId, undefined, signal);
334
+ };
311
335
  // Only an existing conversation the account can read is a send target.
312
- const before = await conversation(conversationId);
336
+ const before = await readConversation();
313
337
  const prior = earlierAttempt(before, self, requestId, text);
314
- if (prior) {
315
- return {
316
- sent: true,
317
- deduplicated: true,
318
- id: prior.id,
319
- message_id: prior.message_id,
320
- conversation_id: conversationId,
321
- occurred_at: prior.occurred_at,
322
- };
338
+ if (prior) return delivered(prior);
339
+ let response;
340
+ for (const delay of [...UNAVAILABLE_SEND_RETRY_DELAYS_MS, null]) {
341
+ if (account() !== self) fail("X account changed before the send");
342
+ try {
343
+ response = await request(`${DM_API}/new2.json`, {
344
+ method: "POST",
345
+ signal,
346
+ headers: { "content-type": "application/json" },
347
+ body: JSON.stringify({
348
+ conversation_id: conversationId,
349
+ recipient_ids: false,
350
+ request_id: requestId,
351
+ text,
352
+ cards_platform: "Web-12",
353
+ include_cards: 1,
354
+ include_quote_count: true,
355
+ dm_users: false,
356
+ }),
357
+ });
358
+ break;
359
+ } catch (error) {
360
+ if (error?.status !== 503) throw error;
361
+ signal.throwIfAborted();
362
+ if (delay !== null)
363
+ await new Promise((resolve) => setTimeout(resolve, delay));
364
+ const landed = earlierAttempt(
365
+ await readConversation(),
366
+ self,
367
+ requestId,
368
+ text,
369
+ );
370
+ if (landed) return delivered(landed);
371
+ if (delay === null) throw error;
372
+ }
323
373
  }
324
- if (account() !== self) fail("X account changed before the send");
325
- const response = await request(`${DM_API}/new2.json`, {
326
- method: "POST",
327
- headers: { "content-type": "application/json" },
328
- body: JSON.stringify({
329
- conversation_id: conversationId,
330
- recipient_ids: false,
331
- request_id: requestId,
332
- text,
333
- cards_platform: "Web-12",
334
- include_cards: 1,
335
- include_quote_count: true,
336
- dm_users: false,
337
- }),
338
- });
339
374
  const created = messagesOf(response).find(
340
375
  (message) => String(message.conversation_id) === conversationId,
341
376
  );
342
377
  const messageId = created ? String(created.id ?? "") : "";
343
378
  if (!/^[0-9]+$/.test(messageId))
344
379
  fail("X accepted the send but returned no message id");
345
- const after = await conversation(conversationId);
380
+ const after = await readConversation();
346
381
  const landed = rowsOf(after, self).find(
347
382
  (row) => row.message_id === messageId && row.from_me,
348
383
  );
@@ -5,7 +5,7 @@
5
5
  "server": "dist/server.bundle.mjs",
6
6
  "embeddingsServer": "dist/embeddings-server.mjs"
7
7
  },
8
- "version": "24.0.0",
8
+ "version": "24.1.0",
9
9
  "verify": "dist/verify.mjs"
10
10
  },
11
11
  "device": {
@@ -16,7 +16,7 @@
16
16
  "connector": "node_modules/@lobu/cli/dist/commands/connector.js",
17
17
  "worker": "node_modules/@lobu/connector-worker/dist/bin.js"
18
18
  },
19
- "version": "24.0.0",
19
+ "version": "24.1.0",
20
20
  "verify": "dist/verify.mjs"
21
21
  },
22
22
  "postgres": {
@@ -24,7 +24,7 @@
24
24
  "entries": {
25
25
  "postgres": "dist/index.mjs"
26
26
  },
27
- "version": "24.0.0",
27
+ "version": "24.1.0",
28
28
  "verify": "dist/verify.mjs"
29
29
  },
30
30
  "embeddings": {
@@ -32,7 +32,7 @@
32
32
  "entries": {
33
33
  "embeddings": "dist/embeddings.js"
34
34
  },
35
- "version": "24.0.0",
35
+ "version": "24.1.0",
36
36
  "verify": "dist/verify.mjs"
37
37
  }
38
38
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobu/cli",
3
- "version": "24.0.0",
3
+ "version": "24.1.0",
4
4
  "description": "CLI for deploying and managing AI agents on Lobu",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobu/connector-sdk",
3
- "version": "24.0.0",
3
+ "version": "24.1.0",
4
4
  "description": "Lobu memory SDK — build pluggable connectors for Lobu memory",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -64,12 +64,7 @@ export class AcpTranscript {
64
64
  type: 'tool_use',
65
65
  id: event.tool.toolCallId,
66
66
  name: event.tool.name ?? event.tool.title,
67
- input: cappedJsonValue({
68
- title: event.tool.title,
69
- kind: event.tool.kind,
70
- status: event.tool.status,
71
- rawInput: event.tool.rawInput,
72
- }),
67
+ input: cappedJsonValue(event.tool.rawInput ?? {}),
73
68
  },
74
69
  ]);
75
70
  continue;
@@ -216,16 +211,33 @@ export async function runAcpTurn(options) {
216
211
  events.push({ kind: 'assistant', messageId, text });
217
212
  }
218
213
  else if (update.sessionUpdate === 'tool_call') {
219
- tools.set(update.toolCallId, update);
220
- events.push({ kind: 'tool', tool: update });
214
+ const tool = { ...update };
215
+ tools.set(update.toolCallId, tool);
216
+ events.push({ kind: 'tool', tool });
221
217
  }
222
- else if (update.sessionUpdate === 'tool_call_update' &&
223
- (update.status === 'completed' || update.status === 'failed')) {
218
+ else if (update.sessionUpdate === 'tool_call_update') {
219
+ // A call opens before its input has streamed; later updates carry the
220
+ // arguments and a final title, so fold them into the recorded call.
221
+ const tool = tools.get(update.toolCallId);
222
+ if (tool) {
223
+ if (update.name != null)
224
+ tool.name = update.name;
225
+ if (update.title != null)
226
+ tool.title = update.title;
227
+ if (update.content != null)
228
+ tool.content = update.content;
229
+ if (update.rawInput !== undefined)
230
+ tool.rawInput = update.rawInput;
231
+ if (update.rawOutput !== undefined)
232
+ tool.rawOutput = update.rawOutput;
233
+ }
234
+ if (update.status !== 'completed' && update.status !== 'failed')
235
+ return;
224
236
  events.push({
225
237
  kind: 'tool-result',
226
238
  toolCallId: update.toolCallId,
227
239
  failed: update.status === 'failed',
228
- output: update.rawOutput ?? update.content ?? tools.get(update.toolCallId)?.rawOutput ?? null,
240
+ output: update.rawOutput ?? update.content ?? tool?.rawOutput ?? tool?.content ?? null,
229
241
  });
230
242
  }
231
243
  // Deliberately do not persist agent_thought_chunk: ACP exposes public
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobu/connector-worker",
3
- "version": "24.0.0",
3
+ "version": "24.1.0",
4
4
  "description": "Self-hosted worker for Lobu memory — connectors and embedding generation",
5
5
  "type": "module",
6
6
  "bin": {
@@ -0,0 +1,74 @@
1
+ /**
2
+ * The view runtime contract: React, React DOM and `@lobu/views` are supplied
3
+ * by the view shell, never bundled into a view. The server builds them once
4
+ * from its own installation and inlines that script ahead of every view
5
+ * bundle as `globalThis[VIEW_RUNTIME_GLOBAL]`; each view bundle reads its
6
+ * runtime imports off that global. A runtime fix reaches views using this
7
+ * contract on the next deploy, without re-saving them. A self-contained
8
+ * bundle from before the contract keeps running on its own runtime until it
9
+ * is saved again; one the server built is rebuilt when served.
10
+ *
11
+ * Every view compiler builds through these pieces — the server on save and on
12
+ * a served rebuild, and `lobu apply` in the author's checkout — so the same
13
+ * retained source compiles to the same bundle wherever it is built.
14
+ */
15
+ /** Global the shell's runtime script assigns and every view bundle reads. */
16
+ export declare const VIEW_RUNTIME_GLOBAL = "__lobuViews";
17
+ /** Module specifiers a view imports from the shell runtime. */
18
+ export declare const VIEW_RUNTIME_MODULES: readonly string[];
19
+ /** Packages behind {@link VIEW_RUNTIME_MODULES}. A view whose retained
20
+ * dependencies are all among these needs nothing but its own source files
21
+ * to compile, so the server can build it. */
22
+ export declare const VIEW_RUNTIME_PACKAGES: readonly string[];
23
+ /** Entry source that mounts the module at `specifier` through the runtime's
24
+ * `mountView`: its `view` declaration and default-export component. */
25
+ export declare function viewMountEntry(specifier: string): string;
26
+ /** Entry source for the shell runtime script: every runtime module, keyed by
27
+ * specifier on the runtime global. */
28
+ export declare function viewRuntimeEntry(): string;
29
+ /** esbuild options every view bundle and the runtime script share. */
30
+ export declare const VIEW_BUILD_OPTIONS: {
31
+ readonly bundle: true;
32
+ readonly write: false;
33
+ readonly format: "iife";
34
+ readonly platform: "browser";
35
+ readonly target: "es2022";
36
+ readonly jsx: "automatic";
37
+ readonly minify: true;
38
+ readonly sourcemap: false;
39
+ readonly legalComments: "none";
40
+ readonly define: {
41
+ readonly "process.env.NODE_ENV": "\"production\"";
42
+ };
43
+ readonly logLevel: "silent";
44
+ };
45
+ interface RuntimePluginBuild {
46
+ onResolve(options: {
47
+ filter: RegExp;
48
+ }, callback: (args: {
49
+ path: string;
50
+ }) => {
51
+ path: string;
52
+ namespace: string;
53
+ } | undefined): void;
54
+ onLoad(options: {
55
+ filter: RegExp;
56
+ namespace: string;
57
+ }, callback: (args: {
58
+ path: string;
59
+ }) => {
60
+ contents: string;
61
+ loader: "js";
62
+ }): void;
63
+ }
64
+ /**
65
+ * esbuild plugin resolving each runtime module to a shim that reads it off
66
+ * the runtime global, so the bundle carries none of the runtime. Structurally
67
+ * typed: core does not depend on esbuild.
68
+ */
69
+ export declare function viewRuntimePlugin(): {
70
+ name: string;
71
+ setup(build: RuntimePluginBuild): void;
72
+ };
73
+ export {};
74
+ //# sourceMappingURL=view-runtime.d.ts.map
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ /**
3
+ * The view runtime contract: React, React DOM and `@lobu/views` are supplied
4
+ * by the view shell, never bundled into a view. The server builds them once
5
+ * from its own installation and inlines that script ahead of every view
6
+ * bundle as `globalThis[VIEW_RUNTIME_GLOBAL]`; each view bundle reads its
7
+ * runtime imports off that global. A runtime fix reaches views using this
8
+ * contract on the next deploy, without re-saving them. A self-contained
9
+ * bundle from before the contract keeps running on its own runtime until it
10
+ * is saved again; one the server built is rebuilt when served.
11
+ *
12
+ * Every view compiler builds through these pieces — the server on save and on
13
+ * a served rebuild, and `lobu apply` in the author's checkout — so the same
14
+ * retained source compiles to the same bundle wherever it is built.
15
+ */
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.VIEW_BUILD_OPTIONS = exports.VIEW_RUNTIME_PACKAGES = exports.VIEW_RUNTIME_MODULES = exports.VIEW_RUNTIME_GLOBAL = void 0;
18
+ exports.viewMountEntry = viewMountEntry;
19
+ exports.viewRuntimeEntry = viewRuntimeEntry;
20
+ exports.viewRuntimePlugin = viewRuntimePlugin;
21
+ /** Global the shell's runtime script assigns and every view bundle reads. */
22
+ exports.VIEW_RUNTIME_GLOBAL = "__lobuViews";
23
+ /** Module specifiers a view imports from the shell runtime. */
24
+ exports.VIEW_RUNTIME_MODULES = [
25
+ "react",
26
+ "react/jsx-runtime",
27
+ "react-dom",
28
+ "react-dom/client",
29
+ "@lobu/views",
30
+ "@lobu/views/components",
31
+ ];
32
+ /** Packages behind {@link VIEW_RUNTIME_MODULES}. A view whose retained
33
+ * dependencies are all among these needs nothing but its own source files
34
+ * to compile, so the server can build it. */
35
+ exports.VIEW_RUNTIME_PACKAGES = [
36
+ "react",
37
+ "react-dom",
38
+ "@lobu/views",
39
+ ];
40
+ const RUNTIME_NAMESPACE = "lobu-view-runtime";
41
+ /** Entry source that mounts the module at `specifier` through the runtime's
42
+ * `mountView`: its `view` declaration and default-export component. */
43
+ function viewMountEntry(specifier) {
44
+ return `import { mountView } from "@lobu/views";\nimport * as mod from ${JSON.stringify(specifier)};\nmountView(mod.view, mod.default);\n`;
45
+ }
46
+ /** Entry source for the shell runtime script: every runtime module, keyed by
47
+ * specifier on the runtime global. */
48
+ function viewRuntimeEntry() {
49
+ const imports = exports.VIEW_RUNTIME_MODULES.map((specifier, i) => `import * as m${i} from ${JSON.stringify(specifier)};`);
50
+ const entries = exports.VIEW_RUNTIME_MODULES.map((specifier, i) => `${JSON.stringify(specifier)}: m${i}`);
51
+ return `${imports.join("\n")}\nglobalThis[${JSON.stringify(exports.VIEW_RUNTIME_GLOBAL)}] = Object.freeze({ ${entries.join(", ")} });\n`;
52
+ }
53
+ /** esbuild options every view bundle and the runtime script share. */
54
+ exports.VIEW_BUILD_OPTIONS = {
55
+ bundle: true,
56
+ write: false,
57
+ format: "iife",
58
+ platform: "browser",
59
+ target: "es2022",
60
+ jsx: "automatic",
61
+ minify: true,
62
+ sourcemap: false,
63
+ legalComments: "none",
64
+ define: { "process.env.NODE_ENV": '"production"' },
65
+ logLevel: "silent",
66
+ };
67
+ /**
68
+ * esbuild plugin resolving each runtime module to a shim that reads it off
69
+ * the runtime global, so the bundle carries none of the runtime. Structurally
70
+ * typed: core does not depend on esbuild.
71
+ */
72
+ function viewRuntimePlugin() {
73
+ return {
74
+ name: "lobu-view-runtime",
75
+ setup(build) {
76
+ build.onResolve({ filter: /.*/ }, (args) => exports.VIEW_RUNTIME_MODULES.includes(args.path)
77
+ ? { path: args.path, namespace: RUNTIME_NAMESPACE }
78
+ : undefined);
79
+ build.onLoad({ filter: /.*/, namespace: RUNTIME_NAMESPACE }, (args) => ({
80
+ contents: `module.exports = globalThis[${JSON.stringify(exports.VIEW_RUNTIME_GLOBAL)}][${JSON.stringify(args.path)}];`,
81
+ loader: "js",
82
+ }));
83
+ },
84
+ };
85
+ }
86
+ //# sourceMappingURL=view-runtime.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobu/core",
3
- "version": "24.0.0",
3
+ "version": "24.1.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Core types and utilities for Lobu agent platform",
6
6
  "repository": {
@@ -226,6 +226,11 @@
226
226
  "import": "./dist/contracts/tools/view-definition.js",
227
227
  "require": "./dist/contracts/tools/view-definition.js"
228
228
  },
229
+ "./contracts/tools/view-runtime": {
230
+ "types": "./dist/contracts/tools/view-runtime.d.ts",
231
+ "import": "./dist/contracts/tools/view-runtime.js",
232
+ "require": "./dist/contracts/tools/view-runtime.js"
233
+ },
229
234
  "./contracts/tools/view-path": {
230
235
  "types": "./dist/contracts/tools/view-path.d.ts",
231
236
  "import": "./dist/contracts/tools/view-path.js",