@coasys/ad4m 0.13.0-test-interpretation-1 → 0.13.0-test-model-layer

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 (279) hide show
  1. package/lib/index.cjs +2409 -625
  2. package/lib/index.js +2406 -626
  3. package/lib/src/Literal.js +8 -0
  4. package/lib/src/ai/AIClient.js +6 -3
  5. package/lib/src/apiClient.d.ts +40 -4
  6. package/lib/src/apiClient.js +149 -9
  7. package/lib/src/generated/api/RunInterpretationRequest.d.ts +16 -0
  8. package/lib/src/index.d.ts +3 -1
  9. package/lib/src/index.js +2 -0
  10. package/lib/src/model/Ad4mModel.d.ts +34 -16
  11. package/lib/src/model/Ad4mModel.js +302 -63
  12. package/lib/src/model/Ad4mModel.test.js +480 -735
  13. package/lib/src/model/ModelQueryBuilder.js +2 -2
  14. package/lib/src/model/decorators.d.ts +199 -12
  15. package/lib/src/model/decorators.js +88 -32
  16. package/lib/src/model/json-schema.js +7 -21
  17. package/lib/src/model/model-manifest.d.ts +41 -0
  18. package/lib/src/model/model-manifest.js +11 -0
  19. package/lib/src/model/query-common.d.ts +2 -2
  20. package/lib/src/model/query-sparql.d.ts +62 -0
  21. package/lib/src/model/query-sparql.js +78 -15
  22. package/lib/src/model/query-sparql.test.js +92 -10
  23. package/lib/src/model/query-utils.d.ts +7 -2
  24. package/lib/src/model/query-utils.js +21 -11
  25. package/lib/src/model/shacl-gen.js +77 -15
  26. package/lib/src/model/types.d.ts +32 -8
  27. package/lib/src/neighbourhood/NeighbourhoodProxy.test.js +33 -33
  28. package/lib/src/perspectives/AutoProcessor.d.ts +198 -2
  29. package/lib/src/perspectives/FlowInstance.d.ts +187 -0
  30. package/lib/src/perspectives/FlowInstance.js +336 -0
  31. package/lib/src/perspectives/FlowModels.d.ts +94 -0
  32. package/lib/src/perspectives/FlowModels.js +182 -0
  33. package/lib/src/perspectives/InterpretationModels.d.ts +41 -3
  34. package/lib/src/perspectives/InterpretationModels.js +60 -26
  35. package/lib/src/perspectives/PerspectiveClient.d.ts +88 -7
  36. package/lib/src/perspectives/PerspectiveClient.js +138 -11
  37. package/lib/src/perspectives/PerspectiveProxy.d.ts +150 -57
  38. package/lib/src/perspectives/PerspectiveProxy.js +411 -287
  39. package/lib/src/perspectives/SparqlBindings.d.ts +24 -3
  40. package/lib/src/perspectives/SparqlBindings.js +57 -6
  41. package/lib/src/shacl/SHACLFlow.d.ts +273 -47
  42. package/lib/src/shacl/SHACLFlow.js +397 -88
  43. package/lib/src/shacl/SHACLShape.d.ts +19 -3
  44. package/lib/src/shacl/SHACLShape.js +30 -1
  45. package/lib/src/shacl/SHACLShape.test.js +82 -0
  46. package/lib/src/shacl/index.d.ts +1 -1
  47. package/lib/src/shacl/index.js +1 -1
  48. package/package.json +3 -3
  49. package/src/Literal.ts +7 -0
  50. package/src/ai/AIClient.ts +6 -3
  51. package/src/apiClient.test.ts +227 -0
  52. package/src/apiClient.ts +185 -9
  53. package/src/generated/api/RunInterpretationRequest.ts +19 -3
  54. package/src/index.ts +3 -1
  55. package/src/model/Ad4mModel.test.ts +729 -22
  56. package/src/model/Ad4mModel.ts +305 -66
  57. package/src/model/ModelQueryBuilder.ts +2 -2
  58. package/src/model/decorators.ts +278 -44
  59. package/src/model/json-schema.ts +10 -25
  60. package/src/model/query-common.ts +2 -2
  61. package/src/model/query-sparql.test.ts +114 -13
  62. package/src/model/query-sparql.ts +83 -14
  63. package/src/model/query-utils.ts +22 -12
  64. package/src/model/relation-filtering.test.ts +70 -20
  65. package/src/model/shacl-gen.ts +78 -13
  66. package/src/model/shacl-roundtrip.test.ts +134 -2
  67. package/src/model/types.ts +30 -8
  68. package/src/perspectives/AutoProcessor.ts +204 -2
  69. package/src/perspectives/FlowInstance.ts +369 -0
  70. package/src/perspectives/FlowModels.ts +157 -0
  71. package/src/perspectives/InterpretationModels.ts +91 -21
  72. package/src/perspectives/PerspectiveClient.test.ts +67 -6
  73. package/src/perspectives/PerspectiveClient.ts +190 -14
  74. package/src/perspectives/PerspectiveProxy.test.ts +406 -0
  75. package/src/perspectives/PerspectiveProxy.ts +494 -308
  76. package/src/perspectives/SparqlBindings.test.ts +134 -0
  77. package/src/perspectives/SparqlBindings.ts +57 -6
  78. package/src/perspectives/shacl-rpc.test.ts +258 -0
  79. package/src/shacl/SHACLFlow.test.ts +762 -35
  80. package/src/shacl/SHACLFlow.ts +680 -112
  81. package/src/shacl/SHACLShape.test.ts +30 -4
  82. package/src/shacl/SHACLShape.ts +59 -6
  83. package/src/shacl/index.ts +1 -1
  84. package/lib/src/generated/rest/AIModelLoadingStatus.d.ts +0 -7
  85. package/lib/src/generated/rest/AIModelLoadingStatus.js +0 -2
  86. package/lib/src/generated/rest/AddAgentInfosRequest.d.ts +0 -3
  87. package/lib/src/generated/rest/AddAgentInfosRequest.js +0 -2
  88. package/lib/src/generated/rest/AddLinkExpressionRequest.d.ts +0 -6
  89. package/lib/src/generated/rest/AddLinkExpressionRequest.js +0 -1
  90. package/lib/src/generated/rest/AddLinkRequest.d.ts +0 -6
  91. package/lib/src/generated/rest/AddLinkRequest.js +0 -1
  92. package/lib/src/generated/rest/AddLinksBulkRequest.d.ts +0 -6
  93. package/lib/src/generated/rest/AddLinksBulkRequest.js +0 -1
  94. package/lib/src/generated/rest/AddSdnaRequest.d.ts +0 -6
  95. package/lib/src/generated/rest/AddSdnaRequest.js +0 -2
  96. package/lib/src/generated/rest/ApplyTemplateRequest.d.ts +0 -4
  97. package/lib/src/generated/rest/ApplyTemplateRequest.js +0 -2
  98. package/lib/src/generated/rest/AuthInfoInput.d.ts +0 -10
  99. package/lib/src/generated/rest/AuthInfoInput.js +0 -1
  100. package/lib/src/generated/rest/BroadcastRequest.d.ts +0 -6
  101. package/lib/src/generated/rest/BroadcastRequest.js +0 -1
  102. package/lib/src/generated/rest/CapabilityInput.d.ts +0 -5
  103. package/lib/src/generated/rest/CapabilityInput.js +0 -1
  104. package/lib/src/generated/rest/CommitBatchRequest.d.ts +0 -3
  105. package/lib/src/generated/rest/CommitBatchRequest.js +0 -2
  106. package/lib/src/generated/rest/ComputeLogEntry.d.ts +0 -9
  107. package/lib/src/generated/rest/ComputeLogEntry.js +0 -2
  108. package/lib/src/generated/rest/CreateExpressionRequest.d.ts +0 -4
  109. package/lib/src/generated/rest/CreateExpressionRequest.js +0 -2
  110. package/lib/src/generated/rest/CreatePerspectiveRequest.d.ts +0 -3
  111. package/lib/src/generated/rest/CreatePerspectiveRequest.js +0 -2
  112. package/lib/src/generated/rest/CreateSubjectRequest.d.ts +0 -6
  113. package/lib/src/generated/rest/CreateSubjectRequest.js +0 -2
  114. package/lib/src/generated/rest/CreateUserRequest.d.ts +0 -4
  115. package/lib/src/generated/rest/CreateUserRequest.js +0 -2
  116. package/lib/src/generated/rest/CreateUserResponse.d.ts +0 -5
  117. package/lib/src/generated/rest/CreateUserResponse.js +0 -2
  118. package/lib/src/generated/rest/DecoratedExpressionProof.d.ts +0 -6
  119. package/lib/src/generated/rest/DecoratedExpressionProof.js +0 -2
  120. package/lib/src/generated/rest/DecoratedLinkExpression.d.ts +0 -10
  121. package/lib/src/generated/rest/DecoratedLinkExpression.js +0 -1
  122. package/lib/src/generated/rest/DisposeQueryRequest.d.ts +0 -3
  123. package/lib/src/generated/rest/DisposeQueryRequest.js +0 -2
  124. package/lib/src/generated/rest/EmailTestRequest.d.ts +0 -6
  125. package/lib/src/generated/rest/EmailTestRequest.js +0 -2
  126. package/lib/src/generated/rest/EmbedRequest.d.ts +0 -4
  127. package/lib/src/generated/rest/EmbedRequest.js +0 -2
  128. package/lib/src/generated/rest/EntanglementProofInput.d.ts +0 -6
  129. package/lib/src/generated/rest/EntanglementProofInput.js +0 -2
  130. package/lib/src/generated/rest/EntanglementProofPreflightRequest.d.ts +0 -4
  131. package/lib/src/generated/rest/EntanglementProofPreflightRequest.js +0 -2
  132. package/lib/src/generated/rest/ExecuteCommandsRequest.d.ts +0 -4
  133. package/lib/src/generated/rest/ExecuteCommandsRequest.js +0 -2
  134. package/lib/src/generated/rest/ExportRequest.d.ts +0 -5
  135. package/lib/src/generated/rest/ExportRequest.js +0 -2
  136. package/lib/src/generated/rest/ExpressionManyRequest.d.ts +0 -3
  137. package/lib/src/generated/rest/ExpressionManyRequest.js +0 -2
  138. package/lib/src/generated/rest/ExpressionProof.d.ts +0 -4
  139. package/lib/src/generated/rest/ExpressionProof.js +0 -2
  140. package/lib/src/generated/rest/ExpressionProofInput.d.ts +0 -6
  141. package/lib/src/generated/rest/ExpressionProofInput.js +0 -2
  142. package/lib/src/generated/rest/FriendSendMessageRequest.d.ts +0 -3
  143. package/lib/src/generated/rest/FriendSendMessageRequest.js +0 -2
  144. package/lib/src/generated/rest/FriendsListRequest.d.ts +0 -3
  145. package/lib/src/generated/rest/FriendsListRequest.js +0 -2
  146. package/lib/src/generated/rest/GenerateAgentRequest.d.ts +0 -3
  147. package/lib/src/generated/rest/GenerateAgentRequest.js +0 -2
  148. package/lib/src/generated/rest/GenerateJwtRequest.d.ts +0 -4
  149. package/lib/src/generated/rest/GenerateJwtRequest.js +0 -2
  150. package/lib/src/generated/rest/GetSubjectDataRequest.d.ts +0 -4
  151. package/lib/src/generated/rest/GetSubjectDataRequest.js +0 -2
  152. package/lib/src/generated/rest/HostingInfoResponse.d.ts +0 -5
  153. package/lib/src/generated/rest/HostingInfoResponse.js +0 -2
  154. package/lib/src/generated/rest/HostingWalletResponse.d.ts +0 -4
  155. package/lib/src/generated/rest/HostingWalletResponse.js +0 -2
  156. package/lib/src/generated/rest/ImportAgentRequest.d.ts +0 -6
  157. package/lib/src/generated/rest/ImportAgentRequest.js +0 -2
  158. package/lib/src/generated/rest/ImportRequest.d.ts +0 -4
  159. package/lib/src/generated/rest/ImportRequest.js +0 -2
  160. package/lib/src/generated/rest/JoinNeighbourhoodRequest.d.ts +0 -3
  161. package/lib/src/generated/rest/JoinNeighbourhoodRequest.js +0 -2
  162. package/lib/src/generated/rest/KeepAliveQueryRequest.d.ts +0 -3
  163. package/lib/src/generated/rest/KeepAliveQueryRequest.js +0 -2
  164. package/lib/src/generated/rest/LanguageMetaInput.d.ts +0 -6
  165. package/lib/src/generated/rest/LanguageMetaInput.js +0 -2
  166. package/lib/src/generated/rest/Link.d.ts +0 -5
  167. package/lib/src/generated/rest/Link.js +0 -2
  168. package/lib/src/generated/rest/LinkExpression.d.ts +0 -10
  169. package/lib/src/generated/rest/LinkExpression.js +0 -1
  170. package/lib/src/generated/rest/LinkExpressionInput.d.ts +0 -10
  171. package/lib/src/generated/rest/LinkExpressionInput.js +0 -1
  172. package/lib/src/generated/rest/LinkInput.d.ts +0 -5
  173. package/lib/src/generated/rest/LinkInput.js +0 -2
  174. package/lib/src/generated/rest/LinkLanguageTemplatesRequest.d.ts +0 -3
  175. package/lib/src/generated/rest/LinkLanguageTemplatesRequest.js +0 -2
  176. package/lib/src/generated/rest/LinkMutationRequest.d.ts +0 -12
  177. package/lib/src/generated/rest/LinkMutationRequest.js +0 -1
  178. package/lib/src/generated/rest/LinkMutationResponse.d.ts +0 -9
  179. package/lib/src/generated/rest/LinkMutationResponse.js +0 -1
  180. package/lib/src/generated/rest/LinkMutations.d.ts +0 -6
  181. package/lib/src/generated/rest/LinkMutations.js +0 -1
  182. package/lib/src/generated/rest/LinkMutationsRequest.d.ts +0 -5
  183. package/lib/src/generated/rest/LinkMutationsRequest.js +0 -1
  184. package/lib/src/generated/rest/LinkStatus.d.ts +0 -1
  185. package/lib/src/generated/rest/LinkStatus.js +0 -2
  186. package/lib/src/generated/rest/LinkUpdateInput.d.ts +0 -5
  187. package/lib/src/generated/rest/LinkUpdateInput.js +0 -1
  188. package/lib/src/generated/rest/LockAgentRequest.d.ts +0 -3
  189. package/lib/src/generated/rest/LockAgentRequest.js +0 -2
  190. package/lib/src/generated/rest/LoginUserRequest.d.ts +0 -5
  191. package/lib/src/generated/rest/LoginUserRequest.js +0 -2
  192. package/lib/src/generated/rest/ModelType.d.ts +0 -1
  193. package/lib/src/generated/rest/ModelType.js +0 -2
  194. package/lib/src/generated/rest/NotificationGrantRequest.d.ts +0 -3
  195. package/lib/src/generated/rest/NotificationGrantRequest.js +0 -2
  196. package/lib/src/generated/rest/NotificationInput.d.ts +0 -10
  197. package/lib/src/generated/rest/NotificationInput.js +0 -2
  198. package/lib/src/generated/rest/OpenLinkRequest.d.ts +0 -3
  199. package/lib/src/generated/rest/OpenLinkRequest.js +0 -2
  200. package/lib/src/generated/rest/PermitCapabilityRequest.d.ts +0 -3
  201. package/lib/src/generated/rest/PermitCapabilityRequest.js +0 -2
  202. package/lib/src/generated/rest/PerspectiveInput.d.ts +0 -4
  203. package/lib/src/generated/rest/PerspectiveInput.js +0 -1
  204. package/lib/src/generated/rest/PromptRequest.d.ts +0 -4
  205. package/lib/src/generated/rest/PromptRequest.js +0 -2
  206. package/lib/src/generated/rest/PublicPerspectiveInput.d.ts +0 -4
  207. package/lib/src/generated/rest/PublicPerspectiveInput.js +0 -1
  208. package/lib/src/generated/rest/PublishLanguageRequest.d.ts +0 -5
  209. package/lib/src/generated/rest/PublishLanguageRequest.js +0 -1
  210. package/lib/src/generated/rest/PublishNeighbourhoodRequest.d.ts +0 -6
  211. package/lib/src/generated/rest/PublishNeighbourhoodRequest.js +0 -1
  212. package/lib/src/generated/rest/QueryRequest.d.ts +0 -7
  213. package/lib/src/generated/rest/QueryRequest.js +0 -2
  214. package/lib/src/generated/rest/RemoveLinkRequest.d.ts +0 -5
  215. package/lib/src/generated/rest/RemoveLinkRequest.js +0 -1
  216. package/lib/src/generated/rest/RemoveLinksBulkRequest.d.ts +0 -5
  217. package/lib/src/generated/rest/RemoveLinksBulkRequest.js +0 -1
  218. package/lib/src/generated/rest/RequestCapabilityRequest.d.ts +0 -4
  219. package/lib/src/generated/rest/RequestCapabilityRequest.js +0 -1
  220. package/lib/src/generated/rest/RequestPaymentRequest.d.ts +0 -3
  221. package/lib/src/generated/rest/RequestPaymentRequest.js +0 -2
  222. package/lib/src/generated/rest/RequestVerificationRequest.d.ts +0 -4
  223. package/lib/src/generated/rest/RequestVerificationRequest.js +0 -2
  224. package/lib/src/generated/rest/ResourceInput.d.ts +0 -4
  225. package/lib/src/generated/rest/ResourceInput.js +0 -2
  226. package/lib/src/generated/rest/SetDefaultModelRequest.d.ts +0 -4
  227. package/lib/src/generated/rest/SetDefaultModelRequest.js +0 -1
  228. package/lib/src/generated/rest/SetFreeHostingEnabledRequest.d.ts +0 -3
  229. package/lib/src/generated/rest/SetFreeHostingEnabledRequest.js +0 -2
  230. package/lib/src/generated/rest/SetHotWalletAddressRequest.d.ts +0 -3
  231. package/lib/src/generated/rest/SetHotWalletAddressRequest.js +0 -2
  232. package/lib/src/generated/rest/SetMultiUserRequest.d.ts +0 -3
  233. package/lib/src/generated/rest/SetMultiUserRequest.js +0 -2
  234. package/lib/src/generated/rest/SetOnlineStatusRequest.d.ts +0 -5
  235. package/lib/src/generated/rest/SetOnlineStatusRequest.js +0 -1
  236. package/lib/src/generated/rest/SetStatusRequest.d.ts +0 -3
  237. package/lib/src/generated/rest/SetStatusRequest.js +0 -2
  238. package/lib/src/generated/rest/SetUserFreeAccessRequest.d.ts +0 -4
  239. package/lib/src/generated/rest/SetUserFreeAccessRequest.js +0 -2
  240. package/lib/src/generated/rest/SignMessageRequest.d.ts +0 -3
  241. package/lib/src/generated/rest/SignMessageRequest.js +0 -2
  242. package/lib/src/generated/rest/SignalRequest.d.ts +0 -6
  243. package/lib/src/generated/rest/SignalRequest.js +0 -1
  244. package/lib/src/generated/rest/SubscribeQueryRequest.d.ts +0 -3
  245. package/lib/src/generated/rest/SubscribeQueryRequest.js +0 -2
  246. package/lib/src/generated/rest/SubscribeQueryResponse.d.ts +0 -4
  247. package/lib/src/generated/rest/SubscribeQueryResponse.js +0 -2
  248. package/lib/src/generated/rest/TrustedAgentsRequest.d.ts +0 -3
  249. package/lib/src/generated/rest/TrustedAgentsRequest.js +0 -2
  250. package/lib/src/generated/rest/UnlockAgentRequest.d.ts +0 -4
  251. package/lib/src/generated/rest/UnlockAgentRequest.js +0 -2
  252. package/lib/src/generated/rest/UpdateLinkRequest.d.ts +0 -7
  253. package/lib/src/generated/rest/UpdateLinkRequest.js +0 -1
  254. package/lib/src/generated/rest/UpdatePerspectiveRequest.d.ts +0 -3
  255. package/lib/src/generated/rest/UpdatePerspectiveRequest.js +0 -2
  256. package/lib/src/generated/rest/UpdateProfileRequest.d.ts +0 -5
  257. package/lib/src/generated/rest/UpdateProfileRequest.js +0 -1
  258. package/lib/src/generated/rest/UserStatistics.d.ts +0 -9
  259. package/lib/src/generated/rest/UserStatistics.js +0 -2
  260. package/lib/src/generated/rest/VerificationRequestResult.d.ts +0 -6
  261. package/lib/src/generated/rest/VerificationRequestResult.js +0 -2
  262. package/lib/src/generated/rest/VerifyEmailRequest.d.ts +0 -6
  263. package/lib/src/generated/rest/VerifyEmailRequest.js +0 -2
  264. package/lib/src/generated/rest/VerifySignatureRequest.d.ts +0 -5
  265. package/lib/src/generated/rest/VerifySignatureRequest.js +0 -2
  266. package/lib/src/generated/rest/WriteSettingsRequest.d.ts +0 -3
  267. package/lib/src/generated/rest/WriteSettingsRequest.js +0 -2
  268. package/lib/src/generated/rest/index.d.ts +0 -73
  269. package/lib/src/generated/rest/index.js +0 -8
  270. package/lib/src/generated/rest/routes.d.ts +0 -587
  271. package/lib/src/generated/rest/routes.js +0 -3
  272. package/lib/src/model/query-surreal.d.ts +0 -44
  273. package/lib/src/model/query-surreal.js +0 -249
  274. package/lib/src/model/surreal-utils.d.ts +0 -42
  275. package/lib/src/model/surreal-utils.js +0 -128
  276. package/lib/src/perspectives/PerspectiveProxy.test.d.ts +0 -1
  277. package/lib/src/perspectives/PerspectiveProxy.test.js +0 -34
  278. package/lib/src/restClient.d.ts +0 -52
  279. package/lib/src/restClient.js +0 -227
