@coasys/ad4m 0.13.0-test-flows-1 → 0.13.1-staging.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/lib/index.cjs +9613 -7069
- package/lib/index.js +7367 -4840
- package/lib/src/Ad4mClient.d.ts +12 -4
- package/lib/src/Ad4mClient.js +15 -11
- package/lib/src/Literal.js +3 -3
- package/lib/src/agent/Agent.d.ts +4 -1
- package/lib/src/agent/Agent.js +6 -0
- package/lib/src/agent/AgentClient.d.ts +9 -23
- package/lib/src/agent/AgentClient.js +68 -148
- package/lib/src/ai/AIClient.d.ts +10 -6
- package/lib/src/ai/AIClient.js +29 -27
- package/lib/src/apiClient.d.ts +54 -42
- package/lib/src/apiClient.js +279 -252
- package/lib/src/expression/Expression.d.ts +13 -4
- package/lib/src/expression/Expression.js +0 -1
- package/lib/src/expression/ExpressionClient.js +1 -1
- package/lib/src/generated/api/AIPromptExamples.d.ts +4 -0
- package/lib/src/generated/api/AIPromptExamples.js +2 -0
- package/lib/src/generated/api/AIPromptExamplesInput.d.ts +4 -0
- package/lib/src/generated/api/AIPromptExamplesInput.js +2 -0
- package/lib/src/generated/api/AITask.d.ts +11 -0
- package/lib/src/generated/api/AITaskInput.d.ts +8 -0
- package/lib/src/generated/api/AddAgentInfosRequest.d.ts +3 -0
- package/lib/src/generated/api/AddAgentInfosRequest.js +2 -0
- package/lib/src/generated/api/AddLinkExpressionRequest.d.ts +2 -2
- package/lib/src/generated/api/AddLinkRequest.d.ts +2 -2
- package/lib/src/generated/api/AddLinksBulkRequest.d.ts +2 -2
- package/lib/src/generated/api/AddSdnaRequest.d.ts +2 -2
- package/lib/src/generated/api/Agent.d.ts +6 -0
- package/lib/src/generated/api/AgentAddEntanglementProofsParams.d.ts +9 -0
- package/lib/src/generated/api/AgentByDidParams.d.ts +3 -0
- package/lib/src/generated/api/AgentByDidParams.js +2 -0
- package/lib/src/generated/api/AgentRemoveAppParams.d.ts +3 -0
- package/lib/src/generated/api/AgentRemoveAppParams.js +2 -0
- package/lib/src/generated/api/AgentRevokeTokenParams.d.ts +3 -0
- package/lib/src/generated/api/AgentRevokeTokenParams.js +2 -0
- package/lib/src/generated/api/AgentSignature.d.ts +4 -0
- package/lib/src/generated/api/AgentSignature.js +2 -0
- package/lib/src/generated/api/AgentStatus.d.ts +8 -0
- package/lib/src/generated/api/AgentStatusChangedEvent.d.ts +7 -0
- package/lib/src/generated/api/AgentUpdatedEvent.d.ts +7 -0
- package/lib/src/generated/api/AgentsByDidsRequest.d.ts +3 -0
- package/lib/src/generated/api/AgentsByDidsRequest.js +2 -0
- package/lib/src/generated/api/AiAddModelParams.d.ts +4 -0
- package/lib/src/generated/api/AiAddTaskParams.d.ts +4 -0
- package/lib/src/generated/api/AiDiscoverModelsParams.d.ts +8 -0
- package/lib/src/generated/api/AiDiscoverModelsParams.js +2 -0
- package/lib/src/generated/api/AiGetDefaultModelParams.d.ts +4 -0
- package/lib/src/generated/api/AiIdParams.d.ts +3 -0
- package/lib/src/generated/api/AiIdParams.js +2 -0
- package/lib/src/generated/api/AiModelLoadingStatusParams.d.ts +7 -0
- package/lib/src/generated/api/AiModelLoadingStatusParams.js +2 -0
- package/lib/src/generated/api/AiSetDefaultModelParams.d.ts +5 -0
- package/lib/src/generated/api/AiSetDefaultModelParams.js +1 -0
- package/lib/src/generated/api/AiTranscriptionCloseParams.d.ts +3 -0
- package/lib/src/generated/api/AiTranscriptionCloseParams.js +2 -0
- package/lib/src/generated/api/AiTranscriptionOpenParams.d.ts +5 -0
- package/lib/src/generated/api/AiTranscriptionOpenParams.js +1 -0
- package/lib/src/generated/api/AiUpdateModelParams.d.ts +5 -0
- package/lib/src/generated/api/AiUpdateModelParams.js +1 -0
- package/lib/src/generated/api/AiUpdateTaskParams.d.ts +4 -0
- package/lib/src/generated/api/AiUpdateTaskParams.js +1 -0
- package/lib/src/generated/api/Apps.d.ts +7 -0
- package/lib/src/generated/api/Apps.js +1 -0
- package/lib/src/generated/api/AuthInfo.d.ts +10 -0
- package/lib/src/generated/api/AuthInfo.js +1 -0
- package/lib/src/generated/api/AuthInfoInput.d.ts +4 -4
- package/lib/src/generated/api/AutoProcessorEvent.d.ts +89 -0
- package/lib/src/generated/api/AutoProcessorEvent.js +1 -0
- package/lib/src/generated/api/AutoProcessorNeighbourhoodState.d.ts +32 -0
- package/lib/src/generated/api/AutoProcessorNeighbourhoodState.js +1 -0
- package/lib/src/generated/api/AutoProcessorStep.d.ts +7 -0
- package/lib/src/generated/api/AutoProcessorStep.js +2 -0
- package/lib/src/generated/api/BroadcastRequest.d.ts +5 -0
- package/lib/src/generated/api/BroadcastRequest.js +2 -0
- package/lib/src/generated/api/CallSessionInfo.d.ts +23 -0
- package/lib/src/generated/api/CallSessionInfo.js +2 -0
- package/lib/src/generated/api/Capability.d.ts +5 -0
- package/lib/src/generated/api/Capability.js +1 -0
- package/lib/src/generated/api/CreateSubjectRequest.d.ts +2 -2
- package/lib/src/generated/api/CreateUserRequest.d.ts +4 -0
- package/lib/src/generated/api/CreateUserRequest.js +2 -0
- package/lib/src/generated/api/DateTime.d.ts +1 -0
- package/lib/src/generated/api/DateTime.js +2 -0
- package/lib/src/generated/api/DecoratedExpressionProof.d.ts +6 -0
- package/lib/src/generated/api/DecoratedExpressionProof.js +2 -0
- package/lib/src/generated/api/DecoratedLinkExpression.d.ts +10 -0
- package/lib/src/generated/api/DecoratedLinkExpression.js +1 -0
- package/lib/src/generated/api/DecoratedNeighbourhoodExpression.d.ts +8 -0
- package/lib/src/generated/api/DecoratedNeighbourhoodExpression.js +1 -0
- package/lib/src/generated/api/DecoratedPerspective.d.ts +4 -0
- package/lib/src/generated/api/DecoratedPerspective.js +1 -0
- package/lib/src/generated/api/DiscardBatchRequest.d.ts +3 -0
- package/lib/src/generated/api/DiscardBatchRequest.js +2 -0
- package/lib/src/generated/api/DisposeQueryRequest.d.ts +3 -0
- package/lib/src/generated/api/DisposeQueryRequest.js +2 -0
- package/lib/src/generated/api/EntanglementProof.d.ts +8 -0
- package/lib/src/generated/api/EntanglementProof.js +2 -0
- package/lib/src/generated/api/EntanglementProofInput.d.ts +1 -1
- package/lib/src/generated/api/EntanglementProofPreflightRequest.d.ts +4 -0
- package/lib/src/generated/api/EntanglementProofPreflightRequest.js +2 -0
- package/lib/src/generated/api/EntanglementProofsWrapper.d.ts +7 -0
- package/lib/src/generated/api/EntanglementProofsWrapper.js +1 -0
- package/lib/src/generated/api/Events.d.ts +56 -0
- package/lib/src/generated/api/Events.js +18 -0
- package/lib/src/generated/api/ExceptionInfo.d.ts +7 -0
- package/lib/src/generated/api/ExceptionInfo.js +1 -0
- package/lib/src/generated/api/ExceptionOccurredEvent.d.ts +7 -0
- package/lib/src/generated/api/ExceptionOccurredEvent.js +1 -0
- package/lib/src/generated/api/ExceptionType.d.ts +1 -0
- package/lib/src/generated/api/ExceptionType.js +2 -0
- package/lib/src/generated/api/ExecuteCommandsRequest.d.ts +4 -2
- package/lib/src/generated/api/ExportRequest.d.ts +1 -1
- package/lib/src/generated/api/ExpressionInteractRequest.d.ts +5 -0
- package/lib/src/generated/api/ExpressionInteractRequest.js +1 -0
- package/lib/src/generated/api/ExpressionProofInput.d.ts +4 -4
- package/lib/src/generated/api/ExpressionRendered.d.ts +11 -0
- package/lib/src/generated/api/ExpressionRendered.js +1 -0
- package/lib/src/generated/api/ExpressionUrlRequest.d.ts +3 -0
- package/lib/src/generated/api/ExpressionUrlRequest.js +2 -0
- package/lib/src/generated/api/FireOutcome.d.ts +14 -0
- package/lib/src/generated/api/FireOutcome.js +2 -0
- package/lib/src/generated/api/FlowStateChangedEvent.d.ts +38 -0
- package/lib/src/generated/api/FlowStateChangedEvent.js +2 -0
- package/lib/src/generated/api/FlowStateEntry.d.ts +18 -0
- package/lib/src/generated/api/FlowStateEntry.js +2 -0
- package/lib/src/generated/api/FriendSendMessageRequest.d.ts +1 -1
- package/lib/src/generated/api/HostRate.d.ts +7 -0
- package/lib/src/generated/api/HostRate.js +2 -0
- package/lib/src/generated/api/HostingInfoResult.d.ts +13 -0
- package/lib/src/generated/api/HostingInfoResult.js +1 -0
- package/lib/src/generated/api/HostingInfoUser.d.ts +9 -0
- package/lib/src/generated/api/HostingInfoUser.js +2 -0
- package/lib/src/generated/api/HostingRequestPaymentResult.d.ts +4 -0
- package/lib/src/generated/api/HostingRequestPaymentResult.js +2 -0
- package/lib/src/generated/api/HostingUserInfo.d.ts +6 -0
- package/lib/src/generated/api/HostingUserInfo.js +2 -0
- package/lib/src/generated/api/HostingVersionInfo.d.ts +7 -0
- package/lib/src/generated/api/HostingVersionInfo.js +2 -0
- package/lib/src/generated/api/HostingWalletResult.d.ts +8 -0
- package/lib/src/generated/api/HostingWalletResult.js +1 -0
- package/lib/src/generated/api/IceServer.d.ts +18 -0
- package/lib/src/generated/api/IceServer.js +2 -0
- package/lib/src/generated/api/Icon.d.ts +3 -0
- package/lib/src/generated/api/Icon.js +2 -0
- package/lib/src/generated/api/ImportResult.d.ts +15 -0
- package/lib/src/generated/api/ImportResult.js +1 -0
- package/lib/src/generated/api/ImportStats.d.ts +7 -0
- package/lib/src/generated/api/ImportStats.js +2 -0
- package/lib/src/generated/api/InteractionCall.d.ts +4 -0
- package/lib/src/generated/api/InteractionCall.js +2 -0
- package/lib/src/generated/api/InteractionCallWrapper.d.ts +6 -0
- package/lib/src/generated/api/InteractionCallWrapper.js +2 -0
- package/lib/src/generated/api/InteractionMeta.d.ts +6 -0
- package/lib/src/generated/api/InteractionMeta.js +1 -0
- package/lib/src/generated/api/InteractionParameter.d.ts +4 -0
- package/lib/src/generated/api/InteractionParameter.js +2 -0
- package/lib/src/generated/api/LanguageAddressParams.d.ts +3 -0
- package/lib/src/generated/api/LanguageAddressParams.js +2 -0
- package/lib/src/generated/api/LanguageHandle.d.ts +9 -0
- package/lib/src/generated/api/LanguageHandle.js +1 -0
- package/lib/src/generated/api/LanguageListParams.d.ts +3 -0
- package/lib/src/generated/api/LanguageListParams.js +2 -0
- package/lib/src/generated/api/LanguageMeta.d.ts +11 -0
- package/lib/src/generated/api/LanguageMeta.js +2 -0
- package/lib/src/generated/api/LanguageMetaInput.d.ts +2 -2
- package/lib/src/generated/api/LanguageRef.d.ts +4 -0
- package/lib/src/generated/api/LanguageRef.js +2 -0
- package/lib/src/generated/api/LanguageSettingsWrapper.d.ts +6 -0
- package/lib/src/generated/api/LanguageSettingsWrapper.js +2 -0
- package/lib/src/generated/api/LanguageWriteSettingsParams.d.ts +4 -0
- package/lib/src/generated/api/LanguageWriteSettingsParams.js +2 -0
- package/lib/src/generated/api/LinkExpressionInput.d.ts +1 -1
- package/lib/src/generated/api/LinkInput.d.ts +1 -1
- package/lib/src/generated/api/LinkMutationRequest.d.ts +12 -0
- package/lib/src/generated/api/LinkMutationRequest.js +1 -0
- package/lib/src/generated/api/LinkMutationsRequest.d.ts +5 -0
- package/lib/src/generated/api/LinkMutationsRequest.js +1 -0
- package/lib/src/generated/api/LinkStatus.d.ts +1 -1
- package/lib/src/generated/api/LinkUpdateInput.d.ts +5 -0
- package/lib/src/generated/api/LinkUpdateInput.js +1 -0
- package/lib/src/generated/api/LocalModel.d.ts +7 -0
- package/lib/src/generated/api/LocalModel.js +1 -0
- package/lib/src/generated/api/LocalModelInput.d.ts +7 -0
- package/lib/src/generated/api/LocalModelInput.js +1 -0
- package/lib/src/generated/api/MessageReceivedEvent.d.ts +7 -0
- package/lib/src/generated/api/MessageReceivedEvent.js +1 -0
- package/lib/src/generated/api/Model.d.ts +10 -0
- package/lib/src/generated/api/Model.js +1 -0
- package/lib/src/generated/api/ModelApi.d.ts +17 -0
- package/lib/src/generated/api/ModelApi.js +1 -0
- package/lib/src/generated/api/ModelApiInput.d.ts +11 -0
- package/lib/src/generated/api/ModelApiInput.js +2 -0
- package/lib/src/generated/api/ModelApiType.d.ts +1 -0
- package/lib/src/generated/api/ModelApiType.js +2 -0
- package/lib/src/generated/api/ModelInput.d.ts +9 -0
- package/lib/src/generated/api/ModelInput.js +1 -0
- package/lib/src/generated/api/ModelType.d.ts +1 -1
- package/lib/src/generated/api/Neighbourhood.d.ts +5 -0
- package/lib/src/generated/api/Neighbourhood.js +1 -0
- package/lib/src/generated/api/NeighbourhoodBroadcastParams.d.ts +7 -0
- package/lib/src/generated/api/NeighbourhoodBroadcastParams.js +1 -0
- package/lib/src/generated/api/NeighbourhoodOnlineStatusParams.d.ts +6 -0
- package/lib/src/generated/api/NeighbourhoodOnlineStatusParams.js +1 -0
- package/lib/src/generated/api/NeighbourhoodPerspectivePayload.d.ts +7 -0
- package/lib/src/generated/api/NeighbourhoodPerspectivePayload.js +1 -0
- package/lib/src/generated/api/NeighbourhoodPhase.d.ts +6 -0
- package/lib/src/generated/api/NeighbourhoodPhase.js +2 -0
- package/lib/src/generated/api/NeighbourhoodSignalFilter.d.ts +8 -0
- package/lib/src/generated/api/NeighbourhoodSignalFilter.js +1 -0
- package/lib/src/generated/api/NeighbourhoodSignalParams.d.ts +7 -0
- package/lib/src/generated/api/NeighbourhoodSignalParams.js +1 -0
- package/lib/src/generated/api/NeighbourhoodSignedPerspective.d.ts +8 -0
- package/lib/src/generated/api/NeighbourhoodSignedPerspective.js +1 -0
- package/lib/src/generated/api/NeighbourhoodUuidParams.d.ts +3 -0
- package/lib/src/generated/api/NeighbourhoodUuidParams.js +2 -0
- package/lib/src/generated/api/Notification.d.ts +16 -0
- package/lib/src/generated/api/Notification.js +2 -0
- package/lib/src/generated/api/NotificationGrantRequest.d.ts +6 -0
- package/lib/src/generated/api/NotificationGrantRequest.js +2 -0
- package/lib/src/generated/api/NotificationInput.d.ts +1 -1
- package/lib/src/generated/api/NotificationTriggeredEvent.d.ts +9 -0
- package/lib/src/generated/api/NotificationTriggeredEvent.js +1 -0
- package/lib/src/generated/api/OnlineAgent.d.ts +9 -0
- package/lib/src/generated/api/OnlineAgent.js +1 -0
- package/lib/src/generated/api/OutputRef.d.ts +12 -0
- package/lib/src/generated/api/OutputRef.js +2 -0
- package/lib/src/generated/api/OverlayView.d.ts +24 -0
- package/lib/src/generated/api/OverlayView.js +1 -0
- package/lib/src/generated/api/Perspective.d.ts +4 -0
- package/lib/src/generated/api/Perspective.js +1 -0
- package/lib/src/generated/api/PerspectiveAddAutoProcessorParams.d.ts +26 -0
- package/lib/src/generated/api/PerspectiveAddAutoProcessorParams.js +2 -0
- package/lib/src/generated/api/PerspectiveAddLinkExpressionParams.d.ts +7 -0
- package/lib/src/generated/api/PerspectiveAddLinkExpressionParams.js +1 -0
- package/lib/src/generated/api/PerspectiveAddLinkParams.d.ts +7 -0
- package/lib/src/generated/api/PerspectiveAddLinkParams.js +1 -0
- package/lib/src/generated/api/PerspectiveAddLinksParams.d.ts +7 -0
- package/lib/src/generated/api/PerspectiveAddLinksParams.js +1 -0
- package/lib/src/generated/api/PerspectiveAddSdnaParams.d.ts +14 -0
- package/lib/src/generated/api/PerspectiveAddSdnaParams.js +1 -0
- package/lib/src/generated/api/PerspectiveAddSdnaResult.d.ts +4 -0
- package/lib/src/generated/api/PerspectiveAddSdnaResult.js +2 -0
- package/lib/src/generated/api/PerspectiveCommitBatchParams.d.ts +4 -0
- package/lib/src/generated/api/PerspectiveCommitBatchParams.js +2 -0
- package/lib/src/generated/api/PerspectiveCreateSubjectParams.d.ts +7 -0
- package/lib/src/generated/api/PerspectiveCreateSubjectParams.js +2 -0
- package/lib/src/generated/api/PerspectiveDiscardBatchParams.d.ts +4 -0
- package/lib/src/generated/api/PerspectiveDiscardBatchParams.js +2 -0
- package/lib/src/generated/api/PerspectiveEvaluateGettersParams.d.ts +9 -0
- package/lib/src/generated/api/PerspectiveEvaluateGettersParams.js +2 -0
- package/lib/src/generated/api/PerspectiveExecuteCommandsParams.d.ts +7 -0
- package/lib/src/generated/api/PerspectiveExecuteCommandsParams.js +2 -0
- package/lib/src/generated/api/PerspectiveExpression.d.ts +8 -0
- package/lib/src/generated/api/PerspectiveExpression.js +1 -0
- package/lib/src/generated/api/PerspectiveFlowFiredParams.d.ts +8 -0
- package/lib/src/generated/api/PerspectiveFlowFiredParams.js +2 -0
- package/lib/src/generated/api/PerspectiveFlowProposalParams.d.ts +4 -0
- package/lib/src/generated/api/PerspectiveFlowProposalParams.js +2 -0
- package/lib/src/generated/api/PerspectiveFlowReceiptVerdict.d.ts +12 -0
- package/lib/src/generated/api/PerspectiveFlowReceiptVerdict.js +1 -0
- package/lib/src/generated/api/PerspectiveFlowStatesParams.d.ts +11 -0
- package/lib/src/generated/api/PerspectiveFlowStatesParams.js +2 -0
- package/lib/src/generated/api/PerspectiveFlowValidOutputsParams.d.ts +8 -0
- package/lib/src/generated/api/PerspectiveFlowValidOutputsParams.js +2 -0
- package/lib/src/generated/api/PerspectiveGetAllShaclParams.d.ts +7 -0
- package/lib/src/generated/api/PerspectiveGetAllShaclParams.js +2 -0
- package/lib/src/generated/api/PerspectiveGetSubjectDataParams.d.ts +5 -0
- package/lib/src/generated/api/PerspectiveGetSubjectDataParams.js +2 -0
- package/lib/src/generated/api/PerspectiveHandle.d.ts +10 -0
- package/lib/src/generated/api/PerspectiveHandle.js +1 -0
- package/lib/src/generated/api/PerspectiveLinkDiff.d.ts +9 -0
- package/lib/src/generated/api/PerspectiveLinkDiff.js +1 -0
- package/lib/src/generated/api/PerspectiveLinkMutationsParams.d.ts +6 -0
- package/lib/src/generated/api/PerspectiveLinkMutationsParams.js +1 -0
- package/lib/src/generated/api/PerspectiveLinkUpdatedWithOwner.d.ts +7 -0
- package/lib/src/generated/api/PerspectiveLinkUpdatedWithOwner.js +1 -0
- package/lib/src/generated/api/PerspectiveLinkWithOwner.d.ts +6 -0
- package/lib/src/generated/api/PerspectiveLinkWithOwner.js +1 -0
- package/lib/src/generated/api/PerspectiveMintFlowReceiptParams.d.ts +4 -0
- package/lib/src/generated/api/PerspectiveMintFlowReceiptParams.js +2 -0
- package/lib/src/generated/api/PerspectiveMintFlowReceiptResult.d.ts +9 -0
- package/lib/src/generated/api/PerspectiveMintFlowReceiptResult.js +1 -0
- package/lib/src/generated/api/PerspectiveModelQueryParams.d.ts +13 -0
- package/lib/src/generated/api/PerspectiveModelQueryParams.js +2 -0
- package/lib/src/generated/api/PerspectiveNamedShacl.d.ts +6 -0
- package/lib/src/generated/api/PerspectiveNamedShacl.js +1 -0
- package/lib/src/generated/api/PerspectiveProposeFlowTransitionParams.d.ts +8 -0
- package/lib/src/generated/api/PerspectiveProposeFlowTransitionParams.js +1 -0
- package/lib/src/generated/api/PerspectiveQueryLinksParams.d.ts +15 -0
- package/lib/src/generated/api/PerspectiveQueryLinksParams.js +2 -0
- package/lib/src/generated/api/PerspectiveQueryParams.d.ts +4 -0
- package/lib/src/generated/api/PerspectiveQueryParams.js +2 -0
- package/lib/src/generated/api/PerspectiveReceiptOutcome.d.ts +1 -0
- package/lib/src/generated/api/PerspectiveReceiptOutcome.js +2 -0
- package/lib/src/generated/api/PerspectiveRejectFlowProposalResult.d.ts +3 -0
- package/lib/src/generated/api/PerspectiveRejectFlowProposalResult.js +2 -0
- package/lib/src/generated/api/PerspectiveRemoveAutoProcessorParams.d.ts +4 -0
- package/lib/src/generated/api/PerspectiveRemoveAutoProcessorParams.js +2 -0
- package/lib/src/generated/api/PerspectiveRemoveLinkParams.d.ts +6 -0
- package/lib/src/generated/api/PerspectiveRemoveLinkParams.js +1 -0
- package/lib/src/generated/api/PerspectiveRemoveLinksParams.d.ts +6 -0
- package/lib/src/generated/api/PerspectiveRemoveLinksParams.js +1 -0
- package/lib/src/generated/api/PerspectiveRemoveSubjectParams.d.ts +6 -0
- package/lib/src/generated/api/PerspectiveRemoveSubjectParams.js +2 -0
- package/lib/src/generated/api/PerspectiveRemovedWithOwner.d.ts +5 -0
- package/lib/src/generated/api/PerspectiveRemovedWithOwner.js +2 -0
- package/lib/src/generated/api/PerspectiveResolveInterpretationParams.d.ts +8 -0
- package/lib/src/generated/api/PerspectiveResolveInterpretationParams.js +2 -0
- package/lib/src/generated/api/PerspectiveResynced.d.ts +8 -0
- package/lib/src/generated/api/PerspectiveResynced.js +2 -0
- package/lib/src/generated/api/PerspectiveShacl.d.ts +5 -0
- package/lib/src/generated/api/PerspectiveShacl.js +1 -0
- package/lib/src/generated/api/PerspectiveShaclNameParams.d.ts +4 -0
- package/lib/src/generated/api/PerspectiveShaclNameParams.js +2 -0
- package/lib/src/generated/api/PerspectiveSparqlParams.d.ts +8 -0
- package/lib/src/generated/api/PerspectiveSparqlParams.js +2 -0
- package/lib/src/generated/api/PerspectiveState.d.ts +1 -0
- package/lib/src/generated/api/PerspectiveState.js +2 -0
- package/lib/src/generated/api/PerspectiveStateFilter.d.ts +7 -0
- package/lib/src/generated/api/PerspectiveStateFilter.js +1 -0
- package/lib/src/generated/api/PerspectiveSubjectClassesOfParams.d.ts +4 -0
- package/lib/src/generated/api/PerspectiveSubjectClassesOfParams.js +2 -0
- package/lib/src/generated/api/PerspectiveSubscribed.d.ts +10 -0
- package/lib/src/generated/api/PerspectiveSubscribed.js +2 -0
- package/lib/src/generated/api/PerspectiveSubscriptionParams.d.ts +4 -0
- package/lib/src/generated/api/PerspectiveSubscriptionParams.js +2 -0
- package/lib/src/generated/api/PerspectiveUnsignedInput.d.ts +4 -0
- package/lib/src/generated/api/PerspectiveUnsignedInput.js +1 -0
- package/lib/src/generated/api/PerspectiveUpdateLinkParams.d.ts +8 -0
- package/lib/src/generated/api/PerspectiveUpdateLinkParams.js +1 -0
- package/lib/src/generated/api/PerspectiveUpdateParams.d.ts +4 -0
- package/lib/src/generated/api/PerspectiveUpdateParams.js +2 -0
- package/lib/src/generated/api/PerspectiveUpdateSubjectParams.d.ts +10 -0
- package/lib/src/generated/api/PerspectiveUpdateSubjectParams.js +2 -0
- package/lib/src/generated/api/PerspectiveUuidParams.d.ts +3 -0
- package/lib/src/generated/api/PerspectiveUuidParams.js +2 -0
- package/lib/src/generated/api/PerspectiveVerifyFlowReceiptParams.d.ts +9 -0
- package/lib/src/generated/api/PerspectiveVerifyFlowReceiptParams.js +1 -0
- package/lib/src/generated/api/PerspectiveWithOwner.d.ts +6 -0
- package/lib/src/generated/api/PerspectiveWithOwner.js +1 -0
- package/lib/src/generated/api/ProposeOutcome.d.ts +45 -0
- package/lib/src/generated/api/ProposeOutcome.js +1 -0
- package/lib/src/generated/api/PublicPerspectiveInput.d.ts +4 -0
- package/lib/src/generated/api/PublicPerspectiveInput.js +1 -0
- package/lib/src/generated/api/PublishNeighbourhoodRequest.d.ts +2 -2
- package/lib/src/generated/api/QuerySubscriptionUpdate.d.ts +19 -0
- package/lib/src/generated/api/QuerySubscriptionUpdate.js +2 -0
- package/lib/src/generated/api/QuerySubscriptionUpdateEvent.d.ts +7 -0
- package/lib/src/generated/api/QuerySubscriptionUpdateEvent.js +1 -0
- package/lib/src/generated/api/QueryUpdatesLagged.d.ts +7 -0
- package/lib/src/generated/api/QueryUpdatesLagged.js +2 -0
- package/lib/src/generated/api/RemoveLinkRequest.d.ts +1 -1
- package/lib/src/generated/api/RemoveLinksBulkRequest.d.ts +1 -1
- package/lib/src/generated/api/RemoveSubjectRequest.d.ts +9 -0
- package/lib/src/generated/api/RemoveSubjectRequest.js +2 -0
- package/lib/src/generated/api/RequestCapabilityRequest.d.ts +4 -0
- package/lib/src/generated/api/RequestCapabilityRequest.js +1 -0
- package/lib/src/generated/api/RequestPaymentRequest.d.ts +3 -0
- package/lib/src/generated/api/RequestPaymentRequest.js +2 -0
- package/lib/src/generated/api/Resource.d.ts +4 -0
- package/lib/src/generated/api/Resource.js +2 -0
- package/lib/src/generated/api/ResyncSubscriptionRequest.d.ts +3 -0
- package/lib/src/generated/api/ResyncSubscriptionRequest.js +2 -0
- package/lib/src/generated/api/RpcMethods.d.ts +961 -0
- package/lib/src/generated/api/RpcMethods.js +98 -0
- package/lib/src/generated/api/RunInterpretationRequest.d.ts +27 -1
- package/lib/src/generated/api/RunInterpretationWithHarnessRequest.d.ts +52 -0
- package/lib/src/generated/api/RunInterpretationWithHarnessRequest.js +1 -0
- package/lib/src/generated/api/RuntimeComputeLogParams.d.ts +14 -0
- package/lib/src/generated/api/RuntimeComputeLogParams.js +2 -0
- package/lib/src/generated/api/RuntimeFriendStatusParams.d.ts +3 -0
- package/lib/src/generated/api/RuntimeFriendStatusParams.js +2 -0
- package/lib/src/generated/api/RuntimeGrantNotificationParams.d.ts +4 -0
- package/lib/src/generated/api/RuntimeGrantNotificationParams.js +2 -0
- package/lib/src/generated/api/RuntimeImportPerspectiveResult.d.ts +4 -0
- package/lib/src/generated/api/RuntimeImportPerspectiveResult.js +2 -0
- package/lib/src/generated/api/RuntimeImportResult.d.ts +6 -0
- package/lib/src/generated/api/RuntimeImportResult.js +1 -0
- package/lib/src/generated/api/RuntimeInfo.d.ts +5 -0
- package/lib/src/generated/api/RuntimeInfo.js +2 -0
- package/lib/src/generated/api/RuntimeNotificationIdParams.d.ts +3 -0
- package/lib/src/generated/api/RuntimeNotificationIdParams.js +2 -0
- package/lib/src/generated/api/RuntimeSendFriendMessageParams.d.ts +8 -0
- package/lib/src/generated/api/RuntimeSendFriendMessageParams.js +1 -0
- package/lib/src/generated/api/RuntimeSetFreeHostingEnabledParams.d.ts +3 -0
- package/lib/src/generated/api/RuntimeSetFreeHostingEnabledParams.js +2 -0
- package/lib/src/generated/api/RuntimeUnytSendHotParams.d.ts +4 -0
- package/lib/src/generated/api/RuntimeUnytSendHotParams.js +2 -0
- package/lib/src/generated/api/RuntimeUnytWalletHistoryParams.d.ts +4 -0
- package/lib/src/generated/api/RuntimeUnytWalletHistoryParams.js +2 -0
- package/lib/src/generated/api/RuntimeUpdateNotificationParams.d.ts +11 -0
- package/lib/src/generated/api/RuntimeUpdateNotificationParams.js +2 -0
- package/lib/src/generated/api/SentMessage.d.ts +5 -0
- package/lib/src/generated/api/SentMessage.js +1 -0
- package/lib/src/generated/api/SetHostRatesRequest.d.ts +4 -0
- package/lib/src/generated/api/SetHostRatesRequest.js +1 -0
- package/lib/src/generated/api/SetHotWalletAddressRequest.d.ts +3 -0
- package/lib/src/generated/api/SetHotWalletAddressRequest.js +2 -0
- package/lib/src/generated/api/SetOnlineStatusRequest.d.ts +4 -0
- package/lib/src/generated/api/SetOnlineStatusRequest.js +2 -0
- package/lib/src/generated/api/SetUnytMembraneProofRequest.d.ts +6 -0
- package/lib/src/generated/api/SetUnytMembraneProofRequest.js +2 -0
- package/lib/src/generated/api/SetUserFreeAccessRequest.d.ts +4 -0
- package/lib/src/generated/api/SetUserFreeAccessRequest.js +2 -0
- package/lib/src/generated/api/SfuAddIceCandidateParams.d.ts +8 -0
- package/lib/src/generated/api/SfuAddIceCandidateParams.js +2 -0
- package/lib/src/generated/api/SfuAnswerServerOfferParams.d.ts +8 -0
- package/lib/src/generated/api/SfuAnswerServerOfferParams.js +2 -0
- package/lib/src/generated/api/SfuCallJoinParams.d.ts +14 -0
- package/lib/src/generated/api/SfuCallJoinParams.js +2 -0
- package/lib/src/generated/api/SfuCallRenegotiationOffer.d.ts +30 -0
- package/lib/src/generated/api/SfuCallRenegotiationOffer.js +1 -0
- package/lib/src/generated/api/SfuCascadePipe.d.ts +4 -0
- package/lib/src/generated/api/SfuCascadePipe.js +2 -0
- package/lib/src/generated/api/SfuCascadeStatus.d.ts +8 -0
- package/lib/src/generated/api/SfuCascadeStatus.js +1 -0
- package/lib/src/generated/api/SfuConfig.d.ts +52 -0
- package/lib/src/generated/api/SfuConfig.js +1 -0
- package/lib/src/generated/api/SfuDataMessage.d.ts +24 -0
- package/lib/src/generated/api/SfuDataMessage.js +2 -0
- package/lib/src/generated/api/SfuEnsureMembershipParams.d.ts +4 -0
- package/lib/src/generated/api/SfuEnsureMembershipParams.js +2 -0
- package/lib/src/generated/api/SfuMigrateEvent.d.ts +21 -0
- package/lib/src/generated/api/SfuMigrateEvent.js +2 -0
- package/lib/src/generated/api/SfuNeighbourhoodParams.d.ts +3 -0
- package/lib/src/generated/api/SfuNeighbourhoodParams.js +2 -0
- package/lib/src/generated/api/SfuParticipantQualityPreference.d.ts +7 -0
- package/lib/src/generated/api/SfuParticipantQualityPreference.js +2 -0
- package/lib/src/generated/api/SfuPerspectiveParams.d.ts +6 -0
- package/lib/src/generated/api/SfuPerspectiveParams.js +2 -0
- package/lib/src/generated/api/SfuQualityPreferenceParams.d.ts +8 -0
- package/lib/src/generated/api/SfuQualityPreferenceParams.js +2 -0
- package/lib/src/generated/api/SfuRoomInfo.d.ts +11 -0
- package/lib/src/generated/api/SfuRoomInfo.js +1 -0
- package/lib/src/generated/api/SfuRoomParams.d.ts +4 -0
- package/lib/src/generated/api/SfuRoomParams.js +2 -0
- package/lib/src/generated/api/SfuRoomParticipantInfo.d.ts +11 -0
- package/lib/src/generated/api/SfuRoomParticipantInfo.js +2 -0
- package/lib/src/generated/api/SfuRoomRoster.d.ts +13 -0
- package/lib/src/generated/api/SfuRoomRoster.js +2 -0
- package/lib/src/generated/api/SfuSendDataParams.d.ts +10 -0
- package/lib/src/generated/api/SfuSendDataParams.js +2 -0
- package/lib/src/generated/api/SfuSetConfigParams.d.ts +5 -0
- package/lib/src/generated/api/SfuSetConfigParams.js +1 -0
- package/lib/src/generated/api/SfuStatus.d.ts +24 -0
- package/lib/src/generated/api/SfuStatus.js +2 -0
- package/lib/src/generated/api/ShaclLinkTriple.d.ts +10 -0
- package/lib/src/generated/api/ShaclLinkTriple.js +2 -0
- package/lib/src/generated/api/SignalRequest.d.ts +5 -0
- package/lib/src/generated/api/SignalRequest.js +2 -0
- package/lib/src/generated/api/SubscribeQueryRequest.d.ts +3 -0
- package/lib/src/generated/api/SubscribeQueryRequest.js +2 -0
- package/lib/src/generated/api/TokenizerSource.d.ts +5 -0
- package/lib/src/generated/api/TokenizerSource.js +2 -0
- package/lib/src/generated/api/TokenizerSourceInput.d.ts +5 -0
- package/lib/src/generated/api/TokenizerSourceInput.js +2 -0
- package/lib/src/generated/api/TrackMapEntry.d.ts +17 -0
- package/lib/src/generated/api/TrackMapEntry.js +2 -0
- package/lib/src/generated/api/TranscriptionTextFilter.d.ts +5 -0
- package/lib/src/generated/api/TranscriptionTextFilter.js +2 -0
- package/lib/src/generated/api/TriggeredNotification.d.ts +6 -0
- package/lib/src/generated/api/TriggeredNotification.js +1 -0
- package/lib/src/generated/api/TrustedAgentsWrapper.d.ts +6 -0
- package/lib/src/generated/api/TrustedAgentsWrapper.js +2 -0
- package/lib/src/generated/api/UnlockAgentRequest.d.ts +1 -1
- package/lib/src/generated/api/UnytVersionInfo.d.ts +19 -0
- package/lib/src/generated/api/UnytVersionInfo.js +2 -0
- package/lib/src/generated/api/UpdateLinkRequest.d.ts +1 -1
- package/lib/src/generated/api/UpdateProfileRequest.d.ts +5 -0
- package/lib/src/generated/api/UpdateProfileRequest.js +1 -0
- package/lib/src/generated/api/UpdateSubjectRequest.d.ts +12 -0
- package/lib/src/generated/api/UpdateSubjectRequest.js +2 -0
- package/lib/src/generated/api/UserCreationResult.d.ts +5 -0
- package/lib/src/generated/api/UserCreationResult.js +2 -0
- package/lib/src/generated/api/UserStatistics.d.ts +2 -1
- package/lib/src/generated/api/UserStatistics.js +0 -1
- package/lib/src/generated/api/UsersAppInfo.d.ts +6 -0
- package/lib/src/generated/api/UsersAppInfo.js +2 -0
- package/lib/src/generated/api/UsersEmailParams.d.ts +3 -0
- package/lib/src/generated/api/UsersEmailParams.js +2 -0
- package/lib/src/generated/api/UsersEmailTestAction.d.ts +1 -0
- package/lib/src/generated/api/UsersEmailTestAction.js +2 -0
- package/lib/src/generated/api/UsersEmailTestParams.d.ts +14 -0
- package/lib/src/generated/api/UsersEmailTestParams.js +1 -0
- package/lib/src/generated/api/UsersEmailTestResult.d.ts +5 -0
- package/lib/src/generated/api/UsersEmailTestResult.js +2 -0
- package/lib/src/generated/api/UsersLoginParams.d.ts +8 -0
- package/lib/src/generated/api/UsersLoginParams.js +2 -0
- package/lib/src/generated/api/UsersRequestVerificationParams.d.ts +5 -0
- package/lib/src/generated/api/UsersRequestVerificationParams.js +1 -0
- package/lib/src/generated/api/UsersSetCreditsParams.d.ts +4 -0
- package/lib/src/generated/api/UsersSetCreditsParams.js +2 -0
- package/lib/src/generated/api/UsersVerifyEmailParams.d.ts +12 -0
- package/lib/src/generated/api/UsersVerifyEmailParams.js +2 -0
- package/lib/src/generated/api/ValidOutput.d.ts +29 -0
- package/lib/src/generated/api/ValidOutput.js +1 -0
- package/lib/src/generated/api/VoiceActivityParamsInput.d.ts +7 -0
- package/lib/src/generated/api/VoiceActivityParamsInput.js +2 -0
- package/lib/src/generated/api/index.d.ts +11 -0
- package/lib/src/generated/api/index.js +5 -3
- package/lib/src/generated/api/serde_json/JsonValue.d.ts +3 -0
- package/lib/src/generated/api/serde_json/JsonValue.js +2 -0
- package/lib/src/index.d.ts +9 -3
- package/lib/src/index.js +5 -3
- package/lib/src/language/LanguageClient.d.ts +3 -3
- package/lib/src/language/LanguageClient.js +6 -6
- package/lib/src/language/LanguageMeta.d.ts +1 -1
- package/lib/src/links/Links.d.ts +16 -5
- package/lib/src/links/Links.js +34 -0
- package/lib/src/model/Ad4mModel.d.ts +84 -0
- package/lib/src/model/Ad4mModel.js +365 -72
- package/lib/src/model/ModelQueryBuilder.d.ts +15 -13
- package/lib/src/model/ModelQueryBuilder.js +78 -221
- package/lib/src/model/decorators.d.ts +52 -2
- package/lib/src/model/decorators.js +83 -8
- package/lib/src/model/query-sparql.js +2 -3
- package/lib/src/model/shacl-gen.d.ts +3 -1
- package/lib/src/model/shacl-gen.js +40 -10
- package/lib/src/model/types.d.ts +19 -0
- package/lib/src/neighbourhood/MeshManager.d.ts +384 -0
- package/lib/src/neighbourhood/MeshManager.js +1144 -0
- package/lib/src/neighbourhood/Neighbourhood.d.ts +1 -1
- package/lib/src/neighbourhood/NeighbourhoodClient.d.ts +96 -5
- package/lib/src/neighbourhood/NeighbourhoodClient.js +211 -15
- package/lib/src/neighbourhood/NeighbourhoodProxy.d.ts +55 -1
- package/lib/src/neighbourhood/NeighbourhoodProxy.js +170 -3
- package/lib/src/neighbourhood/Session.d.ts +105 -0
- package/lib/src/neighbourhood/Session.js +412 -0
- package/lib/src/neighbourhood/SfuManager.d.ts +174 -0
- package/lib/src/neighbourhood/SfuManager.js +619 -0
- package/lib/src/neighbourhood/SfuTypes.d.ts +35 -0
- package/lib/src/neighbourhood/SfuTypes.js +8 -0
- package/lib/src/notifyListeners.d.ts +2 -0
- package/lib/src/notifyListeners.js +12 -0
- package/lib/src/perspectives/AutoProcessor.d.ts +12 -80
- package/lib/src/perspectives/FlowInstance.d.ts +73 -26
- package/lib/src/perspectives/FlowInstance.js +96 -31
- package/lib/src/perspectives/FlowModels.d.ts +30 -9
- package/lib/src/perspectives/FlowModels.js +43 -14
- package/lib/src/perspectives/InterpretationModels.d.ts +2 -0
- package/lib/src/perspectives/InterpretationModels.js +6 -0
- package/lib/src/perspectives/LiveQuery.d.ts +49 -0
- package/lib/src/perspectives/LiveQuery.js +169 -0
- package/lib/src/perspectives/Perspective.d.ts +8 -1
- package/lib/src/perspectives/Perspective.js +11 -0
- package/lib/src/perspectives/PerspectiveClient.d.ts +38 -65
- package/lib/src/perspectives/PerspectiveClient.js +87 -257
- package/lib/src/perspectives/PerspectiveDiff.d.ts +1 -1
- package/lib/src/perspectives/PerspectiveHandle.d.ts +15 -8
- package/lib/src/perspectives/PerspectiveHandle.js +25 -9
- package/lib/src/perspectives/PerspectiveProxy.d.ts +102 -228
- package/lib/src/perspectives/PerspectiveProxy.js +247 -673
- package/lib/src/perspectives/TextContent.d.ts +31 -0
- package/lib/src/perspectives/TextContent.js +52 -0
- package/lib/src/perspectives/WakerSubscriptionManager.d.ts +23 -0
- package/lib/src/perspectives/WakerSubscriptionManager.js +58 -21
- package/lib/src/runtime/RuntimeClient.d.ts +15 -27
- package/lib/src/runtime/RuntimeClient.js +57 -113
- package/lib/src/runtime/RuntimeTypes.d.ts +2 -2
- package/lib/src/runtime/RuntimeTypes.js +2 -2
- package/lib/src/shacl/SHACLFlow.d.ts +34 -6
- package/lib/src/shacl/SHACLFlow.js +62 -15
- package/lib/src/shacl/SHACLShape.d.ts +12 -0
- package/lib/src/shacl/SHACLShape.js +206 -321
- package/package.json +15 -16
- package/pnpm-workspace.yaml +4 -1
- package/src/Ad4mClient.test.ts +481 -144
- package/src/Ad4mClient.ts +16 -12
- package/src/Literal.test.ts +32 -0
- package/src/Literal.ts +3 -3
- package/src/agent/Agent.ts +8 -0
- package/src/agent/AgentClient.ts +87 -195
- package/src/agent/mutatePublicPerspective.test.ts +110 -0
- package/src/ai/AIClient.ts +40 -43
- package/src/ai/transcription-stream.test.ts +54 -0
- package/src/apiClient.test.ts +613 -185
- package/src/apiClient.ts +282 -288
- package/src/cache/cache.test.ts +7 -8
- package/src/expression/Expression.ts +12 -3
- package/src/expression/ExpressionClient.ts +6 -7
- package/src/generated/api/AIPromptExamples.ts +3 -0
- package/src/generated/api/AIPromptExamplesInput.ts +3 -0
- package/src/generated/api/AITask.ts +4 -0
- package/src/generated/api/AITaskInput.ts +4 -0
- package/src/generated/api/AddAgentInfosRequest.ts +3 -0
- package/src/generated/api/AddLinkExpressionRequest.ts +1 -1
- package/src/generated/api/AddLinkRequest.ts +1 -1
- package/src/generated/api/AddLinksBulkRequest.ts +1 -1
- package/src/generated/api/AddSdnaRequest.ts +1 -1
- package/src/generated/api/Agent.ts +4 -0
- package/src/generated/api/AgentAddEntanglementProofsParams.ts +8 -0
- package/src/generated/api/AgentByDidParams.ts +3 -0
- package/src/generated/api/AgentRemoveAppParams.ts +3 -0
- package/src/generated/api/AgentRevokeTokenParams.ts +3 -0
- package/src/generated/api/AgentSignature.ts +3 -0
- package/src/generated/api/AgentStatus.ts +4 -0
- package/src/generated/api/AgentStatusChangedEvent.ts +7 -0
- package/src/generated/api/AgentUpdatedEvent.ts +7 -0
- package/src/generated/api/AgentsByDidsRequest.ts +3 -0
- package/src/generated/api/AiAddModelParams.ts +4 -0
- package/src/generated/api/AiAddTaskParams.ts +4 -0
- package/src/generated/api/AiDiscoverModelsParams.ts +7 -0
- package/src/generated/api/AiGetDefaultModelParams.ts +4 -0
- package/src/generated/api/AiIdParams.ts +3 -0
- package/src/generated/api/AiModelLoadingStatusParams.ts +6 -0
- package/src/generated/api/AiSetDefaultModelParams.ts +4 -0
- package/src/generated/api/AiTranscriptionCloseParams.ts +3 -0
- package/src/generated/api/AiTranscriptionOpenParams.ts +4 -0
- package/src/generated/api/AiUpdateModelParams.ts +4 -0
- package/src/generated/api/AiUpdateTaskParams.ts +4 -0
- package/src/generated/api/Apps.ts +4 -0
- package/src/generated/api/AuthInfo.ts +4 -0
- package/src/generated/api/AuthInfoInput.ts +1 -1
- package/src/generated/api/AutoProcessorEvent.ts +90 -0
- package/src/generated/api/AutoProcessorNeighbourhoodState.ts +33 -0
- package/src/generated/api/AutoProcessorStep.ts +9 -0
- package/src/generated/api/BroadcastRequest.ts +3 -0
- package/src/generated/api/CallSessionInfo.ts +20 -0
- package/src/generated/api/Capability.ts +4 -0
- package/src/generated/api/CreateSubjectRequest.ts +1 -1
- package/src/generated/api/CreateUserRequest.ts +3 -0
- package/src/generated/api/DateTime.ts +3 -0
- package/src/generated/api/DecoratedExpressionProof.ts +3 -0
- package/src/generated/api/DecoratedLinkExpression.ts +6 -0
- package/src/generated/api/DecoratedNeighbourhoodExpression.ts +5 -0
- package/src/generated/api/DecoratedPerspective.ts +4 -0
- package/src/generated/api/DiscardBatchRequest.ts +3 -0
- package/src/generated/api/DisposeQueryRequest.ts +3 -0
- package/src/generated/api/EntanglementProof.ts +3 -0
- package/src/generated/api/EntanglementProofInput.ts +1 -1
- package/src/generated/api/EntanglementProofPreflightRequest.ts +3 -0
- package/src/generated/api/EntanglementProofsWrapper.ts +7 -0
- package/src/generated/api/Events.ts +77 -0
- package/src/generated/api/ExceptionInfo.ts +4 -0
- package/src/generated/api/ExceptionOccurredEvent.ts +7 -0
- package/src/generated/api/ExceptionType.ts +3 -0
- package/src/generated/api/ExecuteCommandsRequest.ts +1 -1
- package/src/generated/api/ExportRequest.ts +1 -1
- package/src/generated/api/ExpressionInteractRequest.ts +4 -0
- package/src/generated/api/ExpressionProofInput.ts +1 -1
- package/src/generated/api/ExpressionRendered.ts +6 -0
- package/src/generated/api/ExpressionUrlRequest.ts +3 -0
- package/src/generated/api/FireOutcome.ts +11 -0
- package/src/generated/api/FlowStateChangedEvent.ts +36 -0
- package/src/generated/api/FlowStateEntry.ts +18 -0
- package/src/generated/api/FriendSendMessageRequest.ts +1 -1
- package/src/generated/api/HostRate.ts +6 -0
- package/src/generated/api/HostingInfoResult.ts +13 -0
- package/src/generated/api/HostingInfoUser.ts +7 -0
- package/src/generated/api/HostingRequestPaymentResult.ts +3 -0
- package/src/generated/api/HostingUserInfo.ts +3 -0
- package/src/generated/api/HostingVersionInfo.ts +7 -0
- package/src/generated/api/HostingWalletResult.ts +8 -0
- package/src/generated/api/IceServer.ts +19 -0
- package/src/generated/api/Icon.ts +3 -0
- package/src/generated/api/ImportResult.ts +4 -0
- package/src/generated/api/ImportStats.ts +3 -0
- package/src/generated/api/InteractionCall.ts +3 -0
- package/src/generated/api/InteractionCallWrapper.ts +6 -0
- package/src/generated/api/InteractionMeta.ts +4 -0
- package/src/generated/api/InteractionParameter.ts +3 -0
- package/src/generated/api/LanguageAddressParams.ts +3 -0
- package/src/generated/api/LanguageHandle.ts +4 -0
- package/src/generated/api/LanguageListParams.ts +3 -0
- package/src/generated/api/LanguageMeta.ts +3 -0
- package/src/generated/api/LanguageMetaInput.ts +1 -1
- package/src/generated/api/LanguageRef.ts +3 -0
- package/src/generated/api/LanguageSettingsWrapper.ts +6 -0
- package/src/generated/api/LanguageWriteSettingsParams.ts +3 -0
- package/src/generated/api/LinkExpressionInput.ts +1 -1
- package/src/generated/api/LinkInput.ts +1 -1
- package/src/generated/api/LinkMutationRequest.ts +8 -0
- package/src/generated/api/LinkMutationsRequest.ts +4 -0
- package/src/generated/api/LinkStatus.ts +1 -1
- package/src/generated/api/LinkUpdateInput.ts +4 -0
- package/src/generated/api/LocalModel.ts +4 -0
- package/src/generated/api/LocalModelInput.ts +4 -0
- package/src/generated/api/MessageReceivedEvent.ts +7 -0
- package/src/generated/api/Model.ts +6 -0
- package/src/generated/api/ModelApi.ts +14 -0
- package/src/generated/api/ModelApiInput.ts +8 -0
- package/src/generated/api/ModelApiType.ts +3 -0
- package/src/generated/api/ModelInput.ts +6 -0
- package/src/generated/api/ModelType.ts +1 -1
- package/src/generated/api/Neighbourhood.ts +4 -0
- package/src/generated/api/NeighbourhoodBroadcastParams.ts +4 -0
- package/src/generated/api/NeighbourhoodOnlineStatusParams.ts +4 -0
- package/src/generated/api/NeighbourhoodPerspectivePayload.ts +9 -0
- package/src/generated/api/NeighbourhoodPhase.ts +8 -0
- package/src/generated/api/NeighbourhoodSignalFilter.ts +5 -0
- package/src/generated/api/NeighbourhoodSignalParams.ts +4 -0
- package/src/generated/api/NeighbourhoodSignedPerspective.ts +8 -0
- package/src/generated/api/NeighbourhoodUuidParams.ts +3 -0
- package/src/generated/api/Notification.ts +7 -0
- package/src/generated/api/NotificationGrantRequest.ts +6 -0
- package/src/generated/api/NotificationInput.ts +1 -1
- package/src/generated/api/NotificationTriggeredEvent.ts +8 -0
- package/src/generated/api/OnlineAgent.ts +9 -0
- package/src/generated/api/OutputRef.ts +11 -0
- package/src/generated/api/OverlayView.ts +25 -0
- package/src/generated/api/Perspective.ts +4 -0
- package/src/generated/api/PerspectiveAddAutoProcessorParams.ts +11 -0
- package/src/generated/api/PerspectiveAddLinkExpressionParams.ts +4 -0
- package/src/generated/api/PerspectiveAddLinkParams.ts +4 -0
- package/src/generated/api/PerspectiveAddLinksParams.ts +4 -0
- package/src/generated/api/PerspectiveAddSdnaParams.ts +7 -0
- package/src/generated/api/PerspectiveAddSdnaResult.ts +6 -0
- package/src/generated/api/PerspectiveCommitBatchParams.ts +3 -0
- package/src/generated/api/PerspectiveCreateSubjectParams.ts +3 -0
- package/src/generated/api/PerspectiveDiscardBatchParams.ts +3 -0
- package/src/generated/api/PerspectiveEvaluateGettersParams.ts +6 -0
- package/src/generated/api/PerspectiveExecuteCommandsParams.ts +3 -0
- package/src/generated/api/PerspectiveExpression.ts +5 -0
- package/src/generated/api/PerspectiveFlowFiredParams.ts +7 -0
- package/src/generated/api/PerspectiveFlowProposalParams.ts +3 -0
- package/src/generated/api/PerspectiveFlowReceiptVerdict.ts +8 -0
- package/src/generated/api/PerspectiveFlowStatesParams.ts +11 -0
- package/src/generated/api/PerspectiveFlowValidOutputsParams.ts +7 -0
- package/src/generated/api/PerspectiveGetAllShaclParams.ts +6 -0
- package/src/generated/api/PerspectiveGetSubjectDataParams.ts +3 -0
- package/src/generated/api/PerspectiveHandle.ts +5 -0
- package/src/generated/api/PerspectiveLinkDiff.ts +7 -0
- package/src/generated/api/PerspectiveLinkMutationsParams.ts +4 -0
- package/src/generated/api/PerspectiveLinkUpdatedWithOwner.ts +4 -0
- package/src/generated/api/PerspectiveLinkWithOwner.ts +4 -0
- package/src/generated/api/PerspectiveMintFlowReceiptParams.ts +3 -0
- package/src/generated/api/PerspectiveMintFlowReceiptResult.ts +9 -0
- package/src/generated/api/PerspectiveModelQueryParams.ts +10 -0
- package/src/generated/api/PerspectiveNamedShacl.ts +4 -0
- package/src/generated/api/PerspectiveProposeFlowTransitionParams.ts +4 -0
- package/src/generated/api/PerspectiveQueryLinksParams.ts +11 -0
- package/src/generated/api/PerspectiveQueryParams.ts +3 -0
- package/src/generated/api/PerspectiveReceiptOutcome.ts +3 -0
- package/src/generated/api/PerspectiveRejectFlowProposalResult.ts +3 -0
- package/src/generated/api/PerspectiveRemoveAutoProcessorParams.ts +3 -0
- package/src/generated/api/PerspectiveRemoveLinkParams.ts +4 -0
- package/src/generated/api/PerspectiveRemoveLinksParams.ts +4 -0
- package/src/generated/api/PerspectiveRemoveSubjectParams.ts +3 -0
- package/src/generated/api/PerspectiveRemovedWithOwner.ts +3 -0
- package/src/generated/api/PerspectiveResolveInterpretationParams.ts +6 -0
- package/src/generated/api/PerspectiveResynced.ts +7 -0
- package/src/generated/api/PerspectiveShacl.ts +4 -0
- package/src/generated/api/PerspectiveShaclNameParams.ts +3 -0
- package/src/generated/api/PerspectiveSparqlParams.ts +7 -0
- package/src/generated/api/PerspectiveState.ts +3 -0
- package/src/generated/api/PerspectiveStateFilter.ts +5 -0
- package/src/generated/api/PerspectiveSubjectClassesOfParams.ts +3 -0
- package/src/generated/api/PerspectiveSubscribed.ts +8 -0
- package/src/generated/api/PerspectiveSubscriptionParams.ts +3 -0
- package/src/generated/api/PerspectiveUnsignedInput.ts +4 -0
- package/src/generated/api/PerspectiveUpdateLinkParams.ts +5 -0
- package/src/generated/api/PerspectiveUpdateParams.ts +3 -0
- package/src/generated/api/PerspectiveUpdateSubjectParams.ts +7 -0
- package/src/generated/api/PerspectiveUuidParams.ts +3 -0
- package/src/generated/api/PerspectiveVerifyFlowReceiptParams.ts +9 -0
- package/src/generated/api/PerspectiveWithOwner.ts +4 -0
- package/src/generated/api/ProposeOutcome.ts +46 -0
- package/src/generated/api/PublicPerspectiveInput.ts +4 -0
- package/src/generated/api/PublishNeighbourhoodRequest.ts +2 -2
- package/src/generated/api/QuerySubscriptionUpdate.ts +10 -0
- package/src/generated/api/QuerySubscriptionUpdateEvent.ts +9 -0
- package/src/generated/api/QueryUpdatesLagged.ts +7 -0
- package/src/generated/api/RemoveLinkRequest.ts +1 -1
- package/src/generated/api/RemoveLinksBulkRequest.ts +1 -1
- package/src/generated/api/RemoveSubjectRequest.ts +7 -0
- package/src/generated/api/RequestCapabilityRequest.ts +4 -0
- package/src/generated/api/RequestPaymentRequest.ts +3 -0
- package/src/generated/api/Resource.ts +3 -0
- package/src/generated/api/ResyncSubscriptionRequest.ts +3 -0
- package/src/generated/api/RpcMethods.ts +479 -0
- package/src/generated/api/RunInterpretationRequest.ts +28 -2
- package/src/generated/api/RunInterpretationWithHarnessRequest.ts +51 -0
- package/src/generated/api/RuntimeComputeLogParams.ts +15 -0
- package/src/generated/api/RuntimeFriendStatusParams.ts +3 -0
- package/src/generated/api/RuntimeGrantNotificationParams.ts +3 -0
- package/src/generated/api/RuntimeImportPerspectiveResult.ts +3 -0
- package/src/generated/api/RuntimeImportResult.ts +8 -0
- package/src/generated/api/RuntimeInfo.ts +3 -0
- package/src/generated/api/RuntimeNotificationIdParams.ts +3 -0
- package/src/generated/api/RuntimeSendFriendMessageParams.ts +8 -0
- package/src/generated/api/RuntimeSetFreeHostingEnabledParams.ts +3 -0
- package/src/generated/api/RuntimeUnytSendHotParams.ts +3 -0
- package/src/generated/api/RuntimeUnytWalletHistoryParams.ts +3 -0
- package/src/generated/api/RuntimeUpdateNotificationParams.ts +3 -0
- package/src/generated/api/SentMessage.ts +4 -0
- package/src/generated/api/SetHostRatesRequest.ts +4 -0
- package/src/generated/api/SetHotWalletAddressRequest.ts +3 -0
- package/src/generated/api/SetOnlineStatusRequest.ts +3 -0
- package/src/generated/api/SetUnytMembraneProofRequest.ts +7 -0
- package/src/generated/api/SetUserFreeAccessRequest.ts +3 -0
- package/src/generated/api/SfuAddIceCandidateParams.ts +7 -0
- package/src/generated/api/SfuAnswerServerOfferParams.ts +7 -0
- package/src/generated/api/SfuCallJoinParams.ts +13 -0
- package/src/generated/api/SfuCallRenegotiationOffer.ts +29 -0
- package/src/generated/api/SfuCascadePipe.ts +3 -0
- package/src/generated/api/SfuCascadeStatus.ts +7 -0
- package/src/generated/api/SfuConfig.ts +53 -0
- package/src/generated/api/SfuDataMessage.ts +23 -0
- package/src/generated/api/SfuEnsureMembershipParams.ts +3 -0
- package/src/generated/api/SfuMigrateEvent.ts +20 -0
- package/src/generated/api/SfuNeighbourhoodParams.ts +3 -0
- package/src/generated/api/SfuParticipantQualityPreference.ts +6 -0
- package/src/generated/api/SfuPerspectiveParams.ts +6 -0
- package/src/generated/api/SfuQualityPreferenceParams.ts +7 -0
- package/src/generated/api/SfuRoomInfo.ts +7 -0
- package/src/generated/api/SfuRoomParams.ts +3 -0
- package/src/generated/api/SfuRoomParticipantInfo.ts +8 -0
- package/src/generated/api/SfuRoomRoster.ts +12 -0
- package/src/generated/api/SfuSendDataParams.ts +7 -0
- package/src/generated/api/SfuSetConfigParams.ts +4 -0
- package/src/generated/api/SfuStatus.ts +24 -0
- package/src/generated/api/ShaclLinkTriple.ts +8 -0
- package/src/generated/api/SignalRequest.ts +3 -0
- package/src/generated/api/SubscribeQueryRequest.ts +3 -0
- package/src/generated/api/TokenizerSource.ts +3 -0
- package/src/generated/api/TokenizerSourceInput.ts +3 -0
- package/src/generated/api/TrackMapEntry.ts +18 -0
- package/src/generated/api/TranscriptionTextFilter.ts +3 -0
- package/src/generated/api/TriggeredNotification.ts +4 -0
- package/src/generated/api/TrustedAgentsWrapper.ts +6 -0
- package/src/generated/api/UnlockAgentRequest.ts +1 -1
- package/src/generated/api/UnytVersionInfo.ts +20 -0
- package/src/generated/api/UpdateLinkRequest.ts +1 -1
- package/src/generated/api/UpdateProfileRequest.ts +4 -0
- package/src/generated/api/UpdateSubjectRequest.ts +10 -0
- package/src/generated/api/UserCreationResult.ts +3 -0
- package/src/generated/api/UserStatistics.ts +2 -1
- package/src/generated/api/UsersAppInfo.ts +6 -0
- package/src/generated/api/UsersEmailParams.ts +3 -0
- package/src/generated/api/UsersEmailTestAction.ts +3 -0
- package/src/generated/api/UsersEmailTestParams.ts +12 -0
- package/src/generated/api/UsersEmailTestResult.ts +7 -0
- package/src/generated/api/UsersLoginParams.ts +7 -0
- package/src/generated/api/UsersRequestVerificationParams.ts +4 -0
- package/src/generated/api/UsersSetCreditsParams.ts +3 -0
- package/src/generated/api/UsersVerifyEmailParams.ts +11 -0
- package/src/generated/api/ValidOutput.ts +30 -0
- package/src/generated/api/VoiceActivityParamsInput.ts +3 -0
- package/src/generated/api/index.ts +14 -2
- package/src/generated/api/serde_json/JsonValue.ts +3 -0
- package/src/index.ts +9 -3
- package/src/language/LanguageClient.ts +12 -13
- package/src/links/Links.ts +49 -3
- package/src/model/Ad4mModel.test.ts +480 -173
- package/src/model/Ad4mModel.ts +407 -77
- package/src/model/ModelQueryBuilder.ts +95 -255
- package/src/model/abstract-classes.test.ts +225 -0
- package/src/model/decorators.ts +145 -9
- package/src/model/query-sparql.ts +2 -3
- package/src/model/relation-filtering.test.ts +191 -0
- package/src/model/shacl-gen.ts +32 -9
- package/src/model/shacl-roundtrip.test.ts +52 -0
- package/src/model/types.ts +19 -0
- package/src/neighbourhood/MeshManager.test.ts +2640 -0
- package/src/neighbourhood/MeshManager.ts +1350 -0
- package/src/neighbourhood/NeighbourhoodClient.test.ts +60 -0
- package/src/neighbourhood/NeighbourhoodClient.ts +298 -27
- package/src/neighbourhood/NeighbourhoodProxy.test.ts +37 -9
- package/src/neighbourhood/NeighbourhoodProxy.ts +247 -1
- package/src/neighbourhood/Session.test.ts +800 -0
- package/src/neighbourhood/Session.ts +525 -0
- package/src/neighbourhood/SfuManager.test.ts +677 -0
- package/src/neighbourhood/SfuManager.ts +803 -0
- package/src/neighbourhood/SfuTypes.ts +40 -0
- package/src/notifyListeners.test.ts +19 -0
- package/src/notifyListeners.ts +10 -0
- package/src/perspectives/AutoProcessor.ts +13 -82
- package/src/perspectives/FlowInstance.ts +136 -32
- package/src/perspectives/FlowModels.ts +46 -11
- package/src/perspectives/InterpretationModels.ts +4 -0
- package/src/perspectives/LiveQuery.test.ts +197 -0
- package/src/perspectives/LiveQuery.ts +189 -0
- package/src/perspectives/Perspective.ts +18 -2
- package/src/perspectives/PerspectiveClient.test.ts +122 -45
- package/src/perspectives/PerspectiveClient.ts +146 -343
- package/src/perspectives/PerspectiveHandle.ts +32 -9
- package/src/perspectives/PerspectiveProxy.test.ts +216 -528
- package/src/perspectives/PerspectiveProxy.ts +259 -736
- package/src/perspectives/TextContent.test.ts +123 -0
- package/src/perspectives/TextContent.ts +36 -0
- package/src/perspectives/WakerSubscriptionManager.test.ts +136 -1
- package/src/perspectives/WakerSubscriptionManager.ts +69 -22
- package/src/perspectives/link-updated-type.test.ts +55 -0
- package/src/perspectives/listener-leaks.test.ts +204 -0
- package/src/perspectives/shacl-rpc.test.ts +22 -27
- package/src/runtime/RuntimeClient.ts +75 -157
- package/src/runtime/RuntimeTypes.ts +3 -3
- package/src/shacl/SHACLFlow.test.ts +49 -1
- package/src/shacl/SHACLFlow.ts +73 -15
- package/src/shacl/SHACLShape.test.ts +161 -16
- package/src/shacl/SHACLShape.ts +210 -439
- package/lib/shims/reflect-metadata.d.ts +0 -0
- package/lib/shims/reflect-metadata.js +0 -0
- package/lib/shims/type-graphql.d.ts +0 -32
- package/lib/shims/type-graphql.js +0 -70
- package/lib/src/PubSub.d.ts +0 -17
- package/lib/src/PubSub.js +0 -17
- package/lib/src/agent/AgentResolver.d.ts +0 -30
- package/lib/src/agent/AgentResolver.js +0 -325
- package/lib/src/ai/AIResolver.d.ts +0 -75
- package/lib/src/ai/AIResolver.js +0 -455
- package/lib/src/buildSchema.d.ts +0 -1
- package/lib/src/buildSchema.js +0 -38
- package/lib/src/expression/ExpressionResolver.d.ts +0 -10
- package/lib/src/expression/ExpressionResolver.js +0 -106
- package/lib/src/language/LanguageContext.d.ts +0 -37
- package/lib/src/language/LanguageContext.js +0 -2
- package/lib/src/language/LanguageResolver.d.ts +0 -19
- package/lib/src/language/LanguageResolver.js +0 -143
- package/lib/src/links/Links.test.js +0 -33
- package/lib/src/model/Ad4mModel.test.js +0 -2055
- package/lib/src/model/Subject.d.ts +0 -25
- package/lib/src/model/Subject.js +0 -164
- package/lib/src/model/hydration-batch.d.ts +0 -34
- package/lib/src/model/hydration-batch.js +0 -147
- package/lib/src/model/hydration-batching.test.d.ts +0 -7
- package/lib/src/model/hydration-batching.test.js +0 -456
- package/lib/src/model/model-manifest.d.ts +0 -41
- package/lib/src/model/model-manifest.js +0 -11
- package/lib/src/model/prolog-facts.d.ts +0 -37
- package/lib/src/model/prolog-facts.js +0 -134
- package/lib/src/model/query-cache.test.js +0 -43
- package/lib/src/model/query-prolog.d.ts +0 -15
- package/lib/src/model/query-prolog.js +0 -140
- package/lib/src/model/query-sparql-batch.d.ts +0 -17
- package/lib/src/model/query-sparql-batch.js +0 -260
- package/lib/src/model/query-sparql.test.js +0 -312
- package/lib/src/model/relation-filtering.test.js +0 -838
- package/lib/src/model/subscription-delta.test.d.ts +0 -24
- package/lib/src/model/subscription-delta.test.js +0 -180
- package/lib/src/model/subscription-pool.d.ts +0 -39
- package/lib/src/model/subscription-pool.js +0 -165
- package/lib/src/neighbourhood/NeighbourhoodProxy.test.js +0 -73
- package/lib/src/neighbourhood/NeighbourhoodResolver.d.ts +0 -24
- package/lib/src/neighbourhood/NeighbourhoodResolver.js +0 -182
- package/lib/src/perspectives/Perspective.test.js +0 -20
- package/lib/src/perspectives/PerspectiveClient.test.js +0 -224
- package/lib/src/perspectives/PerspectiveResolver.d.ts +0 -56
- package/lib/src/perspectives/PerspectiveResolver.js +0 -519
- package/lib/src/runtime/RuntimeResolver.d.ts +0 -173
- package/lib/src/runtime/RuntimeResolver.js +0 -1122
- package/lib/src/schema.gql +0 -631
- package/lib/src/shacl/SHACLFlow.test.js +0 -205
- package/lib/src/shacl/SHACLShape.test.js +0 -418
- package/lib/src/unwrapApolloResult.d.ts +0 -2
- package/lib/src/unwrapApolloResult.js +0 -14
- /package/lib/src/{links/Links.test.d.ts → generated/api/AITask.js} +0 -0
- /package/lib/src/{model/Ad4mModel.test.d.ts → generated/api/AITaskInput.js} +0 -0
- /package/lib/src/{model/query-cache.test.d.ts → generated/api/Agent.js} +0 -0
- /package/lib/src/{model/query-sparql.test.d.ts → generated/api/AgentAddEntanglementProofsParams.js} +0 -0
- /package/lib/src/{model/relation-filtering.test.d.ts → generated/api/AgentStatus.js} +0 -0
- /package/lib/src/{neighbourhood/NeighbourhoodProxy.test.d.ts → generated/api/AgentStatusChangedEvent.js} +0 -0
- /package/lib/src/{perspectives/Perspective.test.d.ts → generated/api/AgentUpdatedEvent.js} +0 -0
- /package/lib/src/{perspectives/PerspectiveClient.test.d.ts → generated/api/AiAddModelParams.js} +0 -0
- /package/lib/src/{shacl/SHACLFlow.test.d.ts → generated/api/AiAddTaskParams.js} +0 -0
- /package/lib/src/{shacl/SHACLShape.test.d.ts → generated/api/AiGetDefaultModelParams.js} +0 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PerspectiveClient } from "./PerspectiveClient";
|
|
2
|
+
import type { EventMap, ScopedEventName } from "../generated/api/Events";
|
|
2
3
|
import type {
|
|
3
4
|
FlowFireOutcome, FlowMintedReceipt, FlowOutputRef, FlowProposeResult,
|
|
4
|
-
FlowReceiptVerdict, FlowValidOutput,
|
|
5
|
+
FlowReceiptVerdict, FlowStateEntry, FlowValidOutput,
|
|
5
6
|
} from "./FlowInstance";
|
|
6
7
|
import { CallOptions } from "../apiClient";
|
|
7
8
|
import { Link, LinkExpression, LinkExpressionInput, LinkExpressionMutations, LinkMutations } from "../links/Links";
|
|
@@ -17,12 +18,14 @@ import { AIClient } from "../ai/AIClient";
|
|
|
17
18
|
import { getPropertiesMetadata, getRelationsMetadata } from "../model/decorators";
|
|
18
19
|
import { getCachedResult, setCachedResult, invalidatePerspectiveCache } from "../model/query-cache";
|
|
19
20
|
import { AllInstancesResult } from "../model/types";
|
|
21
|
+
import { LiveQuery, Subscribed } from "./LiveQuery";
|
|
20
22
|
import type { TranscriptTurn } from "../generated/api";
|
|
23
|
+
import type { JsonValue } from "../generated/api/serde_json/JsonValue";
|
|
21
24
|
|
|
22
25
|
import { SHACLShape } from "../shacl/SHACLShape";
|
|
23
26
|
import { SHACLFlow } from "../shacl/SHACLFlow";
|
|
24
27
|
import { Ad4mModel } from "../model/Ad4mModel";
|
|
25
|
-
import type { AddAutoProcessorConfig,
|
|
28
|
+
import type { AddAutoProcessorConfig, InterpretationOverlayInfo, RawScope, RunInterpretationObserveOptions } from "./AutoProcessor";
|
|
26
29
|
|
|
27
30
|
type QueryCallback = (result: AllInstancesResult) => void;
|
|
28
31
|
|
|
@@ -38,431 +41,72 @@ function extractNamespaceFromUri(uri: string): string {
|
|
|
38
41
|
}
|
|
39
42
|
|
|
40
43
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
*
|
|
48
|
-
* This class handles:
|
|
49
|
-
* - Keeping the subscription alive by sending periodic keepalive signals
|
|
50
|
-
* - Managing callbacks for result updates
|
|
51
|
-
* - Subscribing to query updates via WebSocket subscriptions
|
|
52
|
-
* - Maintaining the latest query result
|
|
53
|
-
* - Ensuring subscription is fully initialized before allowing access
|
|
54
|
-
* - Cleaning up resources when disposed
|
|
55
|
-
*
|
|
56
|
-
* The subscription will remain active as long as keepalive signals are sent.
|
|
57
|
-
* Make sure to call dispose() when you're done with the subscription to clean up
|
|
58
|
-
* resources, stop keepalive signals, and notify the backend to remove the subscription.
|
|
59
|
-
*
|
|
60
|
-
* The subscription goes through an initialization process where it waits for the first
|
|
61
|
-
* result to come through the subscription channel. You can await the `initialized`
|
|
62
|
-
* promise to ensure the subscription is ready. The initialization will timeout after
|
|
63
|
-
* 30 seconds if no result is received.
|
|
64
|
-
*
|
|
65
|
-
* Example usage:
|
|
44
|
+
/** A live SPARQL query with its latest result.
|
|
45
|
+
*
|
|
46
|
+
* `subscribe()` opens the query and resolves once the first result is in;
|
|
47
|
+
* `onResult()` callbacks then get every later result. The executor sends
|
|
48
|
+
* only changes; `LiveQuery` applies them, recovers from a missed update and
|
|
49
|
+
* re-opens the query after a reconnect. Call `dispose()` when done.
|
|
50
|
+
*
|
|
66
51
|
* ```typescript
|
|
67
|
-
* const subscription = await perspective.
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* // Set up callback for future updates
|
|
71
|
-
* const removeCallback = subscription.onResult(result => {
|
|
72
|
-
* console.log("New result:", result);
|
|
73
|
-
* });
|
|
74
|
-
*
|
|
75
|
-
* // Later: clean up subscription and notify backend
|
|
52
|
+
* const subscription = await perspective.subscribeQuery("SELECT ?s WHERE { ?s ?p ?o }");
|
|
53
|
+
* const remove = subscription.onResult(result => console.log(result));
|
|
76
54
|
* subscription.dispose();
|
|
77
55
|
* ```
|
|
78
56
|
*/
|
|
79
57
|
export class QuerySubscriptionProxy {
|
|
80
|
-
#
|
|
81
|
-
#
|
|
82
|
-
#client: PerspectiveClient;
|
|
83
|
-
#callbacks: Set<QueryCallback>;
|
|
84
|
-
#keepaliveTimer: number;
|
|
85
|
-
#unsubscribe?: () => void;
|
|
86
|
-
#reconnectUnsub?: () => void;
|
|
87
|
-
#latestResult: AllInstancesResult|null;
|
|
88
|
-
#disposed: boolean = false;
|
|
58
|
+
#live: LiveQuery;
|
|
59
|
+
#callbacks = new Set<QueryCallback>();
|
|
89
60
|
#initialized: Promise<boolean>;
|
|
90
61
|
#initResolve?: (value: boolean) => void;
|
|
91
62
|
#initReject?: (reason?: any) => void;
|
|
92
|
-
|
|
93
|
-
#query: string;
|
|
94
|
-
// Monotonic token guarding the three concurrent writers of
|
|
95
|
-
// `#unsubscribe`/`#subscriptionId` (full subscribe() from the keepalive
|
|
96
|
-
// and init-timeout retry paths, and the reconnect swap handler). Each
|
|
97
|
-
// writer bumps it on entry and re-checks after every await; a mismatch
|
|
98
|
-
// means a newer writer took over while we were suspended, so the stale
|
|
99
|
-
// continuation must back out instead of clobbering the newer state
|
|
100
|
-
// (worst case otherwise: an overwritten-but-never-called unsubscribe
|
|
101
|
-
// leaks its callback in ApiClient._wsCallbacks for the client lifetime).
|
|
102
|
-
#generation: number = 0;
|
|
103
|
-
|
|
104
|
-
/** Creates a new query subscription
|
|
105
|
-
* @param uuid - The UUID of the perspective
|
|
106
|
-
* @param query - The Prolog query to subscribe to
|
|
107
|
-
* @param client - The PerspectiveClient instance to use for communication
|
|
108
|
-
*/
|
|
63
|
+
|
|
109
64
|
constructor(uuid: string, query: string, client: PerspectiveClient) {
|
|
110
|
-
this.#
|
|
111
|
-
this.#query = query;
|
|
112
|
-
this.#client = client;
|
|
113
|
-
this.#callbacks = new Set();
|
|
114
|
-
this.#latestResult = null;
|
|
115
|
-
|
|
116
|
-
// Create the promise once and store its resolve/reject
|
|
65
|
+
this.#live = new LiveQuery(client, uuid, () => client.subscribeQuery(uuid, query), result => this.#deliver(result));
|
|
117
66
|
this.#initialized = new Promise<boolean>((resolve, reject) => {
|
|
118
67
|
this.#initResolve = resolve;
|
|
119
68
|
this.#initReject = reject;
|
|
120
69
|
});
|
|
70
|
+
// `subscribe()` throws the same error, so a caller who never reads
|
|
71
|
+
// `initialized` must not get an unhandled rejection from it.
|
|
72
|
+
this.#initialized.catch(() => {});
|
|
121
73
|
}
|
|
122
74
|
|
|
75
|
+
/** Open the query; resolves with the first result delivered. */
|
|
123
76
|
async subscribe() {
|
|
124
|
-
// Invalidate any suspended writer (older subscribe() or reconnect
|
|
125
|
-
// swap parked on an await) — see #generation.
|
|
126
|
-
const generation = ++this.#generation;
|
|
127
|
-
|
|
128
|
-
// Remove any prior reconnect listener FIRST — before we touch
|
|
129
|
-
// `#unsubscribe`. Rationale: `#unsubscribe()` calls into
|
|
130
|
-
// `ApiClient.subscribe()`'s deleter, which closes the WebSocket
|
|
131
|
-
// whenever this query owned the last `_wsCallbacks` entry (and no
|
|
132
|
-
// RPCs are pending). The subsequent `subscribeQuery()` below then
|
|
133
|
-
// re-opens a fresh socket, and that fresh `onopen` fires the
|
|
134
|
-
// reconnect callback set. If the OLD reconnect listener is still
|
|
135
|
-
// in that set, it re-enters this method, closes the socket again,
|
|
136
|
-
// reopens again … an endless resubscribe loop. Clearing the
|
|
137
|
-
// listener up-front breaks the cycle; a fresh listener is
|
|
138
|
-
// installed at the end of a successful subscribe(), and a
|
|
139
|
-
// full-retry recovery listener in the catch block on failure.
|
|
140
|
-
if (this.#reconnectUnsub) {
|
|
141
|
-
this.#reconnectUnsub();
|
|
142
|
-
this.#reconnectUnsub = undefined;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
// Clean up previous subscription attempt if retrying
|
|
146
|
-
if (this.#unsubscribe) {
|
|
147
|
-
this.#unsubscribe();
|
|
148
|
-
this.#unsubscribe = undefined;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
// Clear any existing timeout
|
|
152
|
-
if (this.#initTimeoutId) {
|
|
153
|
-
clearTimeout(this.#initTimeoutId);
|
|
154
|
-
this.#initTimeoutId = undefined;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
// Clear any existing keepalive timer to prevent accumulation
|
|
158
|
-
if (this.#keepaliveTimer) {
|
|
159
|
-
clearTimeout(this.#keepaliveTimer);
|
|
160
|
-
this.#keepaliveTimer = undefined;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
77
|
try {
|
|
164
|
-
|
|
165
|
-
let initialResult;
|
|
166
|
-
initialResult = await this.#client.subscribeQuery(this.#uuid, this.#query);
|
|
167
|
-
|
|
168
|
-
// A newer writer (another subscribe() or a reconnect swap) took
|
|
169
|
-
// over while we awaited — back out without touching shared state,
|
|
170
|
-
// and release the now-orphaned server-side subscription so it
|
|
171
|
-
// doesn't linger until its keepalive TTL expires.
|
|
172
|
-
if (this.#disposed || this.#generation !== generation) {
|
|
173
|
-
this.#client.disposeQuerySubscription(this.#uuid, initialResult.subscriptionId)
|
|
174
|
-
.catch(e => console.error('Error disposing superseded query subscription:', e));
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
this.#subscriptionId = initialResult.subscriptionId;
|
|
179
|
-
|
|
180
|
-
// Process the initial result immediately for fast UX.
|
|
181
|
-
// The subscribeQuery() RPC call already returns the initial result,
|
|
182
|
-
// so treat that as successful initialization instead of waiting for a
|
|
183
|
-
// follow-up WebSocket update that may never arrive until the query changes.
|
|
184
|
-
if (initialResult.result !== undefined) {
|
|
185
|
-
this.#deliverResult(initialResult.result);
|
|
186
|
-
} else {
|
|
187
|
-
console.warn('⚠️ No initial result returned from subscribeQuery!');
|
|
188
|
-
|
|
189
|
-
// Only keep the initialization timeout when the backend did not
|
|
190
|
-
// provide an initial result up front.
|
|
191
|
-
this.#initTimeoutId = setTimeout(() => {
|
|
192
|
-
console.error('Subscription initialization timed out after 30 seconds. Resubscribing...');
|
|
193
|
-
// Recursively retry subscription, catching any errors
|
|
194
|
-
this.subscribe().catch(error => {
|
|
195
|
-
console.error('Error during subscription retry after timeout:', error);
|
|
196
|
-
});
|
|
197
|
-
}, 30000);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
// Subscribe to query updates
|
|
201
|
-
this.#unsubscribe = this.#client.subscribeToQueryUpdates(
|
|
202
|
-
this.#subscriptionId,
|
|
203
|
-
(updateResult) => this.#deliverResult(updateResult)
|
|
204
|
-
);
|
|
78
|
+
this.#deliver(await this.#live.start());
|
|
205
79
|
} catch (error) {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
if (this.#initReject) {
|
|
210
|
-
this.#initReject(error);
|
|
211
|
-
this.#initResolve = undefined;
|
|
212
|
-
this.#initReject = undefined;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
// Restore reconnect recovery before rethrowing. The listener was
|
|
216
|
-
// removed at the top of this method; without re-installing one
|
|
217
|
-
// here, a single failed resubscribe (e.g. subscribeQuery timing
|
|
218
|
-
// out during a network flap) would leave the proxy permanently
|
|
219
|
-
// dead: the keepalive loop stops itself on resubscribe failure,
|
|
220
|
-
// and nothing else retries. The recovery listener runs the FULL
|
|
221
|
-
// subscribe() (not the swap-in-place handler) because after a
|
|
222
|
-
// failed attempt there is no keepalive loop left to feed the new
|
|
223
|
-
// server subscription — subscribe() restarts it. This is
|
|
224
|
-
// loop-safe: in this failed state the proxy owns no
|
|
225
|
-
// `_wsCallbacks` entry (the old one was unsubscribed at the top
|
|
226
|
-
// of this method and no new one got registered), so the
|
|
227
|
-
// subscribe() it triggers has nothing to unsubscribe → the
|
|
228
|
-
// socket never closes/reopens under it → no re-entrant onopen.
|
|
229
|
-
if (!this.#disposed && this.#generation === generation && this.#client.onReconnect) {
|
|
230
|
-
this.#reconnectUnsub = this.#client.onReconnect(() => {
|
|
231
|
-
if (this.#disposed) return;
|
|
232
|
-
console.log('WebSocket reconnected — retrying failed subscription for query:', this.#query);
|
|
233
|
-
this.subscribe().catch(e => {
|
|
234
|
-
console.error('Error during subscription retry after reconnect:', e);
|
|
235
|
-
});
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
throw error; // Re-throw so caller knows it failed
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
// Start keepalive loop
|
|
243
|
-
this.#startKeepalive(generation);
|
|
244
|
-
|
|
245
|
-
// Register for reconnect notification — on WebSocket reconnect,
|
|
246
|
-
// immediately re-establish a fresh server-side subscription instead
|
|
247
|
-
// of waiting up to 30s for the keepalive to fail.
|
|
248
|
-
//
|
|
249
|
-
// We deliberately do NOT call `this.subscribe()` here. Full subscribe
|
|
250
|
-
// runs `#unsubscribe` first, which delegates to `ApiClient.subscribe`'s
|
|
251
|
-
// deleter — that closes the WebSocket when this query owned the LAST
|
|
252
|
-
// `_wsCallbacks` entry. The subsequent `subscribeQuery` reopens the
|
|
253
|
-
// socket, whose fresh `onopen` fires every registered reconnect
|
|
254
|
-
// callback again → recursion (CodeRabbit's original finding). And
|
|
255
|
-
// during that close→reopen gap, RPCs in flight from OTHER proxies
|
|
256
|
-
// fail with `503 WebSocket not connected` (observed in
|
|
257
|
-
// integration-tests-mcp `should fire onWake when mention uses agent DID`
|
|
258
|
-
// after PR #899's initial fix — the WakerSubscriptionManager tests
|
|
259
|
-
// share a wakerClient across cases, so any dying reconnect handler
|
|
260
|
-
// interferes with sibling subscriptions).
|
|
261
|
-
//
|
|
262
|
-
// The correct shape is a swap-in-place: get a new server-side
|
|
263
|
-
// subscription ID via `subscribeQuery`, register a new client-side
|
|
264
|
-
// callback FIRST, and only then unsubscribe the old one. That way
|
|
265
|
-
// `_wsCallbacks.size` never dips to 0 during the transition, so the
|
|
266
|
-
// socket doesn't close, no reconnect loop, and no cross-proxy 503s.
|
|
267
|
-
// Any prior listener was already removed at the top of this method
|
|
268
|
-
// (see the note there for why cleanup must run before `#unsubscribe`,
|
|
269
|
-
// not here).
|
|
270
|
-
if (this.#client.onReconnect) {
|
|
271
|
-
this.#reconnectUnsub = this.#client.onReconnect(async () => {
|
|
272
|
-
if (this.#disposed) return;
|
|
273
|
-
// The handler is a writer of `#unsubscribe`/`#subscriptionId`
|
|
274
|
-
// too, so it takes its own generation — see #generation.
|
|
275
|
-
const swapGeneration = ++this.#generation;
|
|
276
|
-
console.log(
|
|
277
|
-
'WebSocket reconnected — re-establishing server subscription for query:',
|
|
278
|
-
this.#query,
|
|
279
|
-
);
|
|
280
|
-
try {
|
|
281
|
-
const newInitial = await this.#client.subscribeQuery(this.#uuid, this.#query);
|
|
282
|
-
if (this.#disposed || this.#generation !== swapGeneration) {
|
|
283
|
-
// A newer writer took over while we awaited — back out
|
|
284
|
-
// and release the orphaned server-side subscription.
|
|
285
|
-
this.#client.disposeQuerySubscription(this.#uuid, newInitial.subscriptionId)
|
|
286
|
-
.catch(e => console.error('Error disposing superseded query subscription:', e));
|
|
287
|
-
return;
|
|
288
|
-
}
|
|
289
|
-
const newSubId = newInitial.subscriptionId;
|
|
290
|
-
|
|
291
|
-
// Register the NEW client-side callback BEFORE removing the
|
|
292
|
-
// old one — keeps `_wsCallbacks.size >= 1` across the swap.
|
|
293
|
-
const newUnsub = this.#client.subscribeToQueryUpdates(
|
|
294
|
-
newSubId,
|
|
295
|
-
(updateResult) => this.#deliverResult(updateResult),
|
|
296
|
-
);
|
|
297
|
-
const oldUnsub = this.#unsubscribe;
|
|
298
|
-
this.#unsubscribe = newUnsub;
|
|
299
|
-
this.#subscriptionId = newSubId;
|
|
300
|
-
if (oldUnsub) oldUnsub();
|
|
301
|
-
|
|
302
|
-
// Our generation bump invalidated the running keepalive
|
|
303
|
-
// loop — restart it under our generation so the new
|
|
304
|
-
// server subscription keeps receiving keepalives.
|
|
305
|
-
clearTimeout(this.#keepaliveTimer);
|
|
306
|
-
this.#startKeepalive(swapGeneration);
|
|
307
|
-
|
|
308
|
-
// Deliver the fresh initial result if the server included one
|
|
309
|
-
// (matches the eager-delivery path in the main subscribe() body).
|
|
310
|
-
// #deliverResult also clears a still-pending init timeout and
|
|
311
|
-
// resolves #initialized, keeping this path symmetric with the
|
|
312
|
-
// update callback in subscribe() — without it, a swap landing
|
|
313
|
-
// while initialization was pending would leave the 30s init
|
|
314
|
-
// timer armed and trigger a spurious full resubscribe.
|
|
315
|
-
if (newInitial.result !== undefined) {
|
|
316
|
-
this.#deliverResult(newInitial.result);
|
|
317
|
-
}
|
|
318
|
-
} catch (error) {
|
|
319
|
-
console.error(
|
|
320
|
-
'Error re-establishing subscription after reconnect:',
|
|
321
|
-
error,
|
|
322
|
-
);
|
|
323
|
-
// Our generation bump invalidated the running keepalive
|
|
324
|
-
// loop; if nothing newer superseded us, restart it so
|
|
325
|
-
// liveness is preserved — its keepAliveQuery against the
|
|
326
|
-
// dead old subscription will fail and fall back to a
|
|
327
|
-
// full subscribe(). The reconnect listener also remains
|
|
328
|
-
// installed, so a later reconnect retries this handler.
|
|
329
|
-
if (!this.#disposed && this.#generation === swapGeneration) {
|
|
330
|
-
clearTimeout(this.#keepaliveTimer);
|
|
331
|
-
this.#startKeepalive(swapGeneration);
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
});
|
|
80
|
+
this.#initReject?.(error);
|
|
81
|
+
this.#initResolve = this.#initReject = undefined;
|
|
82
|
+
throw error;
|
|
335
83
|
}
|
|
336
84
|
}
|
|
337
85
|
|
|
338
|
-
/**
|
|
339
|
-
*
|
|
340
|
-
* This is a unique identifier assigned when the subscription was created.
|
|
341
|
-
* It can be used to reference this specific subscription, for example when
|
|
342
|
-
* sending keepalive signals.
|
|
343
|
-
*
|
|
344
|
-
* @returns The subscription ID string
|
|
345
|
-
*/
|
|
86
|
+
/** The executor's id for this subscription. */
|
|
346
87
|
get id(): string {
|
|
347
|
-
return this.#
|
|
88
|
+
return this.#live.id;
|
|
348
89
|
}
|
|
349
90
|
|
|
350
|
-
/**
|
|
351
|
-
* through the subscription channel. This ensures the subscription is fully
|
|
352
|
-
* set up before allowing access to results or updates.
|
|
353
|
-
*
|
|
354
|
-
* If no result is received within 30 seconds, the subscription will automatically
|
|
355
|
-
* retry. The promise will remain pending until a subscription message successfully
|
|
356
|
-
* arrives, or until a fatal error occurs during subscription setup.
|
|
357
|
-
*
|
|
358
|
-
* Note: You typically don't need to await this directly since the subscription
|
|
359
|
-
* creation methods (like subscribeInfer) already wait for initialization.
|
|
360
|
-
*/
|
|
91
|
+
/** Resolves once the first result has arrived. */
|
|
361
92
|
get initialized(): Promise<boolean> {
|
|
362
93
|
return this.#initialized;
|
|
363
94
|
}
|
|
364
95
|
|
|
365
|
-
/**
|
|
366
|
-
*
|
|
367
|
-
* This returns the most recent result from the query, which could be either:
|
|
368
|
-
* - The initial result from when the subscription was created
|
|
369
|
-
* - The latest update received through the subscription
|
|
370
|
-
*
|
|
371
|
-
* @returns The latest query result as a string (usually a JSON array of bindings)
|
|
372
|
-
*/
|
|
96
|
+
/** The latest result. */
|
|
373
97
|
get result(): AllInstancesResult {
|
|
374
|
-
return this.#
|
|
98
|
+
return this.#live.result;
|
|
375
99
|
}
|
|
376
100
|
|
|
377
|
-
/**
|
|
378
|
-
*
|
|
379
|
-
* The callback will be called immediately with the current result,
|
|
380
|
-
* and then again each time the query results change.
|
|
381
|
-
*
|
|
382
|
-
* @param callback - Function that takes a result string and processes it
|
|
383
|
-
* @returns A function that can be called to remove this callback
|
|
384
|
-
*
|
|
385
|
-
* Example:
|
|
386
|
-
* ```typescript
|
|
387
|
-
* const removeCallback = subscription.onResult(result => {
|
|
388
|
-
* const bindings = JSON.parse(result);
|
|
389
|
-
* console.log("New bindings:", bindings);
|
|
390
|
-
* });
|
|
391
|
-
*
|
|
392
|
-
* // Later: stop receiving updates
|
|
393
|
-
* removeCallback();
|
|
394
|
-
* ```
|
|
395
|
-
*/
|
|
101
|
+
/** Call `callback` with every later result. Returns a remover. */
|
|
396
102
|
onResult(callback: QueryCallback): () => void {
|
|
397
103
|
this.#callbacks.add(callback);
|
|
398
104
|
return () => this.#callbacks.delete(callback);
|
|
399
105
|
}
|
|
400
106
|
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
* initial-result path, the update callback, and the reconnect swap
|
|
405
|
-
* handler so all three stay lifecycle-symmetric. */
|
|
406
|
-
#deliverResult(result: AllInstancesResult) {
|
|
407
|
-
if (this.#initTimeoutId) {
|
|
408
|
-
clearTimeout(this.#initTimeoutId);
|
|
409
|
-
this.#initTimeoutId = undefined;
|
|
410
|
-
}
|
|
411
|
-
// Resolve the initialization promise (only resolves once)
|
|
412
|
-
if (this.#initResolve) {
|
|
413
|
-
this.#initResolve(true);
|
|
414
|
-
this.#initResolve = undefined; // Prevent double-resolve
|
|
415
|
-
this.#initReject = undefined;
|
|
416
|
-
}
|
|
417
|
-
this.#latestResult = result;
|
|
418
|
-
this.#notifyCallbacks(result);
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
/** Start the keepalive loop for the given generation. The loop runs
|
|
422
|
-
* every 30s until it is superseded (generation mismatch — a newer
|
|
423
|
-
* subscribe() or reconnect swap took over) or the proxy is disposed.
|
|
424
|
-
* On a keepalive error it falls back to a full subscribe(). */
|
|
425
|
-
#startKeepalive(generation: number) {
|
|
426
|
-
const keepaliveLoop = async () => {
|
|
427
|
-
// Generation check kills orphaned loops: a loop whose
|
|
428
|
-
// keepAliveQuery was in flight while a newer writer ran is not
|
|
429
|
-
// cancelled by clearTimeout and would otherwise reschedule
|
|
430
|
-
// itself alongside the newer loop.
|
|
431
|
-
if (this.#disposed || this.#generation !== generation) return;
|
|
432
|
-
|
|
433
|
-
try {
|
|
434
|
-
await this.#client.keepAliveQuery(this.#uuid, this.#subscriptionId);
|
|
435
|
-
} catch (e) {
|
|
436
|
-
if (this.#disposed || this.#generation !== generation) return;
|
|
437
|
-
console.error('Error in keepalive:', e);
|
|
438
|
-
// try to reinitialize the subscription
|
|
439
|
-
console.log('Reinitializing subscription for query:', this.#query);
|
|
440
|
-
try {
|
|
441
|
-
await this.subscribe();
|
|
442
|
-
console.log('Subscription reinitialized');
|
|
443
|
-
} catch (resubscribeError) {
|
|
444
|
-
console.error('Error during resubscription from keepalive:', resubscribeError);
|
|
445
|
-
// Don't schedule another keepalive on resubscribe failure.
|
|
446
|
-
// Recovery is not lost: the failed subscribe() installed a
|
|
447
|
-
// reconnect listener that retries the full subscribe.
|
|
448
|
-
return;
|
|
449
|
-
}
|
|
450
|
-
// subscribe() succeeded and started its own keepalive loop
|
|
451
|
-
// under a new generation — this loop is done.
|
|
452
|
-
return;
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
// Schedule next keepalive if still the active generation
|
|
456
|
-
if (!this.#disposed && this.#generation === generation) {
|
|
457
|
-
this.#keepaliveTimer = setTimeout(keepaliveLoop, 30000) as unknown as number;
|
|
458
|
-
}
|
|
459
|
-
};
|
|
460
|
-
|
|
461
|
-
this.#keepaliveTimer = setTimeout(keepaliveLoop, 30000) as unknown as number;
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
/** Internal method to notify all callbacks of a new result */
|
|
465
|
-
#notifyCallbacks(result: AllInstancesResult) {
|
|
107
|
+
#deliver(result: AllInstancesResult) {
|
|
108
|
+
this.#initResolve?.(true);
|
|
109
|
+
this.#initResolve = this.#initReject = undefined;
|
|
466
110
|
for (const callback of this.#callbacks) {
|
|
467
111
|
try {
|
|
468
112
|
callback(result);
|
|
@@ -472,47 +116,16 @@ export class QuerySubscriptionProxy {
|
|
|
472
116
|
}
|
|
473
117
|
}
|
|
474
118
|
|
|
475
|
-
/**
|
|
476
|
-
*
|
|
477
|
-
* This method:
|
|
478
|
-
* 1. Stops the keepalive timer
|
|
479
|
-
* 2. Unsubscribes from subscription updates
|
|
480
|
-
* 3. Clears all registered callbacks
|
|
481
|
-
* 4. Cleans up any pending initialization timeout
|
|
482
|
-
*
|
|
483
|
-
* After calling this method, the subscription is no longer active and
|
|
484
|
-
* will not receive any more updates. The instance should be discarded.
|
|
485
|
-
*/
|
|
119
|
+
/** End the subscription on the executor and drop all callbacks. */
|
|
486
120
|
dispose() {
|
|
487
|
-
this.#
|
|
488
|
-
// Invalidate any suspended writer so a mid-flight subscribe() or
|
|
489
|
-
// reconnect swap backs out instead of resurrecting state.
|
|
490
|
-
this.#generation++;
|
|
491
|
-
clearTimeout(this.#keepaliveTimer);
|
|
492
|
-
if (this.#unsubscribe) {
|
|
493
|
-
this.#unsubscribe();
|
|
494
|
-
}
|
|
495
|
-
if (this.#reconnectUnsub) {
|
|
496
|
-
this.#reconnectUnsub();
|
|
497
|
-
this.#reconnectUnsub = undefined;
|
|
498
|
-
}
|
|
121
|
+
this.#live.dispose();
|
|
499
122
|
this.#callbacks.clear();
|
|
500
|
-
if (this.#initTimeoutId) {
|
|
501
|
-
clearTimeout(this.#initTimeoutId);
|
|
502
|
-
this.#initTimeoutId = undefined;
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
// Tell the backend to dispose of the subscription
|
|
506
|
-
if (this.#subscriptionId) {
|
|
507
|
-
this.#client.disposeQuerySubscription(this.#uuid, this.#subscriptionId)
|
|
508
|
-
.catch(e => console.error('Error disposing query subscription:', e));
|
|
509
|
-
}
|
|
510
123
|
}
|
|
511
124
|
}
|
|
512
125
|
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
export type LinkStatus = "shared" | "local"
|
|
126
|
+
/** Link status argument. The executor accepts either case and returns links
|
|
127
|
+
* with the upper-case form (`LinkExpression.status`). */
|
|
128
|
+
export type LinkStatus = "shared" | "local" | "SHARED" | "LOCAL"
|
|
516
129
|
interface Parameter {
|
|
517
130
|
name: string
|
|
518
131
|
value: string
|
|
@@ -552,7 +165,7 @@ interface Parameter {
|
|
|
552
165
|
* const todo = await perspective.createSubject("Todo", "expression://123");
|
|
553
166
|
*
|
|
554
167
|
* // Subscribe to changes
|
|
555
|
-
* perspective.
|
|
168
|
+
* perspective.on("link-added", ({ link }) => {
|
|
556
169
|
* console.log("New link added:", link);
|
|
557
170
|
* });
|
|
558
171
|
* ```
|
|
@@ -583,10 +196,8 @@ export class PerspectiveProxy {
|
|
|
583
196
|
/** @internal Exposed for ModelQueryBuilder subscription management */
|
|
584
197
|
get client(): PerspectiveClient { return this.#client; }
|
|
585
198
|
|
|
586
|
-
|
|
587
|
-
#
|
|
588
|
-
#perspectiveLinkUpdatedCallbacks: LinkCallback[]
|
|
589
|
-
#perspectiveSyncStateChangeCallbacks: SyncStateChangeCallback[]
|
|
199
|
+
/** Releases of the handlers `on()` registered and has not released yet. */
|
|
200
|
+
#releases = new Set<() => void>()
|
|
590
201
|
#ensuredSubjectClasses = new Set<string>()
|
|
591
202
|
/** The `interpretationOverlays()` RPC currently in flight, shared by concurrent callers. */
|
|
592
203
|
#overlaysInFlight: Promise<InterpretationOverlayInfo[]> | null = null
|
|
@@ -596,10 +207,6 @@ export class PerspectiveProxy {
|
|
|
596
207
|
* Note: Don't create this directly, use ad4m.perspective.add() instead.
|
|
597
208
|
*/
|
|
598
209
|
constructor(handle: PerspectiveHandle, ad4m: PerspectiveClient) {
|
|
599
|
-
this.#perspectiveLinkAddedCallbacks = []
|
|
600
|
-
this.#perspectiveLinkRemovedCallbacks = []
|
|
601
|
-
this.#perspectiveLinkUpdatedCallbacks = []
|
|
602
|
-
this.#perspectiveSyncStateChangeCallbacks = []
|
|
603
210
|
this.#handle = handle
|
|
604
211
|
this.#client = ad4m
|
|
605
212
|
this.uuid = this.#handle.uuid;
|
|
@@ -608,10 +215,6 @@ export class PerspectiveProxy {
|
|
|
608
215
|
this.sharedUrl = this.#handle.sharedUrl;
|
|
609
216
|
this.neighbourhood = this.#handle.neighbourhood;
|
|
610
217
|
this.state = this.#handle.state;
|
|
611
|
-
this.#client.addPerspectiveLinkAddedListener(this.#handle.uuid, this.#perspectiveLinkAddedCallbacks)
|
|
612
|
-
this.#client.addPerspectiveLinkRemovedListener(this.#handle.uuid, this.#perspectiveLinkRemovedCallbacks)
|
|
613
|
-
this.#client.addPerspectiveLinkUpdatedListener(this.#handle.uuid, this.#perspectiveLinkUpdatedCallbacks)
|
|
614
|
-
this.#client.addPerspectiveSyncStateChangeListener(this.#handle.uuid, this.#perspectiveSyncStateChangeCallbacks)
|
|
615
218
|
}
|
|
616
219
|
|
|
617
220
|
/** Update the proxy's internal handle and public fields in-place.
|
|
@@ -748,12 +351,14 @@ export class PerspectiveProxy {
|
|
|
748
351
|
* @param transcript ordered `{ speaker, text }` turns
|
|
749
352
|
* @param basePrefix URI namespace for new instance identities, e.g. `soa://ext/`
|
|
750
353
|
* @param classes local names of the subject classes to extract into; omit for all
|
|
354
|
+
* @param options scopes, progress reporting, and `signal` / `timeoutMs`
|
|
355
|
+
* (default {@link LONG_TIMEOUT_MS})
|
|
751
356
|
*/
|
|
752
357
|
async runInterpretation(
|
|
753
358
|
transcript: TranscriptTurn[],
|
|
754
359
|
basePrefix: string,
|
|
755
360
|
classes?: string[],
|
|
756
|
-
options?: {
|
|
361
|
+
options?: CallOptions & {
|
|
757
362
|
existingScope?: RawScope,
|
|
758
363
|
mintScope?: RawScope,
|
|
759
364
|
/** Report progress while the pass runs — see {@link RunInterpretationObserveOptions}. */
|
|
@@ -764,14 +369,16 @@ export class PerspectiveProxy {
|
|
|
764
369
|
// The scopes were already unreachable from here for that reason, and a fourth, fifth and
|
|
765
370
|
// sixth positional parameter would have made `undefined, undefined, { … }` the normal way
|
|
766
371
|
// to ask for the only one of them most callers want.
|
|
372
|
+
const { existingScope, mintScope, observe, ...callOptions } = options ?? {}
|
|
767
373
|
return await this.#client.runInterpretation(
|
|
768
374
|
this.#handle.uuid,
|
|
769
375
|
transcript,
|
|
770
376
|
basePrefix,
|
|
771
377
|
classes,
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
378
|
+
existingScope,
|
|
379
|
+
mintScope,
|
|
380
|
+
observe,
|
|
381
|
+
callOptions,
|
|
775
382
|
)
|
|
776
383
|
}
|
|
777
384
|
|
|
@@ -790,6 +397,7 @@ export class PerspectiveProxy {
|
|
|
790
397
|
* classic single-shot path)
|
|
791
398
|
* @param classes local names of the subject classes to extract into; omit for all
|
|
792
399
|
* @param modelOverride optional model override; omit for the default LLM
|
|
400
|
+
* @param options `signal` / `timeoutMs` (default {@link LONG_TIMEOUT_MS})
|
|
793
401
|
*/
|
|
794
402
|
async runInterpretationWithHarness(
|
|
795
403
|
transcript: TranscriptTurn[],
|
|
@@ -801,10 +409,11 @@ export class PerspectiveProxy {
|
|
|
801
409
|
// `emitDebugEvents` are supplied, every dispatched tool call fires
|
|
802
410
|
// `ToolCall` + `ToolResult` events on the `auto-processor-event`
|
|
803
411
|
// topic keyed by `observationId`. Subscribe with
|
|
804
|
-
//
|
|
412
|
+
// `on('auto-processor-event')` to render the harness loop
|
|
805
413
|
// live in a UI. Absent = fast headless path (no telemetry cost).
|
|
806
414
|
observationId?: string,
|
|
807
415
|
emitDebugEvents?: boolean,
|
|
416
|
+
options?: CallOptions,
|
|
808
417
|
): Promise<string[]> {
|
|
809
418
|
return await this.#client.runInterpretationWithHarness(
|
|
810
419
|
this.#handle.uuid,
|
|
@@ -816,6 +425,7 @@ export class PerspectiveProxy {
|
|
|
816
425
|
undefined,
|
|
817
426
|
observationId,
|
|
818
427
|
emitDebugEvents,
|
|
428
|
+
options,
|
|
819
429
|
)
|
|
820
430
|
}
|
|
821
431
|
|
|
@@ -823,7 +433,7 @@ export class PerspectiveProxy {
|
|
|
823
433
|
* Register a neighbourhood auto-processor on this perspective. The executor
|
|
824
434
|
* then runs interpretation automatically over new source items (like Flux
|
|
825
435
|
* per channel), coordinating which peer processes each batch. Returns the
|
|
826
|
-
* processor id. Subscribe to progress via
|
|
436
|
+
* processor id. Subscribe to progress via `on('auto-processor-event')`.
|
|
827
437
|
*/
|
|
828
438
|
async addAutoProcessor(config: AddAutoProcessorConfig): Promise<string> {
|
|
829
439
|
return await this.#client.addAutoProcessor(this.#handle.uuid, config)
|
|
@@ -927,7 +537,7 @@ export class PerspectiveProxy {
|
|
|
927
537
|
* The verdict is three-way — see {@link FlowReceiptVerdict}: branch on
|
|
928
538
|
* `outcome`, never on a boolean you derive from it.
|
|
929
539
|
*/
|
|
930
|
-
async verifyFlowReceipt(receipt:
|
|
540
|
+
async verifyFlowReceipt(receipt: JsonValue): Promise<FlowReceiptVerdict> {
|
|
931
541
|
return await this.#client.verifyFlowReceipt(this.#handle.uuid, receipt)
|
|
932
542
|
}
|
|
933
543
|
|
|
@@ -949,27 +559,52 @@ export class PerspectiveProxy {
|
|
|
949
559
|
return await this.#client.flowValidOutputs(this.#handle.uuid, flow, state)
|
|
950
560
|
}
|
|
951
561
|
|
|
952
|
-
/**
|
|
953
|
-
|
|
954
|
-
|
|
562
|
+
/**
|
|
563
|
+
* The state each flow instance is in, as **this agent's** executor last
|
|
564
|
+
* derived it — one entry per instance it has derived, optionally narrowed
|
|
565
|
+
* to `instances`. An instance missing from the answer has not been
|
|
566
|
+
* derived here yet; it stands at its flow's first state.
|
|
567
|
+
*
|
|
568
|
+
* The state is not stored on the graph: the engine derives it from the
|
|
569
|
+
* signed proposals and keeps what it derived per agent, outside the
|
|
570
|
+
* perspective. So no other agent — a co-owner on the same node included —
|
|
571
|
+
* can read or write your entries, and a link query never sees them.
|
|
572
|
+
* `FlowInstance.findAll` / `start` call this for you.
|
|
573
|
+
*/
|
|
574
|
+
async flowStates(instances?: string[]): Promise<FlowStateEntry[]> {
|
|
575
|
+
return await this.#client.flowStates(this.#handle.uuid, instances)
|
|
955
576
|
}
|
|
956
577
|
|
|
957
|
-
/**
|
|
958
|
-
|
|
959
|
-
|
|
578
|
+
/**
|
|
579
|
+
* The proposals of `instance` whose votes settled an edge, as this
|
|
580
|
+
* agent's executor recorded them — the flow's history, sorted by URI.
|
|
581
|
+
* Replaces the `resolvedAs` property proposals used to carry.
|
|
582
|
+
*/
|
|
583
|
+
async flowFired(instance: string): Promise<string[]> {
|
|
584
|
+
return await this.#client.flowFired(this.#handle.uuid, instance)
|
|
960
585
|
}
|
|
961
586
|
|
|
962
587
|
/**
|
|
963
|
-
*
|
|
964
|
-
*
|
|
965
|
-
*
|
|
966
|
-
*
|
|
967
|
-
*
|
|
588
|
+
* Called whenever a flow instance on this perspective changes state on
|
|
589
|
+
* this agent's executor, or an edge settles: `{ instance, from, to,
|
|
590
|
+
* firedProposals, caughtUp }`. Only this agent's sockets receive it.
|
|
591
|
+
*
|
|
592
|
+
* When the executor first derives an instance that already has history
|
|
593
|
+
* (it synced in, or the executor was upgraded) it is called once with
|
|
594
|
+
* `caughtUp: true`, `from: null` and no `firedProposals`: the settles
|
|
595
|
+
* before that are history, but `to` is the state to show for a run that
|
|
596
|
+
* read as not derived (`FlowInstance.currentStateName === undefined`).
|
|
597
|
+
*
|
|
598
|
+
* Returns a function that removes the handler; {@link dispose} removes
|
|
599
|
+
* it too.
|
|
968
600
|
*/
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
601
|
+
onFlowStateChanged(handler: (event: EventMap["flow-state-changed"]) => void): () => void {
|
|
602
|
+
return this.on("flow-state-changed", handler)
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
/** Mint and store the receipt for a completed flow run. */
|
|
606
|
+
async mintFlowReceipt(instanceUri: string): Promise<FlowMintedReceipt> {
|
|
607
|
+
return await this.#client.mintFlowReceipt(this.#handle.uuid, instanceUri)
|
|
973
608
|
}
|
|
974
609
|
|
|
975
610
|
/**
|
|
@@ -1036,11 +671,13 @@ export class PerspectiveProxy {
|
|
|
1036
671
|
* triples (written by `addSdna`). Callers no longer ship shape
|
|
1037
672
|
* metadata with the query; the perspective is the source of truth.
|
|
1038
673
|
*
|
|
1039
|
-
* @param className - The model class name (e.g. "Recipe")
|
|
674
|
+
* @param className - The model class name (e.g. "Recipe"), or several: one
|
|
675
|
+
* query over their union, whose rows carry `__subjectClass` and
|
|
676
|
+
* `__subjectClasses` (#1238)
|
|
1040
677
|
* @param queryJson - Structured query as JSON string
|
|
1041
678
|
* @returns Object with `instances` array and `totalCount`
|
|
1042
679
|
*/
|
|
1043
|
-
async modelQuery(className: string, queryJson: string, options?: CallOptions): Promise<{ instances: any[], totalCount: number }> {
|
|
680
|
+
async modelQuery(className: string | string[], queryJson: string, options?: CallOptions): Promise<{ instances: any[], totalCount: number }> {
|
|
1044
681
|
return await this.#client.modelQuery(this.#handle.uuid, className, queryJson, options);
|
|
1045
682
|
}
|
|
1046
683
|
|
|
@@ -1102,18 +739,16 @@ export class PerspectiveProxy {
|
|
|
1102
739
|
}
|
|
1103
740
|
|
|
1104
741
|
/**
|
|
1105
|
-
*
|
|
1106
|
-
*
|
|
1107
|
-
*
|
|
1108
|
-
*
|
|
1109
|
-
* The subscription reuses the same WS-RPC subscription channel as subscribeQuery().
|
|
1110
|
-
* Use keepAliveQuery() / disposeQuerySubscription() with the returned subscriptionId.
|
|
742
|
+
* Open a live model query on the executor. Later changes arrive as
|
|
743
|
+
* updates; `LiveQuery` (or `ModelQueryBuilder.subscribe()`) applies them.
|
|
744
|
+
* The subscription ends with `disposeQuerySubscription()` or when the
|
|
745
|
+
* socket closes.
|
|
1111
746
|
*
|
|
1112
|
-
* @param className - The model class name
|
|
747
|
+
* @param className - The model class name, or several (same as modelQuery)
|
|
1113
748
|
* @param queryJson - JSON-serialized query parameters (same as modelQuery)
|
|
1114
|
-
* @returns
|
|
749
|
+
* @returns `subscriptionId`, initial `result` and `revision` (0)
|
|
1115
750
|
*/
|
|
1116
|
-
async modelSubscribe(className: string, queryJson: string): Promise<
|
|
751
|
+
async modelSubscribe(className: string | string[], queryJson: string): Promise<Subscribed> {
|
|
1117
752
|
return await this.#client.modelSubscribe(this.#handle.uuid, className, queryJson);
|
|
1118
753
|
}
|
|
1119
754
|
|
|
@@ -1298,78 +933,31 @@ export class PerspectiveProxy {
|
|
|
1298
933
|
}
|
|
1299
934
|
|
|
1300
935
|
/**
|
|
1301
|
-
*
|
|
1302
|
-
*
|
|
1303
|
-
*
|
|
1304
|
-
* @param cb - Callback function
|
|
1305
|
-
*
|
|
1306
|
-
* @example
|
|
1307
|
-
* ```typescript
|
|
1308
|
-
* // Listen for new links
|
|
1309
|
-
* perspective.addListener("link-added", (link) => {
|
|
1310
|
-
* console.log("New link:", link);
|
|
1311
|
-
* });
|
|
1312
|
-
*
|
|
1313
|
-
* // Listen for removed links
|
|
1314
|
-
* perspective.addListener("link-removed", (link) => {
|
|
1315
|
-
* console.log("Link removed:", link);
|
|
1316
|
-
* });
|
|
1317
|
-
* ```
|
|
1318
|
-
*/
|
|
1319
|
-
async addListener(type: PerspectiveListenerTypes, cb: LinkCallback) {
|
|
1320
|
-
if (type === 'link-added') {
|
|
1321
|
-
this.#perspectiveLinkAddedCallbacks.push(cb);
|
|
1322
|
-
} else if (type === 'link-removed') {
|
|
1323
|
-
this.#perspectiveLinkRemovedCallbacks.push(cb);
|
|
1324
|
-
} else if (type === 'link-updated') {
|
|
1325
|
-
this.#perspectiveLinkUpdatedCallbacks.push(cb);
|
|
1326
|
-
}
|
|
1327
|
-
}
|
|
1328
|
-
|
|
1329
|
-
/**
|
|
1330
|
-
* Subscribes to sync state changes if this perspective is shared.
|
|
1331
|
-
*
|
|
1332
|
-
* @param cb - Callback function
|
|
1333
|
-
*
|
|
936
|
+
* Call `handler` with every `type` event about this perspective, until the
|
|
937
|
+
* returned function or {@link dispose} releases it.
|
|
938
|
+
*
|
|
1334
939
|
* @example
|
|
1335
940
|
* ```typescript
|
|
1336
|
-
* perspective.
|
|
1337
|
-
*
|
|
1338
|
-
* });
|
|
941
|
+
* perspective.on("link-added", ({ link }) => console.log("New link:", link));
|
|
942
|
+
* perspective.on("link-updated", ({ oldLink, newLink }) => console.log(oldLink, "->", newLink));
|
|
943
|
+
* perspective.on("sync-state-change", ({ state }) => console.log("Sync state:", state));
|
|
1339
944
|
* ```
|
|
1340
945
|
*/
|
|
1341
|
-
|
|
1342
|
-
this
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
*
|
|
1348
|
-
* @param type - Type of change to stop listening for
|
|
1349
|
-
* @param cb - The callback function to remove
|
|
1350
|
-
*/
|
|
1351
|
-
async removeListener(type: PerspectiveListenerTypes, cb: LinkCallback) {
|
|
1352
|
-
if (type === 'link-added') {
|
|
1353
|
-
const index = this.#perspectiveLinkAddedCallbacks.indexOf(cb);
|
|
1354
|
-
if (index >= 0) this.#perspectiveLinkAddedCallbacks.splice(index, 1);
|
|
1355
|
-
} else if (type === 'link-removed') {
|
|
1356
|
-
const index = this.#perspectiveLinkRemovedCallbacks.indexOf(cb);
|
|
1357
|
-
if (index >= 0) this.#perspectiveLinkRemovedCallbacks.splice(index, 1);
|
|
1358
|
-
} else if (type === 'link-updated') {
|
|
1359
|
-
const index = this.#perspectiveLinkUpdatedCallbacks.indexOf(cb);
|
|
1360
|
-
if (index >= 0) this.#perspectiveLinkUpdatedCallbacks.splice(index, 1);
|
|
946
|
+
on<K extends ScopedEventName>(type: K, handler: (event: EventMap[K]) => void): () => void {
|
|
947
|
+
// A registration of this proxy's own, so dispose() cannot release another proxy's
|
|
948
|
+
// registration of the same function (on() treats equal handlers as one).
|
|
949
|
+
const release = this.#client.on(type, (event: EventMap[K]) => handler(event), { perspective: this.#handle.uuid })
|
|
950
|
+
const releaseOnce = () => {
|
|
951
|
+
if (this.#releases.delete(releaseOnce)) release()
|
|
1361
952
|
}
|
|
953
|
+
this.#releases.add(releaseOnce)
|
|
954
|
+
return releaseOnce
|
|
1362
955
|
}
|
|
1363
956
|
|
|
1364
|
-
/**
|
|
1365
|
-
*
|
|
1366
|
-
* After calling dispose(), the proxy should not be used. */
|
|
957
|
+
/** Removes every handler this proxy registered. Other proxies for the same
|
|
958
|
+
* perspective keep theirs. */
|
|
1367
959
|
dispose(): void {
|
|
1368
|
-
|
|
1369
|
-
this.#perspectiveLinkAddedCallbacks.length = 0
|
|
1370
|
-
this.#perspectiveLinkRemovedCallbacks.length = 0
|
|
1371
|
-
this.#perspectiveLinkUpdatedCallbacks.length = 0
|
|
1372
|
-
this.#perspectiveSyncStateChangeCallbacks.length = 0
|
|
960
|
+
for (const release of [...this.#releases]) release()
|
|
1373
961
|
}
|
|
1374
962
|
|
|
1375
963
|
/**
|
|
@@ -1443,17 +1031,8 @@ export class PerspectiveProxy {
|
|
|
1443
1031
|
*/
|
|
1444
1032
|
async setSingleTarget(link: Link, status: LinkStatus = 'shared') {
|
|
1445
1033
|
const query = new LinkQuery({source: link.source, predicate: link.predicate})
|
|
1446
|
-
const
|
|
1447
|
-
|
|
1448
|
-
for(const l of foundLinks){
|
|
1449
|
-
delete l.__typename
|
|
1450
|
-
delete l.data.__typename
|
|
1451
|
-
delete l.proof.__typename
|
|
1452
|
-
removals.push(l);
|
|
1453
|
-
}
|
|
1454
|
-
const additions = [link];
|
|
1455
|
-
|
|
1456
|
-
await this.linkMutations({additions, removals}, status)
|
|
1034
|
+
const removals = await this.get(query)
|
|
1035
|
+
await this.linkMutations({additions: [link], removals}, status)
|
|
1457
1036
|
}
|
|
1458
1037
|
|
|
1459
1038
|
/** Returns all the Social DNA flows defined in this perspective */
|
|
@@ -1627,6 +1206,8 @@ export class PerspectiveProxy {
|
|
|
1627
1206
|
async ensureSubjectClasses(jsClasses: any[]): Promise<void> {
|
|
1628
1207
|
const entries: { name: string; sdnaCode?: string; sdnaType: "subject_class" | "flow" | "custom"; shaclJson?: string }[] = [];
|
|
1629
1208
|
for (const jsClass of jsClasses) {
|
|
1209
|
+
// Built-in classes (`TextContent`) live in the executor, not here.
|
|
1210
|
+
if (Object.prototype.hasOwnProperty.call(jsClass, 'builtinUri')) continue;
|
|
1630
1211
|
const className = jsClass.className || jsClass.prototype?.className || jsClass.name;
|
|
1631
1212
|
if (this.#ensuredSubjectClasses.has(className)) continue;
|
|
1632
1213
|
|
|
@@ -1649,19 +1230,12 @@ export class PerspectiveProxy {
|
|
|
1649
1230
|
}
|
|
1650
1231
|
}
|
|
1651
1232
|
|
|
1652
|
-
/**
|
|
1653
|
-
* Adds a subject class to the perspective.
|
|
1654
|
-
* Alias for addSdna() with sdnaType='subject_class'.
|
|
1655
|
-
*/
|
|
1656
|
-
async addSubjectClass(name: string, shaclJson: string) {
|
|
1657
|
-
return this.addSdna(name, '', 'subject_class', shaclJson);
|
|
1658
|
-
}
|
|
1659
|
-
|
|
1660
1233
|
/**
|
|
1661
1234
|
* **Recommended way to add SDNA schemas.**
|
|
1662
1235
|
*
|
|
1663
|
-
* Store a SHACL shape in this Perspective
|
|
1664
|
-
*
|
|
1236
|
+
* Store a SHACL shape in this Perspective. The executor writes it as links, as it
|
|
1237
|
+
* does for `@Model` classes. The shape needs a `targetClass` and keeps its
|
|
1238
|
+
* `nodeShapeUri`, which must end with `{name}Shape`.
|
|
1665
1239
|
*
|
|
1666
1240
|
* @param name - Unique name for this schema (e.g., 'Recipe', 'Task')
|
|
1667
1241
|
* @param shape - SHACLShape instance defining the schema
|
|
@@ -1685,31 +1259,7 @@ export class PerspectiveProxy {
|
|
|
1685
1259
|
* await perspective.addShacl('Recipe', shape);
|
|
1686
1260
|
*/
|
|
1687
1261
|
async addShacl(name: string, shape: SHACLShape): Promise<void> {
|
|
1688
|
-
|
|
1689
|
-
const shapeLinks = shape.toLinks();
|
|
1690
|
-
|
|
1691
|
-
// Create name -> shape mapping links
|
|
1692
|
-
const nameMapping = Literal.fromUrl(`literal:string:shacl://${name}`);
|
|
1693
|
-
const allLinks: Link[] = [
|
|
1694
|
-
...shapeLinks.map(l => new Link({
|
|
1695
|
-
source: l.source,
|
|
1696
|
-
predicate: l.predicate,
|
|
1697
|
-
target: l.target
|
|
1698
|
-
})),
|
|
1699
|
-
new Link({
|
|
1700
|
-
source: "ad4m://self",
|
|
1701
|
-
predicate: "ad4m://has_shacl",
|
|
1702
|
-
target: nameMapping.toUrl()
|
|
1703
|
-
}),
|
|
1704
|
-
new Link({
|
|
1705
|
-
source: nameMapping.toUrl(),
|
|
1706
|
-
predicate: "ad4m://shacl_shape_uri",
|
|
1707
|
-
target: shape.nodeShapeUri
|
|
1708
|
-
})
|
|
1709
|
-
];
|
|
1710
|
-
|
|
1711
|
-
// Batch add all links at once
|
|
1712
|
-
await this.addLinks(allLinks);
|
|
1262
|
+
await this.addSdna(name, '', 'subject_class', JSON.stringify(shape.toJSON()));
|
|
1713
1263
|
}
|
|
1714
1264
|
|
|
1715
1265
|
/**
|
|
@@ -1745,15 +1295,20 @@ export class PerspectiveProxy {
|
|
|
1745
1295
|
/**
|
|
1746
1296
|
* Get all SHACL shapes stored in this Perspective (one RPC call).
|
|
1747
1297
|
* The executor resolves all shapes in-process and returns them in bulk.
|
|
1298
|
+
* A shape that fails to decode is skipped with a `console.warn`, so it
|
|
1299
|
+
* does not hide the others.
|
|
1748
1300
|
*/
|
|
1749
1301
|
async getAllShacl(): Promise<Array<{name: string, shape: SHACLShape}>> {
|
|
1750
1302
|
const entries = await this.#client.getAllShacl(this.#handle.uuid);
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
})
|
|
1756
|
-
|
|
1303
|
+
const shapes: Array<{name: string, shape: SHACLShape}> = [];
|
|
1304
|
+
for (const { name, shapeUri, links } of entries) {
|
|
1305
|
+
try {
|
|
1306
|
+
shapes.push({ name, shape: SHACLShape.fromLinks(links as any, shapeUri) });
|
|
1307
|
+
} catch (e) {
|
|
1308
|
+
console.warn(`getAllShacl: skipping SHACL shape "${name}" that cannot be decoded:`, e);
|
|
1309
|
+
}
|
|
1310
|
+
}
|
|
1311
|
+
return shapes;
|
|
1757
1312
|
}
|
|
1758
1313
|
|
|
1759
1314
|
/**
|
|
@@ -1790,33 +1345,59 @@ export class PerspectiveProxy {
|
|
|
1790
1345
|
*
|
|
1791
1346
|
* await perspective.addFlow('Delivery', deliveryFlow);
|
|
1792
1347
|
* ```
|
|
1348
|
+
*
|
|
1349
|
+
* Rejects, storing nothing, when a `consensusRule` carries a key the
|
|
1350
|
+
* executor does not know or a key written twice (#1144): the error names
|
|
1351
|
+
* the state and the key.
|
|
1793
1352
|
*/
|
|
1794
1353
|
async addFlow(name: string, flow: SHACLFlow): Promise<void> {
|
|
1795
|
-
// Serialize flow to links
|
|
1796
|
-
const flowLinks = flow.toLinks();
|
|
1797
|
-
|
|
1798
|
-
// Create registration and mapping links
|
|
1799
1354
|
const flowNameLiteral = Literal.from(name).toUrl();
|
|
1800
|
-
const
|
|
1801
|
-
...
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
target: l.target
|
|
1805
|
-
})),
|
|
1806
|
-
new Link({
|
|
1807
|
-
source: "ad4m://self",
|
|
1808
|
-
predicate: "ad4m://has_flow",
|
|
1809
|
-
target: flowNameLiteral
|
|
1810
|
-
}),
|
|
1811
|
-
new Link({
|
|
1812
|
-
source: flowNameLiteral,
|
|
1813
|
-
predicate: "ad4m://flow_uri",
|
|
1814
|
-
target: flow.flowUri
|
|
1815
|
-
})
|
|
1355
|
+
const wanted = [
|
|
1356
|
+
...flow.toLinks(),
|
|
1357
|
+
{ source: "ad4m://self", predicate: "ad4m://has_flow", target: flowNameLiteral },
|
|
1358
|
+
{ source: flowNameLiteral, predicate: "ad4m://flow_uri", target: flow.flowUri },
|
|
1816
1359
|
];
|
|
1817
|
-
|
|
1818
|
-
//
|
|
1819
|
-
|
|
1360
|
+
|
|
1361
|
+
// Re-adding a flow replaces its definition. Adding alone would leave
|
|
1362
|
+
// a changed consensus rule beside the old one, and a state holding two
|
|
1363
|
+
// rules refuses every move into it. What is stored is found through
|
|
1364
|
+
// the flow's own links, since state and transition URIs may use an
|
|
1365
|
+
// older scheme. Only definition predicates are taken, from the flow's
|
|
1366
|
+
// URI and from each state and transition URI: all of them can carry
|
|
1367
|
+
// links the definition does not own.
|
|
1368
|
+
const flowLevel = new Set(SHACLFlow.FLOW_LEVEL_PREDICATES);
|
|
1369
|
+
const childLevel = new Set(SHACLFlow.STATE_AND_TRANSITION_PREDICATES);
|
|
1370
|
+
const ownLinks = (await this.get(new LinkQuery({ source: flow.flowUri })))
|
|
1371
|
+
.filter(l => flowLevel.has(l.data.predicate));
|
|
1372
|
+
const children = ownLinks
|
|
1373
|
+
.filter(l => l.data.predicate === "ad4m://hasState" || l.data.predicate === "ad4m://hasTransition")
|
|
1374
|
+
.map(l => l.data.target);
|
|
1375
|
+
const childLinks = (await Promise.all(children.map(uri => this.get(new LinkQuery({ source: uri })))))
|
|
1376
|
+
.flat()
|
|
1377
|
+
.filter(l => childLevel.has(l.data.predicate));
|
|
1378
|
+
// A name points at one flow: getFlow reads the first flow_uri link,
|
|
1379
|
+
// and FlowInstance.findAll drops records of any other flow URI. So
|
|
1380
|
+
// every flow_uri link of this name is taken, and one left from an
|
|
1381
|
+
// earlier namespace is removed rather than kept beside the new one.
|
|
1382
|
+
const registration = [
|
|
1383
|
+
...await this.get(new LinkQuery({ source: "ad4m://self", predicate: "ad4m://has_flow", target: flowNameLiteral })),
|
|
1384
|
+
...await this.get(new LinkQuery({ source: flowNameLiteral, predicate: "ad4m://flow_uri" })),
|
|
1385
|
+
];
|
|
1386
|
+
const stored = [...ownLinks, ...childLinks, ...registration];
|
|
1387
|
+
|
|
1388
|
+
// Only the difference is written, so an unchanged definition writes
|
|
1389
|
+
// nothing and a changed one touches only what changed.
|
|
1390
|
+
const key = (l: { source: string; predicate?: string; target: string }) =>
|
|
1391
|
+
JSON.stringify([l.source, l.predicate ?? "", l.target]);
|
|
1392
|
+
const wantedKeys = new Set(wanted.map(key));
|
|
1393
|
+
const storedKeys = new Set(stored.map(l => key(l.data)));
|
|
1394
|
+
const additions = wanted
|
|
1395
|
+
.filter((l, i, all) => !storedKeys.has(key(l)) && all.findIndex(o => key(o) === key(l)) === i)
|
|
1396
|
+
.map(l => new Link(l));
|
|
1397
|
+
const removals = stored.filter(l => !wantedKeys.has(key(l.data)));
|
|
1398
|
+
|
|
1399
|
+
if (additions.length === 0 && removals.length === 0) return;
|
|
1400
|
+
await this.linkMutations({ additions, removals });
|
|
1820
1401
|
}
|
|
1821
1402
|
|
|
1822
1403
|
/**
|
|
@@ -1868,27 +1449,25 @@ export class PerspectiveProxy {
|
|
|
1868
1449
|
* Uses SHACL-based lookup (Prolog-free implementation).
|
|
1869
1450
|
*/
|
|
1870
1451
|
async subjectClasses(): Promise<string[]> {
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
.
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
return [];
|
|
1891
|
-
}
|
|
1452
|
+
// A failed lookup rejects. Answering `[]` would read as "no classes are
|
|
1453
|
+
// registered", which a caller deciding whether to register its own
|
|
1454
|
+
// classes acts on.
|
|
1455
|
+
// Query SHACL class links directly — no need for a separate RPC endpoint
|
|
1456
|
+
const classLinks = await this.get(new LinkQuery({
|
|
1457
|
+
predicate: "rdf://type",
|
|
1458
|
+
target: "ad4m://SubjectClass"
|
|
1459
|
+
}));
|
|
1460
|
+
const classNames = classLinks
|
|
1461
|
+
.map(l => {
|
|
1462
|
+
const source = l.data.source;
|
|
1463
|
+
// Extract class name from URI like "recipe://Recipe" or "flux://Channel"
|
|
1464
|
+
const parts = source.split("://");
|
|
1465
|
+
const lastPart = parts[parts.length - 1];
|
|
1466
|
+
return lastPart.split('/').pop() || '';
|
|
1467
|
+
})
|
|
1468
|
+
.filter(name => name.length > 0);
|
|
1469
|
+
// Deduplicate
|
|
1470
|
+
return [...new Set(classNames)];
|
|
1892
1471
|
}
|
|
1893
1472
|
|
|
1894
1473
|
/**
|
|
@@ -1905,22 +1484,19 @@ export class PerspectiveProxy {
|
|
|
1905
1484
|
* registered should call this once and test membership against the returned
|
|
1906
1485
|
* set, rather than issuing one `queryLinks` per model.
|
|
1907
1486
|
*
|
|
1908
|
-
* One `queryLinks` round trip, no executor-side changes.
|
|
1487
|
+
* One `queryLinks` round trip, no executor-side changes. A failed lookup
|
|
1488
|
+
* rejects rather than answering `[]`, which would read as "nothing is
|
|
1489
|
+
* registered" and lead such a caller to register everything again.
|
|
1909
1490
|
*/
|
|
1910
1491
|
async subjectClassTargetClasses(): Promise<string[]> {
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
return [...new Set(uris)];
|
|
1920
|
-
} catch (e) {
|
|
1921
|
-
console.warn('subjectClassTargetClasses: lookup failed:', e);
|
|
1922
|
-
return [];
|
|
1923
|
-
}
|
|
1492
|
+
const classLinks = await this.get(new LinkQuery({
|
|
1493
|
+
predicate: "rdf://type",
|
|
1494
|
+
target: "ad4m://SubjectClass"
|
|
1495
|
+
}));
|
|
1496
|
+
const uris = classLinks
|
|
1497
|
+
.map(l => l.data.source)
|
|
1498
|
+
.filter(source => source.length > 0);
|
|
1499
|
+
return [...new Set(uris)];
|
|
1924
1500
|
}
|
|
1925
1501
|
|
|
1926
1502
|
async stringOrTemplateObjectToSubjectClassName<T>(subjectClass: T): Promise<string> {
|
|
@@ -2000,6 +1576,14 @@ export class PerspectiveProxy {
|
|
|
2000
1576
|
return exprAddr as unknown as B extends undefined ? T : string;
|
|
2001
1577
|
}
|
|
2002
1578
|
|
|
1579
|
+
/** Sets properties of an existing instance in the executor. Through an
|
|
1580
|
+
* abstract class (#1435), each value is written by every class of the
|
|
1581
|
+
* record that the abstract class reads, under its own name. */
|
|
1582
|
+
async updateSubject(className: string, exprAddr: string, values: Record<string, any>, batchId?: string) {
|
|
1583
|
+
await this.#client.updateSubject(this.#handle.uuid, className, exprAddr, JSON.stringify(values), batchId);
|
|
1584
|
+
invalidatePerspectiveCache(this.#handle.uuid);
|
|
1585
|
+
}
|
|
1586
|
+
|
|
2003
1587
|
async getSubjectData<T>(subjectClass: T, exprAddr: string): Promise<T> {
|
|
2004
1588
|
if (typeof subjectClass === "string") {
|
|
2005
1589
|
return JSON.parse(await this.#client.getSubjectData(this.#handle.uuid, JSON.stringify({className: subjectClass}), exprAddr))
|
|
@@ -2057,8 +1641,26 @@ export class PerspectiveProxy {
|
|
|
2057
1641
|
* and won't be executed until the batch is committed.
|
|
2058
1642
|
*/
|
|
2059
1643
|
async removeSubject<T>(subjectClass: T, exprAddr: string, batchId?: string) {
|
|
1644
|
+
// A built-in abstract class (`TextContent`, #1446) is never stored,
|
|
1645
|
+
// so it has no marker: the executor dispatches it by its URI.
|
|
1646
|
+
const ctor = (subjectClass as any)?.constructor;
|
|
1647
|
+
if (typeof subjectClass === "object" && ctor && Object.prototype.hasOwnProperty.call(ctor, 'builtinUri')) {
|
|
1648
|
+
await this.#client.removeSubject(this.#handle.uuid, ctor.builtinUri, exprAddr, batchId);
|
|
1649
|
+
invalidatePerspectiveCache(this.#handle.uuid);
|
|
1650
|
+
return;
|
|
1651
|
+
}
|
|
2060
1652
|
let className = await this.stringOrTemplateObjectToSubjectClassName(subjectClass)
|
|
2061
1653
|
|
|
1654
|
+
// An abstract class (#1435) is never a record's class: the executor
|
|
1655
|
+
// runs the destructors of the record's classes it reads.
|
|
1656
|
+
const shapePattern = new RegExp(`[/:#]${this.escapeRegExp(className)}Shape$`);
|
|
1657
|
+
const markers = await this.get(new LinkQuery({ predicate: "ad4m://abstract" }));
|
|
1658
|
+
if (markers.some((link) => shapePattern.test(link.data.source))) {
|
|
1659
|
+
await this.#client.removeSubject(this.#handle.uuid, className, exprAddr, batchId);
|
|
1660
|
+
invalidatePerspectiveCache(this.#handle.uuid);
|
|
1661
|
+
return;
|
|
1662
|
+
}
|
|
1663
|
+
|
|
2062
1664
|
// Get destructor actions from SHACL links (Prolog-free)
|
|
2063
1665
|
let actions = await this.getActionsFromSHACL(className, "ad4m://destructor");
|
|
2064
1666
|
|
|
@@ -2408,6 +2010,9 @@ export class PerspectiveProxy {
|
|
|
2408
2010
|
|
|
2409
2011
|
/** Takes a JS class (its constructor) and ensures the SHACL subject class exists. */
|
|
2410
2012
|
async ensureSubjectClass(jsClass: any): Promise<void> {
|
|
2013
|
+
// Built-in classes (`TextContent`) live in the executor, not here.
|
|
2014
|
+
if (Object.prototype.hasOwnProperty.call(jsClass, 'builtinUri')) return;
|
|
2015
|
+
|
|
2411
2016
|
// Get the class name from the JS class
|
|
2412
2017
|
const className = jsClass.className || jsClass.prototype?.className || jsClass.name;
|
|
2413
2018
|
|
|
@@ -2662,95 +2267,13 @@ export class PerspectiveProxy {
|
|
|
2662
2267
|
return this.#client.aiClient
|
|
2663
2268
|
}
|
|
2664
2269
|
|
|
2665
|
-
/**
|
|
2666
|
-
*
|
|
2667
|
-
*
|
|
2668
|
-
* This method:
|
|
2669
|
-
* 1. Creates the subscription on the Rust side
|
|
2670
|
-
* 2. Sets up the subscription callback
|
|
2671
|
-
* 3. Waits for the initial result to come through the subscription channel
|
|
2672
|
-
* 4. Returns a fully initialized QuerySubscriptionProxy
|
|
2673
|
-
*
|
|
2674
|
-
* The returned subscription is guaranteed to be ready to receive updates,
|
|
2675
|
-
* as this method waits for the initialization process to complete.
|
|
2676
|
-
*
|
|
2677
|
-
* The subscription will be automatically cleaned up on both frontend and backend
|
|
2678
|
-
* when dispose() is called. Make sure to call dispose() when you're done to
|
|
2679
|
-
* prevent memory leaks and ensure proper cleanup of resources.
|
|
2680
|
-
*
|
|
2681
|
-
* @param query - Prolog query string
|
|
2682
|
-
* @returns Initialized QuerySubscriptionProxy instance
|
|
2683
|
-
*
|
|
2684
|
-
* @example
|
|
2685
|
-
* ```typescript
|
|
2686
|
-
* // Subscribe to active todos
|
|
2687
|
-
* const subscription = await perspective.subscribeInfer(`
|
|
2688
|
-
* instance(Todo, "Todo"),
|
|
2689
|
-
* property_getter("Todo", Todo, "state", "active")
|
|
2690
|
-
* `);
|
|
2691
|
-
*
|
|
2692
|
-
* // Subscription is already initialized here
|
|
2693
|
-
* console.log("Initial result:", subscription.result);
|
|
2694
|
-
*
|
|
2695
|
-
* // Set up callback for future updates
|
|
2696
|
-
* subscription.onResult((todos) => {
|
|
2697
|
-
* console.log("Active todos:", todos);
|
|
2698
|
-
* });
|
|
2699
|
-
*
|
|
2700
|
-
* // Clean up subscription when done
|
|
2701
|
-
* subscription.dispose();
|
|
2702
|
-
* ```
|
|
2703
|
-
*/
|
|
2704
|
-
async subscribeInfer(query: string): Promise<QuerySubscriptionProxy> {
|
|
2705
|
-
const subscriptionProxy = new QuerySubscriptionProxy(
|
|
2706
|
-
this.uuid,
|
|
2707
|
-
query,
|
|
2708
|
-
this.#client
|
|
2709
|
-
);
|
|
2710
|
-
|
|
2711
|
-
// Start the subscription on the Rust side first to get the real subscription ID
|
|
2712
|
-
await subscriptionProxy.subscribe();
|
|
2713
|
-
|
|
2714
|
-
// Wait for the initial result
|
|
2715
|
-
await subscriptionProxy.initialized;
|
|
2716
|
-
|
|
2717
|
-
return subscriptionProxy;
|
|
2718
|
-
}
|
|
2719
|
-
|
|
2720
|
-
/**
|
|
2721
|
-
* Creates a subscription for a SPARQL query that updates in real-time.
|
|
2722
|
-
*
|
|
2723
|
-
* This method:
|
|
2724
|
-
* 1. Creates the subscription on the Rust side
|
|
2725
|
-
* 2. Sets up the subscription callback
|
|
2726
|
-
* 3. Waits for the initial result to come through the subscription channel
|
|
2727
|
-
* 4. Returns a fully initialized QuerySubscriptionProxy
|
|
2728
|
-
*
|
|
2729
|
-
* The returned subscription is guaranteed to be ready to receive updates,
|
|
2730
|
-
* as this method waits for the initialization process to complete.
|
|
2731
|
-
*
|
|
2732
|
-
* The subscription will be automatically cleaned up on both frontend and backend
|
|
2733
|
-
* when dispose() is called. Make sure to call dispose() when you're done to
|
|
2734
|
-
* prevent memory leaks and ensure proper cleanup of resources.
|
|
2735
|
-
*
|
|
2736
|
-
/** Subscribe to a query with live updates via the SPARQL subscription endpoint.
|
|
2737
|
-
* @param query - Query string
|
|
2738
|
-
* @returns Initialized QuerySubscriptionProxy instance
|
|
2739
|
-
*/
|
|
2270
|
+
/** Live SPARQL query: resolves once the first result is in.
|
|
2271
|
+
* Call `dispose()` on the returned proxy when done. The executor
|
|
2272
|
+
* refuses a Prolog query (400): Prolog live queries are not supported. */
|
|
2740
2273
|
async subscribeQuery(query: string): Promise<QuerySubscriptionProxy> {
|
|
2741
|
-
const
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
this.#client
|
|
2745
|
-
);
|
|
2746
|
-
|
|
2747
|
-
// Start the subscription on the Rust side first to get the real subscription ID
|
|
2748
|
-
await subscriptionProxy.subscribe();
|
|
2749
|
-
|
|
2750
|
-
// Wait for the initial result
|
|
2751
|
-
await subscriptionProxy.initialized;
|
|
2752
|
-
|
|
2753
|
-
return subscriptionProxy;
|
|
2274
|
+
const subscription = new QuerySubscriptionProxy(this.uuid, query, this.#client);
|
|
2275
|
+
await subscription.subscribe();
|
|
2276
|
+
return subscription;
|
|
2754
2277
|
}
|
|
2755
2278
|
|
|
2756
2279
|
}
|