@coasys/ad4m 0.13.0-test-interpretation-2 → 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.
- package/lib/index.cjs +1982 -498
- package/lib/index.js +1982 -499
- package/lib/src/ai/AIClient.js +6 -3
- package/lib/src/apiClient.d.ts +40 -4
- package/lib/src/apiClient.js +149 -9
- package/lib/src/index.d.ts +3 -1
- package/lib/src/index.js +2 -0
- package/lib/src/model/Ad4mModel.d.ts +6 -5
- package/lib/src/model/Ad4mModel.js +246 -29
- package/lib/src/model/Ad4mModel.test.js +480 -735
- package/lib/src/model/decorators.d.ts +147 -4
- package/lib/src/model/decorators.js +70 -24
- package/lib/src/model/model-manifest.d.ts +41 -0
- package/lib/src/model/model-manifest.js +11 -0
- package/lib/src/model/query-sparql.test.js +92 -10
- package/lib/src/model/shacl-gen.js +33 -0
- package/lib/src/model/types.d.ts +9 -0
- package/lib/src/neighbourhood/NeighbourhoodProxy.test.js +33 -33
- package/lib/src/perspectives/AutoProcessor.d.ts +90 -24
- package/lib/src/perspectives/FlowInstance.d.ts +187 -0
- package/lib/src/perspectives/FlowInstance.js +336 -0
- package/lib/src/perspectives/FlowModels.d.ts +94 -0
- package/lib/src/perspectives/FlowModels.js +182 -0
- package/lib/src/perspectives/InterpretationModels.d.ts +12 -22
- package/lib/src/perspectives/InterpretationModels.js +2 -6
- package/lib/src/perspectives/PerspectiveClient.d.ts +68 -7
- package/lib/src/perspectives/PerspectiveClient.js +105 -10
- package/lib/src/perspectives/PerspectiveProxy.d.ts +142 -57
- package/lib/src/perspectives/PerspectiveProxy.js +388 -274
- package/lib/src/shacl/SHACLFlow.d.ts +273 -47
- package/lib/src/shacl/SHACLFlow.js +397 -88
- package/lib/src/shacl/SHACLShape.d.ts +8 -0
- package/lib/src/shacl/SHACLShape.js +17 -0
- package/lib/src/shacl/SHACLShape.test.js +82 -0
- package/package.json +2 -2
- package/src/ai/AIClient.ts +6 -3
- package/src/apiClient.test.ts +227 -0
- package/src/apiClient.ts +185 -9
- package/src/index.ts +3 -1
- package/src/model/Ad4mModel.test.ts +645 -0
- package/src/model/Ad4mModel.ts +245 -26
- package/src/model/decorators.ts +216 -35
- package/src/model/relation-filtering.test.ts +70 -20
- package/src/model/shacl-gen.ts +36 -0
- package/src/model/shacl-roundtrip.test.ts +130 -0
- package/src/model/types.ts +7 -0
- package/src/perspectives/AutoProcessor.ts +94 -24
- package/src/perspectives/FlowInstance.ts +369 -0
- package/src/perspectives/FlowModels.ts +157 -0
- package/src/perspectives/InterpretationModels.ts +13 -25
- package/src/perspectives/PerspectiveClient.test.ts +67 -6
- package/src/perspectives/PerspectiveClient.ts +142 -12
- package/src/perspectives/PerspectiveProxy.test.ts +406 -0
- package/src/perspectives/PerspectiveProxy.ts +459 -289
- package/src/perspectives/shacl-rpc.test.ts +258 -0
- package/src/shacl/SHACLFlow.test.ts +762 -35
- package/src/shacl/SHACLFlow.ts +680 -112
- package/src/shacl/SHACLShape.ts +31 -0
- package/lib/src/generated/rest/AIModelLoadingStatus.d.ts +0 -7
- package/lib/src/generated/rest/AIModelLoadingStatus.js +0 -2
- package/lib/src/generated/rest/AddAgentInfosRequest.d.ts +0 -3
- package/lib/src/generated/rest/AddAgentInfosRequest.js +0 -2
- package/lib/src/generated/rest/AddLinkExpressionRequest.d.ts +0 -6
- package/lib/src/generated/rest/AddLinkExpressionRequest.js +0 -1
- package/lib/src/generated/rest/AddLinkRequest.d.ts +0 -6
- package/lib/src/generated/rest/AddLinkRequest.js +0 -1
- package/lib/src/generated/rest/AddLinksBulkRequest.d.ts +0 -6
- package/lib/src/generated/rest/AddLinksBulkRequest.js +0 -1
- package/lib/src/generated/rest/AddSdnaRequest.d.ts +0 -6
- package/lib/src/generated/rest/AddSdnaRequest.js +0 -2
- package/lib/src/generated/rest/ApplyTemplateRequest.d.ts +0 -4
- package/lib/src/generated/rest/ApplyTemplateRequest.js +0 -2
- package/lib/src/generated/rest/AuthInfoInput.d.ts +0 -10
- package/lib/src/generated/rest/AuthInfoInput.js +0 -1
- package/lib/src/generated/rest/BroadcastRequest.d.ts +0 -6
- package/lib/src/generated/rest/BroadcastRequest.js +0 -1
- package/lib/src/generated/rest/CapabilityInput.d.ts +0 -5
- package/lib/src/generated/rest/CapabilityInput.js +0 -1
- package/lib/src/generated/rest/CommitBatchRequest.d.ts +0 -3
- package/lib/src/generated/rest/CommitBatchRequest.js +0 -2
- package/lib/src/generated/rest/ComputeLogEntry.d.ts +0 -9
- package/lib/src/generated/rest/ComputeLogEntry.js +0 -2
- package/lib/src/generated/rest/CreateExpressionRequest.d.ts +0 -4
- package/lib/src/generated/rest/CreateExpressionRequest.js +0 -2
- package/lib/src/generated/rest/CreatePerspectiveRequest.d.ts +0 -3
- package/lib/src/generated/rest/CreatePerspectiveRequest.js +0 -2
- package/lib/src/generated/rest/CreateSubjectRequest.d.ts +0 -6
- package/lib/src/generated/rest/CreateSubjectRequest.js +0 -2
- package/lib/src/generated/rest/CreateUserRequest.d.ts +0 -4
- package/lib/src/generated/rest/CreateUserRequest.js +0 -2
- package/lib/src/generated/rest/CreateUserResponse.d.ts +0 -5
- package/lib/src/generated/rest/CreateUserResponse.js +0 -2
- package/lib/src/generated/rest/DecoratedExpressionProof.d.ts +0 -6
- package/lib/src/generated/rest/DecoratedExpressionProof.js +0 -2
- package/lib/src/generated/rest/DecoratedLinkExpression.d.ts +0 -10
- package/lib/src/generated/rest/DecoratedLinkExpression.js +0 -1
- package/lib/src/generated/rest/DisposeQueryRequest.d.ts +0 -3
- package/lib/src/generated/rest/DisposeQueryRequest.js +0 -2
- package/lib/src/generated/rest/EmailTestRequest.d.ts +0 -6
- package/lib/src/generated/rest/EmailTestRequest.js +0 -2
- package/lib/src/generated/rest/EmbedRequest.d.ts +0 -4
- package/lib/src/generated/rest/EmbedRequest.js +0 -2
- package/lib/src/generated/rest/EntanglementProofInput.d.ts +0 -6
- package/lib/src/generated/rest/EntanglementProofInput.js +0 -2
- package/lib/src/generated/rest/EntanglementProofPreflightRequest.d.ts +0 -4
- package/lib/src/generated/rest/EntanglementProofPreflightRequest.js +0 -2
- package/lib/src/generated/rest/ExecuteCommandsRequest.d.ts +0 -4
- package/lib/src/generated/rest/ExecuteCommandsRequest.js +0 -2
- package/lib/src/generated/rest/ExportRequest.d.ts +0 -5
- package/lib/src/generated/rest/ExportRequest.js +0 -2
- package/lib/src/generated/rest/ExpressionManyRequest.d.ts +0 -3
- package/lib/src/generated/rest/ExpressionManyRequest.js +0 -2
- package/lib/src/generated/rest/ExpressionProof.d.ts +0 -4
- package/lib/src/generated/rest/ExpressionProof.js +0 -2
- package/lib/src/generated/rest/ExpressionProofInput.d.ts +0 -6
- package/lib/src/generated/rest/ExpressionProofInput.js +0 -2
- package/lib/src/generated/rest/FriendSendMessageRequest.d.ts +0 -3
- package/lib/src/generated/rest/FriendSendMessageRequest.js +0 -2
- package/lib/src/generated/rest/FriendsListRequest.d.ts +0 -3
- package/lib/src/generated/rest/FriendsListRequest.js +0 -2
- package/lib/src/generated/rest/GenerateAgentRequest.d.ts +0 -3
- package/lib/src/generated/rest/GenerateAgentRequest.js +0 -2
- package/lib/src/generated/rest/GenerateJwtRequest.d.ts +0 -4
- package/lib/src/generated/rest/GenerateJwtRequest.js +0 -2
- package/lib/src/generated/rest/GetSubjectDataRequest.d.ts +0 -4
- package/lib/src/generated/rest/GetSubjectDataRequest.js +0 -2
- package/lib/src/generated/rest/HostingInfoResponse.d.ts +0 -5
- package/lib/src/generated/rest/HostingInfoResponse.js +0 -2
- package/lib/src/generated/rest/HostingWalletResponse.d.ts +0 -4
- package/lib/src/generated/rest/HostingWalletResponse.js +0 -2
- package/lib/src/generated/rest/ImportAgentRequest.d.ts +0 -6
- package/lib/src/generated/rest/ImportAgentRequest.js +0 -2
- package/lib/src/generated/rest/ImportRequest.d.ts +0 -4
- package/lib/src/generated/rest/ImportRequest.js +0 -2
- package/lib/src/generated/rest/JoinNeighbourhoodRequest.d.ts +0 -3
- package/lib/src/generated/rest/JoinNeighbourhoodRequest.js +0 -2
- package/lib/src/generated/rest/KeepAliveQueryRequest.d.ts +0 -3
- package/lib/src/generated/rest/KeepAliveQueryRequest.js +0 -2
- package/lib/src/generated/rest/LanguageMetaInput.d.ts +0 -6
- package/lib/src/generated/rest/LanguageMetaInput.js +0 -2
- package/lib/src/generated/rest/Link.d.ts +0 -5
- package/lib/src/generated/rest/Link.js +0 -2
- package/lib/src/generated/rest/LinkExpression.d.ts +0 -10
- package/lib/src/generated/rest/LinkExpression.js +0 -1
- package/lib/src/generated/rest/LinkExpressionInput.d.ts +0 -10
- package/lib/src/generated/rest/LinkExpressionInput.js +0 -1
- package/lib/src/generated/rest/LinkInput.d.ts +0 -5
- package/lib/src/generated/rest/LinkInput.js +0 -2
- package/lib/src/generated/rest/LinkLanguageTemplatesRequest.d.ts +0 -3
- package/lib/src/generated/rest/LinkLanguageTemplatesRequest.js +0 -2
- package/lib/src/generated/rest/LinkMutationRequest.d.ts +0 -12
- package/lib/src/generated/rest/LinkMutationRequest.js +0 -1
- package/lib/src/generated/rest/LinkMutationResponse.d.ts +0 -9
- package/lib/src/generated/rest/LinkMutationResponse.js +0 -1
- package/lib/src/generated/rest/LinkMutations.d.ts +0 -6
- package/lib/src/generated/rest/LinkMutations.js +0 -1
- package/lib/src/generated/rest/LinkMutationsRequest.d.ts +0 -5
- package/lib/src/generated/rest/LinkMutationsRequest.js +0 -1
- package/lib/src/generated/rest/LinkStatus.d.ts +0 -1
- package/lib/src/generated/rest/LinkStatus.js +0 -2
- package/lib/src/generated/rest/LinkUpdateInput.d.ts +0 -5
- package/lib/src/generated/rest/LinkUpdateInput.js +0 -1
- package/lib/src/generated/rest/LockAgentRequest.d.ts +0 -3
- package/lib/src/generated/rest/LockAgentRequest.js +0 -2
- package/lib/src/generated/rest/LoginUserRequest.d.ts +0 -5
- package/lib/src/generated/rest/LoginUserRequest.js +0 -2
- package/lib/src/generated/rest/ModelType.d.ts +0 -1
- package/lib/src/generated/rest/ModelType.js +0 -2
- package/lib/src/generated/rest/NotificationGrantRequest.d.ts +0 -3
- package/lib/src/generated/rest/NotificationGrantRequest.js +0 -2
- package/lib/src/generated/rest/NotificationInput.d.ts +0 -10
- package/lib/src/generated/rest/NotificationInput.js +0 -2
- package/lib/src/generated/rest/OpenLinkRequest.d.ts +0 -3
- package/lib/src/generated/rest/OpenLinkRequest.js +0 -2
- package/lib/src/generated/rest/PermitCapabilityRequest.d.ts +0 -3
- package/lib/src/generated/rest/PermitCapabilityRequest.js +0 -2
- package/lib/src/generated/rest/PerspectiveInput.d.ts +0 -4
- package/lib/src/generated/rest/PerspectiveInput.js +0 -1
- package/lib/src/generated/rest/PromptRequest.d.ts +0 -4
- package/lib/src/generated/rest/PromptRequest.js +0 -2
- package/lib/src/generated/rest/PublicPerspectiveInput.d.ts +0 -4
- package/lib/src/generated/rest/PublicPerspectiveInput.js +0 -1
- package/lib/src/generated/rest/PublishLanguageRequest.d.ts +0 -5
- package/lib/src/generated/rest/PublishLanguageRequest.js +0 -1
- package/lib/src/generated/rest/PublishNeighbourhoodRequest.d.ts +0 -6
- package/lib/src/generated/rest/PublishNeighbourhoodRequest.js +0 -1
- package/lib/src/generated/rest/QueryRequest.d.ts +0 -7
- package/lib/src/generated/rest/QueryRequest.js +0 -2
- package/lib/src/generated/rest/RemoveLinkRequest.d.ts +0 -5
- package/lib/src/generated/rest/RemoveLinkRequest.js +0 -1
- package/lib/src/generated/rest/RemoveLinksBulkRequest.d.ts +0 -5
- package/lib/src/generated/rest/RemoveLinksBulkRequest.js +0 -1
- package/lib/src/generated/rest/RequestCapabilityRequest.d.ts +0 -4
- package/lib/src/generated/rest/RequestCapabilityRequest.js +0 -1
- package/lib/src/generated/rest/RequestPaymentRequest.d.ts +0 -3
- package/lib/src/generated/rest/RequestPaymentRequest.js +0 -2
- package/lib/src/generated/rest/RequestVerificationRequest.d.ts +0 -4
- package/lib/src/generated/rest/RequestVerificationRequest.js +0 -2
- package/lib/src/generated/rest/ResourceInput.d.ts +0 -4
- package/lib/src/generated/rest/ResourceInput.js +0 -2
- package/lib/src/generated/rest/SetDefaultModelRequest.d.ts +0 -4
- package/lib/src/generated/rest/SetDefaultModelRequest.js +0 -1
- package/lib/src/generated/rest/SetFreeHostingEnabledRequest.d.ts +0 -3
- package/lib/src/generated/rest/SetFreeHostingEnabledRequest.js +0 -2
- package/lib/src/generated/rest/SetHotWalletAddressRequest.d.ts +0 -3
- package/lib/src/generated/rest/SetHotWalletAddressRequest.js +0 -2
- package/lib/src/generated/rest/SetMultiUserRequest.d.ts +0 -3
- package/lib/src/generated/rest/SetMultiUserRequest.js +0 -2
- package/lib/src/generated/rest/SetOnlineStatusRequest.d.ts +0 -5
- package/lib/src/generated/rest/SetOnlineStatusRequest.js +0 -1
- package/lib/src/generated/rest/SetStatusRequest.d.ts +0 -3
- package/lib/src/generated/rest/SetStatusRequest.js +0 -2
- package/lib/src/generated/rest/SetUserFreeAccessRequest.d.ts +0 -4
- package/lib/src/generated/rest/SetUserFreeAccessRequest.js +0 -2
- package/lib/src/generated/rest/SignMessageRequest.d.ts +0 -3
- package/lib/src/generated/rest/SignMessageRequest.js +0 -2
- package/lib/src/generated/rest/SignalRequest.d.ts +0 -6
- package/lib/src/generated/rest/SignalRequest.js +0 -1
- package/lib/src/generated/rest/SubscribeQueryRequest.d.ts +0 -3
- package/lib/src/generated/rest/SubscribeQueryRequest.js +0 -2
- package/lib/src/generated/rest/SubscribeQueryResponse.d.ts +0 -4
- package/lib/src/generated/rest/SubscribeQueryResponse.js +0 -2
- package/lib/src/generated/rest/TrustedAgentsRequest.d.ts +0 -3
- package/lib/src/generated/rest/TrustedAgentsRequest.js +0 -2
- package/lib/src/generated/rest/UnlockAgentRequest.d.ts +0 -4
- package/lib/src/generated/rest/UnlockAgentRequest.js +0 -2
- package/lib/src/generated/rest/UpdateLinkRequest.d.ts +0 -7
- package/lib/src/generated/rest/UpdateLinkRequest.js +0 -1
- package/lib/src/generated/rest/UpdatePerspectiveRequest.d.ts +0 -3
- package/lib/src/generated/rest/UpdatePerspectiveRequest.js +0 -2
- package/lib/src/generated/rest/UpdateProfileRequest.d.ts +0 -5
- package/lib/src/generated/rest/UpdateProfileRequest.js +0 -1
- package/lib/src/generated/rest/UserStatistics.d.ts +0 -9
- package/lib/src/generated/rest/UserStatistics.js +0 -2
- package/lib/src/generated/rest/VerificationRequestResult.d.ts +0 -6
- package/lib/src/generated/rest/VerificationRequestResult.js +0 -2
- package/lib/src/generated/rest/VerifyEmailRequest.d.ts +0 -6
- package/lib/src/generated/rest/VerifyEmailRequest.js +0 -2
- package/lib/src/generated/rest/VerifySignatureRequest.d.ts +0 -5
- package/lib/src/generated/rest/VerifySignatureRequest.js +0 -2
- package/lib/src/generated/rest/WriteSettingsRequest.d.ts +0 -3
- package/lib/src/generated/rest/WriteSettingsRequest.js +0 -2
- package/lib/src/generated/rest/index.d.ts +0 -73
- package/lib/src/generated/rest/index.js +0 -8
- package/lib/src/generated/rest/routes.d.ts +0 -587
- package/lib/src/generated/rest/routes.js +0 -3
- package/lib/src/model/query-surreal.d.ts +0 -44
- package/lib/src/model/query-surreal.js +0 -249
- package/lib/src/model/surreal-utils.d.ts +0 -42
- package/lib/src/model/surreal-utils.js +0 -128
- package/lib/src/perspectives/PerspectiveProxy.test.d.ts +0 -1
- package/lib/src/perspectives/PerspectiveProxy.test.js +0 -34
- package/lib/src/restClient.d.ts +0 -52
- package/lib/src/restClient.js +0 -227
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript @Model classes mirroring the Rust-side hardwired SDNA for the
|
|
3
|
+
* flow runtime. Apps can import these to query the perspective graph for
|
|
4
|
+
* pending flow-transition proposals without knowing the raw link predicates.
|
|
5
|
+
*
|
|
6
|
+
* Registration:
|
|
7
|
+
* await FlowTransitionProposal.register(perspective);
|
|
8
|
+
*
|
|
9
|
+
* Querying:
|
|
10
|
+
* const pending = await FlowTransitionProposal.findAll(perspective);
|
|
11
|
+
*
|
|
12
|
+
* Slice 5/7 of the flow-implementation arc (design doc §4.2). The Rust
|
|
13
|
+
* engine does not yet mint these — that lands with the consensus firing
|
|
14
|
+
* work in a later PR arc. This class defines the on-graph shape so:
|
|
15
|
+
* - clients can build UI over proposals immediately (Deliberation demo);
|
|
16
|
+
* - the SDNA-parity test locks TS/Rust drift the moment the JSON exists
|
|
17
|
+
* (`rust-executor/src/perspectives/hardwired_sdna/flow_transition_proposal.json`);
|
|
18
|
+
* - the engine can start writing into this shape when consensus lands
|
|
19
|
+
* without touching the client-side surface.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import { Ad4mModel } from "../model/Ad4mModel";
|
|
23
|
+
import { HasMany, Optional, Property } from "../model/decorators";
|
|
24
|
+
import { Model } from "../model/decorators";
|
|
25
|
+
|
|
26
|
+
// ── FlowTransitionProposal ──────────────────────────────────────────────────
|
|
27
|
+
// Mirrors the Rust hardwired `flow_transition_proposal.json` SDNA (once wired
|
|
28
|
+
// on the engine side; see file header). One node per proposed transition; the
|
|
29
|
+
// URI is `ad4m://flow/proposal/<uuid>` when the engine mints it, but the class
|
|
30
|
+
// carries no URI-format constraint — apps constructing proposals directly may
|
|
31
|
+
// choose any URI they can defend as unique.
|
|
32
|
+
|
|
33
|
+
@Model({ name: "FlowTransitionProposal" })
|
|
34
|
+
export class FlowTransitionProposal extends Ad4mModel {
|
|
35
|
+
/**
|
|
36
|
+
* URI of the running `FlowInstance` this proposal targets. First-declared
|
|
37
|
+
* property so `buildSHACL` derives the shape namespace from its `through`
|
|
38
|
+
* prefix — `ad4m://flow/instance` → `ad4m://` → target_class
|
|
39
|
+
* `ad4m://FlowTransitionProposal`. Also the identity predicate: the
|
|
40
|
+
* discriminator `findAll` uses to isolate proposal nodes.
|
|
41
|
+
*/
|
|
42
|
+
@Property({ through: "ad4m://flow/instance", required: true, identity: true })
|
|
43
|
+
flowInstance: string = "";
|
|
44
|
+
|
|
45
|
+
/** Name of the state the flow instance is currently in. */
|
|
46
|
+
@Property({ through: "ad4m://flow/from_state", required: true })
|
|
47
|
+
fromState: string = "";
|
|
48
|
+
|
|
49
|
+
/** Name of the state the proposal wants to transition to. */
|
|
50
|
+
@Property({ through: "ad4m://flow/to_state", required: true })
|
|
51
|
+
toState: string = "";
|
|
52
|
+
|
|
53
|
+
/** DID of the agent that issued the proposal. */
|
|
54
|
+
@Property({ through: "ad4m://flow/proposer", required: true })
|
|
55
|
+
proposer: string = "";
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* URIs of instances offered as evidence that `toState.requires` is now
|
|
59
|
+
* satisfied. Multiple links, one per cited instance; ordering is not
|
|
60
|
+
* significant.
|
|
61
|
+
*/
|
|
62
|
+
@HasMany({ through: "ad4m://flow/evidence", datatype: "xsd:string" })
|
|
63
|
+
evidence: string[] = [];
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* JSON blob: `{ [uri]: sha256_hex }` — one entry per evidence URI, hashing
|
|
67
|
+
* the canonicalized graph-visible properties (sorted by property URI,
|
|
68
|
+
* multi-values sorted lexicographically) at proposal time. Downstream
|
|
69
|
+
* verifiers use it to detect edits to cited instances after the proposal
|
|
70
|
+
* was written. Stored as an opaque string because SHACL properties carry
|
|
71
|
+
* no rich-object type; the engine parses it back into a map.
|
|
72
|
+
*/
|
|
73
|
+
@Property({ through: "ad4m://flow/evidence_hashes", required: true })
|
|
74
|
+
evidenceHashes: string = "";
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* URI of the `InterpretationRun` node that produced this proposal, when
|
|
78
|
+
* the proposal came from an LLM extraction pass. Absent when a human
|
|
79
|
+
* clicked "propose" in the UI or an external tool wrote the proposal
|
|
80
|
+
* directly.
|
|
81
|
+
*/
|
|
82
|
+
@Optional({ through: "ad4m://flow/run_uri" })
|
|
83
|
+
runUri?: string;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Free-form human-readable justification. Optional — the LLM includes it
|
|
87
|
+
* when it wants to explain *why* the cited evidence satisfies the state's
|
|
88
|
+
* `requires`; the UI shows it to reviewers.
|
|
89
|
+
*/
|
|
90
|
+
@Optional({ through: "ad4m://flow/rationale" })
|
|
91
|
+
rationale?: string;
|
|
92
|
+
|
|
93
|
+
// "When was this proposal written?" is answered by `Ad4mModel`'s built-in
|
|
94
|
+
// `createdAt`, synthesized on hydration from the earliest link timestamp
|
|
95
|
+
// of the proposal's own links (all written together during create_subject).
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// ── FlowInstanceRecord ──────────────────────────────────────────────────────
|
|
99
|
+
// On-graph node minted by the engine when a flow is started on a specific
|
|
100
|
+
// base expression. Its URI is the value that `FlowTransitionProposal.flowInstance`
|
|
101
|
+
// references. Mirrors `rust-executor/src/perspectives/hardwired_sdna/flow_instance.json`.
|
|
102
|
+
//
|
|
103
|
+
// Design authority: `docs/flow-interpretation-hints-design.md` §4.3.
|
|
104
|
+
//
|
|
105
|
+
// This class is the raw on-graph record (@Model over the SDNA shape). The
|
|
106
|
+
// object-oriented handle callers work with is `FlowInstance` in
|
|
107
|
+
// `./FlowInstance.ts` — it wraps `FlowInstanceRecord + SHACLFlow definition`
|
|
108
|
+
// and exposes `currentState`, `availableTransitions`, `proposals`, etc.
|
|
109
|
+
// Renamed from `FlowInstance` → `FlowInstanceRecord` on 2026-08-27 per
|
|
110
|
+
// Nico's PR #929 review R2 (the `FlowInstance` name is reserved for the
|
|
111
|
+
// wrapper the design has always specified in §4.3).
|
|
112
|
+
//
|
|
113
|
+
// The SDNA name (`@Model({ name: "FlowInstance" })`) stays unchanged — that
|
|
114
|
+
// keys the on-graph class, not the TS export. Renaming the TS class only
|
|
115
|
+
// changes the JS import surface; the graph shape is identical, and Rust
|
|
116
|
+
// hardwired_sdna/flow_instance.json + all the parity tests still lock down
|
|
117
|
+
// the same `ad4m://FlowInstance` target class.
|
|
118
|
+
|
|
119
|
+
@Model({ name: "FlowInstance" })
|
|
120
|
+
export class FlowInstanceRecord extends Ad4mModel {
|
|
121
|
+
/**
|
|
122
|
+
* URI of the `SHACLFlow` this instance runs — the flow's canonical
|
|
123
|
+
* identity, collision-free across social-DNA modules from different
|
|
124
|
+
* communities (bare names WILL collide once shared flows are adopted
|
|
125
|
+
* cross-team — James PR #929 R5). Sourced from `SHACLFlow.flowUri`
|
|
126
|
+
* (which is `${namespace}${name}Flow`, e.g. `coasys://DeliveryFlow`).
|
|
127
|
+
*
|
|
128
|
+
* First-declared property so `buildSHACL` derives the shape namespace
|
|
129
|
+
* from its `through` prefix — `ad4m://flow/flow_uri` → `ad4m://` →
|
|
130
|
+
* target_class `ad4m://FlowInstance`. Also the discriminator predicate
|
|
131
|
+
* `findAll` uses to isolate instance nodes.
|
|
132
|
+
*
|
|
133
|
+
* The human-readable flow name is still available on the paired
|
|
134
|
+
* `SHACLFlow` (via `perspective.getFlow(record.flowUri.split('/').pop()!.replace(/Flow$/,''))`,
|
|
135
|
+
* or more commonly via the `FlowInstance` wrapper's `flowName` getter).
|
|
136
|
+
*/
|
|
137
|
+
@Property({ through: "ad4m://flow/flow_uri", required: true, identity: true })
|
|
138
|
+
flowUri: string = "";
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* URI of the subject expression this flow runs on.
|
|
142
|
+
* Named `subject` (not `baseExpression`) because `Ad4mModel` reserves
|
|
143
|
+
* `baseExpression` as a synthetic hydration field always set to the
|
|
144
|
+
* instance's own URI — a subclass property with that name is shadowed
|
|
145
|
+
* on read.
|
|
146
|
+
*/
|
|
147
|
+
@Property({ through: "ad4m://flow/base", required: true })
|
|
148
|
+
subject: string = "";
|
|
149
|
+
|
|
150
|
+
/** Name of the state the flow is currently in. */
|
|
151
|
+
@Property({ through: "ad4m://flow/current_state", required: true })
|
|
152
|
+
currentState: string = "";
|
|
153
|
+
|
|
154
|
+
// "When was this flow started?" is answered by `Ad4mModel`'s built-in
|
|
155
|
+
// `createdAt`, synthesized on hydration from the earliest link timestamp
|
|
156
|
+
// of the instance's own links (all written together during `mint_flow_instance`).
|
|
157
|
+
}
|
|
@@ -106,32 +106,21 @@ export class AutoProcessorConfig extends Ad4mModel {
|
|
|
106
106
|
mintScope?: string;
|
|
107
107
|
|
|
108
108
|
/**
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
109
|
+
* Tool-call budget for the interpretation-pass harness. Absent (or `"0"`)
|
|
110
|
+
* = the original single-shot LLM path — one prompt, one parse, no tools.
|
|
111
|
+
* `"N"` (positive integer) = engage the tool-calling harness and let the
|
|
112
|
+
* LLM issue up to N tool calls per pass (query/list/get/propose_create/
|
|
113
|
+
* propose_link_child) before being forced to answer. Stored as a decimal
|
|
114
|
+
* string because SHACL properties carry no numeric type; the Rust
|
|
115
|
+
* watcher parses it back to `u32`.
|
|
116
116
|
*/
|
|
117
|
-
@Optional({ through: "ad4m://
|
|
118
|
-
|
|
117
|
+
@Optional({ through: "ad4m://max_tool_calls" })
|
|
118
|
+
maxToolCalls?: string;
|
|
119
119
|
|
|
120
120
|
/**
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
* above); when both are absent, defaults to `"false"`.
|
|
125
|
-
*/
|
|
126
|
-
@Optional({ through: "ad4m://persist_debug", resolveLanguage: "literal" })
|
|
127
|
-
persistDebug?: string;
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Emit `LlmRequestSent` and `LlmResponseReceived` auto-processor events
|
|
131
|
-
* mid-pass, so a subscribed UI can render "waiting on LLM" between
|
|
132
|
-
* prompt-send and response-receive. Independent of `persistDebug`.
|
|
133
|
-
* Absent = fall back to legacy `debugMode`; when both are absent,
|
|
134
|
-
* defaults to `"false"`.
|
|
121
|
+
* Enable full debug observability: persists the raw LLM prompt + response
|
|
122
|
+
* on the pass's `InterpretationRun` AND emits `LlmRequestSent` /
|
|
123
|
+
* `LlmResponseReceived` mid-pass events. `"true"` / `"false"` string.
|
|
135
124
|
*/
|
|
136
125
|
@Optional({ through: "ad4m://emit_debug_events", resolveLanguage: "literal" })
|
|
137
126
|
emitDebugEvents?: string;
|
|
@@ -184,8 +173,7 @@ export class InterpretationRun extends Ad4mModel {
|
|
|
184
173
|
sources: string[] = [];
|
|
185
174
|
|
|
186
175
|
/** Raw LLM prompt this pass fed the model. Present only when the pass's
|
|
187
|
-
* AutoProcessor had `
|
|
188
|
-
* fallback). Absent by default. */
|
|
176
|
+
* AutoProcessor had `emitDebugEvents: true`. Absent by default. */
|
|
189
177
|
@Optional({ through: "ad4m://interp/debug_prompt", resolveLanguage: "literal" })
|
|
190
178
|
debugPrompt?: string;
|
|
191
179
|
|
|
@@ -188,12 +188,73 @@ describe('PerspectiveClient RPC operations', () => {
|
|
|
188
188
|
const client = new PerspectiveClient('http://localhost:12000', 'token', false)
|
|
189
189
|
await client.queryLinks('uuid-q', new LinkQuery({ source: 'src', predicate: 'pred', target: 'tgt' }))
|
|
190
190
|
|
|
191
|
-
expect(mockCall).toHaveBeenCalledWith(
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
191
|
+
expect(mockCall).toHaveBeenCalledWith(
|
|
192
|
+
'perspective.queryLinks',
|
|
193
|
+
expect.objectContaining({
|
|
194
|
+
uuid: 'uuid-q',
|
|
195
|
+
source: 'src',
|
|
196
|
+
predicate: 'pred',
|
|
197
|
+
target: 'tgt',
|
|
198
|
+
}),
|
|
199
|
+
undefined,
|
|
200
|
+
)
|
|
201
|
+
})
|
|
202
|
+
|
|
203
|
+
// ── CallOptions forwarding (AbortSignal plumbing) ──────────────────
|
|
204
|
+
//
|
|
205
|
+
// These tests prove the new `options?` parameter on the long-running
|
|
206
|
+
// query methods reaches `ApiClient.call` as the third argument. The
|
|
207
|
+
// wire-protocol behaviour (request.cancel + AbortError rejection) is
|
|
208
|
+
// covered separately in apiClient.test.ts; here we just verify the
|
|
209
|
+
// signal propagates through the SDK layer instead of being silently
|
|
210
|
+
// dropped.
|
|
211
|
+
|
|
212
|
+
it('querySparql forwards options to apiClient.call', async () => {
|
|
213
|
+
mockCall.mockResolvedValue(JSON.stringify([]))
|
|
214
|
+
const client = new PerspectiveClient('http://localhost:12000', 'token', false)
|
|
215
|
+
const controller = new AbortController()
|
|
216
|
+
await client.querySparql('uuid-q', 'SELECT * WHERE { ?s ?p ?o }', { signal: controller.signal })
|
|
217
|
+
expect(mockCall).toHaveBeenCalledWith(
|
|
218
|
+
'perspective.querySparql',
|
|
219
|
+
expect.objectContaining({ uuid: 'uuid-q', query: 'SELECT * WHERE { ?s ?p ?o }' }),
|
|
220
|
+
{ signal: controller.signal },
|
|
221
|
+
)
|
|
222
|
+
})
|
|
223
|
+
|
|
224
|
+
it('modelQuery forwards options to apiClient.call', async () => {
|
|
225
|
+
mockCall.mockResolvedValue(JSON.stringify({ instances: [], totalCount: 0 }))
|
|
226
|
+
const client = new PerspectiveClient('http://localhost:12000', 'token', false)
|
|
227
|
+
const controller = new AbortController()
|
|
228
|
+
await client.modelQuery('uuid-q', 'Recipe', '{}', { signal: controller.signal })
|
|
229
|
+
expect(mockCall).toHaveBeenCalledWith(
|
|
230
|
+
'perspective.modelQuery',
|
|
231
|
+
expect.objectContaining({ uuid: 'uuid-q', class_name: 'Recipe' }),
|
|
232
|
+
{ signal: controller.signal },
|
|
233
|
+
)
|
|
234
|
+
})
|
|
235
|
+
|
|
236
|
+
it('queryLinks forwards options to apiClient.call', async () => {
|
|
237
|
+
mockCall.mockResolvedValue([])
|
|
238
|
+
const client = new PerspectiveClient('http://localhost:12000', 'token', false)
|
|
239
|
+
const controller = new AbortController()
|
|
240
|
+
await client.queryLinks('uuid-q', new LinkQuery({ source: 'src' }), { signal: controller.signal })
|
|
241
|
+
expect(mockCall).toHaveBeenCalledWith(
|
|
242
|
+
'perspective.queryLinks',
|
|
243
|
+
expect.objectContaining({ uuid: 'uuid-q', source: 'src' }),
|
|
244
|
+
{ signal: controller.signal },
|
|
245
|
+
)
|
|
246
|
+
})
|
|
247
|
+
|
|
248
|
+
it('queryProlog forwards options to apiClient.call', async () => {
|
|
249
|
+
mockCall.mockResolvedValue(JSON.stringify([]))
|
|
250
|
+
const client = new PerspectiveClient('http://localhost:12000', 'token', false)
|
|
251
|
+
const controller = new AbortController()
|
|
252
|
+
await client.queryProlog('uuid-q', 'foo(X).', { signal: controller.signal })
|
|
253
|
+
expect(mockCall).toHaveBeenCalledWith(
|
|
254
|
+
'perspective.queryProlog',
|
|
255
|
+
expect.objectContaining({ uuid: 'uuid-q', query: 'foo(X).' }),
|
|
256
|
+
{ signal: controller.signal },
|
|
257
|
+
)
|
|
197
258
|
})
|
|
198
259
|
})
|
|
199
260
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ApiClient, RpcError } from "../apiClient";
|
|
1
|
+
import { ApiClient, CallOptions, RpcError } 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, AutoProcessorNeighbourhoodStateEvent, InterpretationOverlayInfo, RawScope } from "./AutoProcessor";
|
|
14
|
+
import type { AddAutoProcessorConfig, AutoProcessorEvent, AutoProcessorNeighbourhoodStateEvent, InterpretationOverlayInfo, RawScope, RunInterpretationObserveOptions } from "./AutoProcessor";
|
|
15
15
|
|
|
16
16
|
export type PerspectiveHandleCallback = (perspective: PerspectiveHandle) => null
|
|
17
17
|
export type UuidCallback = (uuid: string) => null
|
|
@@ -102,7 +102,7 @@ export class PerspectiveClient {
|
|
|
102
102
|
return this.#apiClient.call<string|null>('perspective.publishSnapshot', { uuid })
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
async queryLinks(uuid: string, query: LinkQuery): Promise<LinkExpression[]> {
|
|
105
|
+
async queryLinks(uuid: string, query: LinkQuery, options?: CallOptions): Promise<LinkExpression[]> {
|
|
106
106
|
const params: Record<string, unknown> = { uuid }
|
|
107
107
|
if (query.source) params.source = query.source
|
|
108
108
|
if (query.predicate) params.predicate = query.predicate
|
|
@@ -110,16 +110,16 @@ export class PerspectiveClient {
|
|
|
110
110
|
if (query.fromDate) params.fromDate = query.fromDate instanceof Date ? query.fromDate.toISOString() : String(query.fromDate)
|
|
111
111
|
if (query.untilDate) params.untilDate = query.untilDate instanceof Date ? query.untilDate.toISOString() : String(query.untilDate)
|
|
112
112
|
if (query.limit !== undefined) params.limit = query.limit
|
|
113
|
-
return this.#apiClient.call<LinkExpression[]>('perspective.queryLinks', params)
|
|
113
|
+
return this.#apiClient.call<LinkExpression[]>('perspective.queryLinks', params, options)
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
async queryProlog(uuid: string, query: string): Promise<unknown> {
|
|
117
|
-
const result = await this.#apiClient.call<string>('perspective.queryProlog', { uuid, query })
|
|
116
|
+
async queryProlog(uuid: string, query: string, options?: CallOptions): Promise<unknown> {
|
|
117
|
+
const result = await this.#apiClient.call<string>('perspective.queryProlog', { uuid, query }, options)
|
|
118
118
|
return JSON.parse(result)
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
async querySparql<T = any>(uuid: string, query: string): Promise<T> {
|
|
122
|
-
const result = await this.#apiClient.call<string>('perspective.querySparql', { uuid, engine: 'sparql', query })
|
|
121
|
+
async querySparql<T = any>(uuid: string, query: string, options?: CallOptions): Promise<T> {
|
|
122
|
+
const result = await this.#apiClient.call<string>('perspective.querySparql', { uuid, engine: 'sparql', query }, options)
|
|
123
123
|
return JSON.parse(result) as T
|
|
124
124
|
}
|
|
125
125
|
|
|
@@ -178,13 +178,19 @@ export class PerspectiveClient {
|
|
|
178
178
|
)
|
|
179
179
|
}
|
|
180
180
|
|
|
181
|
-
async modelQuery(uuid: string, className: string, queryJson: string): Promise<any> {
|
|
181
|
+
async modelQuery(uuid: string, className: string, queryJson: string, options?: CallOptions): Promise<any> {
|
|
182
182
|
const resultJson = await this.#apiClient.call<string>(
|
|
183
|
-
'perspective.modelQuery', { uuid, class_name: className, query_json: queryJson }
|
|
183
|
+
'perspective.modelQuery', { uuid, class_name: className, query_json: queryJson }, options
|
|
184
184
|
)
|
|
185
185
|
return JSON.parse(resultJson)
|
|
186
186
|
}
|
|
187
187
|
|
|
188
|
+
async subjectClassesOf(uuid: string, uris: string[]): Promise<Record<string, string[]>> {
|
|
189
|
+
return await this.#apiClient.call<Record<string, string[]>>(
|
|
190
|
+
'perspective.subjectClassesOf', { uuid, uris }
|
|
191
|
+
)
|
|
192
|
+
}
|
|
193
|
+
|
|
188
194
|
async evaluateGetters(
|
|
189
195
|
uuid: string,
|
|
190
196
|
className: string,
|
|
@@ -275,12 +281,73 @@ export class PerspectiveClient {
|
|
|
275
281
|
classes?: string[],
|
|
276
282
|
existingScope?: RawScope,
|
|
277
283
|
mintScope?: RawScope,
|
|
284
|
+
observe?: RunInterpretationObserveOptions,
|
|
278
285
|
): Promise<string[]> {
|
|
279
286
|
const RUN_INTERPRETATION_TIMEOUT_MS = 20 * 60 * 1000
|
|
280
287
|
return this.#apiClient.call<string[]>(
|
|
281
288
|
'perspective.runInterpretation',
|
|
282
|
-
{
|
|
283
|
-
|
|
289
|
+
{
|
|
290
|
+
uuid, transcript, basePrefix, classes, existingScope, mintScope,
|
|
291
|
+
// Spread rather than always-present, so a client talking to a pre-#903
|
|
292
|
+
// executor sends exactly the params it sent before. `serde` would ignore
|
|
293
|
+
// the extra keys anyway; keeping the wire identical means a bug report
|
|
294
|
+
// from an older node cannot be about these.
|
|
295
|
+
...(observe ? {
|
|
296
|
+
observationId: observe.observationId,
|
|
297
|
+
emitDebugEvents: observe.emitDebugEvents ?? false,
|
|
298
|
+
} : {}),
|
|
299
|
+
},
|
|
300
|
+
{ timeoutMs: RUN_INTERPRETATION_TIMEOUT_MS },
|
|
301
|
+
)
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Tool-calling counterpart to {@link runInterpretation}. The LLM sees a
|
|
306
|
+
* live per-class tool surface (`{Class}_query`, `{Class}_propose_create`,
|
|
307
|
+
* `{Class}_propose_link_child`, …) and drives the extraction via tool
|
|
308
|
+
* calls; buffered proposals drain through the same overlay gate the
|
|
309
|
+
* single-shot path uses.
|
|
310
|
+
*
|
|
311
|
+
* `maxToolCalls` bounds the loop and MUST be > 0 — zero would collapse
|
|
312
|
+
* the harness to a no-op final-answer step; use {@link runInterpretation}
|
|
313
|
+
* for the classic single-shot path.
|
|
314
|
+
*
|
|
315
|
+
* Same 20-minute RPC timeout as the single-shot path — an LLM loop
|
|
316
|
+
* that calls several tools can legitimately take longer than one plain
|
|
317
|
+
* generation.
|
|
318
|
+
*/
|
|
319
|
+
async runInterpretationWithHarness(
|
|
320
|
+
uuid: string,
|
|
321
|
+
transcript: TranscriptTurn[],
|
|
322
|
+
basePrefix: string,
|
|
323
|
+
maxToolCalls: number,
|
|
324
|
+
classes?: string[],
|
|
325
|
+
modelOverride?: string,
|
|
326
|
+
existingScope?: RawScope,
|
|
327
|
+
// Optional live-debug event surface — same shape/semantics as the
|
|
328
|
+
// single-shot `runInterpretation`. `observationId` names the
|
|
329
|
+
// `processor_id` + `batch_key` on emitted `ToolCall` / `ToolResult`
|
|
330
|
+
// events so a subscribed UI can correlate them to this pass.
|
|
331
|
+
// `emitDebugEvents` is a dead-letter without an observationId
|
|
332
|
+
// (nothing to key against); the server gates on both.
|
|
333
|
+
observationId?: string,
|
|
334
|
+
emitDebugEvents?: boolean,
|
|
335
|
+
): Promise<string[]> {
|
|
336
|
+
const RUN_INTERPRETATION_TIMEOUT_MS = 20 * 60 * 1000
|
|
337
|
+
return this.#apiClient.call<string[]>(
|
|
338
|
+
'perspective.runInterpretationWithHarness',
|
|
339
|
+
{
|
|
340
|
+
uuid,
|
|
341
|
+
transcript,
|
|
342
|
+
basePrefix,
|
|
343
|
+
maxToolCalls,
|
|
344
|
+
classes,
|
|
345
|
+
modelOverride,
|
|
346
|
+
existingScope,
|
|
347
|
+
observationId,
|
|
348
|
+
emitDebugEvents,
|
|
349
|
+
},
|
|
350
|
+
{ timeoutMs: RUN_INTERPRETATION_TIMEOUT_MS },
|
|
284
351
|
)
|
|
285
352
|
}
|
|
286
353
|
|
|
@@ -298,6 +365,13 @@ export class PerspectiveClient {
|
|
|
298
365
|
)
|
|
299
366
|
}
|
|
300
367
|
|
|
368
|
+
/** Delete an auto-processor's config. `false` when there was none to delete. */
|
|
369
|
+
async removeAutoProcessor(uuid: string, processorId: string): Promise<boolean> {
|
|
370
|
+
return this.#apiClient.call<boolean>(
|
|
371
|
+
'perspective.removeAutoProcessor', { uuid, processorId },
|
|
372
|
+
)
|
|
373
|
+
}
|
|
374
|
+
|
|
301
375
|
/** Pending interpretation overlays (LLM suggestions awaiting human accept/reject). */
|
|
302
376
|
async interpretationOverlays(uuid: string): Promise<InterpretationOverlayInfo[]> {
|
|
303
377
|
return this.#apiClient.call<InterpretationOverlayInfo[]>(
|
|
@@ -422,6 +496,56 @@ export class PerspectiveClient {
|
|
|
422
496
|
)
|
|
423
497
|
}
|
|
424
498
|
|
|
499
|
+
// ── SHACL resolution (server-side) ─────────────────────────────────────────
|
|
500
|
+
// These methods delegate shape resolution to the executor, which reads links
|
|
501
|
+
// from its local store in-process. Each call replaces the multi-round-trip
|
|
502
|
+
// `queryLinks` sequences the old PerspectiveProxy methods performed.
|
|
503
|
+
|
|
504
|
+
/** List the names of every SHACL shape stored in a perspective (one RPC call). */
|
|
505
|
+
async getShaclNames(uuid: string): Promise<string[]> {
|
|
506
|
+
return this.#apiClient.call<string[]>('perspective.getShaclNames', { uuid })
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* Resolve a shape's `sh:targetClass` by name (one RPC call).
|
|
511
|
+
*
|
|
512
|
+
* Returns `undefined` when the shape (or its `sh://targetClass` edge) is
|
|
513
|
+
* absent — unified with `PerspectiveProxy.getShaclTargetClass` so callers
|
|
514
|
+
* see a single "not found" representation across both layers. The
|
|
515
|
+
* executor wire format is still `null` (see `perspective.getShaclTargetClass`
|
|
516
|
+
* in `perspectives_ws.rs`); this method maps that at the boundary rather
|
|
517
|
+
* than pushing the null one layer further up. PR #935 review r3897752023.
|
|
518
|
+
*/
|
|
519
|
+
async getShaclTargetClass(uuid: string, name: string): Promise<string | undefined> {
|
|
520
|
+
const result = await this.#apiClient.call<string | null>(
|
|
521
|
+
'perspective.getShaclTargetClass',
|
|
522
|
+
{ uuid, name },
|
|
523
|
+
)
|
|
524
|
+
return result ?? undefined
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
/**
|
|
528
|
+
* Retrieve a single SHACL shape's link triples by name (one RPC call).
|
|
529
|
+
* Returns `{shapeUri, links}` for reconstruction via `SHACLShape.fromLinks()`,
|
|
530
|
+
* or `null` if no shape with that name exists.
|
|
531
|
+
*/
|
|
532
|
+
async getShacl(uuid: string, name: string): Promise<{ shapeUri: string; links: Array<{source: string; predicate: string; target: string}> } | null> {
|
|
533
|
+
return this.#apiClient.call<{ shapeUri: string; links: Array<{source: string; predicate: string; target: string}> } | null>(
|
|
534
|
+
'perspective.getShacl', { uuid, name }
|
|
535
|
+
)
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
/**
|
|
539
|
+
* Retrieve all SHACL shapes in one call. Returns an array of
|
|
540
|
+
* `{name, shapeUri, links}` — one entry per shape (one RPC call).
|
|
541
|
+
*/
|
|
542
|
+
async getAllShacl(uuid: string): Promise<Array<{ name: string; shapeUri: string; links: Array<{source: string; predicate: string; target: string}> }>> {
|
|
543
|
+
return this.#apiClient.call<Array<{ name: string; shapeUri: string; links: Array<{source: string; predicate: string; target: string}> }>>(
|
|
544
|
+
'perspective.getAllShacl', { uuid }
|
|
545
|
+
)
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
|
|
425
549
|
// ExpressionClient functions, needed for Subjects:
|
|
426
550
|
async getExpression(expressionURI: string): Promise<ExpressionRendered> {
|
|
427
551
|
return await this.#expressionClient!.get(expressionURI)
|
|
@@ -566,4 +690,10 @@ export class PerspectiveClient {
|
|
|
566
690
|
'perspective.commitBatch', { uuid, batchId }
|
|
567
691
|
)
|
|
568
692
|
}
|
|
693
|
+
|
|
694
|
+
/** Register a callback that fires after a successful WebSocket reconnect.
|
|
695
|
+
* Passes through to ApiClient.onReconnect(). Returns an unsubscribe function. */
|
|
696
|
+
onReconnect(callback: () => void): () => void {
|
|
697
|
+
return this.#apiClient.onReconnect(callback)
|
|
698
|
+
}
|
|
569
699
|
}
|