@lobu/runtime-device 20.2.0 → 21.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/dist/component.json +1 -1
  2. package/dist/dependencies.bun.lock +42 -36
  3. package/npm-shrinkwrap.json +270 -224
  4. package/package.json +1 -1
  5. package/vendor/cli/dist/commands/_lib/apply/apply-cmd.d.ts +7 -2
  6. package/vendor/cli/dist/commands/_lib/apply/apply-cmd.js +77 -75
  7. package/vendor/cli/dist/commands/_lib/apply/client.d.ts +40 -25
  8. package/vendor/cli/dist/commands/_lib/apply/client.js +31 -39
  9. package/vendor/cli/dist/commands/_lib/apply/deployment.d.ts +1 -1
  10. package/vendor/cli/dist/commands/_lib/apply/deployment.js +2 -2
  11. package/vendor/cli/dist/commands/_lib/apply/desired-state.d.ts +47 -11
  12. package/vendor/cli/dist/commands/_lib/apply/desired-state.js +106 -7
  13. package/vendor/cli/dist/commands/_lib/apply/diff.d.ts +14 -6
  14. package/vendor/cli/dist/commands/_lib/apply/diff.js +42 -23
  15. package/vendor/cli/dist/commands/_lib/apply/map-config.js +2 -3
  16. package/vendor/cli/dist/commands/_lib/apply/render.js +2 -0
  17. package/vendor/cli/dist/commands/_lib/apply/rollback-cmd.js +3 -3
  18. package/vendor/cli/dist/commands/_lib/connector-loader.d.ts +5 -1
  19. package/vendor/cli/dist/commands/_lib/connector-loader.js +1 -1
  20. package/vendor/cli/dist/commands/_lib/ensure-deps-installed.d.ts +15 -26
  21. package/vendor/cli/dist/commands/_lib/ensure-deps-installed.js +227 -136
  22. package/vendor/cli/dist/commands/_lib/view-bundler.d.ts +33 -0
  23. package/vendor/cli/dist/commands/_lib/view-bundler.js +207 -0
  24. package/vendor/cli/dist/commands/_lib/view-reapply.d.ts +60 -0
  25. package/vendor/cli/dist/commands/_lib/view-reapply.js +182 -0
  26. package/vendor/cli/dist/commands/dev.d.ts +14 -5
  27. package/vendor/cli/dist/commands/dev.js +56 -8
  28. package/vendor/cli/dist/commands/init.d.ts +1 -1
  29. package/vendor/cli/dist/commands/init.js +4 -4
  30. package/vendor/cli/dist/config/define.d.ts +25 -8
  31. package/vendor/cli/dist/config/define.js +24 -0
  32. package/vendor/cli/dist/connectors/README.md +15 -16
  33. package/vendor/cli/dist/connectors/github.ts +15 -9
  34. package/vendor/cli/dist/connectors/google_calendar.ts +21 -31
  35. package/vendor/cli/dist/connectors/google_drive.ts +106 -131
  36. package/vendor/cli/dist/connectors/google_gmail.ts +53 -30
  37. package/vendor/cli/dist/connectors/hackernews.ts +2 -5
  38. package/vendor/cli/dist/connectors/jira.ts +62 -27
  39. package/vendor/cli/dist/connectors/linear.ts +55 -21
  40. package/vendor/cli/dist/connectors/microsoft_outlook.ts +151 -110
  41. package/vendor/cli/dist/connectors/postgres.ts +19 -11
  42. package/vendor/cli/dist/connectors/producthunt.ts +8 -6
  43. package/vendor/cli/dist/connectors/reddit.ts +2 -2
  44. package/vendor/cli/dist/connectors/rss.ts +2 -2
  45. package/vendor/cli/dist/connectors/whatsapp_web.ts +5 -4
  46. package/vendor/cli/dist/connectors/x.ts +32 -17
  47. package/vendor/cli/dist/connectors/youtube.ts +18 -5
  48. package/vendor/cli/dist/internal/connector-compiler.d.ts +1 -1
  49. package/vendor/cli/dist/internal/connector-compiler.js +216 -17
  50. package/vendor/cli/dist/runtime-components.json +4 -4
  51. package/vendor/cli/package.json +2 -1
  52. package/vendor/connector-sdk/dist/connector-runtime.d.ts +4 -6
  53. package/vendor/connector-sdk/dist/connector-runtime.js +3 -5
  54. package/vendor/connector-sdk/dist/connector-types.d.ts +28 -13
  55. package/vendor/connector-sdk/dist/define-connector.d.ts +4 -1
  56. package/vendor/connector-sdk/dist/define-connector.js +4 -1
  57. package/vendor/connector-sdk/dist/http-client.d.ts +18 -7
  58. package/vendor/connector-sdk/dist/http-client.js +15 -13
  59. package/vendor/connector-sdk/dist/index.d.ts +1 -1
  60. package/vendor/connector-sdk/dist/retry.d.ts +15 -3
  61. package/vendor/connector-sdk/dist/retry.js +40 -64
  62. package/vendor/connector-sdk/package.json +1 -1
  63. package/vendor/connector-worker/dist/agent-turn/guest-entry.js +122 -10
  64. package/vendor/connector-worker/dist/agent-turn/guest.bundle.js +78 -10
  65. package/vendor/connector-worker/dist/agent-turn/types.d.ts +34 -4
  66. package/vendor/connector-worker/dist/compile/index.d.ts +21 -2
  67. package/vendor/connector-worker/dist/compile/index.js +41 -8
  68. package/vendor/connector-worker/dist/compile/source-capture.d.ts +10 -0
  69. package/vendor/connector-worker/dist/compile/source-capture.js +108 -0
  70. package/vendor/connector-worker/dist/daemon/agent-turn.js +97 -10
  71. package/vendor/connector-worker/dist/daemon/automation.d.ts +1 -1
  72. package/vendor/connector-worker/dist/daemon/executor.d.ts +0 -1
  73. package/vendor/connector-worker/dist/daemon/executor.js +42 -51
  74. package/vendor/connector-worker/dist/daemon/start.js +5 -1
  75. package/vendor/connector-worker/dist/executor/interface.d.ts +12 -8
  76. package/vendor/connector-worker/dist/executor/isolate.js +45 -28
  77. package/vendor/connector-worker/dist/self-check/index.js +15 -13
  78. package/vendor/connector-worker/package.json +1 -1
  79. package/vendor/core/dist/agent-policy.js +3 -0
  80. package/vendor/core/dist/connector-query-errors.d.ts +3 -3
  81. package/vendor/core/dist/connector-query-errors.js +8 -3
  82. package/vendor/core/dist/contracts/tools/manage-connections.d.ts +24 -0
  83. package/vendor/core/dist/contracts/tools/manage-connections.js +13 -0
  84. package/vendor/core/dist/contracts/tools/manage-entity-schema.d.ts +15 -25
  85. package/vendor/core/dist/contracts/tools/manage-entity-schema.js +3 -5
  86. package/vendor/core/dist/contracts/tools/manage-feeds.d.ts +11 -0
  87. package/vendor/core/dist/contracts/tools/manage-feeds.js +12 -1
  88. package/vendor/core/dist/contracts/tools/manage-operations.d.ts +47 -6
  89. package/vendor/core/dist/contracts/tools/manage-operations.js +36 -1
  90. package/vendor/core/dist/contracts/tools/manage-views.d.ts +293 -0
  91. package/vendor/core/dist/contracts/tools/manage-views.js +203 -0
  92. package/vendor/core/dist/contracts/tools/source-files-schema.d.ts +7 -0
  93. package/vendor/core/dist/contracts/tools/source-files-schema.js +19 -0
  94. package/vendor/core/dist/contracts/tools/source-files.d.ts +14 -0
  95. package/vendor/core/dist/contracts/tools/source-files.js +55 -0
  96. package/vendor/core/dist/contracts/tools/view-content-hash.d.ts +37 -0
  97. package/vendor/core/dist/contracts/tools/view-content-hash.js +58 -0
  98. package/vendor/core/dist/contracts/tools/view-path.d.ts +18 -0
  99. package/vendor/core/dist/contracts/tools/view-path.js +24 -0
  100. package/vendor/core/dist/contracts/worker/protocol.d.ts +73 -8
  101. package/vendor/core/dist/contracts/worker/protocol.js +58 -9
  102. package/vendor/core/dist/reserved.d.ts +3 -3
  103. package/vendor/core/dist/reserved.js +9 -1
  104. package/vendor/core/dist/utils/secret-redaction.js +2 -0
  105. package/vendor/core/package.json +25 -5
  106. package/vendor/core/dist/contracts/tools/manage-view-templates.d.ts +0 -165
  107. package/vendor/core/dist/contracts/tools/manage-view-templates.js +0 -130
