@lobu/runtime-device 24.9.0 → 24.10.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 (62) hide show
  1. package/dist/component.json +1 -1
  2. package/dist/dependencies.bun.lock +18 -16
  3. package/npm-shrinkwrap.json +78 -61
  4. package/package.json +1 -1
  5. package/vendor/cli/dist/bundled-skills/lobu/SKILL.md +3 -0
  6. package/vendor/cli/dist/commands/_lib/apply/apply-cmd.js +4 -4
  7. package/vendor/cli/dist/commands/_lib/apply/client.d.ts +21 -17
  8. package/vendor/cli/dist/commands/_lib/apply/client.js +32 -34
  9. package/vendor/cli/dist/commands/dev.js +2 -0
  10. package/vendor/cli/dist/connectors/postgres.ts +39 -24
  11. package/vendor/cli/dist/connectors/whatsapp-web-adapter.js +41 -10
  12. package/vendor/cli/dist/connectors/whatsapp-web-helpers.ts +12 -2
  13. package/vendor/cli/dist/connectors/whatsapp_web.ts +18 -2
  14. package/vendor/cli/dist/internal/context.d.ts +5 -0
  15. package/vendor/cli/dist/internal/context.js +23 -9
  16. package/vendor/cli/dist/runtime-components.json +4 -4
  17. package/vendor/cli/package.json +1 -1
  18. package/vendor/connector-sdk/dist/connector-types.d.ts +6 -0
  19. package/vendor/connector-sdk/dist/index.d.ts +1 -0
  20. package/vendor/connector-sdk/dist/index.js +1 -0
  21. package/vendor/connector-sdk/dist/ip-reachability.d.ts +1 -1
  22. package/vendor/connector-sdk/dist/ip-reachability.js +1 -1
  23. package/vendor/connector-sdk/dist/logger.d.ts +1 -1
  24. package/vendor/connector-sdk/dist/logger.js +1 -1
  25. package/vendor/connector-sdk/dist/reaction-client-types.d.ts +3 -1
  26. package/vendor/connector-sdk/dist/retry.d.ts +1 -1
  27. package/vendor/connector-sdk/dist/retry.js +1 -1
  28. package/vendor/connector-sdk/dist/source-withheld-error.d.ts +16 -0
  29. package/vendor/connector-sdk/dist/source-withheld-error.js +19 -0
  30. package/vendor/connector-sdk/package.json +1 -1
  31. package/vendor/connector-worker/dist/daemon/index.d.ts +1 -0
  32. package/vendor/connector-worker/dist/daemon/index.js +1 -0
  33. package/vendor/connector-worker/dist/daemon/terminal-delivery.d.ts +12 -2
  34. package/vendor/connector-worker/dist/daemon/terminal-delivery.js +19 -12
  35. package/vendor/connector-worker/dist/executor/interface.d.ts +10 -0
  36. package/vendor/connector-worker/dist/executor/interface.js +6 -0
  37. package/vendor/connector-worker/dist/executor/isolate.d.ts +1 -0
  38. package/vendor/connector-worker/dist/executor/isolate.js +85 -24
  39. package/vendor/connector-worker/dist/isolate/prelude.js +5 -0
  40. package/vendor/connector-worker/package.json +1 -1
  41. package/vendor/core/dist/classify-error.d.ts +1 -1
  42. package/vendor/core/dist/classify-error.js +2 -2
  43. package/vendor/core/dist/contracts/tools/manage-automations.d.ts +28 -3
  44. package/vendor/core/dist/contracts/tools/manage-automations.js +27 -8
  45. package/vendor/core/dist/contracts/tools/manage-entity.d.ts +8 -0
  46. package/vendor/core/dist/contracts/tools/manage-entity.js +11 -3
  47. package/vendor/core/dist/contracts/tools/save-memory.d.ts +11 -1
  48. package/vendor/core/dist/contracts/tools/save-memory.js +25 -3
  49. package/vendor/core/dist/contracts/tools/search-memory.js +1 -1
  50. package/vendor/core/dist/credentials.d.ts +12 -0
  51. package/vendor/core/dist/credentials.js +1 -0
  52. package/vendor/core/dist/errors.js +2 -2
  53. package/vendor/core/dist/worker/auth.d.ts +5 -0
  54. package/vendor/core/dist/worker/auth.js +15 -4
  55. package/vendor/core/package.json +1 -1
  56. package/vendor/postgres/cf/src/connection.js +7 -2
  57. package/vendor/postgres/cjs/src/connection.js +7 -2
  58. package/vendor/postgres/src/connection.js +7 -2
  59. package/vendor/views/dist/native.d.ts +33 -1
  60. package/vendor/views/dist/native.js +3 -0
  61. package/vendor/views/package.json +1 -1
  62. /package/vendor/postgres/{.bun-tag-c81dacd34e959a7a → .bun-tag-652f2580b8090d71} +0 -0