@@ -16,7 +16,6 @@
16
16
  */
17
17
  import { Ad4mModel } from "../model/Ad4mModel";
18
18
  export declare class AutoProcessorConfig extends Ad4mModel {
19
- type: string;
20
19
  /** Unique processor id — the dedup key for auto-processor instances. */
21
20
  processorId: string;
22
21
  /** SPARQL SELECT that gathers source items each pass. */
@@ -39,9 +38,41 @@ export declare class AutoProcessorConfig extends Ad4mModel {
39
38
  sourceWindowMs?: string;
40
39
  /** Serialised `DedupStrategy` JSON (absent = NormalizedString). */
41
40
  dedupStrategy?: string;
41
+ /**
42
+ * Serialised `Scope` JSON (absent = whole-perspective dedup set).
43
+ * Constrains the existing-instance lookup to the subtree rooted at
44
+ * `Scope.id` linked via `Scope.predicate` — the SoA-tree "existing items
45
+ * live under THIS project node" pattern. Stored as an opaque JSON blob
46
+ * because SHACL properties carry no rich-object type-check; the Rust
47
+ * watcher parses it back into `Scope`.
48
+ */
49
+ existingScope?: string;
50
+ /**
51
+ * Serialised `Scope` JSON (absent = mint sites are unlinked). When set,
52
+ * every freshly created base URI gets an additional `Scope.id
53
+ * --Scope.predicate--> new-uri` link written into the perspective, so
54
+ * mints become first-class children of the target scope. Must be the
55
+ * `Raw` form of `Scope`; `Model` scopes carry no linking predicate.
56
+ */
57
+ mintScope?: string;
58
+ /**
59
+ * Tool-call budget for the interpretation-pass harness. Absent (or `"0"`)
60
+ * = the original single-shot LLM path — one prompt, one parse, no tools.
61
+ * `"N"` (positive integer) = engage the tool-calling harness and let the
62
+ * LLM issue up to N tool calls per pass (query/list/get/propose_create/
63
+ * propose_link_child) before being forced to answer. Stored as a decimal
64
+ * string because SHACL properties carry no numeric type; the Rust
65
+ * watcher parses it back to `u32`.
66
+ */
67
+ maxToolCalls?: string;
68
+ /**
69
+ * Enable full debug observability: persists the raw LLM prompt + response
70
+ * on the pass's `InterpretationRun` AND emits `LlmRequestSent` /
71
+ * `LlmResponseReceived` mid-pass events. `"true"` / `"false"` string.
72
+ */
73
+ emitDebugEvents?: string;
42
74
  }
43
75
  export declare class InterpretationRun extends Ad4mModel {
44
- type: string;
45
76
  /** UUID for this run — the dedup key across run nodes. */
46
77
  runId: string;
47
78
  /** LLM model id used for this run. */
@@ -55,9 +86,16 @@ export declare class InterpretationRun extends Ad4mModel {
55
86
  /**
56
87
  * Source item IDs consumed by this pass.
57
88
  * Stored as multiple links with the same predicate; the processed-turn
58
- * cursor uses these to avoid re-interpreting a turn.
89
+ * cursor uses these to avoid re-interpreting a turn. Values are plain
90
+ * strings (turn hex), so the property opts into `sh:datatype`-gated
91
+ * literal decoding on hydration.
59
92
  */
60
93
  sources: string[];
94
+ /** Raw LLM prompt this pass fed the model. Present only when the pass's
95
+ * AutoProcessor had `emitDebugEvents: true`. Absent by default. */
96
+ debugPrompt?: string;
97
+ /** Raw LLM response this pass received. Same rules as `debugPrompt`. */
98
+ debugResponse?: string;
61
99
  }
62
100
  export declare class InterpretationOverlay extends Ad4mModel {
63
101
  /**
@@ -24,17 +24,26 @@ var __metadata = (this && this.__metadata) || function (k, v) {
24
24
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
25
  };
26
26
  import { Ad4mModel } from "../model/Ad4mModel";
27
- import { Flag, HasMany, Optional, Property } from "../model/decorators";
27
+ import { HasMany, Optional, Property } from "../model/decorators";
28
28
  import { Model } from "../model/decorators";
29
29
  // ── AutoProcessorConfig ─────────────────────────────────────────────────────
30
30
  // Mirrors the Rust `auto_processor::config::AutoProcessorConfig` SDNA.
31
31
  // One node per registered processor; the node URI is
32
32
  // `ad4m://autoprocessor/<processorId>`.
33
+ // Model name = "AutoProcessor" (NOT "AutoProcessorConfig") to match the Rust
34
+ // hardwired subject class in `perspectives/auto_processor/config.rs` — that
35
+ // alignment is what the SDNA parity test in
36
+ // `tests/js/tests/model/interpretation-models.test.ts` guards. The TS class
37
+ // symbol keeps the `Config` suffix for readability (`AutoProcessorConfig` reads
38
+ // better than a bare `AutoProcessor` for an "instances of the config record"
39
+ // query), but the on-graph subject class it registers is `AutoProcessor`.
33
40
  let AutoProcessorConfig = class AutoProcessorConfig extends Ad4mModel {
34
41
  constructor() {
35
42
  super(...arguments);
36
- this.type = "ad4m://AutoProcessor";
37
43
  /** Unique processor id — the dedup key for auto-processor instances. */
44
+ // First-declared property: `buildSHACL` derives the shape namespace from
45
+ // its `through` prefix, so `ad4m://processor_id` → `ad4m://` → target_class
46
+ // `ad4m://AutoProcessor` (matches Rust `AUTO_PROCESSOR_TARGET_CLASS`).
38
47
  this.processorId = "";
39
48
  /** SPARQL SELECT that gathers source items each pass. */
40
49
  this.sourceScopeQuery = "";
@@ -46,12 +55,13 @@ let AutoProcessorConfig = class AutoProcessorConfig extends Ad4mModel {
46
55
  this.batchMax = "32";
47
56
  /** How long a won claim is authoritative before peers may re-claim (ms). */
48
57
  this.claimTtlMs = "60000";
58
+ // No `@Flag` type discriminator (Nico 2026-08-19: "type flags are an
59
+ // anti-pattern for subject classes; match over all the properties
60
+ // instead"). Conformance is by the presence of `processorId` +
61
+ // `sourceScopeQuery` + `interpretationClasses` + `debounceMs` +
62
+ // `batchMax` + `claimTtlMs` — the Rust SDNA takes the same shape.
49
63
  }
50
64
  };
51
- __decorate([
52
- Flag({ through: "rdf://type", value: "ad4m://AutoProcessor" }),
53
- __metadata("design:type", String)
54
- ], AutoProcessorConfig.prototype, "type", void 0);
55
65
  __decorate([
56
66
  Property({ through: "ad4m://processor_id", required: true, identity: true }),
57
67
  __metadata("design:type", String)
@@ -61,11 +71,11 @@ __decorate([
61
71
  __metadata("design:type", String)
62
72
  ], AutoProcessorConfig.prototype, "sourceScopeQuery", void 0);
63
73
  __decorate([
64
- Optional({ through: "ad4m://base_prefix", resolveLanguage: "literal" }),
74
+ Optional({ through: "ad4m://base_prefix" }),
65
75
  __metadata("design:type", String)
66
76
  ], AutoProcessorConfig.prototype, "basePrefix", void 0);
67
77
  __decorate([
68
- HasMany({ through: "ad4m://interpretation_class" }),
78
+ HasMany({ through: "ad4m://interpretation_class", datatype: "xsd:string" }),
69
79
  __metadata("design:type", Array)
70
80
  ], AutoProcessorConfig.prototype, "interpretationClasses", void 0);
71
81
  __decorate([
@@ -73,7 +83,7 @@ __decorate([
73
83
  __metadata("design:type", String)
74
84
  ], AutoProcessorConfig.prototype, "debounceMs", void 0);
75
85
  __decorate([
76
- Optional({ through: "ad4m://batch_min", resolveLanguage: "literal" }),
86
+ Optional({ through: "ad4m://batch_min" }),
77
87
  __metadata("design:type", String)
78
88
  ], AutoProcessorConfig.prototype, "batchMin", void 0);
79
89
  __decorate([
@@ -81,7 +91,7 @@ __decorate([
81
91
  __metadata("design:type", String)
82
92
  ], AutoProcessorConfig.prototype, "batchMax", void 0);
83
93
  __decorate([
84
- Optional({ through: "ad4m://max_wait_ms", resolveLanguage: "literal" }),
94
+ Optional({ through: "ad4m://max_wait_ms" }),
85
95
  __metadata("design:type", String)
86
96
  ], AutoProcessorConfig.prototype, "maxWaitMs", void 0);
87
97
  __decorate([
@@ -89,15 +99,31 @@ __decorate([
89
99
  __metadata("design:type", String)
90
100
  ], AutoProcessorConfig.prototype, "claimTtlMs", void 0);
91
101
  __decorate([
92
- Optional({ through: "ad4m://source_window_ms", resolveLanguage: "literal" }),
102
+ Optional({ through: "ad4m://source_window_ms" }),
93
103
  __metadata("design:type", String)
94
104
  ], AutoProcessorConfig.prototype, "sourceWindowMs", void 0);
95
105
  __decorate([
96
- Optional({ through: "ad4m://dedup_strategy", resolveLanguage: "literal" }),
106
+ Optional({ through: "ad4m://dedup_strategy" }),
97
107
  __metadata("design:type", String)
98
108
  ], AutoProcessorConfig.prototype, "dedupStrategy", void 0);
109
+ __decorate([
110
+ Optional({ through: "ad4m://existing_scope" }),
111
+ __metadata("design:type", String)
112
+ ], AutoProcessorConfig.prototype, "existingScope", void 0);
113
+ __decorate([
114
+ Optional({ through: "ad4m://mint_scope" }),
115
+ __metadata("design:type", String)
116
+ ], AutoProcessorConfig.prototype, "mintScope", void 0);
117
+ __decorate([
118
+ Optional({ through: "ad4m://max_tool_calls" }),
119
+ __metadata("design:type", String)
120
+ ], AutoProcessorConfig.prototype, "maxToolCalls", void 0);
121
+ __decorate([
122
+ Optional({ through: "ad4m://emit_debug_events", resolveLanguage: "literal" }),
123
+ __metadata("design:type", String)
124
+ ], AutoProcessorConfig.prototype, "emitDebugEvents", void 0);
99
125
  AutoProcessorConfig = __decorate([
100
- Model({ name: "AutoProcessorConfig" })
126
+ Model({ name: "AutoProcessor" })
101
127
  ], AutoProcessorConfig);
102
128
  export { AutoProcessorConfig };
103
129
  // ── InterpretationRun ───────────────────────────────────────────────────────
@@ -105,46 +131,54 @@ export { AutoProcessorConfig };
105
131
  // One node per completed pass; the node URI is `ad4m://interp/run/<runId>`.
106
132
  let InterpretationRun = class InterpretationRun extends Ad4mModel {
107
133
  constructor() {
134
+ // No `@Flag` type discriminator — Rust SDNA drops `ad4m://type` too.
135
+ // Conformance is by `runId` (identity) — same pattern
136
+ // `InterpretationOverlay` already uses (`kind` is its discriminator).
108
137
  super(...arguments);
109
- this.type = "ad4m://interpretation-run";
110
138
  /** UUID for this run — the dedup key across run nodes. */
111
139
  this.runId = "";
112
140
  /**
113
141
  * Source item IDs consumed by this pass.
114
142
  * Stored as multiple links with the same predicate; the processed-turn
115
- * cursor uses these to avoid re-interpreting a turn.
143
+ * cursor uses these to avoid re-interpreting a turn. Values are plain
144
+ * strings (turn hex), so the property opts into `sh:datatype`-gated
145
+ * literal decoding on hydration.
116
146
  */
117
147
  this.sources = [];
118
148
  }
119
149
  };
120
- __decorate([
121
- Flag({ through: "ad4m://type", value: "ad4m://interpretation-run" }),
122
- __metadata("design:type", String)
123
- ], InterpretationRun.prototype, "type", void 0);
124
150
  __decorate([
125
151
  Property({ through: "ad4m://interp/run_id", required: true, identity: true }),
126
152
  __metadata("design:type", String)
127
153
  ], InterpretationRun.prototype, "runId", void 0);
128
154
  __decorate([
129
- Optional({ through: "ad4m://interp/model", resolveLanguage: "literal" }),
155
+ Optional({ through: "ad4m://interp/model" }),
130
156
  __metadata("design:type", String)
131
157
  ], InterpretationRun.prototype, "model", void 0);
132
158
  __decorate([
133
- Optional({ through: "ad4m://interp/prompt_version", resolveLanguage: "literal" }),
159
+ Optional({ through: "ad4m://interp/prompt_version" }),
134
160
  __metadata("design:type", String)
135
161
  ], InterpretationRun.prototype, "promptVersion", void 0);
136
162
  __decorate([
137
- Optional({ through: "ad4m://interp/ran_at", resolveLanguage: "literal" }),
163
+ Optional({ through: "ad4m://interp/ran_at" }),
138
164
  __metadata("design:type", String)
139
165
  ], InterpretationRun.prototype, "ranAt", void 0);
140
166
  __decorate([
141
- Optional({ through: "ad4m://interp/processor", resolveLanguage: "literal" }),
167
+ Optional({ through: "ad4m://interp/processor" }),
142
168
  __metadata("design:type", String)
143
169
  ], InterpretationRun.prototype, "processor", void 0);
144
170
  __decorate([
145
- HasMany({ through: "ad4m://interp/sources" }),
171
+ HasMany({ through: "ad4m://interp/sources", datatype: "xsd:string" }),
146
172
  __metadata("design:type", Array)
147
173
  ], InterpretationRun.prototype, "sources", void 0);
174
+ __decorate([
175
+ Optional({ through: "ad4m://interp/debug_prompt", resolveLanguage: "literal" }),
176
+ __metadata("design:type", String)
177
+ ], InterpretationRun.prototype, "debugPrompt", void 0);
178
+ __decorate([
179
+ Optional({ through: "ad4m://interp/debug_response", resolveLanguage: "literal" }),
180
+ __metadata("design:type", String)
181
+ ], InterpretationRun.prototype, "debugResponse", void 0);
148
182
  InterpretationRun = __decorate([
149
183
  Model({ name: "InterpretationRun" })
150
184
  ], InterpretationRun);
@@ -177,11 +211,11 @@ let InterpretationOverlay = class InterpretationOverlay extends Ad4mModel {
177
211
  }
178
212
  };
179
213
  __decorate([
180
- Property({ through: "ad4m://interp/kind", required: true, resolveLanguage: "literal" }),
214
+ Property({ through: "ad4m://interp/kind", required: true }),
181
215
  __metadata("design:type", String)
182
216
  ], InterpretationOverlay.prototype, "kind", void 0);
183
217
  __decorate([
184
- Optional({ through: "ad4m://interp/run", resolveLanguage: "literal" }),
218
+ Optional({ through: "ad4m://interp/run" }),
185
219
  __metadata("design:type", String)
186
220
  ], InterpretationOverlay.prototype, "run", void 0);
187
221
  InterpretationOverlay = __decorate([
@@ -1,4 +1,4 @@
1
- import { ApiClient } from "../apiClient";
1
+ import { ApiClient, CallOptions } from "../apiClient";
2
2
  import { ExpressionRendered } from "../expression/Expression";
3
3
  import { ExpressionClient } from "../expression/ExpressionClient";
4
4
  import { Link, LinkExpressionInput, LinkExpression, LinkMutations, LinkExpressionMutations } from "../links/Links";
@@ -11,7 +11,7 @@ import { LinkStatus, PerspectiveProxy } from './PerspectiveProxy';
11
11
  import { AIClient } from "../ai/AIClient";
12
12
  import { AllInstancesResult } from "../model/types";
13
13
  import type { TranscriptTurn } from "../generated/api";
14
- import type { AddAutoProcessorConfig, AutoProcessorEvent, InterpretationOverlayInfo } from "./AutoProcessor";
14
+ import type { AddAutoProcessorConfig, AutoProcessorEvent, AutoProcessorNeighbourhoodStateEvent, InterpretationOverlayInfo, RawScope, RunInterpretationObserveOptions } from "./AutoProcessor";
15
15
  export type PerspectiveHandleCallback = (perspective: PerspectiveHandle) => null;
16
16
  export type UuidCallback = (uuid: string) => null;
17
17
  export type LinkCallback = (link: LinkExpression) => null;
@@ -27,9 +27,9 @@ export declare class PerspectiveClient {
27
27
  byUUID(uuid: string): Promise<PerspectiveProxy | null>;
28
28
  snapshotByUUID(uuid: string): Promise<Perspective | null>;
29
29
  publishSnapshotByUUID(uuid: string): Promise<string | null>;
30
- queryLinks(uuid: string, query: LinkQuery): Promise<LinkExpression[]>;
31
- queryProlog(uuid: string, query: string): Promise<unknown>;
32
- querySparql<T = any>(uuid: string, query: string): Promise<T>;
30
+ queryLinks(uuid: string, query: LinkQuery, options?: CallOptions): Promise<LinkExpression[]>;
31
+ queryProlog(uuid: string, query: string, options?: CallOptions): Promise<unknown>;
32
+ querySparql<T = any>(uuid: string, query: string, options?: CallOptions): Promise<T>;
33
33
  subscribeQuery(uuid: string, query: string): Promise<{
34
34
  subscriptionId: string;
35
35
  result: AllInstancesResult;
@@ -39,7 +39,8 @@ export declare class PerspectiveClient {
39
39
  subscribeToQueryUpdates(subscriptionId: string, onData: (result: AllInstancesResult) => void): () => void;
40
40
  keepAliveQuery(uuid: string, subscriptionId: string): Promise<boolean>;
41
41
  disposeQuerySubscription(uuid: string, subscriptionId: string): Promise<boolean>;
42
- modelQuery(uuid: string, className: string, queryJson: string): Promise<any>;
42
+ modelQuery(uuid: string, className: string, queryJson: string, options?: CallOptions): Promise<any>;
43
+ subjectClassesOf(uuid: string, uris: string[]): Promise<Record<string, string[]>>;
43
44
  evaluateGetters(uuid: string, className: string, instanceIds: string[], propertyNames?: string[]): Promise<Record<string, Record<string, any>>>;
44
45
  modelSubscribe(uuid: string, className: string, queryJson: string): Promise<{
45
46
  subscriptionId: string;
@@ -64,8 +65,30 @@ export declare class PerspectiveClient {
64
65
  * retries on parse failure), so it can legitimately take minutes on slower
65
66
  * or CPU-only models. We raise the default 30s RPC timeout here to 20 min
66
67
  * (matches the CI `--timeout 1200000` for the interpretation tests).
68
+ *
69
+ * `existingScope` and `mintScope` match the AutoProcessor semantics:
70
+ * `existingScope` constrains the dedup lookup to instances under a
71
+ * subtree; `mintScope` links every FRESHLY-created base as a child of
72
+ * `mintScope.id` via its predicate (upserts of pre-existing instances
73
+ * are NOT re-parented — same rule as the watcher).
74
+ */
75
+ runInterpretation(uuid: string, transcript: TranscriptTurn[], basePrefix: string, classes?: string[], existingScope?: RawScope, mintScope?: RawScope, observe?: RunInterpretationObserveOptions): Promise<string[]>;
76
+ /**
77
+ * Tool-calling counterpart to {@link runInterpretation}. The LLM sees a
78
+ * live per-class tool surface (`{Class}_query`, `{Class}_propose_create`,
79
+ * `{Class}_propose_link_child`, …) and drives the extraction via tool
80
+ * calls; buffered proposals drain through the same overlay gate the
81
+ * single-shot path uses.
82
+ *
83
+ * `maxToolCalls` bounds the loop and MUST be > 0 — zero would collapse
84
+ * the harness to a no-op final-answer step; use {@link runInterpretation}
85
+ * for the classic single-shot path.
86
+ *
87
+ * Same 20-minute RPC timeout as the single-shot path — an LLM loop
88
+ * that calls several tools can legitimately take longer than one plain
89
+ * generation.
67
90
  */
68
- runInterpretation(uuid: string, transcript: TranscriptTurn[], basePrefix: string, classes?: string[]): Promise<string[]>;
91
+ runInterpretationWithHarness(uuid: string, transcript: TranscriptTurn[], basePrefix: string, maxToolCalls: number, classes?: string[], modelOverride?: string, existingScope?: RawScope, observationId?: string, emitDebugEvents?: boolean): Promise<string[]>;
69
92
  /**
70
93
  * Register a neighbourhood auto-processor on this perspective. The executor's
71
94
  * watch loop then runs interpretation automatically over new source items
@@ -75,6 +98,8 @@ export declare class PerspectiveClient {
75
98
  * Returns the processor id.
76
99
  */
77
100
  addAutoProcessor(uuid: string, config: AddAutoProcessorConfig): Promise<string>;
101
+ /** Delete an auto-processor's config. `false` when there was none to delete. */
102
+ removeAutoProcessor(uuid: string, processorId: string): Promise<boolean>;
78
103
  /** Pending interpretation overlays (LLM suggestions awaiting human accept/reject). */
79
104
  interpretationOverlays(uuid: string): Promise<InterpretationOverlayInfo[]>;
80
105
  /** Accept an overlay's suggestion(s): the LLM value becomes the real value and
@@ -87,8 +112,22 @@ export declare class PerspectiveClient {
87
112
  * Subscribe to auto-processor step signals. `cb` fires for every
88
113
  * `auto-processor-event` on `uuid` (BatchReady → Claimed/BackedOff/… →
89
114
  * Processed), letting a UI show progress and await the next batch.
115
+ *
116
+ * Registered on the per-uuid `#linkUnsubscribers` map so
117
+ * `PerspectiveProxy.dispose()` → `removeAllListeners(uuid)` cleans the
118
+ * subscription up; using the global `#unsubscribers` array would leak
119
+ * callbacks across repeated view lifecycles (CodeRabbit #881 review).
90
120
  */
91
121
  addAutoProcessorEventListener(uuid: String, cb: (event: AutoProcessorEvent) => void): Promise<void>;
122
+ /**
123
+ * Subscribe to neighbourhood-state events on a perspective. `cb` fires
124
+ * when THIS executor claims / finishes / abandons a batch for any
125
+ * processor on `uuid` — perspective-scoped observability so a UI can
126
+ * render "someone is auto-processing this" without receiving the batch
127
+ * payload or LLM I/O. Registered on the per-uuid `#linkUnsubscribers`
128
+ * map so `PerspectiveProxy.dispose()` sweeps it up.
129
+ */
130
+ addAutoProcessorNeighbourhoodStateListener(uuid: String, cb: (event: AutoProcessorNeighbourhoodStateEvent) => void): Promise<void>;
92
131
  addLinkExpression(uuid: string, link: LinkExpression, status?: LinkStatus, batchId?: string): Promise<LinkExpression>;
93
132
  updateLink(uuid: string, oldLink: LinkExpressionInput, newLink: Link, batchId?: string): Promise<LinkExpression>;
94
133
  removeLink(uuid: string, link: LinkExpressionInput, batchId?: string): Promise<boolean>;
@@ -102,6 +141,45 @@ export declare class PerspectiveClient {
102
141
  executeCommands(uuid: string, commands: string, expression: string, parameters: string, batchId?: string): Promise<boolean>;
103
142
  createSubject(uuid: string, subjectClass: string, expressionAddress: string, initialValues?: string, batchId?: string): Promise<boolean>;
104
143
  getSubjectData(uuid: string, subjectClass: string, expressionAddress: string): Promise<string>;
144
+ /** List the names of every SHACL shape stored in a perspective (one RPC call). */
145
+ getShaclNames(uuid: string): Promise<string[]>;
146
+ /**
147
+ * Resolve a shape's `sh:targetClass` by name (one RPC call).
148
+ *
149
+ * Returns `undefined` when the shape (or its `sh://targetClass` edge) is
150
+ * absent — unified with `PerspectiveProxy.getShaclTargetClass` so callers
151
+ * see a single "not found" representation across both layers. The
152
+ * executor wire format is still `null` (see `perspective.getShaclTargetClass`
153
+ * in `perspectives_ws.rs`); this method maps that at the boundary rather
154
+ * than pushing the null one layer further up. PR #935 review r3897752023.
155
+ */
156
+ getShaclTargetClass(uuid: string, name: string): Promise<string | undefined>;
157
+ /**
158
+ * Retrieve a single SHACL shape's link triples by name (one RPC call).
159
+ * Returns `{shapeUri, links}` for reconstruction via `SHACLShape.fromLinks()`,
160
+ * or `null` if no shape with that name exists.
161
+ */
162
+ getShacl(uuid: string, name: string): Promise<{
163
+ shapeUri: string;
164
+ links: Array<{
165
+ source: string;
166
+ predicate: string;
167
+ target: string;
168
+ }>;
169
+ } | null>;
170
+ /**
171
+ * Retrieve all SHACL shapes in one call. Returns an array of
172
+ * `{name, shapeUri, links}` — one entry per shape (one RPC call).
173
+ */
174
+ getAllShacl(uuid: string): Promise<Array<{
175
+ name: string;
176
+ shapeUri: string;
177
+ links: Array<{
178
+ source: string;
179
+ predicate: string;
180
+ target: string;
181
+ }>;
182
+ }>>;
105
183
  getExpression(expressionURI: string): Promise<ExpressionRendered>;
106
184
  createExpression(content: unknown, languageAddress: string): Promise<string>;
107
185
  addPerspectiveAddedListener(cb: PerspectiveHandleCallback): void;
@@ -121,4 +199,7 @@ export declare class PerspectiveClient {
121
199
  getNeighbourhoodProxy(uuid: string): NeighbourhoodProxy;
122
200
  createBatch(uuid: string): Promise<string>;
123
201
  commitBatch(uuid: string, batchId: string): Promise<LinkExpressionMutations>;
202
+ /** Register a callback that fires after a successful WebSocket reconnect.
203
+ * Passes through to ApiClient.onReconnect(). Returns an unsubscribe function. */
204
+ onReconnect(callback: () => void): () => void;
124
205
  }
@@ -87,7 +87,7 @@ export class PerspectiveClient {
87
87
  async publishSnapshotByUUID(uuid) {
88
88
  return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.publishSnapshot', { uuid });
89
89
  }
90
- async queryLinks(uuid, query) {
90
+ async queryLinks(uuid, query, options) {
91
91
  const params = { uuid };
92
92
  if (query.source)
93
93
  params.source = query.source;
@@ -101,14 +101,14 @@ export class PerspectiveClient {
101
101
  params.untilDate = query.untilDate instanceof Date ? query.untilDate.toISOString() : String(query.untilDate);
102
102
  if (query.limit !== undefined)
103
103
  params.limit = query.limit;
104
- return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.queryLinks', params);
104
+ return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.queryLinks', params, options);
105
105
  }
106
- async queryProlog(uuid, query) {
107
- const result = await __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.queryProlog', { uuid, query });
106
+ async queryProlog(uuid, query, options) {
107
+ const result = await __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.queryProlog', { uuid, query }, options);
108
108
  return JSON.parse(result);
109
109
  }
110
- async querySparql(uuid, query) {
111
- const result = await __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.querySparql', { uuid, engine: 'sparql', query });
110
+ async querySparql(uuid, query, options) {
111
+ const result = await __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.querySparql', { uuid, engine: 'sparql', query }, options);
112
112
  return JSON.parse(result);
113
113
  }
114
114
  async subscribeQuery(uuid, query) {
@@ -148,10 +148,13 @@ export class PerspectiveClient {
148
148
  }
149
149
  return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.disposeQuery', { uuid, subscriptionId });
150
150
  }
151
- async modelQuery(uuid, className, queryJson) {
152
- const resultJson = await __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.modelQuery', { uuid, class_name: className, query_json: queryJson });
151
+ async modelQuery(uuid, className, queryJson, options) {
152
+ const resultJson = await __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.modelQuery', { uuid, class_name: className, query_json: queryJson }, options);
153
153
  return JSON.parse(resultJson);
154
154
  }
155
+ async subjectClassesOf(uuid, uris) {
156
+ return await __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.subjectClassesOf', { uuid, uris });
157
+ }
155
158
  async evaluateGetters(uuid, className, instanceIds, propertyNames) {
156
159
  const resultJson = await __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.evaluateGetters', {
157
160
  uuid,
@@ -202,10 +205,62 @@ export class PerspectiveClient {
202
205
  * retries on parse failure), so it can legitimately take minutes on slower
203
206
  * or CPU-only models. We raise the default 30s RPC timeout here to 20 min
204
207
  * (matches the CI `--timeout 1200000` for the interpretation tests).
208
+ *
209
+ * `existingScope` and `mintScope` match the AutoProcessor semantics:
210
+ * `existingScope` constrains the dedup lookup to instances under a
211
+ * subtree; `mintScope` links every FRESHLY-created base as a child of
212
+ * `mintScope.id` via its predicate (upserts of pre-existing instances
213
+ * are NOT re-parented — same rule as the watcher).
214
+ */
215
+ async runInterpretation(uuid, transcript, basePrefix, classes, existingScope, mintScope, observe) {
216
+ const RUN_INTERPRETATION_TIMEOUT_MS = 20 * 60 * 1000;
217
+ return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.runInterpretation', {
218
+ uuid, transcript, basePrefix, classes, existingScope, mintScope,
219
+ // Spread rather than always-present, so a client talking to a pre-#903
220
+ // executor sends exactly the params it sent before. `serde` would ignore
221
+ // the extra keys anyway; keeping the wire identical means a bug report
222
+ // from an older node cannot be about these.
223
+ ...(observe ? {
224
+ observationId: observe.observationId,
225
+ emitDebugEvents: observe.emitDebugEvents ?? false,
226
+ } : {}),
227
+ }, { timeoutMs: RUN_INTERPRETATION_TIMEOUT_MS });
228
+ }
229
+ /**
230
+ * Tool-calling counterpart to {@link runInterpretation}. The LLM sees a
231
+ * live per-class tool surface (`{Class}_query`, `{Class}_propose_create`,
232
+ * `{Class}_propose_link_child`, …) and drives the extraction via tool
233
+ * calls; buffered proposals drain through the same overlay gate the
234
+ * single-shot path uses.
235
+ *
236
+ * `maxToolCalls` bounds the loop and MUST be > 0 — zero would collapse
237
+ * the harness to a no-op final-answer step; use {@link runInterpretation}
238
+ * for the classic single-shot path.
239
+ *
240
+ * Same 20-minute RPC timeout as the single-shot path — an LLM loop
241
+ * that calls several tools can legitimately take longer than one plain
242
+ * generation.
205
243
  */
206
- async runInterpretation(uuid, transcript, basePrefix, classes) {
244
+ async runInterpretationWithHarness(uuid, transcript, basePrefix, maxToolCalls, classes, modelOverride, existingScope,
245
+ // Optional live-debug event surface — same shape/semantics as the
246
+ // single-shot `runInterpretation`. `observationId` names the
247
+ // `processor_id` + `batch_key` on emitted `ToolCall` / `ToolResult`
248
+ // events so a subscribed UI can correlate them to this pass.
249
+ // `emitDebugEvents` is a dead-letter without an observationId
250
+ // (nothing to key against); the server gates on both.
251
+ observationId, emitDebugEvents) {
207
252
  const RUN_INTERPRETATION_TIMEOUT_MS = 20 * 60 * 1000;
208
- return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.runInterpretation', { uuid, transcript, basePrefix, classes }, RUN_INTERPRETATION_TIMEOUT_MS);
253
+ return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.runInterpretationWithHarness', {
254
+ uuid,
255
+ transcript,
256
+ basePrefix,
257
+ maxToolCalls,
258
+ classes,
259
+ modelOverride,
260
+ existingScope,
261
+ observationId,
262
+ emitDebugEvents,
263
+ }, { timeoutMs: RUN_INTERPRETATION_TIMEOUT_MS });
209
264
  }
210
265
  /**
211
266
  * Register a neighbourhood auto-processor on this perspective. The executor's
@@ -218,6 +273,10 @@ export class PerspectiveClient {
218
273
  async addAutoProcessor(uuid, config) {
219
274
  return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.addAutoProcessor', { uuid, ...config });
220
275
  }
276
+ /** Delete an auto-processor's config. `false` when there was none to delete. */
277
+ async removeAutoProcessor(uuid, processorId) {
278
+ return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.removeAutoProcessor', { uuid, processorId });
279
+ }
221
280
  /** Pending interpretation overlays (LLM suggestions awaiting human accept/reject). */
222
281
  async interpretationOverlays(uuid) {
223
282
  return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.interpretationOverlays', { uuid });
@@ -236,6 +295,11 @@ export class PerspectiveClient {
236
295
  * Subscribe to auto-processor step signals. `cb` fires for every
237
296
  * `auto-processor-event` on `uuid` (BatchReady → Claimed/BackedOff/… →
238
297
  * Processed), letting a UI show progress and await the next batch.
298
+ *
299
+ * Registered on the per-uuid `#linkUnsubscribers` map so
300
+ * `PerspectiveProxy.dispose()` → `removeAllListeners(uuid)` cleans the
301
+ * subscription up; using the global `#unsubscribers` array would leak
302
+ * callbacks across repeated view lifecycles (CodeRabbit #881 review).
239
303
  */
240
304
  async addAutoProcessorEventListener(uuid, cb) {
241
305
  const unsub = __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").subscribe((data) => {
@@ -243,7 +307,28 @@ export class PerspectiveClient {
243
307
  cb(data);
244
308
  }
245
309
  });
246
- __classPrivateFieldGet(this, _PerspectiveClient_unsubscribers, "f").push(unsub);
310
+ let existing = __classPrivateFieldGet(this, _PerspectiveClient_linkUnsubscribers, "f").get(uuid) || [];
311
+ existing.push(unsub);
312
+ __classPrivateFieldGet(this, _PerspectiveClient_linkUnsubscribers, "f").set(uuid, existing);
313
+ await __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").waitForSubscription();
314
+ }
315
+ /**
316
+ * Subscribe to neighbourhood-state events on a perspective. `cb` fires
317
+ * when THIS executor claims / finishes / abandons a batch for any
318
+ * processor on `uuid` — perspective-scoped observability so a UI can
319
+ * render "someone is auto-processing this" without receiving the batch
320
+ * payload or LLM I/O. Registered on the per-uuid `#linkUnsubscribers`
321
+ * map so `PerspectiveProxy.dispose()` sweeps it up.
322
+ */
323
+ async addAutoProcessorNeighbourhoodStateListener(uuid, cb) {
324
+ const unsub = __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").subscribe((data) => {
325
+ if (data.type === 'auto-processor-neighbourhood-state' && data.perspectiveUuid === uuid) {
326
+ cb(data);
327
+ }
328
+ });
329
+ let existing = __classPrivateFieldGet(this, _PerspectiveClient_linkUnsubscribers, "f").get(uuid) || [];
330
+ existing.push(unsub);
331
+ __classPrivateFieldGet(this, _PerspectiveClient_linkUnsubscribers, "f").set(uuid, existing);
247
332
  await __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").waitForSubscription();
248
333
  }
249
334
  async addLinkExpression(uuid, link, status = 'shared', batchId) {
@@ -274,6 +359,43 @@ export class PerspectiveClient {
274
359
  async getSubjectData(uuid, subjectClass, expressionAddress) {
275
360
  return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.getSubjectData', { uuid, subjectClass, expressionAddress });
276
361
  }
362
+ // ── SHACL resolution (server-side) ─────────────────────────────────────────
363
+ // These methods delegate shape resolution to the executor, which reads links
364
+ // from its local store in-process. Each call replaces the multi-round-trip
365
+ // `queryLinks` sequences the old PerspectiveProxy methods performed.
366
+ /** List the names of every SHACL shape stored in a perspective (one RPC call). */
367
+ async getShaclNames(uuid) {
368
+ return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.getShaclNames', { uuid });
369
+ }
370
+ /**
371
+ * Resolve a shape's `sh:targetClass` by name (one RPC call).
372
+ *
373
+ * Returns `undefined` when the shape (or its `sh://targetClass` edge) is
374
+ * absent — unified with `PerspectiveProxy.getShaclTargetClass` so callers
375
+ * see a single "not found" representation across both layers. The
376
+ * executor wire format is still `null` (see `perspective.getShaclTargetClass`
377
+ * in `perspectives_ws.rs`); this method maps that at the boundary rather
378
+ * than pushing the null one layer further up. PR #935 review r3897752023.
379
+ */
380
+ async getShaclTargetClass(uuid, name) {
381
+ const result = await __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.getShaclTargetClass', { uuid, name });
382
+ return result ?? undefined;
383
+ }
384
+ /**
385
+ * Retrieve a single SHACL shape's link triples by name (one RPC call).
386
+ * Returns `{shapeUri, links}` for reconstruction via `SHACLShape.fromLinks()`,
387
+ * or `null` if no shape with that name exists.
388
+ */
389
+ async getShacl(uuid, name) {
390
+ return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.getShacl', { uuid, name });
391
+ }
392
+ /**
393
+ * Retrieve all SHACL shapes in one call. Returns an array of
394
+ * `{name, shapeUri, links}` — one entry per shape (one RPC call).
395
+ */
396
+ async getAllShacl(uuid) {
397
+ return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.getAllShacl', { uuid });
398
+ }
277
399
  // ExpressionClient functions, needed for Subjects:
278
400
  async getExpression(expressionURI) {
279
401
  return await __classPrivateFieldGet(this, _PerspectiveClient_expressionClient, "f").get(expressionURI);
@@ -395,5 +517,10 @@ export class PerspectiveClient {
395
517
  async commitBatch(uuid, batchId) {
396
518
  return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.commitBatch', { uuid, batchId });
397
519
  }
520
+ /** Register a callback that fires after a successful WebSocket reconnect.
521
+ * Passes through to ApiClient.onReconnect(). Returns an unsubscribe function. */
522
+ onReconnect(callback) {
523
+ return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").onReconnect(callback);
524
+ }
398
525
  }
399
526
  _PerspectiveClient_apiClient = new WeakMap(), _PerspectiveClient_perspectiveAddedCallbacks = new WeakMap(), _PerspectiveClient_perspectiveUpdatedCallbacks = new WeakMap(), _PerspectiveClient_perspectiveRemovedCallbacks = new WeakMap(), _PerspectiveClient_perspectiveSyncStateChangeCallbacks = new WeakMap(), _PerspectiveClient_expressionClient = new WeakMap(), _PerspectiveClient_neighbourhoodClient = new WeakMap(), _PerspectiveClient_aiClient = new WeakMap(), _PerspectiveClient_unsubscribers = new WeakMap(), _PerspectiveClient_linkUnsubscribers = new WeakMap(), _PerspectiveClient_querySubscriptionUnsubscribers = new WeakMap();