@@ -0,0 +1,37 @@
1
+ import type { RetainedSource } from "./source-files";
2
+ /**
3
+ * Content identity for Lobu views, shared by the server (compile-at-save)
4
+ * and the CLI (diff-before-apply): ONE function derives the key on both
5
+ * sides, never read off whatever carried it. The hash covers the source, the
6
+ * declared metadata that affects the stored row (name, description, attach,
7
+ * params, actions), the retained files and dependencies when present, AND
8
+ * the digest of the executable browser bundle. The
9
+ * bundle matters because the CLI resolves relative imports and view npm deps
10
+ * where node_modules exists: two different executable artifacts built from
11
+ * the same entry source must never compare identical. `last_writer` is
12
+ * provenance of the last write, not content: including it would defeat no-op
13
+ * detection, since every apply run mints a new apply_id.
14
+ *
15
+ * Canonicalization: `source` verbatim; metadata via `stableStringify`
16
+ * (object keys sorted, arrays in order); the artifact as the full hex
17
+ * sha256 of its UTF-8 bytes. Same bytes on either path (a CLI-supplied
18
+ * `compiled_code` or a server-side compilation) converge on the same
19
+ * identity; byte-identical source/metadata/artifact and retained source stays a no-op.
20
+ */
21
+ /** Deterministic JSON for hashing: object keys sorted, arrays kept in order. */
22
+ export declare function stableStringify(value: unknown): string;
23
+ /** Declared metadata that affects the stored view (everything but provenance). */
24
+ export interface ViewContentMetadata {
25
+ name: string;
26
+ description: string;
27
+ attach: unknown;
28
+ params: unknown;
29
+ actions: unknown;
30
+ }
31
+ /**
32
+ * sha256 of the source plus the declared metadata plus the compiled
33
+ * artifact's digest and retained files/dependencies, first 16 hex. Identical
34
+ * source, metadata, bundle and retained source means nothing is written.
35
+ */
36
+ export declare function contentHash(source: string, metadata: ViewContentMetadata, compiledCode: string, retainedSource?: RetainedSource): string;
37
+ //# sourceMappingURL=view-content-hash.d.ts.map
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.stableStringify = stableStringify;
4
+ exports.contentHash = contentHash;
5
+ const node_crypto_1 = require("node:crypto");
6
+ /**
7
+ * Content identity for Lobu views, shared by the server (compile-at-save)
8
+ * and the CLI (diff-before-apply): ONE function derives the key on both
9
+ * sides, never read off whatever carried it. The hash covers the source, the
10
+ * declared metadata that affects the stored row (name, description, attach,
11
+ * params, actions), the retained files and dependencies when present, AND
12
+ * the digest of the executable browser bundle. The
13
+ * bundle matters because the CLI resolves relative imports and view npm deps
14
+ * where node_modules exists: two different executable artifacts built from
15
+ * the same entry source must never compare identical. `last_writer` is
16
+ * provenance of the last write, not content: including it would defeat no-op
17
+ * detection, since every apply run mints a new apply_id.
18
+ *
19
+ * Canonicalization: `source` verbatim; metadata via `stableStringify`
20
+ * (object keys sorted, arrays in order); the artifact as the full hex
21
+ * sha256 of its UTF-8 bytes. Same bytes on either path (a CLI-supplied
22
+ * `compiled_code` or a server-side compilation) converge on the same
23
+ * identity; byte-identical source/metadata/artifact and retained source stays a no-op.
24
+ */
25
+ /** Deterministic JSON for hashing: object keys sorted, arrays kept in order. */
26
+ function stableStringify(value) {
27
+ if (value === null || value === undefined)
28
+ return "null";
29
+ if (Array.isArray(value))
30
+ return `[${value.map(stableStringify).join(",")}]`;
31
+ if (typeof value === "object") {
32
+ const entries = Object.entries(value)
33
+ .sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))
34
+ .map(([k, v]) => `${JSON.stringify(k)}:${stableStringify(v)}`);
35
+ return `{${entries.join(",")}}`;
36
+ }
37
+ return JSON.stringify(value) ?? "null";
38
+ }
39
+ /**
40
+ * sha256 of the source plus the declared metadata plus the compiled
41
+ * artifact's digest and retained files/dependencies, first 16 hex. Identical
42
+ * source, metadata, bundle and retained source means nothing is written.
43
+ */
44
+ function contentHash(source, metadata, compiledCode, retainedSource) {
45
+ const artifactDigest = (0, node_crypto_1.createHash)("sha256")
46
+ .update(compiledCode, "utf8")
47
+ .digest("hex");
48
+ const hash = (0, node_crypto_1.createHash)("sha256")
49
+ .update(source)
50
+ .update("\n")
51
+ .update(stableStringify(metadata ?? null))
52
+ .update("\n")
53
+ .update(artifactDigest);
54
+ if (retainedSource)
55
+ hash.update("\n").update(stableStringify(retainedSource));
56
+ return hash.digest("hex").slice(0, 16);
57
+ }
58
+ //# sourceMappingURL=view-content-hash.js.map
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Where a view lives in the web host's URL space. A view is selected by path,
3
+ * never by a query key, so the page's query string is the view's params alone
4
+ * and can never collide with the host's own keys (filters, peek, paging):
5
+ *
6
+ * /<org>/data/-/views/<key> workspace view (Data hub tab)
7
+ * /<org>/<type>/-/views/<key> view attached to a type
8
+ * /<org>/<type>/<slug>/-/views/<key> view attached to a record
9
+ *
10
+ * `-` marks where the host's path ends. It is reserved as a slug: entity-type
11
+ * create rejects it (RESERVED_ENTITY_TYPE_SLUGS) and so does a record's
12
+ * explicit slug, and a derived record slug never is one (slugify trims dashes). The server's `open_view` links and the web host's tabs both build
13
+ * the suffix here, so the two cannot drift apart.
14
+ */
15
+ export declare const VIEW_PATH_MARKER = "-";
16
+ /** The suffix that selects view `key` beneath a host page's path. */
17
+ export declare function viewPathSuffix(key: string): string;
18
+ //# sourceMappingURL=view-path.d.ts.map
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VIEW_PATH_MARKER = void 0;
4
+ exports.viewPathSuffix = viewPathSuffix;
5
+ /**
6
+ * Where a view lives in the web host's URL space. A view is selected by path,
7
+ * never by a query key, so the page's query string is the view's params alone
8
+ * and can never collide with the host's own keys (filters, peek, paging):
9
+ *
10
+ * /<org>/data/-/views/<key> workspace view (Data hub tab)
11
+ * /<org>/<type>/-/views/<key> view attached to a type
12
+ * /<org>/<type>/<slug>/-/views/<key> view attached to a record
13
+ *
14
+ * `-` marks where the host's path ends. It is reserved as a slug: entity-type
15
+ * create rejects it (RESERVED_ENTITY_TYPE_SLUGS) and so does a record's
16
+ * explicit slug, and a derived record slug never is one (slugify trims dashes). The server's `open_view` links and the web host's tabs both build
17
+ * the suffix here, so the two cannot drift apart.
18
+ */
19
+ exports.VIEW_PATH_MARKER = "-";
20
+ /** The suffix that selects view `key` beneath a host page's path. */
21
+ function viewPathSuffix(key) {
22
+ return `/${exports.VIEW_PATH_MARKER}/views/${key}`;
23
+ }
24
+ //# sourceMappingURL=view-path.js.map
@@ -1080,6 +1080,7 @@ export declare const CompleteRequestSchema: import("@sinclair/typebox").TObject<
1080
1080
  worker_id: import("@sinclair/typebox").TString;
