@lobu/runtime-device 24.8.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 (110) hide show
  1. package/dist/component.json +1 -1
  2. package/dist/dependencies.bun.lock +36 -34
  3. package/npm-shrinkwrap.json +228 -207
  4. package/package.json +1 -1
  5. package/vendor/cli/dist/bundled-skills/lobu/SKILL.md +17 -3
  6. package/vendor/cli/dist/commands/_lib/apply/apply-cmd.js +31 -4
  7. package/vendor/cli/dist/commands/_lib/apply/client.d.ts +37 -22
  8. package/vendor/cli/dist/commands/_lib/apply/client.js +63 -43
  9. package/vendor/cli/dist/commands/_lib/apply/deployment.d.ts +8 -12
  10. package/vendor/cli/dist/commands/_lib/apply/deployment.js +14 -1
  11. package/vendor/cli/dist/commands/_lib/apply/desired-state.d.ts +8 -4
  12. package/vendor/cli/dist/commands/_lib/apply/desired-state.js +2 -1
  13. package/vendor/cli/dist/commands/_lib/apply/diff.d.ts +26 -7
  14. package/vendor/cli/dist/commands/_lib/apply/diff.js +101 -30
  15. package/vendor/cli/dist/commands/_lib/apply/map-config.js +29 -2
  16. package/vendor/cli/dist/commands/_lib/apply/render.js +2 -0
  17. package/vendor/cli/dist/commands/_lib/apply/shared.d.ts +20 -0
  18. package/vendor/cli/dist/commands/_lib/apply/shared.js +22 -0
  19. package/vendor/cli/dist/commands/_lib/init-from-org/bootstrap.js +14 -0
  20. package/vendor/cli/dist/commands/dev.js +2 -0
  21. package/vendor/cli/dist/commands/memory/_lib/seed-cmd.js +6 -2
  22. package/vendor/cli/dist/config/define.d.ts +21 -3
  23. package/vendor/cli/dist/connectors/README.md +6 -2
  24. package/vendor/cli/dist/connectors/github.ts +16 -3
  25. package/vendor/cli/dist/connectors/market_quotes.ts +388 -91
  26. package/vendor/cli/dist/connectors/postgres.ts +60 -38
  27. package/vendor/cli/dist/connectors/whatsapp-web-adapter.js +41 -10
  28. package/vendor/cli/dist/connectors/whatsapp-web-helpers.ts +12 -2
  29. package/vendor/cli/dist/connectors/whatsapp_web.ts +18 -2
  30. package/vendor/cli/dist/connectors/x-dm-adapter.js +55 -21
  31. package/vendor/cli/dist/connectors/x.ts +1 -1
  32. package/vendor/cli/dist/internal/context.d.ts +5 -0
  33. package/vendor/cli/dist/internal/context.js +23 -9
  34. package/vendor/cli/dist/runtime-components.json +4 -4
  35. package/vendor/cli/package.json +1 -1
  36. package/vendor/connector-sdk/dist/connector-types.d.ts +29 -2
  37. package/vendor/connector-sdk/dist/index.d.ts +1 -0
  38. package/vendor/connector-sdk/dist/index.js +1 -0
  39. package/vendor/connector-sdk/dist/ip-reachability.d.ts +1 -1
  40. package/vendor/connector-sdk/dist/ip-reachability.js +1 -1
  41. package/vendor/connector-sdk/dist/logger.d.ts +1 -1
  42. package/vendor/connector-sdk/dist/logger.js +1 -1
  43. package/vendor/connector-sdk/dist/reaction-client-types.d.ts +3 -1
  44. package/vendor/connector-sdk/dist/retry.d.ts +1 -1
  45. package/vendor/connector-sdk/dist/retry.js +1 -1
  46. package/vendor/connector-sdk/dist/source-withheld-error.d.ts +16 -0
  47. package/vendor/connector-sdk/dist/source-withheld-error.js +19 -0
  48. package/vendor/connector-sdk/package.json +1 -1
  49. package/vendor/connector-worker/dist/daemon/automation.js +7 -4
  50. package/vendor/connector-worker/dist/daemon/index.d.ts +1 -0
  51. package/vendor/connector-worker/dist/daemon/index.js +1 -0
  52. package/vendor/connector-worker/dist/daemon/terminal-delivery.d.ts +12 -2
  53. package/vendor/connector-worker/dist/daemon/terminal-delivery.js +19 -12
  54. package/vendor/connector-worker/dist/executor/interface.d.ts +10 -0
  55. package/vendor/connector-worker/dist/executor/interface.js +6 -0
  56. package/vendor/connector-worker/dist/executor/isolate.d.ts +1 -0
  57. package/vendor/connector-worker/dist/executor/isolate.js +88 -24
  58. package/vendor/connector-worker/dist/isolate/prelude.js +5 -0
  59. package/vendor/connector-worker/package.json +1 -1
  60. package/vendor/core/dist/classify-error.d.ts +4 -5
  61. package/vendor/core/dist/classify-error.js +10 -10
  62. package/vendor/core/dist/contracts/tools/collection-presentation.d.ts +17 -1
  63. package/vendor/core/dist/contracts/tools/collection-presentation.js +27 -3
  64. package/vendor/core/dist/contracts/tools/manage-automations.d.ts +67 -3
  65. package/vendor/core/dist/contracts/tools/manage-automations.js +38 -9
  66. package/vendor/core/dist/contracts/tools/manage-entity-schema.js +1 -1
  67. package/vendor/core/dist/contracts/tools/manage-entity.d.ts +8 -0
  68. package/vendor/core/dist/contracts/tools/manage-entity.js +11 -3
  69. package/vendor/core/dist/contracts/tools/manage-views.d.ts +249 -7
  70. package/vendor/core/dist/contracts/tools/manage-views.js +83 -21
  71. package/vendor/core/dist/contracts/tools/navigation.d.ts +248 -0
  72. package/vendor/core/dist/contracts/tools/navigation.js +284 -0
  73. package/vendor/core/dist/contracts/tools/save-memory.d.ts +11 -1
  74. package/vendor/core/dist/contracts/tools/save-memory.js +25 -3
  75. package/vendor/core/dist/contracts/tools/search-memory.js +1 -1
  76. package/vendor/core/dist/contracts/tools/view-attach.d.ts +7 -0
  77. package/vendor/core/dist/contracts/tools/view-attach.js +15 -0
  78. package/vendor/core/dist/contracts/tools/view-content-hash.d.ts +4 -1
  79. package/vendor/core/dist/contracts/tools/view-content-hash.js +4 -2
  80. package/vendor/core/dist/contracts/tools/view-definition.d.ts +2 -0
  81. package/vendor/core/dist/contracts/tools/view-definition.js +52 -0
  82. package/vendor/core/dist/contracts/tools/view-host.d.ts +68 -0
  83. package/vendor/core/dist/contracts/tools/view-host.js +28 -1
  84. package/vendor/core/dist/contracts/tools/view-scope.d.ts +31 -0
  85. package/vendor/core/dist/contracts/tools/view-scope.js +45 -0
  86. package/vendor/core/dist/credentials.d.ts +12 -0
  87. package/vendor/core/dist/credentials.js +1 -0
  88. package/vendor/core/dist/errors.d.ts +17 -24
  89. package/vendor/core/dist/errors.js +19 -26
  90. package/vendor/core/dist/types.d.ts +0 -6
  91. package/vendor/core/dist/worker/auth.d.ts +5 -0
  92. package/vendor/core/dist/worker/auth.js +15 -4
  93. package/vendor/core/package.json +11 -1
  94. package/vendor/postgres/cf/src/connection.js +7 -2
  95. package/vendor/postgres/cjs/src/connection.js +7 -2
  96. package/vendor/postgres/src/connection.js +7 -2
  97. package/vendor/views/dist/api.d.ts +30 -5
  98. package/vendor/views/dist/api.js +22 -8
  99. package/vendor/views/dist/bridge.d.ts +17 -0
  100. package/vendor/views/dist/bridge.js +49 -1
  101. package/vendor/views/dist/components.d.ts +27 -5
  102. package/vendor/views/dist/components.js +57 -7
  103. package/vendor/views/dist/embed.d.ts +98 -0
  104. package/vendor/views/dist/embed.js +418 -0
  105. package/vendor/views/dist/index.d.ts +3 -1
  106. package/vendor/views/dist/index.js +1 -0
  107. package/vendor/views/dist/native.d.ts +33 -1
  108. package/vendor/views/dist/native.js +3 -0
  109. package/vendor/views/package.json +1 -1
  110. /package/vendor/postgres/{.bun-tag-c81dacd34e959a7a → .bun-tag-652f2580b8090d71} +0 -0
