@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,20 +1,21 @@
|
|
|
1
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
+
};
|
|
1
6
|
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
7
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
8
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
9
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
10
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
11
|
};
|
|
7
|
-
var
|
|
8
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
-
};
|
|
12
|
-
var _QuerySubscriptionProxy_instances, _QuerySubscriptionProxy_uuid, _QuerySubscriptionProxy_subscriptionId, _QuerySubscriptionProxy_client, _QuerySubscriptionProxy_callbacks, _QuerySubscriptionProxy_keepaliveTimer, _QuerySubscriptionProxy_unsubscribe, _QuerySubscriptionProxy_reconnectUnsub, _QuerySubscriptionProxy_latestResult, _QuerySubscriptionProxy_disposed, _QuerySubscriptionProxy_initialized, _QuerySubscriptionProxy_initResolve, _QuerySubscriptionProxy_initReject, _QuerySubscriptionProxy_initTimeoutId, _QuerySubscriptionProxy_query, _QuerySubscriptionProxy_generation, _QuerySubscriptionProxy_deliverResult, _QuerySubscriptionProxy_startKeepalive, _QuerySubscriptionProxy_notifyCallbacks, _PerspectiveProxy_handle, _PerspectiveProxy_client, _PerspectiveProxy_perspectiveLinkAddedCallbacks, _PerspectiveProxy_perspectiveLinkRemovedCallbacks, _PerspectiveProxy_perspectiveLinkUpdatedCallbacks, _PerspectiveProxy_perspectiveSyncStateChangeCallbacks, _PerspectiveProxy_ensuredSubjectClasses, _PerspectiveProxy_overlaysInFlight;
|
|
12
|
+
var _QuerySubscriptionProxy_instances, _QuerySubscriptionProxy_live, _QuerySubscriptionProxy_callbacks, _QuerySubscriptionProxy_initialized, _QuerySubscriptionProxy_initResolve, _QuerySubscriptionProxy_initReject, _QuerySubscriptionProxy_deliver, _PerspectiveProxy_handle, _PerspectiveProxy_client, _PerspectiveProxy_releases, _PerspectiveProxy_ensuredSubjectClasses, _PerspectiveProxy_overlaysInFlight;
|
|
13
13
|
import { Link } from "../links/Links";
|
|
14
14
|
import { LinkQuery } from "./LinkQuery";
|
|
15
15
|
import { Literal } from "../Literal";
|
|
16
16
|
import { getPropertiesMetadata, getRelationsMetadata } from "../model/decorators";
|
|
17
17
|
import { getCachedResult, setCachedResult, invalidatePerspectiveCache } from "../model/query-cache";
|
|
18
|
+
import { LiveQuery } from "./LiveQuery";
|
|
18
19
|
import { SHACLShape } from "../shacl/SHACLShape";
|
|
19
20
|
import { SHACLFlow } from "../shacl/SHACLFlow";
|
|
20
21
|
/** Extract namespace prefix from a URI (everything up to and including the last / or #) */
|
|
@@ -30,421 +31,73 @@ function extractNamespaceFromUri(uri) {
|
|
|
30
31
|
return uri.substring(0, colonIdx + 1);
|
|
31
32
|
return uri;
|
|
32
33
|
}
|
|
33
|
-
/**
|
|
34
|
-
*
|
|
35
|
-
* This class handles:
|
|
36
|
-
* - Keeping the subscription alive by sending periodic keepalive signals
|
|
37
|
-
* - Managing callbacks for result updates
|
|
38
|
-
* - Subscribing to query updates via WebSocket subscriptions
|
|
39
|
-
* - Maintaining the latest query result
|
|
40
|
-
* - Ensuring subscription is fully initialized before allowing access
|
|
41
|
-
* - Cleaning up resources when disposed
|
|
34
|
+
/** A live SPARQL query with its latest result.
|
|
42
35
|
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
36
|
+
* `subscribe()` opens the query and resolves once the first result is in;
|
|
37
|
+
* `onResult()` callbacks then get every later result. The executor sends
|
|
38
|
+
* only changes; `LiveQuery` applies them, recovers from a missed update and
|
|
39
|
+
* re-opens the query after a reconnect. Call `dispose()` when done.
|
|
46
40
|
*
|
|
47
|
-
* The subscription goes through an initialization process where it waits for the first
|
|
48
|
-
* result to come through the subscription channel. You can await the `initialized`
|
|
49
|
-
* promise to ensure the subscription is ready. The initialization will timeout after
|
|
50
|
-
* 30 seconds if no result is received.
|
|
51
|
-
*
|
|
52
|
-
* Example usage:
|
|
53
41
|
* ```typescript
|
|
54
|
-
* const subscription = await perspective.
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
* // Set up callback for future updates
|
|
58
|
-
* const removeCallback = subscription.onResult(result => {
|
|
59
|
-
* console.log("New result:", result);
|
|
60
|
-
* });
|
|
61
|
-
*
|
|
62
|
-
* // Later: clean up subscription and notify backend
|
|
42
|
+
* const subscription = await perspective.subscribeQuery("SELECT ?s WHERE { ?s ?p ?o }");
|
|
43
|
+
* const remove = subscription.onResult(result => console.log(result));
|
|
63
44
|
* subscription.dispose();
|
|
64
45
|
* ```
|
|
65
46
|
*/
|
|
66
47
|
export class QuerySubscriptionProxy {
|
|
67
|
-
/** Creates a new query subscription
|
|
68
|
-
* @param uuid - The UUID of the perspective
|
|
69
|
-
* @param query - The Prolog query to subscribe to
|
|
70
|
-
* @param client - The PerspectiveClient instance to use for communication
|
|
71
|
-
*/
|
|
72
48
|
constructor(uuid, query, client) {
|
|
73
49
|
_QuerySubscriptionProxy_instances.add(this);
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
_QuerySubscriptionProxy_client.set(this, void 0);
|
|
77
|
-
_QuerySubscriptionProxy_callbacks.set(this, void 0);
|
|
78
|
-
_QuerySubscriptionProxy_keepaliveTimer.set(this, void 0);
|
|
79
|
-
_QuerySubscriptionProxy_unsubscribe.set(this, void 0);
|
|
80
|
-
_QuerySubscriptionProxy_reconnectUnsub.set(this, void 0);
|
|
81
|
-
_QuerySubscriptionProxy_latestResult.set(this, void 0);
|
|
82
|
-
_QuerySubscriptionProxy_disposed.set(this, false);
|
|
50
|
+
_QuerySubscriptionProxy_live.set(this, void 0);
|
|
51
|
+
_QuerySubscriptionProxy_callbacks.set(this, new Set());
|
|
83
52
|
_QuerySubscriptionProxy_initialized.set(this, void 0);
|
|
84
53
|
_QuerySubscriptionProxy_initResolve.set(this, void 0);
|
|
85
54
|
_QuerySubscriptionProxy_initReject.set(this, void 0);
|
|
86
|
-
|
|
87
|
-
_QuerySubscriptionProxy_query.set(this, void 0);
|
|
88
|
-
// Monotonic token guarding the three concurrent writers of
|
|
89
|
-
// `#unsubscribe`/`#subscriptionId` (full subscribe() from the keepalive
|
|
90
|
-
// and init-timeout retry paths, and the reconnect swap handler). Each
|
|
91
|
-
// writer bumps it on entry and re-checks after every await; a mismatch
|
|
92
|
-
// means a newer writer took over while we were suspended, so the stale
|
|
93
|
-
// continuation must back out instead of clobbering the newer state
|
|
94
|
-
// (worst case otherwise: an overwritten-but-never-called unsubscribe
|
|
95
|
-
// leaks its callback in ApiClient._wsCallbacks for the client lifetime).
|
|
96
|
-
_QuerySubscriptionProxy_generation.set(this, 0);
|
|
97
|
-
__classPrivateFieldSet(this, _QuerySubscriptionProxy_uuid, uuid, "f");
|
|
98
|
-
__classPrivateFieldSet(this, _QuerySubscriptionProxy_query, query, "f");
|
|
99
|
-
__classPrivateFieldSet(this, _QuerySubscriptionProxy_client, client, "f");
|
|
100
|
-
__classPrivateFieldSet(this, _QuerySubscriptionProxy_callbacks, new Set(), "f");
|
|
101
|
-
__classPrivateFieldSet(this, _QuerySubscriptionProxy_latestResult, null, "f");
|
|
102
|
-
// Create the promise once and store its resolve/reject
|
|
55
|
+
__classPrivateFieldSet(this, _QuerySubscriptionProxy_live, new LiveQuery(client, uuid, () => client.subscribeQuery(uuid, query), result => __classPrivateFieldGet(this, _QuerySubscriptionProxy_instances, "m", _QuerySubscriptionProxy_deliver).call(this, result)), "f");
|
|
103
56
|
__classPrivateFieldSet(this, _QuerySubscriptionProxy_initialized, new Promise((resolve, reject) => {
|
|
104
57
|
__classPrivateFieldSet(this, _QuerySubscriptionProxy_initResolve, resolve, "f");
|
|
105
58
|
__classPrivateFieldSet(this, _QuerySubscriptionProxy_initReject, reject, "f");
|
|
106
59
|
}), "f");
|
|
60
|
+
// `subscribe()` throws the same error, so a caller who never reads
|
|
61
|
+
// `initialized` must not get an unhandled rejection from it.
|
|
62
|
+
__classPrivateFieldGet(this, _QuerySubscriptionProxy_initialized, "f").catch(() => { });
|
|
107
63
|
}
|
|
64
|
+
/** Open the query; resolves with the first result delivered. */
|
|
108
65
|
async subscribe() {
|
|
109
|
-
var _a;
|
|
110
|
-
// Invalidate any suspended writer (older subscribe() or reconnect
|
|
111
|
-
// swap parked on an await) — see #generation.
|
|
112
|
-
const generation = __classPrivateFieldSet(this, _QuerySubscriptionProxy_generation, (_a = __classPrivateFieldGet(this, _QuerySubscriptionProxy_generation, "f"), ++_a), "f");
|
|
113
|
-
// Remove any prior reconnect listener FIRST — before we touch
|
|
114
|
-
// `#unsubscribe`. Rationale: `#unsubscribe()` calls into
|
|
115
|
-
// `ApiClient.subscribe()`'s deleter, which closes the WebSocket
|
|
116
|
-
// whenever this query owned the last `_wsCallbacks` entry (and no
|
|
117
|
-
// RPCs are pending). The subsequent `subscribeQuery()` below then
|
|
118
|
-
// re-opens a fresh socket, and that fresh `onopen` fires the
|
|
119
|
-
// reconnect callback set. If the OLD reconnect listener is still
|
|
120
|
-
// in that set, it re-enters this method, closes the socket again,
|
|
121
|
-
// reopens again … an endless resubscribe loop. Clearing the
|
|
122
|
-
// listener up-front breaks the cycle; a fresh listener is
|
|
123
|
-
// installed at the end of a successful subscribe(), and a
|
|
124
|
-
// full-retry recovery listener in the catch block on failure.
|
|
125
|
-
if (__classPrivateFieldGet(this, _QuerySubscriptionProxy_reconnectUnsub, "f")) {
|
|
126
|
-
__classPrivateFieldGet(this, _QuerySubscriptionProxy_reconnectUnsub, "f").call(this);
|
|
127
|
-
__classPrivateFieldSet(this, _QuerySubscriptionProxy_reconnectUnsub, undefined, "f");
|
|
128
|
-
}
|
|
129
|
-
// Clean up previous subscription attempt if retrying
|
|
130
|
-
if (__classPrivateFieldGet(this, _QuerySubscriptionProxy_unsubscribe, "f")) {
|
|
131
|
-
__classPrivateFieldGet(this, _QuerySubscriptionProxy_unsubscribe, "f").call(this);
|
|
132
|
-
__classPrivateFieldSet(this, _QuerySubscriptionProxy_unsubscribe, undefined, "f");
|
|
133
|
-
}
|
|
134
|
-
// Clear any existing timeout
|
|
135
|
-
if (__classPrivateFieldGet(this, _QuerySubscriptionProxy_initTimeoutId, "f")) {
|
|
136
|
-
clearTimeout(__classPrivateFieldGet(this, _QuerySubscriptionProxy_initTimeoutId, "f"));
|
|
137
|
-
__classPrivateFieldSet(this, _QuerySubscriptionProxy_initTimeoutId, undefined, "f");
|
|
138
|
-
}
|
|
139
|
-
// Clear any existing keepalive timer to prevent accumulation
|
|
140
|
-
if (__classPrivateFieldGet(this, _QuerySubscriptionProxy_keepaliveTimer, "f")) {
|
|
141
|
-
clearTimeout(__classPrivateFieldGet(this, _QuerySubscriptionProxy_keepaliveTimer, "f"));
|
|
142
|
-
__classPrivateFieldSet(this, _QuerySubscriptionProxy_keepaliveTimer, undefined, "f");
|
|
143
|
-
}
|
|
144
66
|
try {
|
|
145
|
-
|
|
146
|
-
let initialResult;
|
|
147
|
-
initialResult = await __classPrivateFieldGet(this, _QuerySubscriptionProxy_client, "f").subscribeQuery(__classPrivateFieldGet(this, _QuerySubscriptionProxy_uuid, "f"), __classPrivateFieldGet(this, _QuerySubscriptionProxy_query, "f"));
|
|
148
|
-
// A newer writer (another subscribe() or a reconnect swap) took
|
|
149
|
-
// over while we awaited — back out without touching shared state,
|
|
150
|
-
// and release the now-orphaned server-side subscription so it
|
|
151
|
-
// doesn't linger until its keepalive TTL expires.
|
|
152
|
-
if (__classPrivateFieldGet(this, _QuerySubscriptionProxy_disposed, "f") || __classPrivateFieldGet(this, _QuerySubscriptionProxy_generation, "f") !== generation) {
|
|
153
|
-
__classPrivateFieldGet(this, _QuerySubscriptionProxy_client, "f").disposeQuerySubscription(__classPrivateFieldGet(this, _QuerySubscriptionProxy_uuid, "f"), initialResult.subscriptionId)
|
|
154
|
-
.catch(e => console.error('Error disposing superseded query subscription:', e));
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
__classPrivateFieldSet(this, _QuerySubscriptionProxy_subscriptionId, initialResult.subscriptionId, "f");
|
|
158
|
-
// Process the initial result immediately for fast UX.
|
|
159
|
-
// The subscribeQuery() RPC call already returns the initial result,
|
|
160
|
-
// so treat that as successful initialization instead of waiting for a
|
|
161
|
-
// follow-up WebSocket update that may never arrive until the query changes.
|
|
162
|
-
if (initialResult.result !== undefined) {
|
|
163
|
-
__classPrivateFieldGet(this, _QuerySubscriptionProxy_instances, "m", _QuerySubscriptionProxy_deliverResult).call(this, initialResult.result);
|
|
164
|
-
}
|
|
165
|
-
else {
|
|
166
|
-
console.warn('⚠️ No initial result returned from subscribeQuery!');
|
|
167
|
-
// Only keep the initialization timeout when the backend did not
|
|
168
|
-
// provide an initial result up front.
|
|
169
|
-
__classPrivateFieldSet(this, _QuerySubscriptionProxy_initTimeoutId, setTimeout(() => {
|
|
170
|
-
console.error('Subscription initialization timed out after 30 seconds. Resubscribing...');
|
|
171
|
-
// Recursively retry subscription, catching any errors
|
|
172
|
-
this.subscribe().catch(error => {
|
|
173
|
-
console.error('Error during subscription retry after timeout:', error);
|
|
174
|
-
});
|
|
175
|
-
}, 30000), "f");
|
|
176
|
-
}
|
|
177
|
-
// Subscribe to query updates
|
|
178
|
-
__classPrivateFieldSet(this, _QuerySubscriptionProxy_unsubscribe, __classPrivateFieldGet(this, _QuerySubscriptionProxy_client, "f").subscribeToQueryUpdates(__classPrivateFieldGet(this, _QuerySubscriptionProxy_subscriptionId, "f"), (updateResult) => __classPrivateFieldGet(this, _QuerySubscriptionProxy_instances, "m", _QuerySubscriptionProxy_deliverResult).call(this, updateResult)), "f");
|
|
67
|
+
__classPrivateFieldGet(this, _QuerySubscriptionProxy_instances, "m", _QuerySubscriptionProxy_deliver).call(this, await __classPrivateFieldGet(this, _QuerySubscriptionProxy_live, "f").start());
|
|
179
68
|
}
|
|
180
69
|
catch (error) {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
__classPrivateFieldGet(this, _QuerySubscriptionProxy_initReject, "f").call(this, error);
|
|
185
|
-
__classPrivateFieldSet(this, _QuerySubscriptionProxy_initResolve, undefined, "f");
|
|
186
|
-
__classPrivateFieldSet(this, _QuerySubscriptionProxy_initReject, undefined, "f");
|
|
187
|
-
}
|
|
188
|
-
// Restore reconnect recovery before rethrowing. The listener was
|
|
189
|
-
// removed at the top of this method; without re-installing one
|
|
190
|
-
// here, a single failed resubscribe (e.g. subscribeQuery timing
|
|
191
|
-
// out during a network flap) would leave the proxy permanently
|
|
192
|
-
// dead: the keepalive loop stops itself on resubscribe failure,
|
|
193
|
-
// and nothing else retries. The recovery listener runs the FULL
|
|
194
|
-
// subscribe() (not the swap-in-place handler) because after a
|
|
195
|
-
// failed attempt there is no keepalive loop left to feed the new
|
|
196
|
-
// server subscription — subscribe() restarts it. This is
|
|
197
|
-
// loop-safe: in this failed state the proxy owns no
|
|
198
|
-
// `_wsCallbacks` entry (the old one was unsubscribed at the top
|
|
199
|
-
// of this method and no new one got registered), so the
|
|
200
|
-
// subscribe() it triggers has nothing to unsubscribe → the
|
|
201
|
-
// socket never closes/reopens under it → no re-entrant onopen.
|
|
202
|
-
if (!__classPrivateFieldGet(this, _QuerySubscriptionProxy_disposed, "f") && __classPrivateFieldGet(this, _QuerySubscriptionProxy_generation, "f") === generation && __classPrivateFieldGet(this, _QuerySubscriptionProxy_client, "f").onReconnect) {
|
|
203
|
-
__classPrivateFieldSet(this, _QuerySubscriptionProxy_reconnectUnsub, __classPrivateFieldGet(this, _QuerySubscriptionProxy_client, "f").onReconnect(() => {
|
|
204
|
-
if (__classPrivateFieldGet(this, _QuerySubscriptionProxy_disposed, "f"))
|
|
205
|
-
return;
|
|
206
|
-
console.log('WebSocket reconnected — retrying failed subscription for query:', __classPrivateFieldGet(this, _QuerySubscriptionProxy_query, "f"));
|
|
207
|
-
this.subscribe().catch(e => {
|
|
208
|
-
console.error('Error during subscription retry after reconnect:', e);
|
|
209
|
-
});
|
|
210
|
-
}), "f");
|
|
211
|
-
}
|
|
212
|
-
throw error; // Re-throw so caller knows it failed
|
|
213
|
-
}
|
|
214
|
-
// Start keepalive loop
|
|
215
|
-
__classPrivateFieldGet(this, _QuerySubscriptionProxy_instances, "m", _QuerySubscriptionProxy_startKeepalive).call(this, generation);
|
|
216
|
-
// Register for reconnect notification — on WebSocket reconnect,
|
|
217
|
-
// immediately re-establish a fresh server-side subscription instead
|
|
218
|
-
// of waiting up to 30s for the keepalive to fail.
|
|
219
|
-
//
|
|
220
|
-
// We deliberately do NOT call `this.subscribe()` here. Full subscribe
|
|
221
|
-
// runs `#unsubscribe` first, which delegates to `ApiClient.subscribe`'s
|
|
222
|
-
// deleter — that closes the WebSocket when this query owned the LAST
|
|
223
|
-
// `_wsCallbacks` entry. The subsequent `subscribeQuery` reopens the
|
|
224
|
-
// socket, whose fresh `onopen` fires every registered reconnect
|
|
225
|
-
// callback again → recursion (CodeRabbit's original finding). And
|
|
226
|
-
// during that close→reopen gap, RPCs in flight from OTHER proxies
|
|
227
|
-
// fail with `503 WebSocket not connected` (observed in
|
|
228
|
-
// integration-tests-mcp `should fire onWake when mention uses agent DID`
|
|
229
|
-
// after PR #899's initial fix — the WakerSubscriptionManager tests
|
|
230
|
-
// share a wakerClient across cases, so any dying reconnect handler
|
|
231
|
-
// interferes with sibling subscriptions).
|
|
232
|
-
//
|
|
233
|
-
// The correct shape is a swap-in-place: get a new server-side
|
|
234
|
-
// subscription ID via `subscribeQuery`, register a new client-side
|
|
235
|
-
// callback FIRST, and only then unsubscribe the old one. That way
|
|
236
|
-
// `_wsCallbacks.size` never dips to 0 during the transition, so the
|
|
237
|
-
// socket doesn't close, no reconnect loop, and no cross-proxy 503s.
|
|
238
|
-
// Any prior listener was already removed at the top of this method
|
|
239
|
-
// (see the note there for why cleanup must run before `#unsubscribe`,
|
|
240
|
-
// not here).
|
|
241
|
-
if (__classPrivateFieldGet(this, _QuerySubscriptionProxy_client, "f").onReconnect) {
|
|
242
|
-
__classPrivateFieldSet(this, _QuerySubscriptionProxy_reconnectUnsub, __classPrivateFieldGet(this, _QuerySubscriptionProxy_client, "f").onReconnect(async () => {
|
|
243
|
-
var _a;
|
|
244
|
-
if (__classPrivateFieldGet(this, _QuerySubscriptionProxy_disposed, "f"))
|
|
245
|
-
return;
|
|
246
|
-
// The handler is a writer of `#unsubscribe`/`#subscriptionId`
|
|
247
|
-
// too, so it takes its own generation — see #generation.
|
|
248
|
-
const swapGeneration = __classPrivateFieldSet(this, _QuerySubscriptionProxy_generation, (_a = __classPrivateFieldGet(this, _QuerySubscriptionProxy_generation, "f"), ++_a), "f");
|
|
249
|
-
console.log('WebSocket reconnected — re-establishing server subscription for query:', __classPrivateFieldGet(this, _QuerySubscriptionProxy_query, "f"));
|
|
250
|
-
try {
|
|
251
|
-
const newInitial = await __classPrivateFieldGet(this, _QuerySubscriptionProxy_client, "f").subscribeQuery(__classPrivateFieldGet(this, _QuerySubscriptionProxy_uuid, "f"), __classPrivateFieldGet(this, _QuerySubscriptionProxy_query, "f"));
|
|
252
|
-
if (__classPrivateFieldGet(this, _QuerySubscriptionProxy_disposed, "f") || __classPrivateFieldGet(this, _QuerySubscriptionProxy_generation, "f") !== swapGeneration) {
|
|
253
|
-
// A newer writer took over while we awaited — back out
|
|
254
|
-
// and release the orphaned server-side subscription.
|
|
255
|
-
__classPrivateFieldGet(this, _QuerySubscriptionProxy_client, "f").disposeQuerySubscription(__classPrivateFieldGet(this, _QuerySubscriptionProxy_uuid, "f"), newInitial.subscriptionId)
|
|
256
|
-
.catch(e => console.error('Error disposing superseded query subscription:', e));
|
|
257
|
-
return;
|
|
258
|
-
}
|
|
259
|
-
const newSubId = newInitial.subscriptionId;
|
|
260
|
-
// Register the NEW client-side callback BEFORE removing the
|
|
261
|
-
// old one — keeps `_wsCallbacks.size >= 1` across the swap.
|
|
262
|
-
const newUnsub = __classPrivateFieldGet(this, _QuerySubscriptionProxy_client, "f").subscribeToQueryUpdates(newSubId, (updateResult) => __classPrivateFieldGet(this, _QuerySubscriptionProxy_instances, "m", _QuerySubscriptionProxy_deliverResult).call(this, updateResult));
|
|
263
|
-
const oldUnsub = __classPrivateFieldGet(this, _QuerySubscriptionProxy_unsubscribe, "f");
|
|
264
|
-
__classPrivateFieldSet(this, _QuerySubscriptionProxy_unsubscribe, newUnsub, "f");
|
|
265
|
-
__classPrivateFieldSet(this, _QuerySubscriptionProxy_subscriptionId, newSubId, "f");
|
|
266
|
-
if (oldUnsub)
|
|
267
|
-
oldUnsub();
|
|
268
|
-
// Our generation bump invalidated the running keepalive
|
|
269
|
-
// loop — restart it under our generation so the new
|
|
270
|
-
// server subscription keeps receiving keepalives.
|
|
271
|
-
clearTimeout(__classPrivateFieldGet(this, _QuerySubscriptionProxy_keepaliveTimer, "f"));
|
|
272
|
-
__classPrivateFieldGet(this, _QuerySubscriptionProxy_instances, "m", _QuerySubscriptionProxy_startKeepalive).call(this, swapGeneration);
|
|
273
|
-
// Deliver the fresh initial result if the server included one
|
|
274
|
-
// (matches the eager-delivery path in the main subscribe() body).
|
|
275
|
-
// #deliverResult also clears a still-pending init timeout and
|
|
276
|
-
// resolves #initialized, keeping this path symmetric with the
|
|
277
|
-
// update callback in subscribe() — without it, a swap landing
|
|
278
|
-
// while initialization was pending would leave the 30s init
|
|
279
|
-
// timer armed and trigger a spurious full resubscribe.
|
|
280
|
-
if (newInitial.result !== undefined) {
|
|
281
|
-
__classPrivateFieldGet(this, _QuerySubscriptionProxy_instances, "m", _QuerySubscriptionProxy_deliverResult).call(this, newInitial.result);
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
catch (error) {
|
|
285
|
-
console.error('Error re-establishing subscription after reconnect:', error);
|
|
286
|
-
// Our generation bump invalidated the running keepalive
|
|
287
|
-
// loop; if nothing newer superseded us, restart it so
|
|
288
|
-
// liveness is preserved — its keepAliveQuery against the
|
|
289
|
-
// dead old subscription will fail and fall back to a
|
|
290
|
-
// full subscribe(). The reconnect listener also remains
|
|
291
|
-
// installed, so a later reconnect retries this handler.
|
|
292
|
-
if (!__classPrivateFieldGet(this, _QuerySubscriptionProxy_disposed, "f") && __classPrivateFieldGet(this, _QuerySubscriptionProxy_generation, "f") === swapGeneration) {
|
|
293
|
-
clearTimeout(__classPrivateFieldGet(this, _QuerySubscriptionProxy_keepaliveTimer, "f"));
|
|
294
|
-
__classPrivateFieldGet(this, _QuerySubscriptionProxy_instances, "m", _QuerySubscriptionProxy_startKeepalive).call(this, swapGeneration);
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
}), "f");
|
|
70
|
+
__classPrivateFieldGet(this, _QuerySubscriptionProxy_initReject, "f")?.call(this, error);
|
|
71
|
+
__classPrivateFieldSet(this, _QuerySubscriptionProxy_initResolve, __classPrivateFieldSet(this, _QuerySubscriptionProxy_initReject, undefined, "f"), "f");
|
|
72
|
+
throw error;
|
|
298
73
|
}
|
|
299
74
|
}
|
|
300
|
-
/**
|
|
301
|
-
*
|
|
302
|
-
* This is a unique identifier assigned when the subscription was created.
|
|
303
|
-
* It can be used to reference this specific subscription, for example when
|
|
304
|
-
* sending keepalive signals.
|
|
305
|
-
*
|
|
306
|
-
* @returns The subscription ID string
|
|
307
|
-
*/
|
|
75
|
+
/** The executor's id for this subscription. */
|
|
308
76
|
get id() {
|
|
309
|
-
return __classPrivateFieldGet(this,
|
|
77
|
+
return __classPrivateFieldGet(this, _QuerySubscriptionProxy_live, "f").id;
|
|
310
78
|
}
|
|
311
|
-
/**
|
|
312
|
-
* through the subscription channel. This ensures the subscription is fully
|
|
313
|
-
* set up before allowing access to results or updates.
|
|
314
|
-
*
|
|
315
|
-
* If no result is received within 30 seconds, the subscription will automatically
|
|
316
|
-
* retry. The promise will remain pending until a subscription message successfully
|
|
317
|
-
* arrives, or until a fatal error occurs during subscription setup.
|
|
318
|
-
*
|
|
319
|
-
* Note: You typically don't need to await this directly since the subscription
|
|
320
|
-
* creation methods (like subscribeInfer) already wait for initialization.
|
|
321
|
-
*/
|
|
79
|
+
/** Resolves once the first result has arrived. */
|
|
322
80
|
get initialized() {
|
|
323
81
|
return __classPrivateFieldGet(this, _QuerySubscriptionProxy_initialized, "f");
|
|
324
82
|
}
|
|
325
|
-
/**
|
|
326
|
-
*
|
|
327
|
-
* This returns the most recent result from the query, which could be either:
|
|
328
|
-
* - The initial result from when the subscription was created
|
|
329
|
-
* - The latest update received through the subscription
|
|
330
|
-
*
|
|
331
|
-
* @returns The latest query result as a string (usually a JSON array of bindings)
|
|
332
|
-
*/
|
|
83
|
+
/** The latest result. */
|
|
333
84
|
get result() {
|
|
334
|
-
return __classPrivateFieldGet(this,
|
|
85
|
+
return __classPrivateFieldGet(this, _QuerySubscriptionProxy_live, "f").result;
|
|
335
86
|
}
|
|
336
|
-
/**
|
|
337
|
-
*
|
|
338
|
-
* The callback will be called immediately with the current result,
|
|
339
|
-
* and then again each time the query results change.
|
|
340
|
-
*
|
|
341
|
-
* @param callback - Function that takes a result string and processes it
|
|
342
|
-
* @returns A function that can be called to remove this callback
|
|
343
|
-
*
|
|
344
|
-
* Example:
|
|
345
|
-
* ```typescript
|
|
346
|
-
* const removeCallback = subscription.onResult(result => {
|
|
347
|
-
* const bindings = JSON.parse(result);
|
|
348
|
-
* console.log("New bindings:", bindings);
|
|
349
|
-
* });
|
|
350
|
-
*
|
|
351
|
-
* // Later: stop receiving updates
|
|
352
|
-
* removeCallback();
|
|
353
|
-
* ```
|
|
354
|
-
*/
|
|
87
|
+
/** Call `callback` with every later result. Returns a remover. */
|
|
355
88
|
onResult(callback) {
|
|
356
89
|
__classPrivateFieldGet(this, _QuerySubscriptionProxy_callbacks, "f").add(callback);
|
|
357
90
|
return () => __classPrivateFieldGet(this, _QuerySubscriptionProxy_callbacks, "f").delete(callback);
|
|
358
91
|
}
|
|
359
|
-
/**
|
|
360
|
-
*
|
|
361
|
-
* This method:
|
|
362
|
-
* 1. Stops the keepalive timer
|
|
363
|
-
* 2. Unsubscribes from subscription updates
|
|
364
|
-
* 3. Clears all registered callbacks
|
|
365
|
-
* 4. Cleans up any pending initialization timeout
|
|
366
|
-
*
|
|
367
|
-
* After calling this method, the subscription is no longer active and
|
|
368
|
-
* will not receive any more updates. The instance should be discarded.
|
|
369
|
-
*/
|
|
92
|
+
/** End the subscription on the executor and drop all callbacks. */
|
|
370
93
|
dispose() {
|
|
371
|
-
|
|
372
|
-
__classPrivateFieldSet(this, _QuerySubscriptionProxy_disposed, true, "f");
|
|
373
|
-
// Invalidate any suspended writer so a mid-flight subscribe() or
|
|
374
|
-
// reconnect swap backs out instead of resurrecting state.
|
|
375
|
-
__classPrivateFieldSet(this, _QuerySubscriptionProxy_generation, (_a = __classPrivateFieldGet(this, _QuerySubscriptionProxy_generation, "f"), _a++, _a), "f");
|
|
376
|
-
clearTimeout(__classPrivateFieldGet(this, _QuerySubscriptionProxy_keepaliveTimer, "f"));
|
|
377
|
-
if (__classPrivateFieldGet(this, _QuerySubscriptionProxy_unsubscribe, "f")) {
|
|
378
|
-
__classPrivateFieldGet(this, _QuerySubscriptionProxy_unsubscribe, "f").call(this);
|
|
379
|
-
}
|
|
380
|
-
if (__classPrivateFieldGet(this, _QuerySubscriptionProxy_reconnectUnsub, "f")) {
|
|
381
|
-
__classPrivateFieldGet(this, _QuerySubscriptionProxy_reconnectUnsub, "f").call(this);
|
|
382
|
-
__classPrivateFieldSet(this, _QuerySubscriptionProxy_reconnectUnsub, undefined, "f");
|
|
383
|
-
}
|
|
94
|
+
__classPrivateFieldGet(this, _QuerySubscriptionProxy_live, "f").dispose();
|
|
384
95
|
__classPrivateFieldGet(this, _QuerySubscriptionProxy_callbacks, "f").clear();
|
|
385
|
-
if (__classPrivateFieldGet(this, _QuerySubscriptionProxy_initTimeoutId, "f")) {
|
|
386
|
-
clearTimeout(__classPrivateFieldGet(this, _QuerySubscriptionProxy_initTimeoutId, "f"));
|
|
387
|
-
__classPrivateFieldSet(this, _QuerySubscriptionProxy_initTimeoutId, undefined, "f");
|
|
388
|
-
}
|
|
389
|
-
// Tell the backend to dispose of the subscription
|
|
390
|
-
if (__classPrivateFieldGet(this, _QuerySubscriptionProxy_subscriptionId, "f")) {
|
|
391
|
-
__classPrivateFieldGet(this, _QuerySubscriptionProxy_client, "f").disposeQuerySubscription(__classPrivateFieldGet(this, _QuerySubscriptionProxy_uuid, "f"), __classPrivateFieldGet(this, _QuerySubscriptionProxy_subscriptionId, "f"))
|
|
392
|
-
.catch(e => console.error('Error disposing query subscription:', e));
|
|
393
|
-
}
|
|
394
96
|
}
|
|
395
97
|
}
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
__classPrivateFieldSet(this, _QuerySubscriptionProxy_initTimeoutId, undefined, "f");
|
|
400
|
-
}
|
|
401
|
-
// Resolve the initialization promise (only resolves once)
|
|
402
|
-
if (__classPrivateFieldGet(this, _QuerySubscriptionProxy_initResolve, "f")) {
|
|
403
|
-
__classPrivateFieldGet(this, _QuerySubscriptionProxy_initResolve, "f").call(this, true);
|
|
404
|
-
__classPrivateFieldSet(this, _QuerySubscriptionProxy_initResolve, undefined, "f"); // Prevent double-resolve
|
|
405
|
-
__classPrivateFieldSet(this, _QuerySubscriptionProxy_initReject, undefined, "f");
|
|
406
|
-
}
|
|
407
|
-
__classPrivateFieldSet(this, _QuerySubscriptionProxy_latestResult, result, "f");
|
|
408
|
-
__classPrivateFieldGet(this, _QuerySubscriptionProxy_instances, "m", _QuerySubscriptionProxy_notifyCallbacks).call(this, result);
|
|
409
|
-
}, _QuerySubscriptionProxy_startKeepalive = function _QuerySubscriptionProxy_startKeepalive(generation) {
|
|
410
|
-
const keepaliveLoop = async () => {
|
|
411
|
-
// Generation check kills orphaned loops: a loop whose
|
|
412
|
-
// keepAliveQuery was in flight while a newer writer ran is not
|
|
413
|
-
// cancelled by clearTimeout and would otherwise reschedule
|
|
414
|
-
// itself alongside the newer loop.
|
|
415
|
-
if (__classPrivateFieldGet(this, _QuerySubscriptionProxy_disposed, "f") || __classPrivateFieldGet(this, _QuerySubscriptionProxy_generation, "f") !== generation)
|
|
416
|
-
return;
|
|
417
|
-
try {
|
|
418
|
-
await __classPrivateFieldGet(this, _QuerySubscriptionProxy_client, "f").keepAliveQuery(__classPrivateFieldGet(this, _QuerySubscriptionProxy_uuid, "f"), __classPrivateFieldGet(this, _QuerySubscriptionProxy_subscriptionId, "f"));
|
|
419
|
-
}
|
|
420
|
-
catch (e) {
|
|
421
|
-
if (__classPrivateFieldGet(this, _QuerySubscriptionProxy_disposed, "f") || __classPrivateFieldGet(this, _QuerySubscriptionProxy_generation, "f") !== generation)
|
|
422
|
-
return;
|
|
423
|
-
console.error('Error in keepalive:', e);
|
|
424
|
-
// try to reinitialize the subscription
|
|
425
|
-
console.log('Reinitializing subscription for query:', __classPrivateFieldGet(this, _QuerySubscriptionProxy_query, "f"));
|
|
426
|
-
try {
|
|
427
|
-
await this.subscribe();
|
|
428
|
-
console.log('Subscription reinitialized');
|
|
429
|
-
}
|
|
430
|
-
catch (resubscribeError) {
|
|
431
|
-
console.error('Error during resubscription from keepalive:', resubscribeError);
|
|
432
|
-
// Don't schedule another keepalive on resubscribe failure.
|
|
433
|
-
// Recovery is not lost: the failed subscribe() installed a
|
|
434
|
-
// reconnect listener that retries the full subscribe.
|
|
435
|
-
return;
|
|
436
|
-
}
|
|
437
|
-
// subscribe() succeeded and started its own keepalive loop
|
|
438
|
-
// under a new generation — this loop is done.
|
|
439
|
-
return;
|
|
440
|
-
}
|
|
441
|
-
// Schedule next keepalive if still the active generation
|
|
442
|
-
if (!__classPrivateFieldGet(this, _QuerySubscriptionProxy_disposed, "f") && __classPrivateFieldGet(this, _QuerySubscriptionProxy_generation, "f") === generation) {
|
|
443
|
-
__classPrivateFieldSet(this, _QuerySubscriptionProxy_keepaliveTimer, setTimeout(keepaliveLoop, 30000), "f");
|
|
444
|
-
}
|
|
445
|
-
};
|
|
446
|
-
__classPrivateFieldSet(this, _QuerySubscriptionProxy_keepaliveTimer, setTimeout(keepaliveLoop, 30000), "f");
|
|
447
|
-
}, _QuerySubscriptionProxy_notifyCallbacks = function _QuerySubscriptionProxy_notifyCallbacks(result) {
|
|
98
|
+
_QuerySubscriptionProxy_live = new WeakMap(), _QuerySubscriptionProxy_callbacks = new WeakMap(), _QuerySubscriptionProxy_initialized = new WeakMap(), _QuerySubscriptionProxy_initResolve = new WeakMap(), _QuerySubscriptionProxy_initReject = new WeakMap(), _QuerySubscriptionProxy_instances = new WeakSet(), _QuerySubscriptionProxy_deliver = function _QuerySubscriptionProxy_deliver(result) {
|
|
99
|
+
__classPrivateFieldGet(this, _QuerySubscriptionProxy_initResolve, "f")?.call(this, true);
|
|
100
|
+
__classPrivateFieldSet(this, _QuerySubscriptionProxy_initResolve, __classPrivateFieldSet(this, _QuerySubscriptionProxy_initReject, undefined, "f"), "f");
|
|
448
101
|
for (const callback of __classPrivateFieldGet(this, _QuerySubscriptionProxy_callbacks, "f")) {
|
|
449
102
|
try {
|
|
450
103
|
callback(result);
|
|
@@ -488,7 +141,7 @@ _QuerySubscriptionProxy_uuid = new WeakMap(), _QuerySubscriptionProxy_subscripti
|
|
|
488
141
|
* const todo = await perspective.createSubject("Todo", "expression://123");
|
|
489
142
|
*
|
|
490
143
|
* // Subscribe to changes
|
|
491
|
-
* perspective.
|
|
144
|
+
* perspective.on("link-added", ({ link }) => {
|
|
492
145
|
* console.log("New link added:", link);
|
|
493
146
|
* });
|
|
494
147
|
* ```
|
|
@@ -503,10 +156,8 @@ export class PerspectiveProxy {
|
|
|
503
156
|
constructor(handle, ad4m) {
|
|
504
157
|
_PerspectiveProxy_handle.set(this, void 0);
|
|
505
158
|
_PerspectiveProxy_client.set(this, void 0);
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
_PerspectiveProxy_perspectiveLinkUpdatedCallbacks.set(this, void 0);
|
|
509
|
-
_PerspectiveProxy_perspectiveSyncStateChangeCallbacks.set(this, void 0);
|
|
159
|
+
/** Releases of the handlers `on()` registered and has not released yet. */
|
|
160
|
+
_PerspectiveProxy_releases.set(this, new Set());
|
|
510
161
|
_PerspectiveProxy_ensuredSubjectClasses.set(this, new Set()
|
|
511
162
|
/** The `interpretationOverlays()` RPC currently in flight, shared by concurrent callers. */
|
|
512
163
|
);
|
|
@@ -517,10 +168,6 @@ export class PerspectiveProxy {
|
|
|
517
168
|
* Note: Don't create this directly, use ad4m.perspective.add() instead.
|
|
518
169
|
*/
|
|
519
170
|
);
|
|
520
|
-
__classPrivateFieldSet(this, _PerspectiveProxy_perspectiveLinkAddedCallbacks, [], "f");
|
|
521
|
-
__classPrivateFieldSet(this, _PerspectiveProxy_perspectiveLinkRemovedCallbacks, [], "f");
|
|
522
|
-
__classPrivateFieldSet(this, _PerspectiveProxy_perspectiveLinkUpdatedCallbacks, [], "f");
|
|
523
|
-
__classPrivateFieldSet(this, _PerspectiveProxy_perspectiveSyncStateChangeCallbacks, [], "f");
|
|
524
171
|
__classPrivateFieldSet(this, _PerspectiveProxy_handle, handle, "f");
|
|
525
172
|
__classPrivateFieldSet(this, _PerspectiveProxy_client, ad4m, "f");
|
|
526
173
|
this.uuid = __classPrivateFieldGet(this, _PerspectiveProxy_handle, "f").uuid;
|
|
@@ -529,10 +176,6 @@ export class PerspectiveProxy {
|
|
|
529
176
|
this.sharedUrl = __classPrivateFieldGet(this, _PerspectiveProxy_handle, "f").sharedUrl;
|
|
530
177
|
this.neighbourhood = __classPrivateFieldGet(this, _PerspectiveProxy_handle, "f").neighbourhood;
|
|
531
178
|
this.state = __classPrivateFieldGet(this, _PerspectiveProxy_handle, "f").state;
|
|
532
|
-
__classPrivateFieldGet(this, _PerspectiveProxy_client, "f").addPerspectiveLinkAddedListener(__classPrivateFieldGet(this, _PerspectiveProxy_handle, "f").uuid, __classPrivateFieldGet(this, _PerspectiveProxy_perspectiveLinkAddedCallbacks, "f"));
|
|
533
|
-
__classPrivateFieldGet(this, _PerspectiveProxy_client, "f").addPerspectiveLinkRemovedListener(__classPrivateFieldGet(this, _PerspectiveProxy_handle, "f").uuid, __classPrivateFieldGet(this, _PerspectiveProxy_perspectiveLinkRemovedCallbacks, "f"));
|
|
534
|
-
__classPrivateFieldGet(this, _PerspectiveProxy_client, "f").addPerspectiveLinkUpdatedListener(__classPrivateFieldGet(this, _PerspectiveProxy_handle, "f").uuid, __classPrivateFieldGet(this, _PerspectiveProxy_perspectiveLinkUpdatedCallbacks, "f"));
|
|
535
|
-
__classPrivateFieldGet(this, _PerspectiveProxy_client, "f").addPerspectiveSyncStateChangeListener(__classPrivateFieldGet(this, _PerspectiveProxy_handle, "f").uuid, __classPrivateFieldGet(this, _PerspectiveProxy_perspectiveSyncStateChangeCallbacks, "f"));
|
|
536
179
|
}
|
|
537
180
|
/** Update the proxy's internal handle and public fields in-place.
|
|
538
181
|
* Keeps the same object reference so all holders see the update. */
|
|
@@ -662,13 +305,16 @@ export class PerspectiveProxy {
|
|
|
662
305
|
* @param transcript ordered `{ speaker, text }` turns
|
|
663
306
|
* @param basePrefix URI namespace for new instance identities, e.g. `soa://ext/`
|
|
664
307
|
* @param classes local names of the subject classes to extract into; omit for all
|
|
308
|
+
* @param options scopes, progress reporting, and `signal` / `timeoutMs`
|
|
309
|
+
* (default {@link LONG_TIMEOUT_MS})
|
|
665
310
|
*/
|
|
666
311
|
async runInterpretation(transcript, basePrefix, classes, options) {
|
|
667
312
|
// Grouped into an options bag rather than continuing the client's positional list.
|
|
668
313
|
// The scopes were already unreachable from here for that reason, and a fourth, fifth and
|
|
669
314
|
// sixth positional parameter would have made `undefined, undefined, { … }` the normal way
|
|
670
315
|
// to ask for the only one of them most callers want.
|
|
671
|
-
|
|
316
|
+
const { existingScope, mintScope, observe, ...callOptions } = options ?? {};
|
|
317
|
+
return await __classPrivateFieldGet(this, _PerspectiveProxy_client, "f").runInterpretation(__classPrivateFieldGet(this, _PerspectiveProxy_handle, "f").uuid, transcript, basePrefix, classes, existingScope, mintScope, observe, callOptions);
|
|
672
318
|
}
|
|
673
319
|
/**
|
|
674
320
|
* Harness-dispatched interpretation pass over this perspective (design v3
|
|
@@ -685,22 +331,23 @@ export class PerspectiveProxy {
|
|
|
685
331
|
* classic single-shot path)
|
|
686
332
|
* @param classes local names of the subject classes to extract into; omit for all
|
|
687
333
|
* @param modelOverride optional model override; omit for the default LLM
|
|
334
|
+
* @param options `signal` / `timeoutMs` (default {@link LONG_TIMEOUT_MS})
|
|
688
335
|
*/
|
|
689
336
|
async runInterpretationWithHarness(transcript, basePrefix, maxToolCalls, classes, modelOverride,
|
|
690
337
|
// Optional live-debug observability. When both `observationId` and
|
|
691
338
|
// `emitDebugEvents` are supplied, every dispatched tool call fires
|
|
692
339
|
// `ToolCall` + `ToolResult` events on the `auto-processor-event`
|
|
693
340
|
// topic keyed by `observationId`. Subscribe with
|
|
694
|
-
//
|
|
341
|
+
// `on('auto-processor-event')` to render the harness loop
|
|
695
342
|
// live in a UI. Absent = fast headless path (no telemetry cost).
|
|
696
|
-
observationId, emitDebugEvents) {
|
|
697
|
-
return await __classPrivateFieldGet(this, _PerspectiveProxy_client, "f").runInterpretationWithHarness(__classPrivateFieldGet(this, _PerspectiveProxy_handle, "f").uuid, transcript, basePrefix, maxToolCalls, classes, modelOverride, undefined, observationId, emitDebugEvents);
|
|
343
|
+
observationId, emitDebugEvents, options) {
|
|
344
|
+
return await __classPrivateFieldGet(this, _PerspectiveProxy_client, "f").runInterpretationWithHarness(__classPrivateFieldGet(this, _PerspectiveProxy_handle, "f").uuid, transcript, basePrefix, maxToolCalls, classes, modelOverride, undefined, observationId, emitDebugEvents, options);
|
|
698
345
|
}
|
|
699
346
|
/**
|
|
700
347
|
* Register a neighbourhood auto-processor on this perspective. The executor
|
|
701
348
|
* then runs interpretation automatically over new source items (like Flux
|
|
702
349
|
* per channel), coordinating which peer processes each batch. Returns the
|
|
703
|
-
* processor id. Subscribe to progress via
|
|
350
|
+
* processor id. Subscribe to progress via `on('auto-processor-event')`.
|
|
704
351
|
*/
|
|
705
352
|
async addAutoProcessor(config) {
|
|
706
353
|
return await __classPrivateFieldGet(this, _PerspectiveProxy_client, "f").addAutoProcessor(__classPrivateFieldGet(this, _PerspectiveProxy_handle, "f").uuid, config);
|
|
@@ -819,23 +466,49 @@ export class PerspectiveProxy {
|
|
|
819
466
|
async flowValidOutputs(flow, state) {
|
|
820
467
|
return await __classPrivateFieldGet(this, _PerspectiveProxy_client, "f").flowValidOutputs(__classPrivateFieldGet(this, _PerspectiveProxy_handle, "f").uuid, flow, state);
|
|
821
468
|
}
|
|
822
|
-
/**
|
|
823
|
-
|
|
824
|
-
|
|
469
|
+
/**
|
|
470
|
+
* The state each flow instance is in, as **this agent's** executor last
|
|
471
|
+
* derived it — one entry per instance it has derived, optionally narrowed
|
|
472
|
+
* to `instances`. An instance missing from the answer has not been
|
|
473
|
+
* derived here yet; it stands at its flow's first state.
|
|
474
|
+
*
|
|
475
|
+
* The state is not stored on the graph: the engine derives it from the
|
|
476
|
+
* signed proposals and keeps what it derived per agent, outside the
|
|
477
|
+
* perspective. So no other agent — a co-owner on the same node included —
|
|
478
|
+
* can read or write your entries, and a link query never sees them.
|
|
479
|
+
* `FlowInstance.findAll` / `start` call this for you.
|
|
480
|
+
*/
|
|
481
|
+
async flowStates(instances) {
|
|
482
|
+
return await __classPrivateFieldGet(this, _PerspectiveProxy_client, "f").flowStates(__classPrivateFieldGet(this, _PerspectiveProxy_handle, "f").uuid, instances);
|
|
825
483
|
}
|
|
826
|
-
/**
|
|
827
|
-
|
|
828
|
-
|
|
484
|
+
/**
|
|
485
|
+
* The proposals of `instance` whose votes settled an edge, as this
|
|
486
|
+
* agent's executor recorded them — the flow's history, sorted by URI.
|
|
487
|
+
* Replaces the `resolvedAs` property proposals used to carry.
|
|
488
|
+
*/
|
|
489
|
+
async flowFired(instance) {
|
|
490
|
+
return await __classPrivateFieldGet(this, _PerspectiveProxy_client, "f").flowFired(__classPrivateFieldGet(this, _PerspectiveProxy_handle, "f").uuid, instance);
|
|
829
491
|
}
|
|
830
492
|
/**
|
|
831
|
-
*
|
|
832
|
-
*
|
|
833
|
-
*
|
|
834
|
-
*
|
|
835
|
-
*
|
|
493
|
+
* Called whenever a flow instance on this perspective changes state on
|
|
494
|
+
* this agent's executor, or an edge settles: `{ instance, from, to,
|
|
495
|
+
* firedProposals, caughtUp }`. Only this agent's sockets receive it.
|
|
496
|
+
*
|
|
497
|
+
* When the executor first derives an instance that already has history
|
|
498
|
+
* (it synced in, or the executor was upgraded) it is called once with
|
|
499
|
+
* `caughtUp: true`, `from: null` and no `firedProposals`: the settles
|
|
500
|
+
* before that are history, but `to` is the state to show for a run that
|
|
501
|
+
* read as not derived (`FlowInstance.currentStateName === undefined`).
|
|
502
|
+
*
|
|
503
|
+
* Returns a function that removes the handler; {@link dispose} removes
|
|
504
|
+
* it too.
|
|
836
505
|
*/
|
|
837
|
-
|
|
838
|
-
return
|
|
506
|
+
onFlowStateChanged(handler) {
|
|
507
|
+
return this.on("flow-state-changed", handler);
|
|
508
|
+
}
|
|
509
|
+
/** Mint and store the receipt for a completed flow run. */
|
|
510
|
+
async mintFlowReceipt(instanceUri) {
|
|
511
|
+
return await __classPrivateFieldGet(this, _PerspectiveProxy_client, "f").mintFlowReceipt(__classPrivateFieldGet(this, _PerspectiveProxy_handle, "f").uuid, instanceUri);
|
|
839
512
|
}
|
|
840
513
|
/**
|
|
841
514
|
* Executes a Prolog query against the perspective's knowledge base.
|
|
@@ -900,7 +573,9 @@ export class PerspectiveProxy {
|
|
|
900
573
|
* triples (written by `addSdna`). Callers no longer ship shape
|
|
901
574
|
* metadata with the query; the perspective is the source of truth.
|
|
902
575
|
*
|
|
903
|
-
* @param className - The model class name (e.g. "Recipe")
|
|
576
|
+
* @param className - The model class name (e.g. "Recipe"), or several: one
|
|
577
|
+
* query over their union, whose rows carry `__subjectClass` and
|
|
578
|
+
* `__subjectClasses` (#1238)
|
|
904
579
|
* @param queryJson - Structured query as JSON string
|
|
905
580
|
* @returns Object with `instances` array and `totalCount`
|
|
906
581
|
*/
|
|
@@ -958,16 +633,14 @@ export class PerspectiveProxy {
|
|
|
958
633
|
return await __classPrivateFieldGet(this, _PerspectiveProxy_client, "f").evaluateGetters(__classPrivateFieldGet(this, _PerspectiveProxy_handle, "f").uuid, className, instanceIds, propertyNames);
|
|
959
634
|
}
|
|
960
635
|
/**
|
|
961
|
-
*
|
|
962
|
-
*
|
|
963
|
-
*
|
|
964
|
-
*
|
|
965
|
-
* The subscription reuses the same WS-RPC subscription channel as subscribeQuery().
|
|
966
|
-
* Use keepAliveQuery() / disposeQuerySubscription() with the returned subscriptionId.
|
|
636
|
+
* Open a live model query on the executor. Later changes arrive as
|
|
637
|
+
* updates; `LiveQuery` (or `ModelQueryBuilder.subscribe()`) applies them.
|
|
638
|
+
* The subscription ends with `disposeQuerySubscription()` or when the
|
|
639
|
+
* socket closes.
|
|
967
640
|
*
|
|
968
|
-
* @param className - The model class name
|
|
641
|
+
* @param className - The model class name, or several (same as modelQuery)
|
|
969
642
|
* @param queryJson - JSON-serialized query parameters (same as modelQuery)
|
|
970
|
-
* @returns
|
|
643
|
+
* @returns `subscriptionId`, initial `result` and `revision` (0)
|
|
971
644
|
*/
|
|
972
645
|
async modelSubscribe(className, queryJson) {
|
|
973
646
|
return await __classPrivateFieldGet(this, _PerspectiveProxy_client, "f").modelSubscribe(__classPrivateFieldGet(this, _PerspectiveProxy_handle, "f").uuid, className, queryJson);
|
|
@@ -1142,82 +815,32 @@ export class PerspectiveProxy {
|
|
|
1142
815
|
return await __classPrivateFieldGet(this, _PerspectiveProxy_client, "f").createExpression(content, languageAddress);
|
|
1143
816
|
}
|
|
1144
817
|
/**
|
|
1145
|
-
*
|
|
1146
|
-
*
|
|
1147
|
-
* @param type - Type of change to listen for
|
|
1148
|
-
* @param cb - Callback function
|
|
1149
|
-
*
|
|
1150
|
-
* @example
|
|
1151
|
-
* ```typescript
|
|
1152
|
-
* // Listen for new links
|
|
1153
|
-
* perspective.addListener("link-added", (link) => {
|
|
1154
|
-
* console.log("New link:", link);
|
|
1155
|
-
* });
|
|
1156
|
-
*
|
|
1157
|
-
* // Listen for removed links
|
|
1158
|
-
* perspective.addListener("link-removed", (link) => {
|
|
1159
|
-
* console.log("Link removed:", link);
|
|
1160
|
-
* });
|
|
1161
|
-
* ```
|
|
1162
|
-
*/
|
|
1163
|
-
async addListener(type, cb) {
|
|
1164
|
-
if (type === 'link-added') {
|
|
1165
|
-
__classPrivateFieldGet(this, _PerspectiveProxy_perspectiveLinkAddedCallbacks, "f").push(cb);
|
|
1166
|
-
}
|
|
1167
|
-
else if (type === 'link-removed') {
|
|
1168
|
-
__classPrivateFieldGet(this, _PerspectiveProxy_perspectiveLinkRemovedCallbacks, "f").push(cb);
|
|
1169
|
-
}
|
|
1170
|
-
else if (type === 'link-updated') {
|
|
1171
|
-
__classPrivateFieldGet(this, _PerspectiveProxy_perspectiveLinkUpdatedCallbacks, "f").push(cb);
|
|
1172
|
-
}
|
|
1173
|
-
}
|
|
1174
|
-
/**
|
|
1175
|
-
* Subscribes to sync state changes if this perspective is shared.
|
|
1176
|
-
*
|
|
1177
|
-
* @param cb - Callback function
|
|
818
|
+
* Call `handler` with every `type` event about this perspective, until the
|
|
819
|
+
* returned function or {@link dispose} releases it.
|
|
1178
820
|
*
|
|
1179
821
|
* @example
|
|
1180
822
|
* ```typescript
|
|
1181
|
-
* perspective.
|
|
1182
|
-
*
|
|
1183
|
-
* });
|
|
823
|
+
* perspective.on("link-added", ({ link }) => console.log("New link:", link));
|
|
824
|
+
* perspective.on("link-updated", ({ oldLink, newLink }) => console.log(oldLink, "->", newLink));
|
|
825
|
+
* perspective.on("sync-state-change", ({ state }) => console.log("Sync state:", state));
|
|
1184
826
|
* ```
|
|
1185
827
|
*/
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
__classPrivateFieldGet(this, _PerspectiveProxy_perspectiveLinkAddedCallbacks, "f").splice(index, 1);
|
|
1200
|
-
}
|
|
1201
|
-
else if (type === 'link-removed') {
|
|
1202
|
-
const index = __classPrivateFieldGet(this, _PerspectiveProxy_perspectiveLinkRemovedCallbacks, "f").indexOf(cb);
|
|
1203
|
-
if (index >= 0)
|
|
1204
|
-
__classPrivateFieldGet(this, _PerspectiveProxy_perspectiveLinkRemovedCallbacks, "f").splice(index, 1);
|
|
1205
|
-
}
|
|
1206
|
-
else if (type === 'link-updated') {
|
|
1207
|
-
const index = __classPrivateFieldGet(this, _PerspectiveProxy_perspectiveLinkUpdatedCallbacks, "f").indexOf(cb);
|
|
1208
|
-
if (index >= 0)
|
|
1209
|
-
__classPrivateFieldGet(this, _PerspectiveProxy_perspectiveLinkUpdatedCallbacks, "f").splice(index, 1);
|
|
1210
|
-
}
|
|
1211
|
-
}
|
|
1212
|
-
/** Clean up all subscriptions registered by this proxy.
|
|
1213
|
-
* Call this when the proxy is no longer needed to prevent subscription leaks.
|
|
1214
|
-
* After calling dispose(), the proxy should not be used. */
|
|
828
|
+
on(type, handler) {
|
|
829
|
+
// A registration of this proxy's own, so dispose() cannot release another proxy's
|
|
830
|
+
// registration of the same function (on() treats equal handlers as one).
|
|
831
|
+
const release = __classPrivateFieldGet(this, _PerspectiveProxy_client, "f").on(type, (event) => handler(event), { perspective: __classPrivateFieldGet(this, _PerspectiveProxy_handle, "f").uuid });
|
|
832
|
+
const releaseOnce = () => {
|
|
833
|
+
if (__classPrivateFieldGet(this, _PerspectiveProxy_releases, "f").delete(releaseOnce))
|
|
834
|
+
release();
|
|
835
|
+
};
|
|
836
|
+
__classPrivateFieldGet(this, _PerspectiveProxy_releases, "f").add(releaseOnce);
|
|
837
|
+
return releaseOnce;
|
|
838
|
+
}
|
|
839
|
+
/** Removes every handler this proxy registered. Other proxies for the same
|
|
840
|
+
* perspective keep theirs. */
|
|
1215
841
|
dispose() {
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
__classPrivateFieldGet(this, _PerspectiveProxy_perspectiveLinkRemovedCallbacks, "f").length = 0;
|
|
1219
|
-
__classPrivateFieldGet(this, _PerspectiveProxy_perspectiveLinkUpdatedCallbacks, "f").length = 0;
|
|
1220
|
-
__classPrivateFieldGet(this, _PerspectiveProxy_perspectiveSyncStateChangeCallbacks, "f").length = 0;
|
|
842
|
+
for (const release of [...__classPrivateFieldGet(this, _PerspectiveProxy_releases, "f")])
|
|
843
|
+
release();
|
|
1221
844
|
}
|
|
1222
845
|
/**
|
|
1223
846
|
* Creates a snapshot of the current perspective state.
|
|
@@ -1286,16 +909,8 @@ export class PerspectiveProxy {
|
|
|
1286
909
|
*/
|
|
1287
910
|
async setSingleTarget(link, status = 'shared') {
|
|
1288
911
|
const query = new LinkQuery({ source: link.source, predicate: link.predicate });
|
|
1289
|
-
const
|
|
1290
|
-
|
|
1291
|
-
for (const l of foundLinks) {
|
|
1292
|
-
delete l.__typename;
|
|
1293
|
-
delete l.data.__typename;
|
|
1294
|
-
delete l.proof.__typename;
|
|
1295
|
-
removals.push(l);
|
|
1296
|
-
}
|
|
1297
|
-
const additions = [link];
|
|
1298
|
-
await this.linkMutations({ additions, removals }, status);
|
|
912
|
+
const removals = await this.get(query);
|
|
913
|
+
await this.linkMutations({ additions: [link], removals }, status);
|
|
1299
914
|
}
|
|
1300
915
|
/** Returns all the Social DNA flows defined in this perspective */
|
|
1301
916
|
async sdnaFlows() {
|
|
@@ -1454,6 +1069,9 @@ export class PerspectiveProxy {
|
|
|
1454
1069
|
async ensureSubjectClasses(jsClasses) {
|
|
1455
1070
|
const entries = [];
|
|
1456
1071
|
for (const jsClass of jsClasses) {
|
|
1072
|
+
// Built-in classes (`TextContent`) live in the executor, not here.
|
|
1073
|
+
if (Object.prototype.hasOwnProperty.call(jsClass, 'builtinUri'))
|
|
1074
|
+
continue;
|
|
1457
1075
|
const className = jsClass.className || jsClass.prototype?.className || jsClass.name;
|
|
1458
1076
|
if (__classPrivateFieldGet(this, _PerspectiveProxy_ensuredSubjectClasses, "f").has(className))
|
|
1459
1077
|
continue;
|
|
@@ -1474,18 +1092,12 @@ export class PerspectiveProxy {
|
|
|
1474
1092
|
__classPrivateFieldGet(this, _PerspectiveProxy_ensuredSubjectClasses, "f").add(entry.name);
|
|
1475
1093
|
}
|
|
1476
1094
|
}
|
|
1477
|
-
/**
|
|
1478
|
-
* Adds a subject class to the perspective.
|
|
1479
|
-
* Alias for addSdna() with sdnaType='subject_class'.
|
|
1480
|
-
*/
|
|
1481
|
-
async addSubjectClass(name, shaclJson) {
|
|
1482
|
-
return this.addSdna(name, '', 'subject_class', shaclJson);
|
|
1483
|
-
}
|
|
1484
1095
|
/**
|
|
1485
1096
|
* **Recommended way to add SDNA schemas.**
|
|
1486
1097
|
*
|
|
1487
|
-
* Store a SHACL shape in this Perspective
|
|
1488
|
-
*
|
|
1098
|
+
* Store a SHACL shape in this Perspective. The executor writes it as links, as it
|
|
1099
|
+
* does for `@Model` classes. The shape needs a `targetClass` and keeps its
|
|
1100
|
+
* `nodeShapeUri`, which must end with `{name}Shape`.
|
|
1489
1101
|
*
|
|
1490
1102
|
* @param name - Unique name for this schema (e.g., 'Recipe', 'Task')
|
|
1491
1103
|
* @param shape - SHACLShape instance defining the schema
|
|
@@ -1509,29 +1121,7 @@ export class PerspectiveProxy {
|
|
|
1509
1121
|
* await perspective.addShacl('Recipe', shape);
|
|
1510
1122
|
*/
|
|
1511
1123
|
async addShacl(name, shape) {
|
|
1512
|
-
|
|
1513
|
-
const shapeLinks = shape.toLinks();
|
|
1514
|
-
// Create name -> shape mapping links
|
|
1515
|
-
const nameMapping = Literal.fromUrl(`literal:string:shacl://${name}`);
|
|
1516
|
-
const allLinks = [
|
|
1517
|
-
...shapeLinks.map(l => new Link({
|
|
1518
|
-
source: l.source,
|
|
1519
|
-
predicate: l.predicate,
|
|
1520
|
-
target: l.target
|
|
1521
|
-
})),
|
|
1522
|
-
new Link({
|
|
1523
|
-
source: "ad4m://self",
|
|
1524
|
-
predicate: "ad4m://has_shacl",
|
|
1525
|
-
target: nameMapping.toUrl()
|
|
1526
|
-
}),
|
|
1527
|
-
new Link({
|
|
1528
|
-
source: nameMapping.toUrl(),
|
|
1529
|
-
predicate: "ad4m://shacl_shape_uri",
|
|
1530
|
-
target: shape.nodeShapeUri
|
|
1531
|
-
})
|
|
1532
|
-
];
|
|
1533
|
-
// Batch add all links at once
|
|
1534
|
-
await this.addLinks(allLinks);
|
|
1124
|
+
await this.addSdna(name, '', 'subject_class', JSON.stringify(shape.toJSON()));
|
|
1535
1125
|
}
|
|
1536
1126
|
/**
|
|
1537
1127
|
* Retrieve a SHACL shape by name from this Perspective (one RPC call).
|
|
@@ -1564,15 +1154,21 @@ export class PerspectiveProxy {
|
|
|
1564
1154
|
/**
|
|
1565
1155
|
* Get all SHACL shapes stored in this Perspective (one RPC call).
|
|
1566
1156
|
* The executor resolves all shapes in-process and returns them in bulk.
|
|
1157
|
+
* A shape that fails to decode is skipped with a `console.warn`, so it
|
|
1158
|
+
* does not hide the others.
|
|
1567
1159
|
*/
|
|
1568
1160
|
async getAllShacl() {
|
|
1569
1161
|
const entries = await __classPrivateFieldGet(this, _PerspectiveProxy_client, "f").getAllShacl(__classPrivateFieldGet(this, _PerspectiveProxy_handle, "f").uuid);
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1162
|
+
const shapes = [];
|
|
1163
|
+
for (const { name, shapeUri, links } of entries) {
|
|
1164
|
+
try {
|
|
1165
|
+
shapes.push({ name, shape: SHACLShape.fromLinks(links, shapeUri) });
|
|
1166
|
+
}
|
|
1167
|
+
catch (e) {
|
|
1168
|
+
console.warn(`getAllShacl: skipping SHACL shape "${name}" that cannot be decoded:`, e);
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
return shapes;
|
|
1576
1172
|
}
|
|
1577
1173
|
/**
|
|
1578
1174
|
* **Recommended way to add Flow definitions.**
|
|
@@ -1608,31 +1204,56 @@ export class PerspectiveProxy {
|
|
|
1608
1204
|
*
|
|
1609
1205
|
* await perspective.addFlow('Delivery', deliveryFlow);
|
|
1610
1206
|
* ```
|
|
1207
|
+
*
|
|
1208
|
+
* Rejects, storing nothing, when a `consensusRule` carries a key the
|
|
1209
|
+
* executor does not know or a key written twice (#1144): the error names
|
|
1210
|
+
* the state and the key.
|
|
1611
1211
|
*/
|
|
1612
1212
|
async addFlow(name, flow) {
|
|
1613
|
-
// Serialize flow to links
|
|
1614
|
-
const flowLinks = flow.toLinks();
|
|
1615
|
-
// Create registration and mapping links
|
|
1616
1213
|
const flowNameLiteral = Literal.from(name).toUrl();
|
|
1617
|
-
const
|
|
1618
|
-
...
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
target: l.target
|
|
1622
|
-
})),
|
|
1623
|
-
new Link({
|
|
1624
|
-
source: "ad4m://self",
|
|
1625
|
-
predicate: "ad4m://has_flow",
|
|
1626
|
-
target: flowNameLiteral
|
|
1627
|
-
}),
|
|
1628
|
-
new Link({
|
|
1629
|
-
source: flowNameLiteral,
|
|
1630
|
-
predicate: "ad4m://flow_uri",
|
|
1631
|
-
target: flow.flowUri
|
|
1632
|
-
})
|
|
1214
|
+
const wanted = [
|
|
1215
|
+
...flow.toLinks(),
|
|
1216
|
+
{ source: "ad4m://self", predicate: "ad4m://has_flow", target: flowNameLiteral },
|
|
1217
|
+
{ source: flowNameLiteral, predicate: "ad4m://flow_uri", target: flow.flowUri },
|
|
1633
1218
|
];
|
|
1634
|
-
//
|
|
1635
|
-
|
|
1219
|
+
// Re-adding a flow replaces its definition. Adding alone would leave
|
|
1220
|
+
// a changed consensus rule beside the old one, and a state holding two
|
|
1221
|
+
// rules refuses every move into it. What is stored is found through
|
|
1222
|
+
// the flow's own links, since state and transition URIs may use an
|
|
1223
|
+
// older scheme. Only definition predicates are taken, from the flow's
|
|
1224
|
+
// URI and from each state and transition URI: all of them can carry
|
|
1225
|
+
// links the definition does not own.
|
|
1226
|
+
const flowLevel = new Set(SHACLFlow.FLOW_LEVEL_PREDICATES);
|
|
1227
|
+
const childLevel = new Set(SHACLFlow.STATE_AND_TRANSITION_PREDICATES);
|
|
1228
|
+
const ownLinks = (await this.get(new LinkQuery({ source: flow.flowUri })))
|
|
1229
|
+
.filter(l => flowLevel.has(l.data.predicate));
|
|
1230
|
+
const children = ownLinks
|
|
1231
|
+
.filter(l => l.data.predicate === "ad4m://hasState" || l.data.predicate === "ad4m://hasTransition")
|
|
1232
|
+
.map(l => l.data.target);
|
|
1233
|
+
const childLinks = (await Promise.all(children.map(uri => this.get(new LinkQuery({ source: uri })))))
|
|
1234
|
+
.flat()
|
|
1235
|
+
.filter(l => childLevel.has(l.data.predicate));
|
|
1236
|
+
// A name points at one flow: getFlow reads the first flow_uri link,
|
|
1237
|
+
// and FlowInstance.findAll drops records of any other flow URI. So
|
|
1238
|
+
// every flow_uri link of this name is taken, and one left from an
|
|
1239
|
+
// earlier namespace is removed rather than kept beside the new one.
|
|
1240
|
+
const registration = [
|
|
1241
|
+
...await this.get(new LinkQuery({ source: "ad4m://self", predicate: "ad4m://has_flow", target: flowNameLiteral })),
|
|
1242
|
+
...await this.get(new LinkQuery({ source: flowNameLiteral, predicate: "ad4m://flow_uri" })),
|
|
1243
|
+
];
|
|
1244
|
+
const stored = [...ownLinks, ...childLinks, ...registration];
|
|
1245
|
+
// Only the difference is written, so an unchanged definition writes
|
|
1246
|
+
// nothing and a changed one touches only what changed.
|
|
1247
|
+
const key = (l) => JSON.stringify([l.source, l.predicate ?? "", l.target]);
|
|
1248
|
+
const wantedKeys = new Set(wanted.map(key));
|
|
1249
|
+
const storedKeys = new Set(stored.map(l => key(l.data)));
|
|
1250
|
+
const additions = wanted
|
|
1251
|
+
.filter((l, i, all) => !storedKeys.has(key(l)) && all.findIndex(o => key(o) === key(l)) === i)
|
|
1252
|
+
.map(l => new Link(l));
|
|
1253
|
+
const removals = stored.filter(l => !wantedKeys.has(key(l.data)));
|
|
1254
|
+
if (additions.length === 0 && removals.length === 0)
|
|
1255
|
+
return;
|
|
1256
|
+
await this.linkMutations({ additions, removals });
|
|
1636
1257
|
}
|
|
1637
1258
|
/**
|
|
1638
1259
|
* Retrieve a Flow definition by name from this Perspective
|
|
@@ -1673,28 +1294,25 @@ export class PerspectiveProxy {
|
|
|
1673
1294
|
* Uses SHACL-based lookup (Prolog-free implementation).
|
|
1674
1295
|
*/
|
|
1675
1296
|
async subjectClasses() {
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
console.warn('subjectClasses: SHACL lookup failed:', e);
|
|
1696
|
-
return [];
|
|
1697
|
-
}
|
|
1297
|
+
// A failed lookup rejects. Answering `[]` would read as "no classes are
|
|
1298
|
+
// registered", which a caller deciding whether to register its own
|
|
1299
|
+
// classes acts on.
|
|
1300
|
+
// Query SHACL class links directly — no need for a separate RPC endpoint
|
|
1301
|
+
const classLinks = await this.get(new LinkQuery({
|
|
1302
|
+
predicate: "rdf://type",
|
|
1303
|
+
target: "ad4m://SubjectClass"
|
|
1304
|
+
}));
|
|
1305
|
+
const classNames = classLinks
|
|
1306
|
+
.map(l => {
|
|
1307
|
+
const source = l.data.source;
|
|
1308
|
+
// Extract class name from URI like "recipe://Recipe" or "flux://Channel"
|
|
1309
|
+
const parts = source.split("://");
|
|
1310
|
+
const lastPart = parts[parts.length - 1];
|
|
1311
|
+
return lastPart.split('/').pop() || '';
|
|
1312
|
+
})
|
|
1313
|
+
.filter(name => name.length > 0);
|
|
1314
|
+
// Deduplicate
|
|
1315
|
+
return [...new Set(classNames)];
|
|
1698
1316
|
}
|
|
1699
1317
|
/**
|
|
1700
1318
|
* Return the full target-class URIs of every registered SubjectClass.
|
|
@@ -1710,23 +1328,19 @@ export class PerspectiveProxy {
|
|
|
1710
1328
|
* registered should call this once and test membership against the returned
|
|
1711
1329
|
* set, rather than issuing one `queryLinks` per model.
|
|
1712
1330
|
*
|
|
1713
|
-
* One `queryLinks` round trip, no executor-side changes.
|
|
1331
|
+
* One `queryLinks` round trip, no executor-side changes. A failed lookup
|
|
1332
|
+
* rejects rather than answering `[]`, which would read as "nothing is
|
|
1333
|
+
* registered" and lead such a caller to register everything again.
|
|
1714
1334
|
*/
|
|
1715
1335
|
async subjectClassTargetClasses() {
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
return [...new Set(uris)];
|
|
1725
|
-
}
|
|
1726
|
-
catch (e) {
|
|
1727
|
-
console.warn('subjectClassTargetClasses: lookup failed:', e);
|
|
1728
|
-
return [];
|
|
1729
|
-
}
|
|
1336
|
+
const classLinks = await this.get(new LinkQuery({
|
|
1337
|
+
predicate: "rdf://type",
|
|
1338
|
+
target: "ad4m://SubjectClass"
|
|
1339
|
+
}));
|
|
1340
|
+
const uris = classLinks
|
|
1341
|
+
.map(l => l.data.source)
|
|
1342
|
+
.filter(source => source.length > 0);
|
|
1343
|
+
return [...new Set(uris)];
|
|
1730
1344
|
}
|
|
1731
1345
|
async stringOrTemplateObjectToSubjectClassName(subjectClass) {
|
|
1732
1346
|
if (typeof subjectClass === "string")
|
|
@@ -1785,6 +1399,13 @@ export class PerspectiveProxy {
|
|
|
1785
1399
|
// getSubjectData() to interact with the created instance.
|
|
1786
1400
|
return exprAddr;
|
|
1787
1401
|
}
|
|
1402
|
+
/** Sets properties of an existing instance in the executor. Through an
|
|
1403
|
+
* abstract class (#1435), each value is written by every class of the
|
|
1404
|
+
* record that the abstract class reads, under its own name. */
|
|
1405
|
+
async updateSubject(className, exprAddr, values, batchId) {
|
|
1406
|
+
await __classPrivateFieldGet(this, _PerspectiveProxy_client, "f").updateSubject(__classPrivateFieldGet(this, _PerspectiveProxy_handle, "f").uuid, className, exprAddr, JSON.stringify(values), batchId);
|
|
1407
|
+
invalidatePerspectiveCache(__classPrivateFieldGet(this, _PerspectiveProxy_handle, "f").uuid);
|
|
1408
|
+
}
|
|
1788
1409
|
async getSubjectData(subjectClass, exprAddr) {
|
|
1789
1410
|
if (typeof subjectClass === "string") {
|
|
1790
1411
|
return JSON.parse(await __classPrivateFieldGet(this, _PerspectiveProxy_client, "f").getSubjectData(__classPrivateFieldGet(this, _PerspectiveProxy_handle, "f").uuid, JSON.stringify({ className: subjectClass }), exprAddr));
|
|
@@ -1842,7 +1463,24 @@ export class PerspectiveProxy {
|
|
|
1842
1463
|
* and won't be executed until the batch is committed.
|
|
1843
1464
|
*/
|
|
1844
1465
|
async removeSubject(subjectClass, exprAddr, batchId) {
|
|
1466
|
+
// A built-in abstract class (`TextContent`, #1446) is never stored,
|
|
1467
|
+
// so it has no marker: the executor dispatches it by its URI.
|
|
1468
|
+
const ctor = subjectClass?.constructor;
|
|
1469
|
+
if (typeof subjectClass === "object" && ctor && Object.prototype.hasOwnProperty.call(ctor, 'builtinUri')) {
|
|
1470
|
+
await __classPrivateFieldGet(this, _PerspectiveProxy_client, "f").removeSubject(__classPrivateFieldGet(this, _PerspectiveProxy_handle, "f").uuid, ctor.builtinUri, exprAddr, batchId);
|
|
1471
|
+
invalidatePerspectiveCache(__classPrivateFieldGet(this, _PerspectiveProxy_handle, "f").uuid);
|
|
1472
|
+
return;
|
|
1473
|
+
}
|
|
1845
1474
|
let className = await this.stringOrTemplateObjectToSubjectClassName(subjectClass);
|
|
1475
|
+
// An abstract class (#1435) is never a record's class: the executor
|
|
1476
|
+
// runs the destructors of the record's classes it reads.
|
|
1477
|
+
const shapePattern = new RegExp(`[/:#]${this.escapeRegExp(className)}Shape$`);
|
|
1478
|
+
const markers = await this.get(new LinkQuery({ predicate: "ad4m://abstract" }));
|
|
1479
|
+
if (markers.some((link) => shapePattern.test(link.data.source))) {
|
|
1480
|
+
await __classPrivateFieldGet(this, _PerspectiveProxy_client, "f").removeSubject(__classPrivateFieldGet(this, _PerspectiveProxy_handle, "f").uuid, className, exprAddr, batchId);
|
|
1481
|
+
invalidatePerspectiveCache(__classPrivateFieldGet(this, _PerspectiveProxy_handle, "f").uuid);
|
|
1482
|
+
return;
|
|
1483
|
+
}
|
|
1846
1484
|
// Get destructor actions from SHACL links (Prolog-free)
|
|
1847
1485
|
let actions = await this.getActionsFromSHACL(className, "ad4m://destructor");
|
|
1848
1486
|
if (!actions) {
|
|
@@ -2159,6 +1797,9 @@ export class PerspectiveProxy {
|
|
|
2159
1797
|
}
|
|
2160
1798
|
/** Takes a JS class (its constructor) and ensures the SHACL subject class exists. */
|
|
2161
1799
|
async ensureSubjectClass(jsClass) {
|
|
1800
|
+
// Built-in classes (`TextContent`) live in the executor, not here.
|
|
1801
|
+
if (Object.prototype.hasOwnProperty.call(jsClass, 'builtinUri'))
|
|
1802
|
+
return;
|
|
2162
1803
|
// Get the class name from the JS class
|
|
2163
1804
|
const className = jsClass.className || jsClass.prototype?.className || jsClass.name;
|
|
2164
1805
|
// Skip if already registered for this perspective instance
|
|
@@ -2377,80 +2018,13 @@ export class PerspectiveProxy {
|
|
|
2377
2018
|
get ai() {
|
|
2378
2019
|
return __classPrivateFieldGet(this, _PerspectiveProxy_client, "f").aiClient;
|
|
2379
2020
|
}
|
|
2380
|
-
/**
|
|
2381
|
-
*
|
|
2382
|
-
*
|
|
2383
|
-
* This method:
|
|
2384
|
-
* 1. Creates the subscription on the Rust side
|
|
2385
|
-
* 2. Sets up the subscription callback
|
|
2386
|
-
* 3. Waits for the initial result to come through the subscription channel
|
|
2387
|
-
* 4. Returns a fully initialized QuerySubscriptionProxy
|
|
2388
|
-
*
|
|
2389
|
-
* The returned subscription is guaranteed to be ready to receive updates,
|
|
2390
|
-
* as this method waits for the initialization process to complete.
|
|
2391
|
-
*
|
|
2392
|
-
* The subscription will be automatically cleaned up on both frontend and backend
|
|
2393
|
-
* when dispose() is called. Make sure to call dispose() when you're done to
|
|
2394
|
-
* prevent memory leaks and ensure proper cleanup of resources.
|
|
2395
|
-
*
|
|
2396
|
-
* @param query - Prolog query string
|
|
2397
|
-
* @returns Initialized QuerySubscriptionProxy instance
|
|
2398
|
-
*
|
|
2399
|
-
* @example
|
|
2400
|
-
* ```typescript
|
|
2401
|
-
* // Subscribe to active todos
|
|
2402
|
-
* const subscription = await perspective.subscribeInfer(`
|
|
2403
|
-
* instance(Todo, "Todo"),
|
|
2404
|
-
* property_getter("Todo", Todo, "state", "active")
|
|
2405
|
-
* `);
|
|
2406
|
-
*
|
|
2407
|
-
* // Subscription is already initialized here
|
|
2408
|
-
* console.log("Initial result:", subscription.result);
|
|
2409
|
-
*
|
|
2410
|
-
* // Set up callback for future updates
|
|
2411
|
-
* subscription.onResult((todos) => {
|
|
2412
|
-
* console.log("Active todos:", todos);
|
|
2413
|
-
* });
|
|
2414
|
-
*
|
|
2415
|
-
* // Clean up subscription when done
|
|
2416
|
-
* subscription.dispose();
|
|
2417
|
-
* ```
|
|
2418
|
-
*/
|
|
2419
|
-
async subscribeInfer(query) {
|
|
2420
|
-
const subscriptionProxy = new QuerySubscriptionProxy(this.uuid, query, __classPrivateFieldGet(this, _PerspectiveProxy_client, "f"));
|
|
2421
|
-
// Start the subscription on the Rust side first to get the real subscription ID
|
|
2422
|
-
await subscriptionProxy.subscribe();
|
|
2423
|
-
// Wait for the initial result
|
|
2424
|
-
await subscriptionProxy.initialized;
|
|
2425
|
-
return subscriptionProxy;
|
|
2426
|
-
}
|
|
2427
|
-
/**
|
|
2428
|
-
* Creates a subscription for a SPARQL query that updates in real-time.
|
|
2429
|
-
*
|
|
2430
|
-
* This method:
|
|
2431
|
-
* 1. Creates the subscription on the Rust side
|
|
2432
|
-
* 2. Sets up the subscription callback
|
|
2433
|
-
* 3. Waits for the initial result to come through the subscription channel
|
|
2434
|
-
* 4. Returns a fully initialized QuerySubscriptionProxy
|
|
2435
|
-
*
|
|
2436
|
-
* The returned subscription is guaranteed to be ready to receive updates,
|
|
2437
|
-
* as this method waits for the initialization process to complete.
|
|
2438
|
-
*
|
|
2439
|
-
* The subscription will be automatically cleaned up on both frontend and backend
|
|
2440
|
-
* when dispose() is called. Make sure to call dispose() when you're done to
|
|
2441
|
-
* prevent memory leaks and ensure proper cleanup of resources.
|
|
2442
|
-
*
|
|
2443
|
-
/** Subscribe to a query with live updates via the SPARQL subscription endpoint.
|
|
2444
|
-
* @param query - Query string
|
|
2445
|
-
* @returns Initialized QuerySubscriptionProxy instance
|
|
2446
|
-
*/
|
|
2021
|
+
/** Live SPARQL query: resolves once the first result is in.
|
|
2022
|
+
* Call `dispose()` on the returned proxy when done. The executor
|
|
2023
|
+
* refuses a Prolog query (400): Prolog live queries are not supported. */
|
|
2447
2024
|
async subscribeQuery(query) {
|
|
2448
|
-
const
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
// Wait for the initial result
|
|
2452
|
-
await subscriptionProxy.initialized;
|
|
2453
|
-
return subscriptionProxy;
|
|
2025
|
+
const subscription = new QuerySubscriptionProxy(this.uuid, query, __classPrivateFieldGet(this, _PerspectiveProxy_client, "f"));
|
|
2026
|
+
await subscription.subscribe();
|
|
2027
|
+
return subscription;
|
|
2454
2028
|
}
|
|
2455
2029
|
}
|
|
2456
|
-
_PerspectiveProxy_handle = new WeakMap(), _PerspectiveProxy_client = new WeakMap(),
|
|
2030
|
+
_PerspectiveProxy_handle = new WeakMap(), _PerspectiveProxy_client = new WeakMap(), _PerspectiveProxy_releases = new WeakMap(), _PerspectiveProxy_ensuredSubjectClasses = new WeakMap(), _PerspectiveProxy_overlaysInFlight = new WeakMap();
|