@sixb/core 0.2.1 → 0.2.2

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 (264) hide show
  1. package/dist/actions/index.js +29 -29
  2. package/dist/agents/cancel.d.ts.map +1 -1
  3. package/dist/agents/index.d.ts +5 -3
  4. package/dist/agents/index.d.ts.map +1 -1
  5. package/dist/agents/index.js +38 -32
  6. package/dist/agents/index.js.map +1 -1
  7. package/dist/agents/run-plan.d.ts +15 -1
  8. package/dist/agents/run-plan.d.ts.map +1 -1
  9. package/dist/agents/run-session-http.d.ts.map +1 -1
  10. package/dist/agents/run-session-serve.d.ts.map +1 -1
  11. package/dist/agents/run-session.d.ts +14 -2
  12. package/dist/agents/run-session.d.ts.map +1 -1
  13. package/dist/agents/skills.d.ts +3 -0
  14. package/dist/agents/skills.d.ts.map +1 -1
  15. package/dist/agents/step-limits.d.ts +6 -0
  16. package/dist/agents/step-limits.d.ts.map +1 -1
  17. package/dist/agents/streams/index.js +1 -1
  18. package/dist/agents/streams/internal.js +1 -1
  19. package/dist/agents/streams/protocol.d.ts +8 -2
  20. package/dist/agents/streams/protocol.d.ts.map +1 -1
  21. package/dist/agents/tool-files.d.ts +3 -1
  22. package/dist/agents/tool-files.d.ts.map +1 -1
  23. package/dist/agents/validation.d.ts +1 -1
  24. package/dist/agents/validation.d.ts.map +1 -1
  25. package/dist/agents/web.d.ts +47 -0
  26. package/dist/agents/web.d.ts.map +1 -0
  27. package/dist/artifacts/publish/index.js +16 -16
  28. package/dist/auth/index.js +3 -3
  29. package/dist/authorization/index.js +2 -2
  30. package/dist/authorization/resolve.d.ts +4 -3
  31. package/dist/authorization/resolve.d.ts.map +1 -1
  32. package/dist/authorization/types.d.ts +5 -5
  33. package/dist/authorization/types.d.ts.map +1 -1
  34. package/dist/bootstrap/index.js +34 -34
  35. package/dist/{chunk-neftrg0n.js → chunk-0j3crh1w.js} +2 -2
  36. package/dist/{chunk-tvbmh7tj.js → chunk-2ajw5rz0.js} +14 -10
  37. package/dist/chunk-2ajw5rz0.js.map +18 -0
  38. package/dist/{chunk-23s66j86.js → chunk-31kcqmhf.js} +1 -1
  39. package/dist/{chunk-nghc7eq0.js → chunk-3723kgba.js} +1 -1
  40. package/dist/{chunk-rjeeyssy.js → chunk-3sqqhpr7.js} +4 -4
  41. package/dist/{chunk-m3qe54bb.js → chunk-4bm0caep.js} +1 -1
  42. package/dist/{chunk-h05rg3bx.js → chunk-4s753g3k.js} +3 -3
  43. package/dist/{chunk-8wsjr52f.js → chunk-5wtnmpze.js} +1 -1
  44. package/dist/{chunk-edx8xcsm.js → chunk-7z5rkf0m.js} +29 -6
  45. package/dist/chunk-7z5rkf0m.js.map +13 -0
  46. package/dist/{chunk-2pk5hjj9.js → chunk-80gym75n.js} +1 -1
  47. package/dist/{chunk-qbrmpgvv.js → chunk-9whfmsfk.js} +1 -1
  48. package/dist/{chunk-z3evap21.js → chunk-a5v4gjdx.js} +27 -26
  49. package/dist/{chunk-z3evap21.js.map → chunk-a5v4gjdx.js.map} +3 -3
  50. package/dist/{chunk-w53trr0c.js → chunk-a7aa0nzj.js} +5 -5
  51. package/dist/{chunk-tvefbgvw.js → chunk-az95tsh3.js} +4 -2
  52. package/dist/chunk-az95tsh3.js.map +11 -0
  53. package/dist/{chunk-7hd2ez3q.js → chunk-c4nrycdy.js} +1 -1
  54. package/dist/{chunk-epyfm23v.js → chunk-c706qvyc.js} +3 -3
  55. package/dist/{chunk-t5daew4g.js → chunk-c7cfe31p.js} +6 -6
  56. package/dist/{chunk-qsg8rw04.js → chunk-d04g36fw.js} +1 -1
  57. package/dist/{chunk-ratj7t3t.js → chunk-dsv783c3.js} +305 -32
  58. package/dist/{chunk-ratj7t3t.js.map → chunk-dsv783c3.js.map} +12 -10
  59. package/dist/{chunk-cb21tx14.js → chunk-eqgr6nsa.js} +81 -25
  60. package/dist/{chunk-cb21tx14.js.map → chunk-eqgr6nsa.js.map} +8 -7
  61. package/dist/{chunk-ax10ft8d.js → chunk-f1h34y3r.js} +5 -5
  62. package/dist/{chunk-9rh8ncs5.js → chunk-fwsvshr5.js} +1 -1
  63. package/dist/{chunk-b7a97n8b.js → chunk-ga63a3dz.js} +6 -6
  64. package/dist/{chunk-b7a97n8b.js.map → chunk-ga63a3dz.js.map} +2 -2
  65. package/dist/{chunk-cgznz22f.js → chunk-gkv8r794.js} +2 -2
  66. package/dist/{chunk-t9xyr7y9.js → chunk-j8thxj7w.js} +3 -3
  67. package/dist/{chunk-31khg3g0.js → chunk-kkjfve0t.js} +73 -2
  68. package/dist/{chunk-31khg3g0.js.map → chunk-kkjfve0t.js.map} +3 -3
  69. package/dist/{chunk-8yzhjawq.js → chunk-m2vh8gh0.js} +8 -14
  70. package/dist/{chunk-8yzhjawq.js.map → chunk-m2vh8gh0.js.map} +3 -3
  71. package/dist/{chunk-nqnfz3jg.js → chunk-mbc5hvnj.js} +2 -2
  72. package/dist/{chunk-jk97v21j.js → chunk-n4zzaf6q.js} +3 -2
  73. package/dist/chunk-n4zzaf6q.js.map +10 -0
  74. package/dist/{chunk-y2x2935j.js → chunk-nh26e7c5.js} +2 -2
  75. package/dist/{chunk-jhbk10wf.js → chunk-q9nkpr8k.js} +1 -1
  76. package/dist/{chunk-47e09r7z.js → chunk-qttqe1ah.js} +86 -6
  77. package/dist/{chunk-47e09r7z.js.map → chunk-qttqe1ah.js.map} +5 -4
  78. package/dist/{chunk-3x3bebz7.js → chunk-s7j8ewqv.js} +161 -62
  79. package/dist/{chunk-3x3bebz7.js.map → chunk-s7j8ewqv.js.map} +7 -6
  80. package/dist/{chunk-dz7a4t3a.js → chunk-twfreyxr.js} +5 -10
  81. package/dist/{chunk-dz7a4t3a.js.map → chunk-twfreyxr.js.map} +4 -4
  82. package/dist/{chunk-ks87m383.js → chunk-w1btn96n.js} +49 -24
  83. package/dist/{chunk-ks87m383.js.map → chunk-w1btn96n.js.map} +6 -6
  84. package/dist/{chunk-fg1db9xx.js → chunk-wkq3kvzd.js} +5 -5
  85. package/dist/chunk-wkq3kvzd.js.map +10 -0
  86. package/dist/{chunk-aqyjb86c.js → chunk-wrjx1fqz.js} +6 -6
  87. package/dist/{chunk-agn8d8ys.js → chunk-xtztwpkh.js} +1 -1
  88. package/dist/{chunk-0g5nyx0k.js → chunk-zeykm8my.js} +2 -2
  89. package/dist/connectors/connections/runs.d.ts +7 -0
  90. package/dist/connectors/connections/runs.d.ts.map +1 -1
  91. package/dist/execution/agent.js +29 -29
  92. package/dist/execution/object-reader-security.d.ts.map +1 -1
  93. package/dist/execution/primitive.js +29 -29
  94. package/dist/execution/request.js +30 -30
  95. package/dist/index.d.ts +2 -2
  96. package/dist/index.d.ts.map +1 -1
  97. package/dist/index.js +37 -37
  98. package/dist/materializer/index.js +15 -15
  99. package/dist/models/catalog.d.ts +16 -0
  100. package/dist/models/catalog.d.ts.map +1 -1
  101. package/dist/models/definitions.d.ts +1 -1
  102. package/dist/models/definitions.d.ts.map +1 -1
  103. package/dist/models/execution/index.js +17 -17
  104. package/dist/models/execution/model-call-recorder.d.ts +1 -1
  105. package/dist/models/execution/model-call-recorder.d.ts.map +1 -1
  106. package/dist/models/execution/web-search.d.ts +7 -0
  107. package/dist/models/execution/web-search.d.ts.map +1 -0
  108. package/dist/models/index.d.ts +3 -1
  109. package/dist/models/index.d.ts.map +1 -1
  110. package/dist/models/index.js +5 -3
  111. package/dist/models/index.js.map +1 -1
  112. package/dist/models/language-model.d.ts +12 -0
  113. package/dist/models/language-model.d.ts.map +1 -1
  114. package/dist/models/web-search-model.d.ts +66 -0
  115. package/dist/models/web-search-model.d.ts.map +1 -0
  116. package/dist/objects/index.js +29 -29
  117. package/dist/objects/query/executor.d.ts.map +1 -1
  118. package/dist/objects/query/index.d.ts +1 -0
  119. package/dist/objects/query/index.d.ts.map +1 -1
  120. package/dist/objects/query/index.js +18 -15
  121. package/dist/objects/query/index.js.map +1 -1
  122. package/dist/objects/query/sort-ties.d.ts +11 -0
  123. package/dist/objects/query/sort-ties.d.ts.map +1 -0
  124. package/dist/pipelines/index.js +15 -15
  125. package/dist/projections/internal.js +15 -15
  126. package/dist/runtime/create.d.ts +1 -1
  127. package/dist/runtime/create.d.ts.map +1 -1
  128. package/dist/runtime/internal.js +21 -21
  129. package/dist/runtime/resolve-definitions.d.ts.map +1 -1
  130. package/dist/security/index.d.ts +1 -0
  131. package/dist/security/index.d.ts.map +1 -1
  132. package/dist/security/registry.d.ts +2 -0
  133. package/dist/security/registry.d.ts.map +1 -1
  134. package/dist/security/view-conditions.d.ts.map +1 -1
  135. package/dist/security/visibility-keys.d.ts +19 -0
  136. package/dist/security/visibility-keys.d.ts.map +1 -0
  137. package/dist/shares/internal.js +15 -15
  138. package/dist/storage/agents/in-memory.d.ts +8 -2
  139. package/dist/storage/agents/in-memory.d.ts.map +1 -1
  140. package/dist/storage/agents/index.d.ts +1 -1
  141. package/dist/storage/agents/index.d.ts.map +1 -1
  142. package/dist/storage/agents/provider.d.ts +8 -2
  143. package/dist/storage/agents/provider.d.ts.map +1 -1
  144. package/dist/storage/agents/provider.js +12 -6
  145. package/dist/storage/agents/provider.js.map +1 -1
  146. package/dist/storage/agents/types.d.ts +42 -2
  147. package/dist/storage/agents/types.d.ts.map +1 -1
  148. package/dist/storage/ai-cost/provider.js +4 -4
  149. package/dist/storage/ai-limits/enforcement.js +3 -3
  150. package/dist/storage/ai-limits/provider.js +2 -2
  151. package/dist/storage/connector-connections/provider.js +3 -3
  152. package/dist/storage/connector-connections/provider.js.map +3 -3
  153. package/dist/storage/file-upload-sessions/provider.js +4 -4
  154. package/dist/storage/index.d.ts +2 -2
  155. package/dist/storage/index.d.ts.map +1 -1
  156. package/dist/storage/index.js +14 -14
  157. package/dist/storage/internal.js +2 -2
  158. package/dist/storage/migrations/types.d.ts +6 -0
  159. package/dist/storage/migrations/types.d.ts.map +1 -1
  160. package/dist/storage/objects/in-memory/query.d.ts.map +1 -1
  161. package/dist/storage/objects/index.d.ts +1 -1
  162. package/dist/storage/objects/index.d.ts.map +1 -1
  163. package/dist/storage/objects/query-preparation.d.ts +13 -0
  164. package/dist/storage/objects/query-preparation.d.ts.map +1 -1
  165. package/dist/storage/objects/read-scope.d.ts.map +1 -1
  166. package/dist/storage/objects/types.d.ts +52 -0
  167. package/dist/storage/objects/types.d.ts.map +1 -1
  168. package/dist/storage/share-grants/provider.js +2 -2
  169. package/dist/storage/workflow-runs/provider.js +4 -4
  170. package/dist/syncs/index.js +17 -17
  171. package/dist/testing/agent-storage-contract.d.ts.map +1 -1
  172. package/dist/testing/ai-limit-storage-contract.d.ts.map +1 -1
  173. package/dist/testing/ai-usage-storage-contract.d.ts.map +1 -1
  174. package/dist/testing/connector-connection-storage-contract.d.ts.map +1 -1
  175. package/dist/testing/index.js +399 -45
  176. package/dist/testing/index.js.map +8 -8
  177. package/dist/testing/object-conditional-read-scope-contract.d.ts.map +1 -1
  178. package/dist/testing/object-query-contract.d.ts.map +1 -1
  179. package/dist/webhooks/internal.js +15 -15
  180. package/dist/workflows/index.js +31 -31
  181. package/package.json +1 -1
  182. package/src/agents/README.md +2 -1
  183. package/src/agents/cancel.ts +7 -1
  184. package/src/agents/index.ts +9 -1
  185. package/src/agents/run-plan.ts +31 -0
  186. package/src/agents/run-session-http.ts +15 -12
  187. package/src/agents/run-session-serve.ts +8 -2
  188. package/src/agents/run-session.ts +31 -11
  189. package/src/agents/skills.ts +3 -0
  190. package/src/agents/step-limits.ts +6 -0
  191. package/src/agents/streams/protocol.ts +9 -4
  192. package/src/agents/tool-files.ts +11 -3
  193. package/src/agents/validation.ts +9 -0
  194. package/src/agents/web.ts +218 -0
  195. package/src/authorization/resolve.ts +9 -11
  196. package/src/authorization/types.ts +5 -5
  197. package/src/connectors/connections/runs.ts +42 -5
  198. package/src/execution/object-reader-security.ts +4 -9
  199. package/src/index.ts +2 -0
  200. package/src/models/catalog.ts +52 -3
  201. package/src/models/definitions.ts +2 -0
  202. package/src/models/execution/README.md +22 -2
  203. package/src/models/execution/model-call-recorder.ts +1 -1
  204. package/src/models/execution/web-search.ts +186 -0
  205. package/src/models/index.ts +12 -0
  206. package/src/models/language-model.ts +12 -0
  207. package/src/models/web-search-model.ts +152 -0
  208. package/src/objects/query/executor.ts +7 -3
  209. package/src/objects/query/index.ts +1 -0
  210. package/src/objects/query/sort-ties.ts +16 -0
  211. package/src/runtime/create.ts +3 -2
  212. package/src/runtime/resolve-definitions.ts +4 -0
  213. package/src/security/index.ts +1 -0
  214. package/src/security/registry.ts +2 -0
  215. package/src/security/view-conditions.ts +4 -3
  216. package/src/security/visibility-keys.ts +144 -0
  217. package/src/storage/agents/in-memory.ts +29 -2
  218. package/src/storage/agents/index.ts +2 -0
  219. package/src/storage/agents/provider.ts +57 -1
  220. package/src/storage/agents/types.ts +45 -2
  221. package/src/storage/connector-connections/in-memory.ts +2 -2
  222. package/src/storage/connector-connections/provider/connections.ts +2 -2
  223. package/src/storage/index.ts +4 -0
  224. package/src/storage/migrations/types.ts +6 -0
  225. package/src/storage/objects/in-memory/query.ts +5 -2
  226. package/src/storage/objects/index.ts +2 -0
  227. package/src/storage/objects/query-preparation.ts +59 -1
  228. package/src/storage/objects/read-scope.ts +108 -2
  229. package/src/storage/objects/types.ts +43 -0
  230. package/src/testing/agent-storage-contract.ts +70 -0
  231. package/src/testing/ai-limit-storage-contract.ts +11 -1
  232. package/src/testing/ai-usage-storage-contract.ts +15 -2
  233. package/src/testing/connector-connection-storage-contract.ts +23 -0
  234. package/src/testing/object-conditional-read-scope-contract.ts +267 -5
  235. package/src/testing/object-query-contract.ts +75 -0
  236. package/dist/chunk-edx8xcsm.js.map +0 -13
  237. package/dist/chunk-fg1db9xx.js.map +0 -10
  238. package/dist/chunk-jk97v21j.js.map +0 -10
  239. package/dist/chunk-tvbmh7tj.js.map +0 -18
  240. package/dist/chunk-tvefbgvw.js.map +0 -11
  241. /package/dist/{chunk-neftrg0n.js.map → chunk-0j3crh1w.js.map} +0 -0
  242. /package/dist/{chunk-23s66j86.js.map → chunk-31kcqmhf.js.map} +0 -0
  243. /package/dist/{chunk-nghc7eq0.js.map → chunk-3723kgba.js.map} +0 -0
  244. /package/dist/{chunk-rjeeyssy.js.map → chunk-3sqqhpr7.js.map} +0 -0
  245. /package/dist/{chunk-m3qe54bb.js.map → chunk-4bm0caep.js.map} +0 -0
  246. /package/dist/{chunk-h05rg3bx.js.map → chunk-4s753g3k.js.map} +0 -0
  247. /package/dist/{chunk-8wsjr52f.js.map → chunk-5wtnmpze.js.map} +0 -0
  248. /package/dist/{chunk-2pk5hjj9.js.map → chunk-80gym75n.js.map} +0 -0
  249. /package/dist/{chunk-qbrmpgvv.js.map → chunk-9whfmsfk.js.map} +0 -0
  250. /package/dist/{chunk-w53trr0c.js.map → chunk-a7aa0nzj.js.map} +0 -0
  251. /package/dist/{chunk-7hd2ez3q.js.map → chunk-c4nrycdy.js.map} +0 -0
  252. /package/dist/{chunk-epyfm23v.js.map → chunk-c706qvyc.js.map} +0 -0
  253. /package/dist/{chunk-t5daew4g.js.map → chunk-c7cfe31p.js.map} +0 -0
  254. /package/dist/{chunk-qsg8rw04.js.map → chunk-d04g36fw.js.map} +0 -0
  255. /package/dist/{chunk-ax10ft8d.js.map → chunk-f1h34y3r.js.map} +0 -0
  256. /package/dist/{chunk-9rh8ncs5.js.map → chunk-fwsvshr5.js.map} +0 -0
  257. /package/dist/{chunk-cgznz22f.js.map → chunk-gkv8r794.js.map} +0 -0
  258. /package/dist/{chunk-t9xyr7y9.js.map → chunk-j8thxj7w.js.map} +0 -0
  259. /package/dist/{chunk-nqnfz3jg.js.map → chunk-mbc5hvnj.js.map} +0 -0
  260. /package/dist/{chunk-y2x2935j.js.map → chunk-nh26e7c5.js.map} +0 -0
  261. /package/dist/{chunk-jhbk10wf.js.map → chunk-q9nkpr8k.js.map} +0 -0
  262. /package/dist/{chunk-aqyjb86c.js.map → chunk-wrjx1fqz.js.map} +0 -0
  263. /package/dist/{chunk-agn8d8ys.js.map → chunk-xtztwpkh.js.map} +0 -0
  264. /package/dist/{chunk-0g5nyx0k.js.map → chunk-zeykm8my.js.map} +0 -0