@@ -6,13 +6,12 @@
6
6
  * `AgentErrorCode`. Every other layer consumes this rather than growing its
7
7
  * own regex, and three of them act on the result:
8
8
  *
9
- * - `providerQuotaResetNotBefore` (automations/schedule-cursor.ts) returns
10
- * `null` unless the code is `PROVIDER_QUOTA_EXHAUSTED`, so an unclassified
11
- * quota trip never parks the Automation until the provider's reset — it
12
- * keeps firing on schedule against an exhausted quota.
9
+ * - `classifyRunOutcome` (server runs/run-outcome.ts) stamps a classified
10
+ * failure `infra_error`; an unclassified provider refusal is blamed on the
11
+ * agent as `agent_error`.
13
12
  * - `response-renderer.ts` and `chat-response-bridge.ts` resolve the code to
14
13
  * a remediation CTA; with none, the user gets the provider's raw prose.
15
- * - An unclassified failure also misses the `PROVIDER_*` Sentry alerting.
14
+ * - An unclassified failure also misses the `PROVIDER_*` error alerting.
16
15
  *
17
16
  * Adding a failure mode = one pattern here + one entry in `AGENT_ERRORS`.
18
17
  *
@@ -86,10 +85,11 @@ function classifyErrorMessage(message) {
86
85
  // dodged the PROVIDER_* alert.
87
86
  //
88
87
  // It belongs HERE and not in `PROVIDER_BALANCE_EXHAUSTED` above: a
89
- // subscription usage limit is WINDOWED — the provider names its own reset,
90
- // hours or days out — while that union parks an Automation for a flat day
91
- // regardless. Parking a windowed limit on a balance schedule would be a
92
- // worse bug than the one this fixes.
88
+ // subscription usage limit is WINDOWED — it clears on the provider's own
89
+ // reset — while that union means the account cannot spend until someone tops
90
+ // it up. The device daemon stops a retrying OpenCode run on balance wording
91
+ // alone, so a windowed limit in that union would cut short a run the CLI's
92
+ // own retry could still finish.
93
93
  if (errors_js_1.PROVIDER_WINDOWED_QUOTA.test(message))
94
94
  return errors_js_1.AgentErrorCode.PROVIDER_QUOTA_EXHAUSTED;
95
95
  // Gemini can end a turn with this provider-side tool-call rejection instead
@@ -115,7 +115,7 @@ function classifyErrorMessage(message) {
115
115
  // (code no_credentials) when every credential tier misses. The live red-test
116
116
  // (LOBU-BACKEND-W) landed as `unclassified` because the auth-hint regex
117
117
  // doesn't cover this shape — and an unclassified event dodges the
118
- // PROVIDER_* Sentry alert.
118
+ // PROVIDER_* alert.
119
119
  if (/no\s+(provider\s+)?credentials\s+configured|no_credentials/i.test(message))
120
120
  return errors_js_1.AgentErrorCode.PROVIDER_AUTH;
121
121
  // The provider accepted the credential but refuses to USE it: Anthropic 403s
@@ -40,6 +40,11 @@ declare const PresetSchema: import("@sinclair/typebox").TObject<{
40
40
  toDays: import("@sinclair/typebox").TInteger;
41
41
  timeZone: import("@sinclair/typebox").TString;
42
42
  }>>;
43
+ /** Adds `{ field, op: "eq", value: <signed-in user's email> }`. Only a
44
+ * filter: read access is still enforced server-side. */
45
+ viewer: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
46
+ field: import("@sinclair/typebox").TString;
47
+ }>>;
43
48
  }>;