@@ -122,7 +122,7 @@ exports.AutomationScheduleTriggerSchema = typebox_1.Type.Object({
122
122
  })),
123
123
  skip_if_unchanged: typebox_1.Type.Optional(typebox_1.Type.Boolean({
124
124
  default: true,
125
- description: "Book a due window with no new or changed source content as a no-op run instead of dispatching an agent. Applies to native dispatch and to external claimNextWindow, which answers 409 for a skipped window.",
125
+ description: "Book a due window with no new or changed source content as a no-op run instead of dispatching an agent. Applies to native dispatch and to external claimNextWindow, which returns a status 'completed' receipt for a skipped window.",
126
126
  })),
127
127
  }, { additionalProperties: false });
128
128
  exports.AutomationTriggerSchema = typebox_1.Type.Union([
@@ -700,13 +700,32 @@ exports.AutomationClaimNextWindowContextSchema = typebox_1.Type.Object({
700
700
  skills: typebox_1.Type.Array(typebox_1.Type.Object({ name: typebox_1.Type.String(), content: typebox_1.Type.String() })),
701
701
  })),
702
702
  });
703
- exports.AutomationClaimNextWindowResultSchema = typebox_1.Type.Object({
704
- action: typebox_1.Type.Literal("claim_next_window"),
705
- automation_id: typebox_1.Type.String(),
706
- run_id: typebox_1.Type.Integer(),
707
- lease_expires_at: typebox_1.Type.String(),
708
- context: exports.AutomationClaimNextWindowContextSchema,
709
- });
703
+ /**
704
+ * A claim either leases a window (`claimed`, with context to process and a
705
+ * window_token for completeWindow) or reports that the due window had no new
706
+ * or changed source content and was already booked as a no-op run
707
+ * (`completed`). A completed receipt needs no completeWindow: the schedule
708
+ * has advanced, so refresh activity for the next due window.
709
+ */
710
+ exports.AutomationClaimNextWindowResultSchema = typebox_1.Type.Union([
711
+ typebox_1.Type.Object({
712
+ action: typebox_1.Type.Literal("claim_next_window"),
713
+ automation_id: typebox_1.Type.String(),
714
+ status: typebox_1.Type.Literal("claimed"),
715
+ run_id: typebox_1.Type.Integer(),
716
+ lease_expires_at: typebox_1.Type.String(),
717
+ context: exports.AutomationClaimNextWindowContextSchema,
718
+ }),
719
+ typebox_1.Type.Object({
720
+ action: typebox_1.Type.Literal("claim_next_window"),
721
+ automation_id: typebox_1.Type.String(),
722
+ status: typebox_1.Type.Literal("completed"),
723
+ run_id: typebox_1.Type.Integer(),
724
+ skipped_unchanged: typebox_1.Type.Literal(true),
725
+ window_start: typebox_1.Type.String(),
726
+ window_end: typebox_1.Type.String(),
727
+ }),
728
+ ]);
710
729
  exports.AutomationTriggerExecutionSchema = typebox_1.Type.Union([
711
730
  typebox_1.Type.Object({
712
731
  lane: typebox_1.Type.Literal("managed_agent"),
@@ -365,6 +365,13 @@ declare const RelationshipReadFailureSchema: import("@sinclair/typebox").TObject
365
365
  code: import("@sinclair/typebox").TString;
366
366
  }>;
367
367
  export type RelationshipReadFailure = Static<typeof RelationshipReadFailureSchema>;
368
+ /** A feed of a source-backed record's live read that returned no rows. */
369
+ export declare const SourceReadFailureSchema: import("@sinclair/typebox").TObject<{
370
+ feed_id: import("@sinclair/typebox").TInteger;
371
+ error: import("@sinclair/typebox").TString;
372
+ code: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TLiteral<"withheld">>;
373
+ }>;
374
+ export type SourceReadFailure = Static<typeof SourceReadFailureSchema>;
368
375
  export declare const ManageEntityResultSchema: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
369
376
  action: import("@sinclair/typebox").TLiteral<"create">;
370
377
  entity: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
@@ -686,6 +693,7 @@ export declare const ManageEntityResultSchema: import("@sinclair/typebox").TUnio
686
693
  record_failures: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
687
694
  feed_id: import("@sinclair/typebox").TInteger;
688
695
  error: import("@sinclair/typebox").TString;
696
+ code: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TLiteral<"withheld">>;
689
697
  }>>;
690
698
  next_cursor: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>>;
691
699
  }>, import("@sinclair/typebox").TObject<{
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ManageEntityResultSchema = exports.ManageEntityItemSchema = exports.EntityIdentitySchema = exports.RelationshipCountByTypeSchema = exports.RelationshipRowSchema = exports.ManageEntitySchema = exports.DiscoverDuplicatesAction = exports.ListLinksAction = exports.UpdateLinkAction = exports.UnlinkEntitiesAction = exports.LinkEntitiesAction = exports.DeleteEntityAction = exports.GetEntityAction = exports.ListEntitiesAction = exports.UpdateEntityAction = exports.CreateEntityAction = void 0;
3
+ exports.ManageEntityResultSchema = exports.SourceReadFailureSchema = exports.ManageEntityItemSchema = exports.EntityIdentitySchema = exports.RelationshipCountByTypeSchema = exports.RelationshipRowSchema = exports.ManageEntitySchema = exports.DiscoverDuplicatesAction = exports.ListLinksAction = exports.UpdateLinkAction = exports.UnlinkEntitiesAction = exports.LinkEntitiesAction = exports.DeleteEntityAction = exports.GetEntityAction = exports.ListEntitiesAction = exports.UpdateEntityAction = exports.CreateEntityAction = void 0;
4
4
  const typebox_1 = require("@sinclair/typebox");
5
5
  const interaction_envelope_1 = require("../interaction-envelope");
6
6
  const collection_selection_1 = require("./collection-selection");
@@ -277,7 +277,7 @@ exports.ListLinksAction = typebox_1.Type.Object({
277
277
  include_deleted: typebox_1.Type.Optional(IncludeDeleted),
278
278
  ...(0, pagination_1.paginationFields)(100),
279
279
  cursor: typebox_1.Type.Optional(typebox_1.Type.Union([typebox_1.Type.String({ minLength: 1, maxLength: 65536 }), typebox_1.Type.Null()], {
280
- description: "[list_links, source records] Omit or pass null for the first bounded page, then pass next_cursor until it is null. Stop automatic pagination on record_failures; the cursor retains failed sources for an explicit retry. Pages may be short or empty while next_cursor exists. Merge repeated links across pages by (relationship_type, direction, entity_type, key), keeping the newest occurred_at. Numeric entity_id calls retain limit/offset pagination; source pages bound limit to 100. Authored relationships are permission checked at both endpoints. counts_by_type describes the visible page (counts_scope: page), not a global total. Source pages reject source, confidence_min and include_deleted filters, which cannot be applied to live links. Source reads share a 20 second page deadline. Unavailable endpoints are withheld with key-free relationship_failures; readable links remain available. Updating an edge still requires readable endpoints. Unlink by relationship_id remains available during outages.",
280
+ description: "[list_links, source records] Omit or pass null for the first bounded page, then pass next_cursor until it is null. Stop automatic pagination on record_failures without a code; the cursor retains those failed sources for an explicit retry. A failure with code 'withheld' is a source deliberately keeping the record private (error is its reason): its links are not missing, it is never retried, and pagination continues. Pages may be short or empty while next_cursor exists. Merge repeated links across pages by (relationship_type, direction, entity_type, key), keeping the newest occurred_at. Numeric entity_id calls retain limit/offset pagination; source pages bound limit to 100. Authored relationships are permission checked at both endpoints. counts_by_type describes the visible page (counts_scope: page), not a global total. Source pages reject source, confidence_min and include_deleted filters, which cannot be applied to live links. Source reads share a 20 second page deadline. Unavailable endpoints are withheld with key-free relationship_failures; readable links remain available. Updating an edge still requires readable endpoints. Unlink by relationship_id remains available during outages.",
281
281
  })),
282
282
  automation_source: typebox_1.Type.Optional(AutomationSource),
283
283
  });
@@ -412,6 +412,14 @@ const RelationshipReadFailureSchema = typebox_1.Type.Object({
412
412
  relationship_id: typebox_1.Type.Integer(),
413
413
  code: typebox_1.Type.String(),
414
414
  });
415
+ /** A feed of a source-backed record's live read that returned no rows. */
416
+ exports.SourceReadFailureSchema = typebox_1.Type.Object({
417
+ feed_id: typebox_1.Type.Integer(),
418
+ error: typebox_1.Type.String(),
419
+ code: typebox_1.Type.Optional(typebox_1.Type.Literal("withheld", {
420
+ description: "The source deliberately withholds this record and `error` is its reason. Its items are private, not missing; it is never retained for retry.",
421
+ })),
422
+ });
415
423
  exports.ManageEntityResultSchema = typebox_1.Type.Union([
416
424
  typebox_1.Type.Object({
417
425
  action: typebox_1.Type.Literal("create"),
@@ -537,7 +545,7 @@ exports.ManageEntityResultSchema = typebox_1.Type.Union([
537
545
  occurred_at: typebox_1.Type.String(),
538
546
  source_url: typebox_1.Type.Union([typebox_1.Type.String(), typebox_1.Type.Null()]),
539
547
  })),
540
- record_failures: typebox_1.Type.Array(typebox_1.Type.Object({ feed_id: typebox_1.Type.Integer(), error: typebox_1.Type.String() })),
548
+ record_failures: typebox_1.Type.Array(exports.SourceReadFailureSchema),
541
549
  next_cursor: typebox_1.Type.Optional(typebox_1.Type.Union([typebox_1.Type.String(), typebox_1.Type.Null()])),
542
550
  }),
543
551
  typebox_1.Type.Object({
@@ -11,8 +11,12 @@
11
11
  */
12
12
  import { type Static } from "@sinclair/typebox";
13
13
  import type { FlatActionInput } from "./action-input";
14
+ /** Bounds on `{ name }` entries in `entity_ids`; the handler enforces the count. */
15
+ export declare const MAX_ENTITY_NAMES = 20;
14
16
  export declare const SaveContentSchema: import("@sinclair/typebox").TObject<{
15
- entity_ids: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TNumber>>;
17
+ entity_ids: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TInteger, import("@sinclair/typebox").TObject<{
18
+ name: import("@sinclair/typebox").TString;
19
+ }>]>>>;
16
20
  content: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
17
21
  title: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
18
22
  author: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
@@ -32,6 +36,12 @@ export declare const SaveContentSchema: import("@sinclair/typebox").TObject<{
32
36
  }>>;
33
37
  }>;
34
38
  export type SaveContentArgs = Static<typeof SaveContentSchema>;
39
+ /** A `{ name }` entry from `entity_ids` that did not link, as returned in the save result's `unlinked`. */
40
+ export declare const UnlinkedEntityNameSchema: import("@sinclair/typebox").TObject<{
41
+ name: import("@sinclair/typebox").TString;
42
+ reason: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"not_found">, import("@sinclair/typebox").TLiteral<"ambiguous">, import("@sinclair/typebox").TLiteral<"not_writable">]>;
43
+ }>;
44
+ export type UnlinkedEntityName = Static<typeof UnlinkedEntityNameSchema>;
35
45
  /**
36
46
  * `client.knowledge.save` input. The schema leaves every field optional
37
47
  * because `saveContent` resolves the requirement per `payload_type`:
@@ -11,11 +11,23 @@
11
11
  * connector isolate lane can bundle it (`packages/connector-sdk/AGENTS.md`).
12
12
  */
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.SaveContentSchema = void 0;
14
+ exports.UnlinkedEntityNameSchema = exports.SaveContentSchema = exports.MAX_ENTITY_NAMES = void 0;
15
15
  const typebox_1 = require("@sinclair/typebox");
16
+ /** Bounds on `{ name }` entries in `entity_ids`; the handler enforces the count. */
17
+ exports.MAX_ENTITY_NAMES = 20;
18
+ const MAX_ENTITY_NAME_LENGTH = 256;
16
19
  exports.SaveContentSchema = typebox_1.Type.Object({
17
- entity_ids: typebox_1.Type.Optional(typebox_1.Type.Array(typebox_1.Type.Number(), {
18
- description: "Entity IDs to associate content with. Omit for org-scoped content.",
20
+ entity_ids: typebox_1.Type.Optional(typebox_1.Type.Array(typebox_1.Type.Union([
21
+ typebox_1.Type.Integer({ minimum: 1 }),
22
+ typebox_1.Type.Object({
23
+ name: typebox_1.Type.String({
24
+ minLength: 1,
25
+ maxLength: MAX_ENTITY_NAME_LENGTH,
26
+ description: "The record's exact full name: a person's full name, owner/repo for a repository.",
27
+ }),
28
+ }, { additionalProperties: false }),
29
+ ]), {
30
+ description: `Records this content is about. Each entry is a record id, or { name } with the record's exact full name. A name links only when exactly one record in this workspace has that name; otherwise it is returned in \`unlinked\` and the content is still saved. Reference only records the content is substantially about, at most ${exports.MAX_ENTITY_NAMES} names. Omit for org-scoped content.`,
19
31
  })),
20
32
  content: typebox_1.Type.Optional(typebox_1.Type.String({
21
33
  description: "The text content to save. Required for text/markdown payload types.",
@@ -69,4 +81,14 @@ exports.SaveContentSchema = typebox_1.Type.Object({
69
81
  description: "Attribution source when save is triggered by an Automation reaction",
70
82
  })),
71
83
  });
84
+ /** A `{ name }` entry from `entity_ids` that did not link, as returned in the save result's `unlinked`. */
85
+ exports.UnlinkedEntityNameSchema = typebox_1.Type.Object({
86
+ name: typebox_1.Type.String(),
87
+ reason: typebox_1.Type.Union([
88
+ typebox_1.Type.Literal("not_found"),
89
+ typebox_1.Type.Literal("ambiguous"),
90
+ // Only on a replay of a save stored before members could link records (Nov 2026).
91
+ typebox_1.Type.Literal("not_writable"),
92
+ ]),
93
+ });
72
94
  //# sourceMappingURL=save-memory.js.map
@@ -38,7 +38,7 @@ exports.SearchSchema = typebox_1.Type.Object({
38
38
  description: "Filter by category metadata field",
39
39
  })),
40
40
  fuzzy: typebox_1.Type.Optional(typebox_1.Type.Boolean({
41
- description: "Enable fuzzy name matching",
41
+ description: "Enable fuzzy name matching. When false, an entity matches only on its exact name or an exact identifier (case-insensitive); no partial or similar names.",
42
42
  default: true,
43
43
  })),
44
44
  min_similarity: typebox_1.Type.Optional(typebox_1.Type.Number({
@@ -53,6 +53,18 @@ export declare function normalizeCredential<C extends BaseCredential = BaseCrede
53
53
  export declare function readCredentialStore<C extends BaseCredential = BaseCredential>(file: string, defaultContextName: string): Promise<CredentialStore<C>>;
54
54
  /** Read one context's credential (null when absent/corrupt). */
55
55
  export declare function readContextCredential<C extends BaseCredential = BaseCredential>(file: string, contextName: string, defaultContextName: string): Promise<C | null>;
56
+ /**
57
+ * Atomically write `data` to `file` with 0600 perms. Writes to a sibling temp
58
+ * file (same dir, so `rename` is on the same filesystem and therefore atomic on
59
+ * POSIX), chmods the temp BEFORE the rename so the published file never has a
60
+ * window of looser perms, then renames over the target. This makes concurrent
61
+ * writers (CLI `lobu login` + the server's token-refresh write-back) safe: each
62
+ * writer commits its whole-file image in a single atomic `rename`, so a reader
63
+ * always sees one writer's complete file — never a half-written / interleaved
64
+ * one. (Last-writer-wins on the rename; we don't merge, but neither writer can
65
+ * corrupt the store.)
66
+ */
67
+ export declare function atomicWriteFile(file: string, data: string): Promise<void>;
56
68
  /**
57
69
  * Write one context's credential into the store, preserving other contexts.
58
70
  * The write is atomic (temp-file + `rename`) so a concurrent writer (e.g. the
@@ -16,6 +16,7 @@ exports.CREDENTIAL_REFRESH_BUFFER_MS = void 0;
16
16
  exports.normalizeCredential = normalizeCredential;
17
17
  exports.readCredentialStore = readCredentialStore;
18
18
  exports.readContextCredential = readContextCredential;
19
+ exports.atomicWriteFile = atomicWriteFile;
19
20
  exports.writeContextCredential = writeContextCredential;
20
21
  exports.deleteContextCredential = deleteContextCredential;
21
22
  exports.credentialNeedsRefresh = credentialNeedsRefresh;
@@ -179,7 +179,7 @@ exports.AGENT_ERRORS = {
179
179
  // The provider's own finish_reason string is not useful to an end user
180
180
  // ("function_call_filter: MALFORMED_FUNCTION_CALL"), so unlike the other
181
181
  // PROVIDER_* entries this one carries its own text and does NOT relay the
182
- // upstream blob. The raw message stays in the logs / Sentry.
182
+ // upstream blob. The raw message stays in the logs.
183
183
  [AgentErrorCode.PROVIDER_TOOL_CALL_FAILED]: {
184
184
  message: "The model provider rejected its own tool call and ended the turn. This is usually temporary — please try again.",
185
185
  cta: "none",
@@ -241,7 +241,7 @@ exports.PROVIDER_BALANCE_EXHAUSTED = /credit balance is too low|insufficient (?:
241
241
  * Keep windowed wording ONLY. These classify as quota, but they often clear
242
242
  * within the minute, so nothing may treat them as a balance wall.
243
243
  */
244
- exports.PROVIDER_WINDOWED_QUOTA = /limit exhausted|usage limit|rate[-\s]?limit|quota (?:exceeded|exhausted)|too many requests|\b429\b|resource_exhausted/i;
244
+ exports.PROVIDER_WINDOWED_QUOTA = /limit exhausted|usage limit|(?:you've|you have) hit your weekly limit\b|rate[-\s]?limit|quota (?:exceeded|exhausted)|too many requests|\b429\b|resource_exhausted/i;
245
245
  /** Parse an `AgentErrorCode` from an unknown value (payload/DB boundary). */
246
246
  function toAgentErrorCode(value) {
247
247
  if (typeof value !== "string")
@@ -236,6 +236,11 @@ export interface WorkerTokenOptions {
236
236
  nixPackages?: string[];
237
237
  }
238
238
  export declare function generateWorkerToken(userId: string, conversationId: string, deploymentName: string, options: WorkerTokenOptions): string;
239
+ /** Mint a session bearer and advertise the same lifetime the verifier enforces. */
240
+ export declare function generateWorkerTokenWithExpiry(userId: string, conversationId: string, deploymentName: string, options: WorkerTokenOptions): {
241
+ token: string;
242
+ expiresAt: number;
243
+ };
239
244
  /**
240
245
  * Mint deployment-lifetime worker and proxy credentials with one revocation
241
246
  * identity. Revoking the deployment token must also stop its egress.
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CHAT_TURN_ACCESS = void 0;
4
4
  exports.looksLikeWorkerToken = looksLikeWorkerToken;
5
5
  exports.generateWorkerToken = generateWorkerToken;
6
+ exports.generateWorkerTokenWithExpiry = generateWorkerTokenWithExpiry;
6
7
  exports.generateWorkerTokenPair = generateWorkerTokenPair;
7
8
  exports.mintGatewayMcpToken = mintGatewayMcpToken;
8
9
  exports.verifyWorkerToken = verifyWorkerToken;
@@ -32,7 +33,7 @@ exports.CHAT_TURN_ACCESS = [
32
33
  "public_visitor",
33
34
  "reply_only",
34
35
  ];
35
- function generateToken(userId, conversationId, deploymentName, options, tokenKind, jti = (0, node_crypto_1.randomUUID)()) {
36
+ function generateToken(userId, conversationId, deploymentName, options, tokenKind, jti = (0, node_crypto_1.randomUUID)(), timestamp = Date.now()) {
36
37
  if (!options.channelId) {
37
38
  throw new Error("channelId is required for worker token generation");
38
39
  }
@@ -47,7 +48,7 @@ function generateToken(userId, conversationId, deploymentName, options, tokenKin
47
48
  connectionId: options.connectionId,
48
49
  responseThreadId: options.responseThreadId,
49
50
  deploymentName,
50
- timestamp: Date.now(),
51
+ timestamp,
51
52
  platform: options.platform,
52
53
  source: options.source,
53
54
  executionMode: options.executionMode,
@@ -72,6 +73,14 @@ function generateToken(userId, conversationId, deploymentName, options, tokenKin
72
73
  function generateWorkerToken(userId, conversationId, deploymentName, options) {
73
74
  return generateToken(userId, conversationId, deploymentName, options, "worker");
74
75
  }
76
+ /** Mint a session bearer and advertise the same lifetime the verifier enforces. */
77
+ function generateWorkerTokenWithExpiry(userId, conversationId, deploymentName, options) {
78
+ const issuedAt = Date.now();
79
+ return {
80
+ token: generateToken(userId, conversationId, deploymentName, options, "worker", (0, node_crypto_1.randomUUID)(), issuedAt),
81
+ expiresAt: workerTokenExpiresAt(issuedAt),
82
+ };
83
+ }
75
84
  /**
76
85
  * Mint deployment-lifetime worker and proxy credentials with one revocation
77
86
  * identity. Revoking the deployment token must also stop its egress.
@@ -108,6 +117,9 @@ function parsePositiveIntEnv(name, fallback, allowZero = false) {
108
117
  return fallback;
109
118
  return raw;
110
119
  }
120
+ function workerTokenExpiresAt(issuedAt) {
121
+ return (issuedAt + parsePositiveIntEnv("WORKER_TOKEN_TTL_MS", 2 * 60 * 60 * 1000));
122
+ }
111
123
  /**
112
124
  * Verify and decrypt a worker authentication token
113
125
  */
@@ -273,10 +285,9 @@ function verifyToken(token, expectedKind) {
273
285
  // WORKER_TOKEN_CLOCK_SKEW_MS. Tokens timestamped further in the future
274
286
  // than the skew are rejected too — otherwise forward drift would grant
275
287
  // an unbounded validity window.
276
- const ttl = parsePositiveIntEnv("WORKER_TOKEN_TTL_MS", 2 * 60 * 60 * 1000);
277
288
  const skewMs = parsePositiveIntEnv("WORKER_TOKEN_CLOCK_SKEW_MS", 30 * 1000, true);
278
289
  const age = Date.now() - data.timestamp;
279
- if (age > ttl + skewMs) {
290
+ if (Date.now() > workerTokenExpiresAt(data.timestamp) + skewMs) {
280
291
  logger.error("Worker token rejected: expired");
281
292
  return null;
282
293
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobu/core",
3
- "version": "24.9.0",
3
+ "version": "24.10.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Core types and utilities for Lobu agent platform",
6
6
  "repository": {
@@ -180,11 +180,16 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
180
180
  : (query = q, query.active = true)
181
181
 
182
182
  build(q)
183
- return write(toBuffer(q))
183
+ const written = write(toBuffer(q))
184
+ // BEGIN must reserve its connection even when this write fills the
185
+ // pipeline or reports backpressure. The hook's result still controls
186
+ // whether the pool may schedule another query on this connection.
187
+ const executed = !q.options.onexecute || q.options.onexecute(connection)
188
+ return written
184
189
  && !q.describeFirst
185
190
  && !q.cursorFn
186
191
  && sent.length < max_pipeline
187
- && (!q.options.onexecute || q.options.onexecute(connection))
192
+ && executed
188
193
  } catch (error) {
189
194
  sent.length === 0 && write(Sync)
190
195
  errored(error)
@@ -178,11 +178,16 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
178
178
  : (query = q, query.active = true)
179
179
 
180
180
  build(q)
181
- return write(toBuffer(q))
181
+ const written = write(toBuffer(q))
182
+ // BEGIN must reserve its connection even when this write fills the
183
+ // pipeline or reports backpressure. The hook's result still controls
184
+ // whether the pool may schedule another query on this connection.
185
+ const executed = !q.options.onexecute || q.options.onexecute(connection)
186
+ return written
182
187
  && !q.describeFirst
183
188
  && !q.cursorFn
184
189
  && sent.length < max_pipeline
185
- && (!q.options.onexecute || q.options.onexecute(connection))
190
+ && executed
186
191
  } catch (error) {
187
192
  sent.length === 0 && write(Sync)
188
193
  errored(error)
@@ -178,11 +178,16 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
178
178
  : (query = q, query.active = true)
179
179
 
180
180
  build(q)
181
- return write(toBuffer(q))
181
+ const written = write(toBuffer(q))
182
+ // BEGIN must reserve its connection even when this write fills the
183
+ // pipeline or reports backpressure. The hook's result still controls
184
+ // whether the pool may schedule another query on this connection.
185
+ const executed = !q.options.onexecute || q.options.onexecute(connection)
186
+ return written
182
187
  && !q.describeFirst
183
188
  && !q.cursorFn
184
189
  && sent.length < max_pipeline
185
- && (!q.options.onexecute || q.options.onexecute(connection))
190
+ && executed
186
191
  } catch (error) {
187
192
  sent.length === 0 && write(Sync)
188
193
  errored(error)
@@ -188,12 +188,42 @@ export interface JsonDiffProps {
188
188
  before: Record<string, unknown> | null;
189
189
  after: Record<string, unknown> | null;
190
190
  }
191
+ /** Schema declarations use the entitySchema SDK's field names. List responses
192
+ * supply entity_types / relationship_types; compose rules from listRules.
193
+ * Rendering never applies a declaration. createType/createRelType require a
194
+ * name; the graph alone permits omission and displays the slug. */
195
+ export interface SchemaSpec {
196
+ entityTypes: Array<{
197
+ slug: string;
198
+ name?: string;
199
+ description?: string;
200
+ metadata_schema?: object;
201
+ event_kinds?: object;
202
+ }>;
203
+ relationshipTypes: Array<{
204
+ slug: string;
205
+ name?: string;
206
+ metadata_schema?: object;
207
+ rules: Array<{
208
+ source_entity_type_slug: string;
209
+ target_entity_type_slug: string;
210
+ }>;
211
+ }>;
212
+ }
213
+ export type SchemaGraphProps = {
214
+ schema?: undefined;
215
+ base?: never;
216
+ } | {
217
+ schema: SchemaSpec;
218
+ base?: "workspace" | SchemaSpec;
219
+ };
191
220
  /** Read-only native definition body. Pass a saved object or an authored snapshot.
192
221
  * No fetching, code execution, saving or approval is performed by the body. */
193
222
  export interface DefinitionProps {
194
223
  value: Record<string, unknown>;
195
224
  }
196
225
  export interface NativeComponentProps {
226
+ SchemaGraph: SchemaGraphProps;
197
227
  AutomationDefinition: DefinitionProps;
198
228
  AgentDefinition: DefinitionProps;
199
229
  ConnectorDefinition: DefinitionProps;
@@ -258,9 +288,11 @@ export interface NativeComponentProps {
258
288
  export type NativeComponents = {
259
289
  [K in keyof NativeComponentProps]: ComponentType<NativeComponentProps[K]>;
260
290
  };
261
- export declare const NATIVE_COMPONENT_NAMES: readonly ["AutomationDefinition", "AgentDefinition", "ConnectorDefinition", "AutomationReference", "AgentReference", "ConnectorReference", "JsonDiff", "EntityListPage", "EntityRecordPage", "EntityTableView", "RecordSpecSheet", "SchemaValue", "EntityAvatar", "Button", "Badge", "Tabs", "TabsList", "TabsTrigger", "TabsContent"];
291
+ export declare const NATIVE_COMPONENT_NAMES: readonly ["SchemaGraph", "AutomationDefinition", "AgentDefinition", "ConnectorDefinition", "AutomationReference", "AgentReference", "ConnectorReference", "JsonDiff", "EntityListPage", "EntityRecordPage", "EntityTableView", "RecordSpecSheet", "SchemaValue", "EntityAvatar", "Button", "Badge", "Tabs", "TabsList", "TabsTrigger", "TabsContent"];
262
292
  export declare const NATIVE_COMPONENT_GLOBAL = "__lobuViewNative";
263
293
  export declare const EntityListPage: ComponentType<EntityListPageProps>;
294
+ /** Read-only workspace schema, snapshot, or semantic schema comparison. */
295
+ export declare const SchemaGraph: ComponentType<SchemaGraphProps>;
264
296
  export declare const EntityRecordPage: ComponentType<EntityRecordPageProps>;
265
297
  export declare const EntityTableView: ComponentType<EntityTableViewProps>;
266
298
  export declare const RecordSpecSheet: ComponentType<{
@@ -2,6 +2,7 @@
2
2
  * Implementations are supplied by the host artifact, using the shell's React. */
3
3
  import { createElement, } from "react";
4
4
  export const NATIVE_COMPONENT_NAMES = [
5
+ "SchemaGraph",
5
6
  "AutomationDefinition",
6
7
  "AgentDefinition",
7
8
  "ConnectorDefinition",
@@ -33,6 +34,8 @@ function native(name) {
33
34
  };
34
35
  }
35
36
  export const EntityListPage = native("EntityListPage");
37
+ /** Read-only workspace schema, snapshot, or semantic schema comparison. */
38
+ export const SchemaGraph = native("SchemaGraph");
36
39
  export const EntityRecordPage = native("EntityRecordPage");
37
40
  export const EntityTableView = native("EntityTableView");
38
41
  export const RecordSpecSheet = native("RecordSpecSheet");
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobu/views",
3
- "version": "24.9.0",
3
+ "version": "24.10.0",
4
4
  "description": "Authoring runtime for Lobu views — React modules rendered in the sandboxed MCP Apps frame",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",