@@ -5,21 +5,23 @@ import"../chunk-6eqsgvxk.js";
5
5
  import"../chunk-165c9wm6.js";
6
6
  import {
7
7
  validateObjectQuery2,
8
+ bindCurrentUserPredicate,
9
+ viewConditionReadCondition,
8
10
  AuthStorageError2,
9
11
  toUserProfile,
10
12
  SYSTEM_PRINCIPAL2
11
- } from "../chunk-3x3bebz7.js";
13
+ } from "../chunk-s7j8ewqv.js";
12
14
  import"../chunk-d7v97qxq.js";
13
15
  import {
14
16
  agentServiceAccountId2,
15
17
  MAX_OBJECT_READ_FACETS2,
16
18
  defineProjection2
17
- } from "../chunk-dz7a4t3a.js";
19
+ } from "../chunk-twfreyxr.js";
18
20
  import"../chunk-jspskey0.js";
19
21
  import {
20
22
  compileSelectedObjectReadScope2,
21
23
  compileConditionalObjectReadScope2
22
- } from "../chunk-31khg3g0.js";
24
+ } from "../chunk-kkjfve0t.js";
23
25
  import {
24
26
  blobIdFromDigest2
25
27
  } from "../chunk-wkv3h3q7.js";
@@ -43,19 +45,19 @@ import {
43
45
  createEventId2
44
46
  } from "../chunk-zrvhsq7f.js";