44
49
  export declare const CollectionPresentationSchema: import("@sinclair/typebox").TObject<{
45
50
  presets: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
@@ -71,6 +76,11 @@ export declare const CollectionPresentationSchema: import("@sinclair/typebox").T
71
76
  toDays: import("@sinclair/typebox").TInteger;
72
77
  timeZone: import("@sinclair/typebox").TString;
73
78
  }>>;
79
+ /** Adds `{ field, op: "eq", value: <signed-in user's email> }`. Only a
80
+ * filter: read access is still enforced server-side. */
81
+ viewer: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
82
+ field: import("@sinclair/typebox").TString;
83
+ }>>;
74
84
  }>>>;
75
85
  table: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
76
86
  columns: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
@@ -88,6 +98,12 @@ export type CollectionPresentation = Static<typeof CollectionPresentationSchema>
88
98
  export type CollectionPreset = Static<typeof PresetSchema>;
89
99
  export type CollectionTable = Static<typeof TableSchema>;
90
100
  export declare function parseCollectionPresentation(raw: unknown): CollectionPresentation;
91
- export declare function resolveCollectionPreset(preset: CollectionPreset, now?: Date): CollectionSelection;
101
+ /**
102
+ * The preset as a concrete selection. A viewer preset needs the signed-in
103
+ * viewer and throws without one, so it never widens to every row.
104
+ */
105
+ export declare function resolveCollectionPreset(preset: CollectionPreset, now?: Date, viewer?: {
106
+ email: string;
107
+ }): CollectionSelection;
92
108
  export {};