1081
1081
  checkpoint: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>>;
1082
1082
  items_collected: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
1083
+ more: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
1083
1084
  auth_update: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>>;
1084
1085
  output_tail: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
1085
1086
  exit_code: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TInteger, import("@sinclair/typebox").TNull]>>;
@@ -1196,13 +1197,21 @@ export declare const TURN_TOOL_OUTPUT_MAX_CHARS = 2000;
1196
1197
  * The server renders this into the established `tool_use` custom event, so the
1197
1198
  * SPA, promptfoo provider and menubar keep one tool-trace shape.
1198
1199
  *
1199
- * Best-effort like the delta it rides with, and for the same reason: a tool
1200
- * trace is a VIEW of the turn, never the turn's answer, so a dropped one costs
1201
- * visibility and nothing else.
1200
+ * Mandatory external-effect evidence. The worker retains each trace until the
1201
+ * server explicitly acknowledges durable storage; capacity overflow fails the
1202
+ * turn honestly rather than dropping evidence.
1202
1203
  */
1203
1204
  export declare const TurnToolEventSchema: import("@sinclair/typebox").TObject<{
1204
1205
  tool_call_id: import("@sinclair/typebox").TString;
1205
1206
  name: import("@sinclair/typebox").TString;
1207
+ /**
1208
+ * The accepted input run this call was started for, so a result that lands
1209
+ * after a mid-turn follow-up stays attributed to the message that initiated
1210
+ * it rather than to whichever input is active when it finishes. Absent on
1211
+ * traces from workers that predate per-input attribution; the completion
1212
+ * route then attributes them to the owning input.
1213
+ */
1214
+ input_run_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
1206
1215
  /**
1207
1216
  * The call's arguments, as the model sent them. The SPA renders `input` as
1208
1217
  * the tool row's args. Absent when the start of the call was not observed.
@@ -1228,12 +1237,14 @@ export declare const TurnToolEventSchema: import("@sinclair/typebox").TObject<{
1228
1237
  * How many finished tool traces a turn holds at once, on the worker's queue and
1229
1238
  * as the bound on the completion body's trailing batch.
1230
1239
  *
1231
- * One definition because it is now both: the worker drops the oldest past this
1232
- * cap, and the completion route rejects a body that exceeds it. A trace is a
1233
- * view of the turn, so a turn that spends its budget on tool calls sheds the
1234
- * oldest rather than growing an unbounded queue or an unbounded request.
1240
+ * One definition because it is now both: the worker fails the turn rather than
1241
+ * exceed this cap, and the completion route rejects a body that exceeds it. A
1242
+ * trace is mandatory external-effect evidence, so a turn that spends its budget
1243
+ * on tool calls fails honestly with its retained prefix instead of growing an
1244
+ * unbounded queue, shedding the oldest silently, or filing an unbounded
1245
+ * request.
1235
1246
  */
1236
- export declare const TURN_TOOL_EVENT_QUEUE_MAX = 20;
1247
+ export declare const TURN_TOOL_EVENT_QUEUE_MAX = 50;
1237
1248
  /** Per-execution input bound shared by repeatable offers and committed receipts. */
1238
1249
  export declare const AGENT_TURN_INPUT_MAX = 32;
1239
1250
  export declare const CompleteAgentTurnRequestSchema: import("@sinclair/typebox").TObject<{
@@ -1252,6 +1263,27 @@ export declare const CompleteAgentTurnRequestSchema: import("@sinclair/typebox")
1252
1263
  consumed_inputs: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
1253
1264
  run_id: import("@sinclair/typebox").TInteger;
1254
1265
  session_entry_id: import("@sinclair/typebox").TString;
1266
+ /**
1267
+ * This input's own answer text, not the execution's. Present on
1268
+ * receipts from workers with per-input attribution; absent on
1269
+ * receipts from older workers, which the completion route delivers
1270
+ * as one execution-wide reply (the pre-#3662 contract those claims
1271
+ * were admitted under).
1272
+ */
1273
+ response_text: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
1274
+ /**
1275
+ * The tools this input's answer actually used, in first-call order.
1276
+ * Per-input like the answer: never the execution-wide ledger, which
1277
+ * would attribute a sibling input's calls to this reply.
1278
+ */
1279
+ tools_used: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
1280
+ /**
1281
+ * The first tool error attributed to this input, quoted exactly as the
1282
+ * tool returned it. Preserved independently of how the model paraphrases
1283
+ * the failure in prose, so the durable record keeps the actionable
1284
+ * message even when the reply does not.
1285
+ */
1286
+ first_error: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
1255
1287
  }>>>;
1256
1288
  /**
1257
1289
  * Every tool this turn invoked, first-call order. Absent and `[]` are NOT
@@ -1260,6 +1292,14 @@ export declare const CompleteAgentTurnRequestSchema: import("@sinclair/typebox")
1260
1292
  * must send the array even when it called nothing.
1261
1293
  */
1262
1294
  tools_used: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
1295
+ /**
1296
+ * The owner input's first tool error, quoted exactly as the tool returned
1297
+ * it. Steered inputs carry theirs on their `consumed_inputs` receipts, so
1298
+ * every terminal reply is stamped with its own input's failure rather than
1299
+ * the execution-wide first one. Preserved independently of how the model
1300
+ * paraphrases the failure in prose.
1301
+ */
1302
+ first_error: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
1263
1303
  /**
1264
1304
  * The turn already posted its answer INTO the conversation it is replying to,
1265
1305
  * through the `send_message`/`present_event` conversation tool. The user has
@@ -1287,6 +1327,14 @@ export declare const CompleteAgentTurnRequestSchema: import("@sinclair/typebox")
1287
1327
  turn_tool_events: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
1288
1328
  tool_call_id: import("@sinclair/typebox").TString;
1289
1329
  name: import("@sinclair/typebox").TString;
1330
+ /**
1331
+ * The accepted input run this call was started for, so a result that lands
1332
+ * after a mid-turn follow-up stays attributed to the message that initiated
1333
+ * it rather than to whichever input is active when it finishes. Absent on
1334
+ * traces from workers that predate per-input attribution; the completion
1335
+ * route then attributes them to the owning input.
1336
+ */
1337
+ input_run_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
1290
1338
  /**
1291
1339
  * The call's arguments, as the model sent them. The SPA renders `input` as
1292
1340
  * the tool row's args. Absent when the start of the call was not observed.
@@ -1422,6 +1470,14 @@ export declare const HeartbeatRequestSchema: import("@sinclair/typebox").TObject
1422
1470
  turn_tool_events: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
1423
1471
  tool_call_id: import("@sinclair/typebox").TString;
1424
1472
  name: import("@sinclair/typebox").TString;
1473
+ /**
1474
+ * The accepted input run this call was started for, so a result that lands
1475
+ * after a mid-turn follow-up stays attributed to the message that initiated
1476
+ * it rather than to whichever input is active when it finishes. Absent on
1477
+ * traces from workers that predate per-input attribution; the completion
1478
+ * route then attributes them to the owning input.
1479
+ */
1480
+ input_run_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
1425
1481
  /**
1426
1482
  * The call's arguments, as the model sent them. The SPA renders `input` as
1427
1483
  * the tool row's args. Absent when the start of the call was not observed.
@@ -1526,6 +1582,12 @@ export type AgentTurnToolEvent = Static<typeof TurnToolEventSchema>;
1526
1582
  * already passed acknowledges without publishing, and the worker retires the
1527
1583
  * batch — there is nothing more it can do about it. Only the ABSENCE of an ack
1528
1584
  * keeps the text queued.
1585
+ *
1586
+ * `turn_tool_ack` is the same honesty for the tool traces that rode the beat:
1587
+ * `received` names how many of the sent traces the server durably stored. The
1588
+ * worker retires only that prefix and re-sends the rest. A liveness-only beat
1589
+ * carries no ack and acknowledges nothing; only its absence keeps evidence
1590
+ * queued.
1529
1591
  */
1530
1592
  export declare const HeartbeatResponseSchema: import("@sinclair/typebox").TObject<{
1531
1593
  continue: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
@@ -1555,6 +1617,9 @@ export declare const HeartbeatResponseSchema: import("@sinclair/typebox").TObjec
1555
1617
  sequence: import("@sinclair/typebox").TInteger;
1556
1618
  published: import("@sinclair/typebox").TBoolean;
1557
1619
  }>>;
1620
+ turn_tool_ack: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
1621
+ received: import("@sinclair/typebox").TInteger;
1622
+ }>>;
1558
1623
  }>;