45
47
  import"../chunk-5grk14e5.js";
46
- import"../chunk-tvefbgvw.js";
47
- import"../chunk-47e09r7z.js";
48
+ import"../chunk-az95tsh3.js";
49
+ import"../chunk-qttqe1ah.js";
48
50
  import {
49
51
  AgentStorageError2
50
- } from "../chunk-edx8xcsm.js";
51
- import"../chunk-0g5nyx0k.js";
52
+ } from "../chunk-7z5rkf0m.js";
53
+ import"../chunk-zeykm8my.js";
52
54
  import {
53
55
  aiLimitCalendarMonth2
54
- } from "../chunk-7hd2ez3q.js";
56
+ } from "../chunk-c4nrycdy.js";
55
57
  import {
56
58
  DEFAULT_FILE_UPLOAD_TERMINAL_SESSION_TTL_MS2
57
59
  } from "../chunk-h89wz928.js";
58
- import"../chunk-23s66j86.js";
60
+ import"../chunk-31kcqmhf.js";
59
61
  import {
60
62
  ArtifactStorageError
61
63
  } from "../chunk-e6xgz4h4.js";
@@ -82,7 +84,7 @@ import {
82
84
  WorkflowInterventionError2,
83
85
  InMemoryStorage2,
84
86
  migrateStorage2
85
- } from "../chunk-cb21tx14.js";
87
+ } from "../chunk-eqgr6nsa.js";
86
88
  import"../chunk-nz7815t3.js";