93
109
  //# sourceMappingURL=collection-presentation.d.ts.map
@@ -32,6 +32,9 @@ const PresetSchema = typebox_1.Type.Object({
32
32
  toDays: typebox_1.Type.Integer({ minimum: -3660, maximum: 3660 }),
33
33
  timeZone: typebox_1.Type.String({ minLength: 1, maxLength: 100 }),
34
34
  }, { additionalProperties: false })),
35
+ /** Adds `{ field, op: "eq", value: <signed-in user's email> }`. Only a
36
+ * filter: read access is still enforced server-side. */
37
+ viewer: typebox_1.Type.Optional(typebox_1.Type.Object({ field: Field }, { additionalProperties: false })),
35
38
  }, { additionalProperties: false });
36
39
  exports.CollectionPresentationSchema = typebox_1.Type.Object({
37
40
  presets: typebox_1.Type.Optional(typebox_1.Type.Array(PresetSchema, { maxItems: 32 })),
@@ -41,6 +44,7 @@ exports.CollectionPresentationSchema = typebox_1.Type.Object({
41
44
  * Both calls run as the viewer; this binding grants no source access. */
42
45
  facetQuery: typebox_1.Type.Optional(typebox_1.Type.String({ minLength: 1, maxLength: 64000 })),
43
46
  }, { additionalProperties: false });
47
+ const MAX_FILTERS = collection_selection_1.AttributeFiltersSchema.maxItems ?? 32;
44
48
  function parseCollectionPresentation(raw) {
45
49
  if (!value_1.Value.Check(exports.CollectionPresentationSchema, raw))
46
50
  throw new Error("Invalid collection presentation configuration");
@@ -49,9 +53,13 @@ function parseCollectionPresentation(raw) {
49
53
  if (keys.has(preset.key))
50
54
  throw new Error(`Duplicate collection preset: ${preset.key}`);
51
55
  keys.add(preset.key);
56
+ // The resolved selection must still fit the selection contract.
57
+ if ((preset.selection.filters?.length ?? 0) +
58
+ (preset.viewer ? 1 : 0) +
59
+ (preset.relativeDate ? 2 : 0) >
60
+ MAX_FILTERS)
61
+ throw new Error(`Collection preset ${preset.key} resolves to more than ${MAX_FILTERS} filters`);
52
62
  if (preset.relativeDate) {
53
- if ((preset.selection.filters?.length ?? 0) > 30)
54
- throw new Error("Relative date presets support at most 30 other filters");
55
63
  if (preset.relativeDate.fromDays > preset.relativeDate.toDays)
56
64
  throw new Error("Relative date range is reversed");
57
65
  // Intl validates IANA timezone names, including UTC.
@@ -62,8 +70,24 @@ function parseCollectionPresentation(raw) {
62
70
  }
63
71
  return raw;
64
72
  }
65
- function resolveCollectionPreset(preset, now = new Date()) {
73
+ /**
74
+ * The preset as a concrete selection. A viewer preset needs the signed-in
75
+ * viewer and throws without one, so it never widens to every row.
76
+ */
77
+ function resolveCollectionPreset(preset, now = new Date(), viewer) {
66
78
  const selection = structuredClone(preset.selection);
79
+ if (preset.viewer) {
80
+ if (!viewer?.email)
81
+ throw new Error(`Collection preset ${preset.key} needs a signed-in viewer`);
82
+ selection.filters = [
83
+ ...(selection.filters ?? []),
84
+ {
85
+ field: preset.viewer.field,
86
+ op: "eq",
87
+ value: viewer.email.toLowerCase(),
88
+ },
89
+ ];
90
+ }
67
91
  if (!preset.relativeDate)
68
92
  return selection;
69
93
  const { field, fromDays, toDays, timeZone } = preset.relativeDate;
@@ -402,11 +402,32 @@ export declare const AutomationClaimNextWindowContextSchema: import("@sinclair/t
402
402
  feed_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
403
403
  }>>>;
404
404
  extraction_schema: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>>;
405
+ /**
406
+ * The run's pinned Automation version instructions. Present on the first
407
+ * page of a window (no source_cursor / before_* cursor), omitted on
408
+ * continuation pages. Follow these instead of a cached copy of the prompt.
409
+ */
410
+ instructions: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
411
+ version_id: import("@sinclair/typebox").TInteger;
412
+ prompt: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
413
+ skills: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
414
+ name: import("@sinclair/typebox").TString;
415
+ content: import("@sinclair/typebox").TString;
416
+ }>>;
417
+ }>>;
405
418
  }>;
406
419
  export type AutomationClaimNextWindowContext = Static<typeof AutomationClaimNextWindowContextSchema>;
407
- export declare const AutomationClaimNextWindowResultSchema: import("@sinclair/typebox").TObject<{
420
+ /**
421
+ * A claim either leases a window (`claimed`, with context to process and a
422
+ * window_token for completeWindow) or reports that the due window had no new
423
+ * or changed source content and was already booked as a no-op run
424
+ * (`completed`). A completed receipt needs no completeWindow: the schedule
425
+ * has advanced, so refresh activity for the next due window.
426
+ */
427
+ export declare const AutomationClaimNextWindowResultSchema: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
408
428
  action: import("@sinclair/typebox").TLiteral<"claim_next_window">;
409
429
  automation_id: import("@sinclair/typebox").TString;
430
+ status: import("@sinclair/typebox").TLiteral<"claimed">;
410
431
  run_id: import("@sinclair/typebox").TInteger;
411
432
  lease_expires_at: import("@sinclair/typebox").TString;
412
433
  context: import("@sinclair/typebox").TObject<{
@@ -433,8 +454,29 @@ export declare const AutomationClaimNextWindowResultSchema: import("@sinclair/ty
433
454
  feed_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
434
455
  }>>>;
435
456
  extraction_schema: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>>;
457
+ /**
458
+ * The run's pinned Automation version instructions. Present on the first
459
+ * page of a window (no source_cursor / before_* cursor), omitted on
460
+ * continuation pages. Follow these instead of a cached copy of the prompt.
461
+ */
462
+ instructions: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
463
+ version_id: import("@sinclair/typebox").TInteger;
464
+ prompt: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
465
+ skills: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
466
+ name: import("@sinclair/typebox").TString;
467
+ content: import("@sinclair/typebox").TString;
468
+ }>>;
469
+ }>>;
436
470
  }>;
437
- }>;
471
+ }>, import("@sinclair/typebox").TObject<{
472
+ action: import("@sinclair/typebox").TLiteral<"claim_next_window">;
473
+ automation_id: import("@sinclair/typebox").TString;
474
+ status: import("@sinclair/typebox").TLiteral<"completed">;
475
+ run_id: import("@sinclair/typebox").TInteger;
476
+ skipped_unchanged: import("@sinclair/typebox").TLiteral<true>;
477
+ window_start: import("@sinclair/typebox").TString;
478
+ window_end: import("@sinclair/typebox").TString;
479
+ }>]>;
438
480
  export type AutomationClaimNextWindowResult = Static<typeof AutomationClaimNextWindowResultSchema>;