1559
1624
  export type DispatchChromeActionRequest = Static<typeof DispatchChromeActionRequestSchema>;
1560
1625
  export type DispatchChromeActionResponse = Static<typeof DispatchChromeActionResponseSchema>;
@@ -732,6 +732,7 @@ exports.CompleteRequestSchema = typebox_1.Type.Composite([
732
732
  items_collected: typebox_1.Type.Optional(typebox_1.Type.Integer()),
733
733
  error_message: typebox_1.Type.Optional(typebox_1.Type.String()),
734
734
  checkpoint: typebox_1.Type.Optional(typebox_1.Type.Record(typebox_1.Type.String(), typebox_1.Type.Unknown())),
735
+ more: typebox_1.Type.Optional(typebox_1.Type.Boolean()),
735
736
  auth_update: typebox_1.Type.Optional(typebox_1.Type.Record(typebox_1.Type.String(), typebox_1.Type.Unknown())),
736
737
  }),
737
738
  exports.WorkerExitDiagnosticsSchema,
@@ -840,13 +841,21 @@ exports.TURN_TOOL_OUTPUT_MAX_CHARS = 2000;
840
841
  * The server renders this into the established `tool_use` custom event, so the
841
842
  * SPA, promptfoo provider and menubar keep one tool-trace shape.