87
89
  import"../chunk-s7xqfxs9.js";
88
90
  import"../chunk-mmagke4x.js";
@@ -91,18 +93,18 @@ import"../chunk-scyq22td.js";
91
93
  import"../chunk-jmfet9r4.js";
92
94
  import"../chunk-qf954wje.js";
93
95
  import"../chunk-x0v3jd47.js";
94
- import"../chunk-neftrg0n.js";
96
+ import"../chunk-0j3crh1w.js";
95
97
  import {
96
98
  ProjectionRegistry2,
97
99
  createLinkScopeFingerprint2,
98
100
  createOntologyMaterializer2
99
- } from "../chunk-rjeeyssy.js";
101
+ } from "../chunk-3sqqhpr7.js";
100
102
  import {
101
103
  bindModelExecutionAttempt,
102
104
  isBoundSixb
103
- } from "../chunk-z3evap21.js";
105
+ } from "../chunk-a5v4gjdx.js";
104
106
  import"../chunk-w976a4me.js";
105
- import"../chunk-ax10ft8d.js";
107
+ import"../chunk-f1h34y3r.js";
106
108
  import {
107
109
  planObjectQuery2,
108
110
  executeObjectQuery2,
@@ -110,18 +112,18 @@ import {
110
112
  existsObjects2,
111
113
  facetObjects2,
112
114
  executeObjectQueryLinks2
113
- } from "../chunk-tvbmh7tj.js";
114
- import"../chunk-8yzhjawq.js";
115
- import"../chunk-fg1db9xx.js";
115
+ } from "../chunk-2ajw5rz0.js";
116
+ import"../chunk-m2vh8gh0.js";
117
+ import"../chunk-wkq3kvzd.js";
116
118
  import"../chunk-3fqxbn31.js";
117
119
  import"../chunk-waqk73p1.js";
118
120
  import"../chunk-kwfhd1g0.js";
119
- import"../chunk-t9xyr7y9.js";
120
- import"../chunk-qsg8rw04.js";
121
+ import"../chunk-j8thxj7w.js";
122
+ import"../chunk-d04g36fw.js";
121
123
  import"../chunk-sgx82nnt.js";
122
124
  import"../chunk-8ncg20rd.js";
123
125
  import"../chunk-5a4a52tq.js";
124
- import"../chunk-9rh8ncs5.js";
126
+ import"../chunk-fwsvshr5.js";
125
127
  import {
126
128
  col2,
127
129
  defineDataset2,
@@ -130,31 +132,31 @@ import {
130
132
  import {
131
133
  writeDataset2
132
134
  } from "../chunk-jbw70d6t.js";
133
- import"../chunk-b7a97n8b.js";
134
- import"../chunk-jhbk10wf.js";
135
+ import"../chunk-ga63a3dz.js";
136
+ import"../chunk-q9nkpr8k.js";
135
137
  import"../chunk-1vg43g9q.js";
136
138
  import"../chunk-m427qgq0.js";
137
139
  import {
138
140
  SixbHost2
139
- } from "../chunk-ks87m383.js";
141
+ } from "../chunk-w1btn96n.js";
140
142
  import"../chunk-w122ymx4.js";
141
143
  import"../chunk-t5608tkq.js";
142
144
  import"../chunk-s038wa5v.js";
143
- import"../chunk-aqyjb86c.js";
144
- import"../chunk-y2x2935j.js";
145
+ import"../chunk-wrjx1fqz.js";
146
+ import"../chunk-nh26e7c5.js";
145
147
  import"../chunk-fb3feg1e.js";
146
148
  import"../chunk-yw9pyg66.js";
147
149
  import"../chunk-ytzcxtpt.js";
148
150
  import {
149
151
  projectAgentThreadModelContext2
150
- } from "../chunk-ratj7t3t.js";
152
+ } from "../chunk-dsv783c3.js";
151
153
  import"../chunk-57g0215c.js";
152
154
  import"../chunk-de5sfbc3.js";
153
155
  import"../chunk-5taem5aw.js";
154
156
  import"../chunk-jftd33rc.js";