439
481
  export declare const AutomationTriggerExecutionSchema: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
440
482
  lane: import("@sinclair/typebox").TLiteral<"managed_agent">;
@@ -570,9 +612,10 @@ export declare const ManageAutomationsResultSchema: import("@sinclair/typebox").
570
612
  window_start: import("@sinclair/typebox").TString;
571
613
  window_end: import("@sinclair/typebox").TString;
572
614
  content_linked: import("@sinclair/typebox").TInteger;
573
- }>, import("@sinclair/typebox").TObject<{
615
+ }>, import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
574
616
  action: import("@sinclair/typebox").TLiteral<"claim_next_window">;
575
617
  automation_id: import("@sinclair/typebox").TString;
618
+ status: import("@sinclair/typebox").TLiteral<"claimed">;
576
619
  run_id: import("@sinclair/typebox").TInteger;
577
620
  lease_expires_at: import("@sinclair/typebox").TString;
578
621
  context: import("@sinclair/typebox").TObject<{
@@ -599,8 +642,29 @@ export declare const ManageAutomationsResultSchema: import("@sinclair/typebox").
599
642
  feed_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
600
643
  }>>>;
601
644
  extraction_schema: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>>;
645
+ /**
646
+ * The run's pinned Automation version instructions. Present on the first
647
+ * page of a window (no source_cursor / before_* cursor), omitted on
648
+ * continuation pages. Follow these instead of a cached copy of the prompt.
649
+ */
650
+ instructions: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
651
+ version_id: import("@sinclair/typebox").TInteger;
652
+ prompt: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
653
+ skills: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
654
+ name: import("@sinclair/typebox").TString;
655
+ content: import("@sinclair/typebox").TString;
656
+ }>>;
657
+ }>>;
602
658
  }>;