842
843
  *
843
- * Best-effort like the delta it rides with, and for the same reason: a tool
844
- * trace is a VIEW of the turn, never the turn's answer, so a dropped one costs
845
- * visibility and nothing else.
844
+ * Mandatory external-effect evidence. The worker retains each trace until the
845
+ * server explicitly acknowledges durable storage; capacity overflow fails the
846
+ * turn honestly rather than dropping evidence.
846
847
  */
847
848
  exports.TurnToolEventSchema = typebox_1.Type.Object({
848
849
  tool_call_id: typebox_1.Type.String({ maxLength: 256 }),
849
850
  name: typebox_1.Type.String({ maxLength: 256 }),
851
+ /**
852
+ * The accepted input run this call was started for, so a result that lands
853
+ * after a mid-turn follow-up stays attributed to the message that initiated
854
+ * it rather than to whichever input is active when it finishes. Absent on
855
+ * traces from workers that predate per-input attribution; the completion
856
+ * route then attributes them to the owning input.
857
+ */
858
+ input_run_id: typebox_1.Type.Optional(typebox_1.Type.Integer({ minimum: 1 })),
850
859
  /**
851
860
  * The call's arguments, as the model sent them. The SPA renders `input` as
852
861
  * the tool row's args. Absent when the start of the call was not observed.
@@ -872,12 +881,14 @@ exports.TurnToolEventSchema = typebox_1.Type.Object({
872
881
  * How many finished tool traces a turn holds at once, on the worker's queue and
873
882
  * as the bound on the completion body's trailing batch.
874
883
  *
875
- * One definition because it is now both: the worker drops the oldest past this
876
- * cap, and the completion route rejects a body that exceeds it. A trace is a
877
- * view of the turn, so a turn that spends its budget on tool calls sheds the
878
- * oldest rather than growing an unbounded queue or an unbounded request.
884
+ * One definition because it is now both: the worker fails the turn rather than
885
+ * exceed this cap, and the completion route rejects a body that exceeds it. A
886
+ * trace is mandatory external-effect evidence, so a turn that spends its budget
887
+ * on tool calls fails honestly with its retained prefix instead of growing an
888
+ * unbounded queue, shedding the oldest silently, or filing an unbounded
889
+ * request.
879
890
  */
880
- exports.TURN_TOOL_EVENT_QUEUE_MAX = 20;
891
+ exports.TURN_TOOL_EVENT_QUEUE_MAX = 50;
881
892
  /** Per-execution input bound shared by repeatable offers and committed receipts. */
882
893
  exports.AGENT_TURN_INPUT_MAX = 32;
883
894
  exports.CompleteAgentTurnRequestSchema = typebox_1.Type.Object({
@@ -896,6 +907,27 @@ exports.CompleteAgentTurnRequestSchema = typebox_1.Type.Object({
896
907
  consumed_inputs: typebox_1.Type.Optional(typebox_1.Type.Array(typebox_1.Type.Object({
897
908
  run_id: typebox_1.Type.Integer({ minimum: 1 }),
898
909
  session_entry_id: typebox_1.Type.String({ minLength: 1 }),
910
+ /**
911
+ * This input's own answer text, not the execution's. Present on
912
+ * receipts from workers with per-input attribution; absent on
913
+ * receipts from older workers, which the completion route delivers
914
+ * as one execution-wide reply (the pre-#3662 contract those claims
915
+ * were admitted under).
916
+ */
917
+ response_text: typebox_1.Type.Optional(typebox_1.Type.String({ minLength: 1, maxLength: 32000 })),
918
+ /**
919
+ * The tools this input's answer actually used, in first-call order.
920
+ * Per-input like the answer: never the execution-wide ledger, which
921
+ * would attribute a sibling input's calls to this reply.
922
+ */
923
+ tools_used: typebox_1.Type.Optional(typebox_1.Type.Array(typebox_1.Type.String({ maxLength: 256 }), { maxItems: 50 })),
924
+ /**
925
+ * The first tool error attributed to this input, quoted exactly as the
926
+ * tool returned it. Preserved independently of how the model paraphrases
927
+ * the failure in prose, so the durable record keeps the actionable
928
+ * message even when the reply does not.
929
+ */
930
+ first_error: typebox_1.Type.Optional(typebox_1.Type.String({ minLength: 1, maxLength: exports.TURN_TOOL_OUTPUT_MAX_CHARS })),
899
931
  }), { maxItems: exports.AGENT_TURN_INPUT_MAX })),
900
932
  /**
901
933
  * Every tool this turn invoked, first-call order. Absent and `[]` are NOT
@@ -904,6 +936,14 @@ exports.CompleteAgentTurnRequestSchema = typebox_1.Type.Object({
904
936
  * must send the array even when it called nothing.
905
937
  */
906
938
  tools_used: typebox_1.Type.Optional(typebox_1.Type.Array(typebox_1.Type.String())),
939
+ /**
940
+ * The owner input's first tool error, quoted exactly as the tool returned
941
+ * it. Steered inputs carry theirs on their `consumed_inputs` receipts, so
942
+ * every terminal reply is stamped with its own input's failure rather than
943
+ * the execution-wide first one. Preserved independently of how the model
944
+ * paraphrases the failure in prose.
945
+ */
946
+ first_error: typebox_1.Type.Optional(typebox_1.Type.String({ minLength: 1, maxLength: exports.TURN_TOOL_OUTPUT_MAX_CHARS })),
907
947
  /**
908
948
  * The turn already posted its answer INTO the conversation it is replying to,
909
949
  * through the `send_message`/`present_event` conversation tool. The user has
@@ -1049,7 +1089,7 @@ exports.HeartbeatRequestSchema = typebox_1.Type.Object({
1049
1089
  * the same reason: the turn already reports on this interval, and where the
1050
1090
  * traces are delivered is read from the run's own row, never from this body.
1051
1091
  */
1052
- turn_tool_events: typebox_1.Type.Optional(typebox_1.Type.Array(exports.TurnToolEventSchema)),
1092
+ turn_tool_events: typebox_1.Type.Optional(typebox_1.Type.Array(exports.TurnToolEventSchema, { maxItems: exports.TURN_TOOL_EVENT_QUEUE_MAX })),
1053
1093
  });
1054
1094
  /**
1055
1095
  * Request the gateway dispatch a chrome connector action on behalf of a
@@ -1101,6 +1141,12 @@ exports.DispatchChromeActionResponseSchema = typebox_1.Type.Object({
1101
1141
  * already passed acknowledges without publishing, and the worker retires the
1102
1142
  * batch — there is nothing more it can do about it. Only the ABSENCE of an ack
1103
1143
  * keeps the text queued.
1144
+ *
1145
+ * `turn_tool_ack` is the same honesty for the tool traces that rode the beat:
1146
+ * `received` names how many of the sent traces the server durably stored. The
1147
+ * worker retires only that prefix and re-sends the rest. A liveness-only beat
1148
+ * carries no ack and acknowledges nothing; only its absence keeps evidence
1149
+ * queued.
1104
1150
  */
1105
1151
  exports.HeartbeatResponseSchema = typebox_1.Type.Object({
1106
1152
  continue: typebox_1.Type.Optional(typebox_1.Type.Boolean()),
@@ -1130,5 +1176,8 @@ exports.HeartbeatResponseSchema = typebox_1.Type.Object({
1130
1176
  sequence: typebox_1.Type.Integer({ minimum: 0 }),
1131
1177
  published: typebox_1.Type.Boolean(),
1132
1178
  })),
1179
+ turn_tool_ack: typebox_1.Type.Optional(typebox_1.Type.Object({
1180
+ received: typebox_1.Type.Integer({ minimum: 0 }),
1181
+ })),
1133
1182
  });
1134
1183
  //# sourceMappingURL=protocol.js.map
@@ -17,7 +17,7 @@ export declare function isSystemEntityType(et: {
17
17
  * Owner-level route segments under /$owner/. Entity type slugs and org slugs
18
18
  * must never collide with these.
19
19
  */
20
- export declare const OWNER_ROUTE_SEGMENTS: readonly ["activity", "agents", "connectors", "memory", "members", "settings"];
20
+ export declare const OWNER_ROUTE_SEGMENTS: readonly ["activity", "agents", "connectors", "data", "memory", "members", "settings"];
21
21
  /**
22
22
  * Legacy page slugs removed from the UI router. Bookmarks and previously sent
23
23
  * chat messages can still contain URLs under these segments, so the segments
@@ -31,14 +31,14 @@ export declare const REMOVED_OWNER_SEGMENTS: readonly ["events", "automations",
31
31
  * pages, global prefixes, and infra subdomains that must not be claimed as
32
32
  * org slugs.
33
33
  */
34
- export declare const RESERVED_PATHS: readonly ["activity", "agents", "connectors", "memory", "members", "settings", "events", "automations", "connections", "sources", "environments", "infrastructure", "inference-providers", "devices", "auth", "api", "inbox", "templates", "help", "account", "me", "admin", "health", "login", "logout", "signup", "register", "contents", "entity-types", "www", "mcp", "static", "assets", "cdn", "docs", "mail", "connector", "oauth", "orgs", "slack", "dashboard"];
34
+ export declare const RESERVED_PATHS: readonly ["activity", "agents", "connectors", "data", "memory", "members", "settings", "events", "automations", "connections", "sources", "environments", "infrastructure", "inference-providers", "devices", "auth", "api", "inbox", "templates", "help", "account", "me", "admin", "health", "login", "logout", "signup", "register", "contents", "entity-types", "www", "mcp", "static", "assets", "cdn", "docs", "mail", "connector", "oauth", "orgs", "slack", "dashboard"];
35
35
  export declare const RESERVED_PATHS_SET: ReadonlySet<string>;
36
36
  /**
37
37
  * Slugs users cannot use when *creating* an entity type. Route collisions plus
38
38
  * product words that are not knowledge types. Create-time hygiene only — not
39
39
  * hide/prune policy (that is `$` prefix only).
40
40
  */
41
- export declare const RESERVED_ENTITY_TYPE_SLUGS: readonly ["activity", "agents", "connectors", "memory", "members", "settings", "events", "automations", "connections", "sources", "environments", "infrastructure", "inference-providers", "devices", "entity-types", "recent", "chat", "organization", "user", "automation", "content", "source", "connector"];
41
+ export declare const RESERVED_ENTITY_TYPE_SLUGS: readonly ["activity", "agents", "connectors", "data", "memory", "members", "settings", "events", "automations", "connections", "sources", "environments", "infrastructure", "inference-providers", "devices", "entity-types", "recent", "chat", "-", "organization", "user", "automation", "content", "source", "connector"];
42
42
  /**
43
43
  * Whether a proposed entity-type slug is illegal for user/API create.
44
44
  * `$…` is reserved for platform-named types ($member, $resource).
@@ -13,6 +13,7 @@ exports.isSystemEntityType = isSystemEntityType;
13
13
  exports.isReservedEntityTypeSlug = isReservedEntityTypeSlug;
14
14
  exports.normalizeEntityTypeSlug = normalizeEntityTypeSlug;
15
15
  exports.isReservedConnectorKey = isReservedConnectorKey;
16
+ const view_path_1 = require("./contracts/tools/view-path");
16
17
  // ── Entity type classification ──────────────────────────────────────────────
17
18
  /**
18
19
  * True when a type is platform-owned (hidden from rail, never pruned).
@@ -30,6 +31,8 @@ exports.OWNER_ROUTE_SEGMENTS = [
30
31
  "activity",
31
32
  "agents",
32
33
  "connectors",
34
+ "data",
35
+ // Redirects to /events: stored notification permalinks point here.
33
36
  "memory",
34
37
  "members",
35
38
  "settings",
@@ -119,6 +122,9 @@ exports.RESERVED_ENTITY_TYPE_SLUGS = [
119
122
  "entity-types",
120
123
  "recent",
121
124
  "chat",
125
+ // The web host's view marker (`/<type>/-/views/<key>`): a type stored as `-`
126
+ // would make its own list page parse as a view path.
127
+ view_path_1.VIEW_PATH_MARKER,
122
128
  // Product words that are not knowledge types.
123
129
  "organization",
124
130
  "user",
@@ -132,7 +138,9 @@ exports.RESERVED_ENTITY_TYPE_SLUGS = [
132
138
  * `$…` is reserved for platform-named types ($member, $resource).
133
139
  */
134
140
  function isReservedEntityTypeSlug(slug) {
135
- const s = slug.toLowerCase();
141
+ // Checked in its STORED form: create rewrites `!` to `-` and `entity_types`
142
+ // to `entity-types`, so checking the raw input let those through.
143
+ const s = normalizeEntityTypeSlug(slug);
136
144
  if (s.startsWith("$"))
137
145
  return true;
138
146
  return exports.RESERVED_ENTITY_TYPE_SLUGS.includes(s);
@@ -111,6 +111,8 @@ function redactUriCredentials(value) {
111
111
  * non-denylisted key.
112
112
  */
113
113
  function deepRedactSecrets(value) {
114
+ if (value instanceof Date)
115
+ return value.toISOString();
114
116
  if (Array.isArray(value))
115
117
  return value.map(deepRedactSecrets);
116
118
  if (value && typeof value === "object") {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobu/core",
3
- "version": "20.2.0",
3
+ "version": "21.0.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Core types and utilities for Lobu agent platform",
6
6
  "repository": {
@@ -56,6 +56,11 @@
56
56
  "import": "./dist/errors.js",
57
57
  "require": "./dist/errors.js"
58
58
  },
59
+ "./connector-query-errors": {
60
+ "types": "./dist/connector-query-errors.d.ts",
61
+ "import": "./dist/connector-query-errors.js",
62
+ "require": "./dist/connector-query-errors.js"
63
+ },
59
64
  "./ajv": {
60
65
  "types": "./dist/utils/ajv.d.ts",
61
66
  "import": "./dist/utils/ajv.js",
@@ -121,10 +126,15 @@
121
126
  "import": "./dist/contracts/tools/manage-schedules.js",
122
127
  "require": "./dist/contracts/tools/manage-schedules.js"
123
128
  },
124
- "./contracts/tools/manage-view-templates": {
125
- "types": "./dist/contracts/tools/manage-view-templates.d.ts",
126
- "import": "./dist/contracts/tools/manage-view-templates.js",
127
- "require": "./dist/contracts/tools/manage-view-templates.js"
129
+ "./contracts/tools/manage-views": {
130
+ "types": "./dist/contracts/tools/manage-views.d.ts",
131
+ "import": "./dist/contracts/tools/manage-views.js",
132
+ "require": "./dist/contracts/tools/manage-views.js"
133
+ },
134
+ "./contracts/tools/view-content-hash": {
135
+ "types": "./dist/contracts/tools/view-content-hash.d.ts",
136
+ "import": "./dist/contracts/tools/view-content-hash.js",
137
+ "require": "./dist/contracts/tools/view-content-hash.js"
128
138
  },
129
139
  "./contracts/tools/manage-auth-profiles": {
130
140
  "types": "./dist/contracts/tools/manage-auth-profiles.d.ts",
@@ -195,6 +205,16 @@
195
205
  "types": "./dist/agent-tooling.d.ts",
196
206
  "import": "./dist/agent-tooling.js",
197
207
  "require": "./dist/agent-tooling.js"
208
+ },
209
+ "./contracts/tools/view-path": {
210
+ "types": "./dist/contracts/tools/view-path.d.ts",
211
+ "import": "./dist/contracts/tools/view-path.js",
212
+ "require": "./dist/contracts/tools/view-path.js"
213
+ },
214
+ "./contracts/tools/source-files": {
215
+ "types": "./dist/contracts/tools/source-files.d.ts",
216
+ "import": "./dist/contracts/tools/source-files.js",
217
+ "require": "./dist/contracts/tools/source-files.js"
198
218
  }
199
219
  },
200
220
  "dependencies": {