155
157
  import {
156
158
  workflowAgentStepActorId2
157
- } from "../chunk-t5daew4g.js";
159
+ } from "../chunk-c7cfe31p.js";
158
160
  import {
159
161
  BrokerError2,
160
162
  InMemoryBroker2
@@ -165,36 +167,36 @@ import {
165
167
  } from "../chunk-s3we74h8.js";
166
168
  import"../chunk-j1ny5fwh.js";
167
169
  import"../chunk-4zm1k3xj.js";
168
- import"../chunk-nqnfz3jg.js";
170
+ import"../chunk-mbc5hvnj.js";
169
171
  import"../chunk-jjmggm9a.js";
170
172
  import"../chunk-c69nj7se.js";
171
- import"../chunk-w53trr0c.js";
173
+ import"../chunk-a7aa0nzj.js";
172
174
  import {
173
175
  createTestingScope
174
- } from "../chunk-m3qe54bb.js";
175
- import"../chunk-8wsjr52f.js";
176
- import"../chunk-h05rg3bx.js";
176
+ } from "../chunk-4bm0caep.js";
177
+ import"../chunk-5wtnmpze.js";
178
+ import"../chunk-4s753g3k.js";
177
179
  import {
178
180
  SandboxNotRunningError2
179
181
  } from "../chunk-r1cxq7vv.js";
180
- import"../chunk-cgznz22f.js";
181
- import"../chunk-epyfm23v.js";
182
+ import"../chunk-gkv8r794.js";
183
+ import"../chunk-c706qvyc.js";
182
184
  import {
183
185
  restoreTrustedPrimitiveExecutionScope
184
- } from "../chunk-qbrmpgvv.js";
185
- import"../chunk-nghc7eq0.js";
186
+ } from "../chunk-9whfmsfk.js";
187
+ import"../chunk-3723kgba.js";
186
188
  import"../chunk-6b61s40c.js";
187
189
  import {
188
190
  LakeStorageError2
189
191
  } from "../chunk-65abf64x.js";
190
192
  import"../chunk-5kyvrtjh.js";
191
- import"../chunk-2pk5hjj9.js";
193
+ import"../chunk-80gym75n.js";
192
194
  import {
193
195
  ActionRunError2
194
196
  } from "../chunk-3gbefjg5.js";
195
197
  import {
196
198
  AiUsageStorageError2
197
- } from "../chunk-agn8d8ys.js";
199
+ } from "../chunk-xtztwpkh.js";
198
200
  import"../chunk-21q0j5f2.js";
199
201
  import {
200
202
  ObjectQueryPlanningError2
@@ -206,7 +208,7 @@ import {
206
208
  } from "../chunk-y7dbmaqh.js";
207
209
  import {
208
210
  AGENT_TOKEN_RATE_SAMPLES2
209
- } from "../chunk-jk97v21j.js";
211
+ } from "../chunk-n4zzaf6q.js";
210
212
  import"../chunk-a3faa34j.js";
211
213
 
212
214
  // src/testing/action-execution.ts
@@ -3142,6 +3144,56 @@ function runAgentStorageContractSuite(label, options) {
3142
3144
  await expectAgentError2(storage.computers.hold(session("s_5", { computer: { ...laptop, name: "a\x07b" } })), "invalid_input");
3143
3145
  });
3144
3146
  });