603
659
  }>, import("@sinclair/typebox").TObject<{
660
+ action: import("@sinclair/typebox").TLiteral<"claim_next_window">;
661
+ automation_id: import("@sinclair/typebox").TString;
662
+ status: import("@sinclair/typebox").TLiteral<"completed">;
663
+ run_id: import("@sinclair/typebox").TInteger;
664
+ skipped_unchanged: import("@sinclair/typebox").TLiteral<true>;
665
+ window_start: import("@sinclair/typebox").TString;
666
+ window_end: import("@sinclair/typebox").TString;
667
+ }>]>, import("@sinclair/typebox").TObject<{
604
668
  action: import("@sinclair/typebox").TLiteral<"trigger">;
605
669
  automation_id: import("@sinclair/typebox").TString;
606
670
  run_id: import("@sinclair/typebox").TInteger;
@@ -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([
@@ -355,7 +355,7 @@ exports.ManageAutomationsSchema = typebox_1.Type.Object({
355
355
  description: "Submit an Automation window result and advance the Automation arrival mark. Required after every claim_next_window, including when the window held nothing actionable: the mark moves only inside this call, so an unfinished claim lets the lease expire, times the run out, and serves the same content again on the next claim.",
356
356
  }),
357
357
  typebox_1.Type.Literal("claim_next_window", {
358
- description: "Atomically claim the Automation unclaimed arrival window and return bounded source context plus a fenced window token. The window is [arrival mark, now - settle) over events.created_at, not a calendar period. The caller MUST finish the claim with complete_window, even for an empty or non-actionable window.",
358
+ description: "Atomically claim the Automation unclaimed arrival window and return bounded source context plus a fenced window token. The first page carries context.instructions, the prompt and skills of the run's pinned version; follow them instead of a cached copy. The window is [arrival mark, now - settle) over events.created_at, not a calendar period. The caller MUST finish the claim with complete_window, even for an empty or non-actionable window.",
359
359
  }),
360
360
  typebox_1.Type.Literal("trigger", {
361
361
  description: "Create or reuse an immediate Automation run. The result identifies whether Lobu, a device worker, this caller, or another external caller owns execution. Follow the returned next_action: a pending external run uses knowledge.read then automations.completeWindow, while the owner of an existing external lease resumes it with automations.claimNextWindow.",
@@ -689,14 +689,43 @@ exports.AutomationClaimNextWindowContextSchema = typebox_1.Type.Object({
689
689
  feed_id: typebox_1.Type.Optional(typebox_1.Type.Integer()),
690
690
  }))),
691
691
  extraction_schema: typebox_1.Type.Optional(typebox_1.Type.Record(typebox_1.Type.String(), typebox_1.Type.Unknown())),
692
+ /**
693
+ * The run's pinned Automation version instructions. Present on the first
694
+ * page of a window (no source_cursor / before_* cursor), omitted on
695
+ * continuation pages. Follow these instead of a cached copy of the prompt.
696
+ */
697
+ instructions: typebox_1.Type.Optional(typebox_1.Type.Object({
698
+ version_id: typebox_1.Type.Integer(),
699
+ prompt: typebox_1.Type.Union([typebox_1.Type.String(), typebox_1.Type.Null()]),
700
+ skills: typebox_1.Type.Array(typebox_1.Type.Object({ name: typebox_1.Type.String(), content: typebox_1.Type.String() })),
701
+ })),
692
702
  });
693
- exports.AutomationClaimNextWindowResultSchema = typebox_1.Type.Object({
694
- action: typebox_1.Type.Literal("claim_next_window"),
695
- automation_id: typebox_1.Type.String(),
696
- run_id: typebox_1.Type.Integer(),
697
- lease_expires_at: typebox_1.Type.String(),
698
- context: exports.AutomationClaimNextWindowContextSchema,
699
- });
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
+ ]);
700
729
  exports.AutomationTriggerExecutionSchema = typebox_1.Type.Union([
701
730
  typebox_1.Type.Object({
702
731
  lane: typebox_1.Type.Literal("managed_agent"),
@@ -95,7 +95,7 @@ exports.ManageEntitySchemaSchema = typebox_1.Type.Object({
95
95
  name: typebox_1.Type.Optional(typebox_1.Type.String({ description: "[create/update] Display name", minLength: 1 })),
96
96
  description: typebox_1.Type.Optional(typebox_1.Type.String({ description: "[create/update] Description" })),
97
97
  metadata_schema: typebox_1.Type.Optional(typebox_1.Type.Record(typebox_1.Type.String(), typebox_1.Type.Unknown(), {
98
- description: "[create/update] JSON Schema for metadata validation. Source-backed types declare a durable projected key with root x-lobu-record-key naming the key column; this enables string entity_id + entity_type addressing and authored links without storing source rows. A linked type cannot change its backing or key until its edges are unlinked. Entity property annotations: x-facet: true exposes scalar enum values as collection filters; x-sidebar: true also exposes those values as navigation shortcuts. x-enum-labels maps stringified enum values to display labels. x-table-label or title labels the attribute. These annotations do not grant access or define separate segments.",
98
+ description: "[create/update] JSON Schema for metadata validation. Source-backed types declare a durable projected key with root x-lobu-record-key naming the key column; this enables string entity_id + entity_type addressing and authored links without storing source rows. A linked type cannot change its backing or key until its edges are unlinked. Root x-lobu-stamps maps a server-owned timestamp field to the field it tracks (e.g. { stage_at: stage }): the stamp must be a declared property with type string and format date-time, and the tracked field a declared property; every write sets the stamp when the tracked field is set on create or changes value, and caller-supplied stamp values are ignored. Entity property annotations: x-facet: true exposes scalar enum values as collection filters; x-sidebar: true also exposes those values as navigation shortcuts. x-enum-labels maps stringified enum values to display labels. x-table-label or title labels the attribute. These annotations do not grant access or define separate segments.",
99
99
  })),
100
100
  list_scope: typebox_1.Type.Optional(typebox_1.Type.Union([typebox_1.Type.Literal("accessible"), typebox_1.Type.Literal("organization")], {
101
101
  description: "[list] accessible (default) includes the current org plus public schemas; organization returns only the bound org.",
@@ -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({