3147
+ test5("keeps what an open sixb reports of its background commands, and the stops asked", async () => {
3148
+ await withStorage(async (storage) => {
3149
+ const live = at2("2026-06-23T12:01:00.000Z");
3150
+ const session = (overrides = {}) => ({
3151
+ projectId: projectId5,
3152
+ id: "s_1",
3153
+ ownerPrincipal: owner,
3154
+ computer: laptop,
3155
+ expiresAt: live,
3156
+ ...overrides
3157
+ });
3158
+ const running = {
3159
+ threadId: "thr_1",
3160
+ id: "bg_1",
3161
+ command: "bun dev",
3162
+ status: "running",
3163
+ startedAt: "2026-06-23T11:59:00.000Z"
3164
+ };
3165
+ const ref = { threadId: "thr_1", id: "bg_1", startedAt: running.startedAt };
3166
+ const stop = (command = ref, ownerPrincipal = owner) => storage.computers.requestStop({ projectId: projectId5, id: "s_1", ownerPrincipal, command });
3167
+ await storage.computers.hold(session({ backgroundCommands: [running] }));
3168
+ await expect5(stop()).resolves.toEqual(session({ backgroundCommands: [running], stopRequests: [ref] }));
3169
+ await expect5(stop()).resolves.toEqual(session({ backgroundCommands: [running], stopRequests: [ref] }));
3170
+ await expect5(stop(ref, otherUser)).resolves.toBeNull();
3171
+ const stopped = {
3172
+ ...running,
3173
+ status: "stopped",
3174
+ exitCode: 143,
3175
+ endedAt: "2026-06-23T12:00:30.000Z"
3176
+ };
3177
+ await storage.computers.hold(session({ backgroundCommands: [stopped] }));
3178
+ await expect5(storage.computers.listLive({
3179
+ projectId: projectId5,
3180
+ ownerPrincipal: owner,
3181
+ now: at2(running.startedAt)
3182
+ })).resolves.toEqual([session({ backgroundCommands: [stopped], stopRequests: [ref] })]);
3183
+ for (let index = 2;index <= 65; index += 1)
3184
+ await stop({ ...ref, id: `bg_${index}` });
3185
+ const [kept] = await storage.computers.listLive({
3186
+ projectId: projectId5,
3187
+ ownerPrincipal: owner,
3188
+ now: at2(running.startedAt)
3189
+ });
3190
+ expect5(kept?.stopRequests?.length).toBe(64);
3191
+ expect5(kept?.stopRequests?.[0]?.id).toBe("bg_2");
3192
+ expect5(kept?.stopRequests?.at(-1)?.id).toBe("bg_65");
3193
+ await expectAgentError2(stop({ ...ref, id: "" }), "invalid_input");
3194
+ await expectAgentError2(storage.computers.hold(session({ backgroundCommands: [{ ...running, status: "lost" }] })), "invalid_input");
3195
+ });
3196
+ });
3145
3197
  test5("reads several threads at once, in the order asked", async () => {
3146
3198
  await withStorage(async (storage) => {
3147
3199
  const first = await storage.threads.create(threadInput());
@@ -5913,7 +5965,7 @@ function runAiLimitStorageContractSuite(label, options) {
5913
5965
  meter: "cost.catalogEstimated",
5914
5966
  amount: { currency: "USD", amountNanos: "100" }
5915
5967
  };
5916
- for (const modelKind of ["reranking", "image", "speech"]) {
5968
+ for (const modelKind of ["reranking", "web-search", "image", "speech"]) {
5917
5969
  await expect8(storage.aiLimits.reserveModelCall(reservation(modelKind, 0, { estimates: [cost], modelKind }))).resolves.toEqual({ status: "notRequired" });
5918
5970
  }
5919
5971
  await expect8(storage.aiLimits.reserveModelCall(reservation("language", 0, { estimates: [cost] }))).resolves.toMatchObject({ status: "unavailable", reasons: ["missingEstimate"] });
@@ -5927,6 +5979,16 @@ function runAiLimitStorageContractSuite(label, options) {
5927
5979
  projectId: projectId8,
5928
5980
  usageRecordId: "usage-reranking"
5929
5981
  });
5982
+ await recordUsageInput(storage.aiUsage, {
5983
+ id: "usage-web-search",
5984
+ callId: "web-search",
5985
+ modelKind: "web-search",
5986
+ usage: {}
5987
+ });
5988
+ await storage.aiLimits.recordModelCallActuals({
5989
+ projectId: projectId8,
5990
+ usageRecordId: "usage-web-search"
5991
+ });
5930
5992
  expect8(await status()).toMatchObject({
5931
5993
  accountingStatus: "complete",
5932
5994
  consumption: { actual: { amount: 4 } }
@@ -7180,7 +7242,7 @@ function runAiUsageStorageContractSuite(label, options) {
7180
7242
  }
7181
7243
  };
7182
7244
  describe10(label, () => {
7183
- test10("persists transcription and reranking usage kinds without invented token totals", async () => {
7245
+ test10("persists transcription, reranking and web search usage kinds without invented token totals", async () => {
7184
7246
  await withStorage(async (storage) => {
7185
7247
  const latest = () => storage.getLatestForExecution({ projectId: projectId10, executionId: agentExecutionId });
7186
7248
  const input = modelCallInput({
@@ -7204,6 +7266,15 @@ function runAiUsageStorageContractSuite(label, options) {
7204
7266
  occurredAt: at5("2026-06-23T10:01:00.000Z")
7205
7267
  }));
7206
7268
  expect10((await latest())?.modelKind).toBe("reranking");
7269
+ await storage.recordModelCall(modelCallInput({
7270
+ id: "usage_web_search",
7271
+ callId: "call_web_search",
7272
+ responseId: "response_web_search",
7273
+ modelKind: "web-search",
7274
+ usage: {},
7275
+ occurredAt: at5("2026-06-23T10:02:00.000Z")
7276
+ }));
7277
+ expect10((await latest())?.modelKind).toBe("web-search");
7207
7278
  });
7208
7279
  });
7209
7280
  test10("persists generated-media usage and the speech kind", async () => {
@@ -11387,6 +11458,26 @@ function runConnectorConnectionStorageContractSuite(label, options) {
11387
11458
  });
11388
11459
  });
11389
11460
  });
11461
+ test15("connects another account to a disconnected slot without replacement", async () => {
11462
+ await withStorage(async (storage) => {
11463
+ const first = await createAuthorization(storage, "authorization-a", "account-a");
11464
+ const connected = await connect(storage, first, "connection-a", "account-a");
11465
+ await storage.disconnectConnection({
11466
+ projectId: projectId13,
11467
+ connectorId,
11468
+ connectionId: connected.connection.id
11469
+ });
11470
+ const second = await createAuthorization(storage, "authorization-b", "account-b");
11471
+ const reconnected = await connect(storage, second, "ignored-new-id", "account-b");
11472
+ expect15(reconnected.connection).toMatchObject({
11473
+ id: connected.connection.id,
11474
+ authorizationId: second.id,
11475
+ account: { id: "account-b" },
11476
+ status: "connected"
11477
+ });
11478
+ expect15(reconnected.replaced).toBe(false);
11479
+ });
11480
+ });
11390
11481
  test15("keeps pending selection untouched when connection validation fails", async () => {
11391
11482
  await withStorage(async (storage) => {
11392
11483
  const active = await createAuthorization(storage, "authorization-a", "account-a");
@@ -17282,9 +17373,23 @@ var Customer = defineObjectType2({
17282
17373
  id: "ConditionCustomer",
17283
17374
  name: "Condition Customer",
17284
17375
  properties: [prop2("id", "string", { required: true, primary: true }), prop2("name", "string")],
17285
- links: [link2("invoices", Invoice)]
17376
+ links: [link2("invoices", Invoice), link2("primaryInvoice", Invoice, { cardinality: "one" })]
17377
+ });
17378
+ var Ticket = defineObjectType2({
17379
+ id: "ConditionTicket",
17380
+ name: "Condition Ticket",
17381
+ properties: [
17382
+ prop2("id", "string", {
17383
+ required: true,
17384
+ primary: true,
17385
+ query: { searchable: true, sortable: true }
17386
+ }),
17387
+ prop2("status", "string", { query: { searchable: true, filterable: true } }),
17388
+ prop2("owner", ref2.user(), { nullable: true, query: { searchable: true, filterable: true } }),
17389
+ prop2("watchers", { type: "array", items: ref2.user() }, { nullable: true, query: { searchable: true, filterable: true } })
17390
+ ]
17286
17391
  });
17287
- var ontology3 = new OntologyRegistry2({ sources: [Invoice, CreditNote, Customer] });
17392
+ var ontology3 = new OntologyRegistry2({ sources: [Invoice, CreditNote, Customer, Ticket] });
17288
17393
  function runConditionalObjectReadScopeContractSuite(label, options) {
17289
17394
  const withHarness = async (body) => {
17290
17395
  const harness = await options.createHarness();
@@ -17542,6 +17647,114 @@ function runConditionalObjectReadScopeContractSuite(label, options) {
17542
17647
  expect26(invoices.map((row) => row.primaryId).sort()).toEqual(["inv-1", "inv-3"]);
17543
17648
  });
17544
17649
  });
17650
+ test26("never expands through a hidden object", async () => {
17651
+ await withHarness(async ({ harness }) => {
17652
+ const unconditioned = createReader(harness.objectReadScopeFactory, []);
17653
+ const conditioned = createReader(harness.objectReadScopeFactory, [noDrafts(Invoice.id)]);
17654
+ const customers = async (reader) => {
17655
+ const [customer] = await queryRows(reader, {
17656
+ kind: "expand",
17657
+ input: {
17658
+ kind: "limit",
17659
+ limit: 10,
17660
+ input: { kind: "start", objectTypeId: Customer.id }
17661
+ },
17662
+ expansions: [
17663
+ { linkId: "primaryInvoice", direction: "outgoing" },
17664
+ {
17665
+ linkId: "invoices",
17666
+ direction: "outgoing",
17667
+ expand: [{ linkId: "related", direction: "outgoing" }]
17668
+ }
17669
+ ]
17670
+ });
17671
+ return {
17672
+ primaryInvoice: linkedIds(customer?.links?.primaryInvoice),
17673
+ invoices: Object.fromEntries(linkedRows(customer?.links?.invoices).map((row) => [
17674
+ row.primaryId,
17675
+ linkedIds(row.links?.related)
17676
+ ]))
17677
+ };
17678
+ };
17679
+ expect26(await customers(unconditioned)).toEqual({
17680
+ primaryInvoice: ["inv-2"],
17681
+ invoices: { "inv-1": ["inv-2", "inv-3"], "inv-2": ["inv-1"], "inv-3": [] }
17682
+ });
17683
+ expect26(await customers(conditioned)).toEqual({
17684
+ primaryInvoice: [],
17685
+ invoices: { "inv-1": ["inv-3"], "inv-3": [] }
17686
+ });
17687
+ const relatedFrom = async (reader) => {
17688
+ const invoices = await queryRows(reader, {
17689
+ kind: "expand",
17690
+ input: {
17691
+ kind: "limit",
17692
+ limit: 10,
17693
+ input: sorted({ kind: "start", objectTypeId: Invoice.id }, "amount")
17694
+ },
17695
+ expansions: [
17696
+ { linkId: "related", direction: "incoming", sourceObjectTypeId: Invoice.id }
17697
+ ]
17698
+ });
17699
+ return invoices.map((row) => linkedIds(row.links?.related));
17700
+ };
17701
+ expect26(await relatedFrom(unconditioned)).toEqual([["inv-2"], ["inv-1"], ["inv-1"]]);
17702
+ expect26(await relatedFrom(conditioned)).toEqual([[], ["inv-1"]]);
17703
+ });
17704
+ });
17705
+ test26("never traverses through a hidden object", async () => {
17706
+ await withHarness(async ({ harness }) => {
17707
+ const unconditioned = createReader(harness.objectReadScopeFactory, []);
17708
+ const conditioned = createReader(harness.objectReadScopeFactory, [noDrafts(Invoice.id)]);
17709
+ const reached = async (reader, query) => {
17710
+ const rows = await queryRows(reader, query);
17711
+ return rows.map((row) => row.primaryId).sort();
17712
+ };
17713
+ const relatedOf = (input) => ({
17714
+ kind: "traverse",
17715
+ direction: "outgoing",
17716
+ linkId: "related",
17717
+ input
17718
+ });
17719
+ const refs = (...primaryIds) => ({
17720
+ kind: "refs",
17721
+ refs: primaryIds.map((primaryId) => ({ objectTypeId: Invoice.id, primaryId }))
17722
+ });
17723
+ const twoHops = relatedOf({
17724
+ kind: "traverse",
17725
+ direction: "outgoing",
17726
+ linkId: "invoices",
17727
+ input: { kind: "start", objectTypeId: Customer.id }
17728
+ });
17729
+ expect26(await reached(unconditioned, twoHops)).toEqual(["inv-1", "inv-2", "inv-3"]);
17730
+ expect26(await reached(conditioned, twoHops)).toEqual(["inv-3"]);
17731
+ const fromRefs = relatedOf(refs("inv-1", "inv-2"));
17732
+ expect26(await reached(unconditioned, fromRefs)).toEqual(["inv-1", "inv-2", "inv-3"]);
17733
+ expect26(await reached(conditioned, fromRefs)).toEqual(["inv-3"]);
17734
+ const fromSet = relatedOf({
17735
+ kind: "set",
17736
+ op: "union",
17737
+ inputs: [refs("inv-2"), refs("inv-3")]
17738
+ });
17739
+ expect26(await reached(unconditioned, fromSet)).toEqual(["inv-1"]);
17740
+ expect26(await reached(conditioned, fromSet)).toEqual([]);
17741
+ const sourcesOf = {
17742
+ kind: "traverse",
17743
+ direction: "incoming",
17744
+ linkId: "related",
17745
+ sourceObjectTypeId: Invoice.id,
17746
+ input: refs("inv-1", "inv-3")
17747
+ };
17748
+ expect26(await reached(unconditioned, sourcesOf)).toEqual(["inv-1", "inv-2"]);
17749
+ expect26(await reached(conditioned, sourcesOf)).toEqual(["inv-1"]);
17750
+ expect26(await unconditioned.countObjects?.({ projectId: projectId18, query: sourcesOf })).toEqual({
17751
+ count: 2
17752
+ });
17753
+ expect26(await conditioned.countObjects?.({ projectId: projectId18, query: sourcesOf })).toEqual({
17754
+ count: 1
17755
+ });
17756
+ });
17757
+ });
17545
17758
  test26("applies a condition to its concrete type only", async () => {
17546
17759
  await withHarness(async ({ harness }) => {
17547
17760
  const invoicesOnly = createReader(harness.objectReadScopeFactory, [noDrafts(Invoice.id)]);
@@ -17584,6 +17797,75 @@ function runConditionalObjectReadScopeContractSuite(label, options) {
17584
17797
  })).toEqual([]);
17585
17798
  });
17586
17799
  });
17800
+ test26("shows a reader through its conditions' keys exactly what their predicate shows", async () => {
17801
+ await withHarness(async ({ harness, fixture }) => {
17802
+ const ids = ["usr_1", 'a"b', "a\\b", 'a", "b', "*", "u:usr_1"];
17803
+ const users = ids.map((id) => ({ type: "user", id }));
17804
+ const auth = harness.storage.auth;
17805
+ if (!auth)
17806
+ throw new Error("The conditional read contract requires auth storage.");
17807
+ for (const [index, id] of ids.entries()) {
17808
+ await auth.users.create({ projectId: projectId18, id, email: `reader-${index}@example.com` });
17809
+ }
17810
+ await fixture.seed({
17811
+ objects: users.flatMap((user, index) => [
17812
+ object(Ticket.id, `t-${index}-owned`, {
17813
+ id: `t-${index}-owned`,
17814
+ status: "open",
17815
+ owner: user
17816
+ }),
17817
+ object(Ticket.id, `t-${index}-watched`, {
17818
+ id: `t-${index}-watched`,
17819
+ status: index % 2 === 0 ? "open" : "closed",
17820
+ owner: users[(index + 1) % users.length],
17821
+ watchers: [user, users[(index + 2) % users.length]]
17822
+ })
17823
+ ]),
17824
+ links: []
17825
+ });
17826
+ const me = { type: "currentUser" };
17827
+ const conditions = [
17828
+ { op: "eq", propertyId: "owner", value: me },
17829
+ { op: "contains", propertyId: "watchers", value: me },
17830
+ {
17831
+ op: "or",
17832
+ items: [
17833
+ { op: "eq", propertyId: "status", value: "closed" },
17834
+ { op: "in", propertyId: "owner", values: [me, users[0]] }
17835
+ ]
17836
+ },
17837
+ {
17838
+ op: "and",
17839
+ items: [
17840
+ { op: "eq", propertyId: "status", value: "open" },
17841
+ { op: "contains", propertyId: "watchers", value: me }
17842
+ ]
17843
+ },
17844
+ { op: "neq", propertyId: "owner", value: me }
17845
+ ];
17846
+ const visible = async (condition) => {
17847
+ const reader = createReader(harness.objectReadScopeFactory, [condition]);
17848
+ const rows = await queryRows(reader, {
17849
+ kind: "limit",
17850
+ limit: 100,
17851
+ input: sorted({ kind: "start", objectTypeId: Ticket.id }, "id")
17852
+ });
17853
+ return rows.map((row) => row.primaryId);
17854
+ };
17855
+ for (const [index, condition] of conditions.entries()) {
17856
+ const predicates = [ticketCondition(condition), ticketCondition(conditions[0])];
17857
+ for (const user of [undefined, ...users]) {
17858
+ const keyed = viewConditionReadCondition(Ticket.id, predicates, user);
17859
+ const bound = bindCurrentUserPredicate({ op: "or", items: predicates }, user);
17860
+ expect26({ index, user, ids: await visible(keyed) }).toEqual({
17861
+ index,
17862
+ user,
17863
+ ids: await visible({ objectTypeId: Ticket.id, predicate: bound })
17864
+ });
17865
+ }
17866
+ }
17867
+ });
17868
+ });
17587
17869
  test26("never reads another project's objects or links", async () => {
17588
17870
  await withHarness(async ({ harness }) => {
17589
17871
  await migrateStorage2(harness.storage, { projectId: otherProjectId6, ontology: ontology3 });
@@ -17678,7 +17960,25 @@ function noDrafts(objectTypeId) {
17678
17960
  const { query } = validateObjectQuery2({ kind: "filter", input: { kind: "start", objectTypeId }, predicate }, { ontology: ontology3 });
17679
17961
  if (query.kind !== "filter")
17680
17962
  throw new Error("expected a validated filter");
17681
- return { objectTypeId, predicate: query.predicate };
17963
+ return viewConditionReadCondition(objectTypeId, [query.predicate], undefined);
17964
+ }
17965
+ function ticketCondition(predicate) {
17966
+ const { query } = validateObjectQuery2({ kind: "filter", input: { kind: "start", objectTypeId: Ticket.id }, predicate }, { ontology: ontology3 });
17967
+ if (query.kind !== "filter")
17968
+ throw new Error("expected a validated filter");
17969
+ return query.predicate;
17970
+ }
17971
+ async function queryRows(reader, query) {
17972
+ const result = await executeObjectQuery2({ projectId: projectId18, query }, { ontology: ontology3, storage: reader });
17973
+ return result.objects;
17974
+ }
17975
+ function linkedRows(value) {
17976
+ if (Array.isArray(value))
17977
+ return value;
17978
+ return value ? [value] : [];
17979
+ }
17980
+ function linkedIds(value) {
17981
+ return linkedRows(value).map((row) => row.primaryId).sort();
17682
17982
  }
17683
17983
  function sorted(input, propertyId, direction = "asc") {
17684
17984
  return { kind: "sort", fields: [{ kind: "property", propertyId, direction }], input };
@@ -17701,6 +18001,7 @@ async function seed2(fixture) {
17701
18001
  linkRow(Customer.id, "cust-1", "invoices", Invoice.id, "inv-1"),
17702
18002
  linkRow(Customer.id, "cust-1", "invoices", Invoice.id, "inv-2"),
17703
18003
  linkRow(Customer.id, "cust-1", "invoices", Invoice.id, "inv-3"),
18004
+ linkRow(Customer.id, "cust-1", "primaryInvoice", Invoice.id, "inv-2"),
17704
18005
  linkRow(Invoice.id, "inv-1", "related", Invoice.id, "inv-2"),
17705
18006
  linkRow(Invoice.id, "inv-2", "related", Invoice.id, "inv-1"),
17706
18007
  linkRow(Invoice.id, "inv-1", "related", Invoice.id, "inv-3")
@@ -18253,6 +18554,59 @@ function runObjectQueryProviderContractSuite(label, options) {
18253
18554
  expect27(codes(await where({ op: "gt", propertyId: "code", value: "\uFF21" }))).toEqual(["\uD83D\uDE00"]);
18254
18555
  });
18255
18556
  });
18557
+ test27("lists a descending sort as the ascending one backwards, ties included", async () => {
18558
+ await withStorage(async ({ objects: storage, fixture }) => {
18559
+ const labelCodes = ["b", null, "a", "b", "a", null, "b"];
18560
+ const deviceNames = ["dimmer", "sensor", "dimmer", "sensor"];
18561
+ await fixture.seed({
18562
+ objects: [
18563
+ ...labelCodes.map((code, index) => objectSeed(Label.id, `tie-${index}`, { id: `tie-${index}`, code })),
18564
+ objectSeed(Room.id, "room-ties", { id: "room-ties" }),
18565
+ ...deviceNames.map((name, index) => objectSeed(Device3.id, `device-tie-${index}`, { id: `device-tie-${index}`, name }))
18566
+ ],
18567
+ links: deviceNames.map((_, index) => linkSeed(Room.id, "room-ties", "hasDevice", Device3.id, `device-tie-${index}`))
18568
+ });
18569
+ const run = (query) => executeObjectQuery2({ projectId: projectId19, query }, { ontology: objectQueryContractOntology, storage });
18570
+ const byCode = (direction) => ({
18571
+ kind: "sort",
18572
+ fields: [{ kind: "property", propertyId: "code", direction }],
18573
+ input: { kind: "start", objectTypeId: Label.id }
18574
+ });
18575
+ const ascending = ids(await run(byCode("asc")));
18576
+ const descending = ids(await run(byCode("desc")));
18577
+ const valued = ascending.slice(0, 5);
18578
+ const nulls = ascending.slice(5);
18579
+ expect27(descending).toEqual([...valued.reverse(), ...nulls.reverse()]);
18580
+ const paged = [];
18581
+ let pageToken;
18582
+ do {
18583
+ const page = await run({ kind: "page", pageSize: 2, pageToken, input: byCode("desc") });
18584
+ paged.push(...ids(page));
18585
+ pageToken = page.nextPageToken;
18586
+ } while (pageToken);
18587
+ expect27(paged).toEqual(descending);
18588
+ const devices = async (direction) => {
18589
+ const result = await run({
18590
+ kind: "expand",
18591
+ expansions: [
18592
+ {
18593
+ linkId: "hasDevice",
18594
+ direction: "outgoing",
18595
+ limit: deviceNames.length,
18596
+ orderBy: [{ kind: "property", propertyId: "name", direction }]
18597
+ }
18598
+ ],
18599
+ input: { kind: "limit", limit: 10, input: { kind: "start", objectTypeId: Room.id } }
18600
+ });
18601
+ const room = result.objects.find((row) => row.primaryId === "room-ties");
18602
+ const linked = room?.links?.hasDevice;
18603
+ return Array.isArray(linked) ? linked.map((row) => row.primaryId) : [];
18604
+ };
18605
+ const ascendingDevices = await devices("asc");
18606
+ expect27(ascendingDevices).toHaveLength(deviceNames.length);
18607
+ expect27(await devices("desc")).toEqual([...ascendingDevices].reverse());
18608
+ });
18609
+ });
18256
18610
  test27("keeps page tokens stable when projection hides sorted cursor fields", async () => {
18257
18611
  await withStorage(async ({ objects: storage, fixture }) => {
18258
18612
  await seedObjectQueryContractData(fixture);
@@ -24409,4 +24763,4 @@ export {
24409
24763
  startTestWebhookRun
24410
24764
  };
24411
24765
 
24412
- //# debugId=41EE842525691F8864756E2164756E21
24766
+ //# debugId=652F34A1B34236CB64756E2164756E21