@coasys/ad4m 0.13.0-test-interpretation-1 → 0.13.0-test-model-layer
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.cjs +2409 -625
- package/lib/index.js +2406 -626
- package/lib/src/Literal.js +8 -0
- package/lib/src/ai/AIClient.js +6 -3
- package/lib/src/apiClient.d.ts +40 -4
- package/lib/src/apiClient.js +149 -9
- package/lib/src/generated/api/RunInterpretationRequest.d.ts +16 -0
- package/lib/src/index.d.ts +3 -1
- package/lib/src/index.js +2 -0
- package/lib/src/model/Ad4mModel.d.ts +34 -16
- package/lib/src/model/Ad4mModel.js +302 -63
- package/lib/src/model/Ad4mModel.test.js +480 -735
- package/lib/src/model/ModelQueryBuilder.js +2 -2
- package/lib/src/model/decorators.d.ts +199 -12
- package/lib/src/model/decorators.js +88 -32
- package/lib/src/model/json-schema.js +7 -21
- package/lib/src/model/model-manifest.d.ts +41 -0
- package/lib/src/model/model-manifest.js +11 -0
- package/lib/src/model/query-common.d.ts +2 -2
- package/lib/src/model/query-sparql.d.ts +62 -0
- package/lib/src/model/query-sparql.js +78 -15
- package/lib/src/model/query-sparql.test.js +92 -10
- package/lib/src/model/query-utils.d.ts +7 -2
- package/lib/src/model/query-utils.js +21 -11
- package/lib/src/model/shacl-gen.js +77 -15
- package/lib/src/model/types.d.ts +32 -8
- package/lib/src/neighbourhood/NeighbourhoodProxy.test.js +33 -33
- package/lib/src/perspectives/AutoProcessor.d.ts +198 -2
- package/lib/src/perspectives/FlowInstance.d.ts +187 -0
- package/lib/src/perspectives/FlowInstance.js +336 -0
- package/lib/src/perspectives/FlowModels.d.ts +94 -0
- package/lib/src/perspectives/FlowModels.js +182 -0
- package/lib/src/perspectives/InterpretationModels.d.ts +41 -3
- package/lib/src/perspectives/InterpretationModels.js +60 -26
- package/lib/src/perspectives/PerspectiveClient.d.ts +88 -7
- package/lib/src/perspectives/PerspectiveClient.js +138 -11
- package/lib/src/perspectives/PerspectiveProxy.d.ts +150 -57
- package/lib/src/perspectives/PerspectiveProxy.js +411 -287
- package/lib/src/perspectives/SparqlBindings.d.ts +24 -3
- package/lib/src/perspectives/SparqlBindings.js +57 -6
- package/lib/src/shacl/SHACLFlow.d.ts +273 -47
- package/lib/src/shacl/SHACLFlow.js +397 -88
- package/lib/src/shacl/SHACLShape.d.ts +19 -3
- package/lib/src/shacl/SHACLShape.js +30 -1
- package/lib/src/shacl/SHACLShape.test.js +82 -0
- package/lib/src/shacl/index.d.ts +1 -1
- package/lib/src/shacl/index.js +1 -1
- package/package.json +3 -3
- package/src/Literal.ts +7 -0
- package/src/ai/AIClient.ts +6 -3
- package/src/apiClient.test.ts +227 -0
- package/src/apiClient.ts +185 -9
- package/src/generated/api/RunInterpretationRequest.ts +19 -3
- package/src/index.ts +3 -1
- package/src/model/Ad4mModel.test.ts +729 -22
- package/src/model/Ad4mModel.ts +305 -66
- package/src/model/ModelQueryBuilder.ts +2 -2
- package/src/model/decorators.ts +278 -44
- package/src/model/json-schema.ts +10 -25
- package/src/model/query-common.ts +2 -2
- package/src/model/query-sparql.test.ts +114 -13
- package/src/model/query-sparql.ts +83 -14
- package/src/model/query-utils.ts +22 -12
- package/src/model/relation-filtering.test.ts +70 -20
- package/src/model/shacl-gen.ts +78 -13
- package/src/model/shacl-roundtrip.test.ts +134 -2
- package/src/model/types.ts +30 -8
- package/src/perspectives/AutoProcessor.ts +204 -2
- package/src/perspectives/FlowInstance.ts +369 -0
- package/src/perspectives/FlowModels.ts +157 -0
- package/src/perspectives/InterpretationModels.ts +91 -21
- package/src/perspectives/PerspectiveClient.test.ts +67 -6
- package/src/perspectives/PerspectiveClient.ts +190 -14
- package/src/perspectives/PerspectiveProxy.test.ts +406 -0
- package/src/perspectives/PerspectiveProxy.ts +494 -308
- package/src/perspectives/SparqlBindings.test.ts +134 -0
- package/src/perspectives/SparqlBindings.ts +57 -6
- package/src/perspectives/shacl-rpc.test.ts +258 -0
- package/src/shacl/SHACLFlow.test.ts +762 -35
- package/src/shacl/SHACLFlow.ts +680 -112
- package/src/shacl/SHACLShape.test.ts +30 -4
- package/src/shacl/SHACLShape.ts +59 -6
- package/src/shacl/index.ts +1 -1
- package/lib/src/generated/rest/AIModelLoadingStatus.d.ts +0 -7
- package/lib/src/generated/rest/AIModelLoadingStatus.js +0 -2
- package/lib/src/generated/rest/AddAgentInfosRequest.d.ts +0 -3
- package/lib/src/generated/rest/AddAgentInfosRequest.js +0 -2
- package/lib/src/generated/rest/AddLinkExpressionRequest.d.ts +0 -6
- package/lib/src/generated/rest/AddLinkExpressionRequest.js +0 -1
- package/lib/src/generated/rest/AddLinkRequest.d.ts +0 -6
- package/lib/src/generated/rest/AddLinkRequest.js +0 -1
- package/lib/src/generated/rest/AddLinksBulkRequest.d.ts +0 -6
- package/lib/src/generated/rest/AddLinksBulkRequest.js +0 -1
- package/lib/src/generated/rest/AddSdnaRequest.d.ts +0 -6
- package/lib/src/generated/rest/AddSdnaRequest.js +0 -2
- package/lib/src/generated/rest/ApplyTemplateRequest.d.ts +0 -4
- package/lib/src/generated/rest/ApplyTemplateRequest.js +0 -2
- package/lib/src/generated/rest/AuthInfoInput.d.ts +0 -10
- package/lib/src/generated/rest/AuthInfoInput.js +0 -1
- package/lib/src/generated/rest/BroadcastRequest.d.ts +0 -6
- package/lib/src/generated/rest/BroadcastRequest.js +0 -1
- package/lib/src/generated/rest/CapabilityInput.d.ts +0 -5
- package/lib/src/generated/rest/CapabilityInput.js +0 -1
- package/lib/src/generated/rest/CommitBatchRequest.d.ts +0 -3
- package/lib/src/generated/rest/CommitBatchRequest.js +0 -2
- package/lib/src/generated/rest/ComputeLogEntry.d.ts +0 -9
- package/lib/src/generated/rest/ComputeLogEntry.js +0 -2
- package/lib/src/generated/rest/CreateExpressionRequest.d.ts +0 -4
- package/lib/src/generated/rest/CreateExpressionRequest.js +0 -2
- package/lib/src/generated/rest/CreatePerspectiveRequest.d.ts +0 -3
- package/lib/src/generated/rest/CreatePerspectiveRequest.js +0 -2
- package/lib/src/generated/rest/CreateSubjectRequest.d.ts +0 -6
- package/lib/src/generated/rest/CreateSubjectRequest.js +0 -2
- package/lib/src/generated/rest/CreateUserRequest.d.ts +0 -4
- package/lib/src/generated/rest/CreateUserRequest.js +0 -2
- package/lib/src/generated/rest/CreateUserResponse.d.ts +0 -5
- package/lib/src/generated/rest/CreateUserResponse.js +0 -2
- package/lib/src/generated/rest/DecoratedExpressionProof.d.ts +0 -6
- package/lib/src/generated/rest/DecoratedExpressionProof.js +0 -2
- package/lib/src/generated/rest/DecoratedLinkExpression.d.ts +0 -10
- package/lib/src/generated/rest/DecoratedLinkExpression.js +0 -1
- package/lib/src/generated/rest/DisposeQueryRequest.d.ts +0 -3
- package/lib/src/generated/rest/DisposeQueryRequest.js +0 -2
- package/lib/src/generated/rest/EmailTestRequest.d.ts +0 -6
- package/lib/src/generated/rest/EmailTestRequest.js +0 -2
- package/lib/src/generated/rest/EmbedRequest.d.ts +0 -4
- package/lib/src/generated/rest/EmbedRequest.js +0 -2
- package/lib/src/generated/rest/EntanglementProofInput.d.ts +0 -6
- package/lib/src/generated/rest/EntanglementProofInput.js +0 -2
- package/lib/src/generated/rest/EntanglementProofPreflightRequest.d.ts +0 -4
- package/lib/src/generated/rest/EntanglementProofPreflightRequest.js +0 -2
- package/lib/src/generated/rest/ExecuteCommandsRequest.d.ts +0 -4
- package/lib/src/generated/rest/ExecuteCommandsRequest.js +0 -2
- package/lib/src/generated/rest/ExportRequest.d.ts +0 -5
- package/lib/src/generated/rest/ExportRequest.js +0 -2
- package/lib/src/generated/rest/ExpressionManyRequest.d.ts +0 -3
- package/lib/src/generated/rest/ExpressionManyRequest.js +0 -2
- package/lib/src/generated/rest/ExpressionProof.d.ts +0 -4
- package/lib/src/generated/rest/ExpressionProof.js +0 -2
- package/lib/src/generated/rest/ExpressionProofInput.d.ts +0 -6
- package/lib/src/generated/rest/ExpressionProofInput.js +0 -2
- package/lib/src/generated/rest/FriendSendMessageRequest.d.ts +0 -3
- package/lib/src/generated/rest/FriendSendMessageRequest.js +0 -2
- package/lib/src/generated/rest/FriendsListRequest.d.ts +0 -3
- package/lib/src/generated/rest/FriendsListRequest.js +0 -2
- package/lib/src/generated/rest/GenerateAgentRequest.d.ts +0 -3
- package/lib/src/generated/rest/GenerateAgentRequest.js +0 -2
- package/lib/src/generated/rest/GenerateJwtRequest.d.ts +0 -4
- package/lib/src/generated/rest/GenerateJwtRequest.js +0 -2
- package/lib/src/generated/rest/GetSubjectDataRequest.d.ts +0 -4
- package/lib/src/generated/rest/GetSubjectDataRequest.js +0 -2
- package/lib/src/generated/rest/HostingInfoResponse.d.ts +0 -5
- package/lib/src/generated/rest/HostingInfoResponse.js +0 -2
- package/lib/src/generated/rest/HostingWalletResponse.d.ts +0 -4
- package/lib/src/generated/rest/HostingWalletResponse.js +0 -2
- package/lib/src/generated/rest/ImportAgentRequest.d.ts +0 -6
- package/lib/src/generated/rest/ImportAgentRequest.js +0 -2
- package/lib/src/generated/rest/ImportRequest.d.ts +0 -4
- package/lib/src/generated/rest/ImportRequest.js +0 -2
- package/lib/src/generated/rest/JoinNeighbourhoodRequest.d.ts +0 -3
- package/lib/src/generated/rest/JoinNeighbourhoodRequest.js +0 -2
- package/lib/src/generated/rest/KeepAliveQueryRequest.d.ts +0 -3
- package/lib/src/generated/rest/KeepAliveQueryRequest.js +0 -2
- package/lib/src/generated/rest/LanguageMetaInput.d.ts +0 -6
- package/lib/src/generated/rest/LanguageMetaInput.js +0 -2
- package/lib/src/generated/rest/Link.d.ts +0 -5
- package/lib/src/generated/rest/Link.js +0 -2
- package/lib/src/generated/rest/LinkExpression.d.ts +0 -10
- package/lib/src/generated/rest/LinkExpression.js +0 -1
- package/lib/src/generated/rest/LinkExpressionInput.d.ts +0 -10
- package/lib/src/generated/rest/LinkExpressionInput.js +0 -1
- package/lib/src/generated/rest/LinkInput.d.ts +0 -5
- package/lib/src/generated/rest/LinkInput.js +0 -2
- package/lib/src/generated/rest/LinkLanguageTemplatesRequest.d.ts +0 -3
- package/lib/src/generated/rest/LinkLanguageTemplatesRequest.js +0 -2
- package/lib/src/generated/rest/LinkMutationRequest.d.ts +0 -12
- package/lib/src/generated/rest/LinkMutationRequest.js +0 -1
- package/lib/src/generated/rest/LinkMutationResponse.d.ts +0 -9
- package/lib/src/generated/rest/LinkMutationResponse.js +0 -1
- package/lib/src/generated/rest/LinkMutations.d.ts +0 -6
- package/lib/src/generated/rest/LinkMutations.js +0 -1
- package/lib/src/generated/rest/LinkMutationsRequest.d.ts +0 -5
- package/lib/src/generated/rest/LinkMutationsRequest.js +0 -1
- package/lib/src/generated/rest/LinkStatus.d.ts +0 -1
- package/lib/src/generated/rest/LinkStatus.js +0 -2
- package/lib/src/generated/rest/LinkUpdateInput.d.ts +0 -5
- package/lib/src/generated/rest/LinkUpdateInput.js +0 -1
- package/lib/src/generated/rest/LockAgentRequest.d.ts +0 -3
- package/lib/src/generated/rest/LockAgentRequest.js +0 -2
- package/lib/src/generated/rest/LoginUserRequest.d.ts +0 -5
- package/lib/src/generated/rest/LoginUserRequest.js +0 -2
- package/lib/src/generated/rest/ModelType.d.ts +0 -1
- package/lib/src/generated/rest/ModelType.js +0 -2
- package/lib/src/generated/rest/NotificationGrantRequest.d.ts +0 -3
- package/lib/src/generated/rest/NotificationGrantRequest.js +0 -2
- package/lib/src/generated/rest/NotificationInput.d.ts +0 -10
- package/lib/src/generated/rest/NotificationInput.js +0 -2
- package/lib/src/generated/rest/OpenLinkRequest.d.ts +0 -3
- package/lib/src/generated/rest/OpenLinkRequest.js +0 -2
- package/lib/src/generated/rest/PermitCapabilityRequest.d.ts +0 -3
- package/lib/src/generated/rest/PermitCapabilityRequest.js +0 -2
- package/lib/src/generated/rest/PerspectiveInput.d.ts +0 -4
- package/lib/src/generated/rest/PerspectiveInput.js +0 -1
- package/lib/src/generated/rest/PromptRequest.d.ts +0 -4
- package/lib/src/generated/rest/PromptRequest.js +0 -2
- package/lib/src/generated/rest/PublicPerspectiveInput.d.ts +0 -4
- package/lib/src/generated/rest/PublicPerspectiveInput.js +0 -1
- package/lib/src/generated/rest/PublishLanguageRequest.d.ts +0 -5
- package/lib/src/generated/rest/PublishLanguageRequest.js +0 -1
- package/lib/src/generated/rest/PublishNeighbourhoodRequest.d.ts +0 -6
- package/lib/src/generated/rest/PublishNeighbourhoodRequest.js +0 -1
- package/lib/src/generated/rest/QueryRequest.d.ts +0 -7
- package/lib/src/generated/rest/QueryRequest.js +0 -2
- package/lib/src/generated/rest/RemoveLinkRequest.d.ts +0 -5
- package/lib/src/generated/rest/RemoveLinkRequest.js +0 -1
- package/lib/src/generated/rest/RemoveLinksBulkRequest.d.ts +0 -5
- package/lib/src/generated/rest/RemoveLinksBulkRequest.js +0 -1
- package/lib/src/generated/rest/RequestCapabilityRequest.d.ts +0 -4
- package/lib/src/generated/rest/RequestCapabilityRequest.js +0 -1
- package/lib/src/generated/rest/RequestPaymentRequest.d.ts +0 -3
- package/lib/src/generated/rest/RequestPaymentRequest.js +0 -2
- package/lib/src/generated/rest/RequestVerificationRequest.d.ts +0 -4
- package/lib/src/generated/rest/RequestVerificationRequest.js +0 -2
- package/lib/src/generated/rest/ResourceInput.d.ts +0 -4
- package/lib/src/generated/rest/ResourceInput.js +0 -2
- package/lib/src/generated/rest/SetDefaultModelRequest.d.ts +0 -4
- package/lib/src/generated/rest/SetDefaultModelRequest.js +0 -1
- package/lib/src/generated/rest/SetFreeHostingEnabledRequest.d.ts +0 -3
- package/lib/src/generated/rest/SetFreeHostingEnabledRequest.js +0 -2
- package/lib/src/generated/rest/SetHotWalletAddressRequest.d.ts +0 -3
- package/lib/src/generated/rest/SetHotWalletAddressRequest.js +0 -2
- package/lib/src/generated/rest/SetMultiUserRequest.d.ts +0 -3
- package/lib/src/generated/rest/SetMultiUserRequest.js +0 -2
- package/lib/src/generated/rest/SetOnlineStatusRequest.d.ts +0 -5
- package/lib/src/generated/rest/SetOnlineStatusRequest.js +0 -1
- package/lib/src/generated/rest/SetStatusRequest.d.ts +0 -3
- package/lib/src/generated/rest/SetStatusRequest.js +0 -2
- package/lib/src/generated/rest/SetUserFreeAccessRequest.d.ts +0 -4
- package/lib/src/generated/rest/SetUserFreeAccessRequest.js +0 -2
- package/lib/src/generated/rest/SignMessageRequest.d.ts +0 -3
- package/lib/src/generated/rest/SignMessageRequest.js +0 -2
- package/lib/src/generated/rest/SignalRequest.d.ts +0 -6
- package/lib/src/generated/rest/SignalRequest.js +0 -1
- package/lib/src/generated/rest/SubscribeQueryRequest.d.ts +0 -3
- package/lib/src/generated/rest/SubscribeQueryRequest.js +0 -2
- package/lib/src/generated/rest/SubscribeQueryResponse.d.ts +0 -4
- package/lib/src/generated/rest/SubscribeQueryResponse.js +0 -2
- package/lib/src/generated/rest/TrustedAgentsRequest.d.ts +0 -3
- package/lib/src/generated/rest/TrustedAgentsRequest.js +0 -2
- package/lib/src/generated/rest/UnlockAgentRequest.d.ts +0 -4
- package/lib/src/generated/rest/UnlockAgentRequest.js +0 -2
- package/lib/src/generated/rest/UpdateLinkRequest.d.ts +0 -7
- package/lib/src/generated/rest/UpdateLinkRequest.js +0 -1
- package/lib/src/generated/rest/UpdatePerspectiveRequest.d.ts +0 -3
- package/lib/src/generated/rest/UpdatePerspectiveRequest.js +0 -2
- package/lib/src/generated/rest/UpdateProfileRequest.d.ts +0 -5
- package/lib/src/generated/rest/UpdateProfileRequest.js +0 -1
- package/lib/src/generated/rest/UserStatistics.d.ts +0 -9
- package/lib/src/generated/rest/UserStatistics.js +0 -2
- package/lib/src/generated/rest/VerificationRequestResult.d.ts +0 -6
- package/lib/src/generated/rest/VerificationRequestResult.js +0 -2
- package/lib/src/generated/rest/VerifyEmailRequest.d.ts +0 -6
- package/lib/src/generated/rest/VerifyEmailRequest.js +0 -2
- package/lib/src/generated/rest/VerifySignatureRequest.d.ts +0 -5
- package/lib/src/generated/rest/VerifySignatureRequest.js +0 -2
- package/lib/src/generated/rest/WriteSettingsRequest.d.ts +0 -3
- package/lib/src/generated/rest/WriteSettingsRequest.js +0 -2
- package/lib/src/generated/rest/index.d.ts +0 -73
- package/lib/src/generated/rest/index.js +0 -8
- package/lib/src/generated/rest/routes.d.ts +0 -587
- package/lib/src/generated/rest/routes.js +0 -3
- package/lib/src/model/query-surreal.d.ts +0 -44
- package/lib/src/model/query-surreal.js +0 -249
- package/lib/src/model/surreal-utils.d.ts +0 -42
- package/lib/src/model/surreal-utils.js +0 -128
- package/lib/src/perspectives/PerspectiveProxy.test.d.ts +0 -1
- package/lib/src/perspectives/PerspectiveProxy.test.js +0 -34
- package/lib/src/restClient.d.ts +0 -52
- package/lib/src/restClient.js +0 -227
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { LinkCallback, PerspectiveClient, SyncStateChangeCallback } from "./PerspectiveClient";
|
|
2
|
+
import { CallOptions } from "../apiClient";
|
|
2
3
|
import { Link, LinkExpression, LinkExpressionInput, LinkExpressionMutations, LinkMutations } from "../links/Links";
|
|
3
4
|
import { LinkQuery } from "./LinkQuery";
|
|
4
5
|
import { PerspectiveHandle, PerspectiveState } from './PerspectiveHandle';
|
|
@@ -11,7 +12,7 @@ import { AllInstancesResult } from "../model/types";
|
|
|
11
12
|
import type { TranscriptTurn } from "../generated/api";
|
|
12
13
|
import { SHACLShape } from "../shacl/SHACLShape";
|
|
13
14
|
import { SHACLFlow } from "../shacl/SHACLFlow";
|
|
14
|
-
import type { AddAutoProcessorConfig, AutoProcessorEvent, InterpretationOverlayInfo } from "./AutoProcessor";
|
|
15
|
+
import type { AddAutoProcessorConfig, AutoProcessorEvent, AutoProcessorNeighbourhoodStateEvent, InterpretationOverlayInfo, RawScope, RunInterpretationObserveOptions } from "./AutoProcessor";
|
|
15
16
|
type QueryCallback = (result: AllInstancesResult) => void;
|
|
16
17
|
/** Proxy object for a subscribed Prolog query that provides real-time updates
|
|
17
18
|
*
|
|
@@ -279,7 +280,7 @@ export declare class PerspectiveProxy {
|
|
|
279
280
|
* });
|
|
280
281
|
* ```
|
|
281
282
|
*/
|
|
282
|
-
get(query: LinkQuery): Promise<LinkExpression[]>;
|
|
283
|
+
get(query: LinkQuery, options?: CallOptions): Promise<LinkExpression[]>;
|
|
283
284
|
/**
|
|
284
285
|
* Runs generic LLM interpretation over a conversation transcript, turning it
|
|
285
286
|
* into typed instances of this perspective's own SHACL subject classes
|
|
@@ -293,7 +294,29 @@ export declare class PerspectiveProxy {
|
|
|
293
294
|
* @param basePrefix URI namespace for new instance identities, e.g. `soa://ext/`
|
|
294
295
|
* @param classes local names of the subject classes to extract into; omit for all
|
|
295
296
|
*/
|
|
296
|
-
runInterpretation(transcript: TranscriptTurn[], basePrefix: string, classes?: string[]
|
|
297
|
+
runInterpretation(transcript: TranscriptTurn[], basePrefix: string, classes?: string[], options?: {
|
|
298
|
+
existingScope?: RawScope;
|
|
299
|
+
mintScope?: RawScope;
|
|
300
|
+
/** Report progress while the pass runs — see {@link RunInterpretationObserveOptions}. */
|
|
301
|
+
observe?: RunInterpretationObserveOptions;
|
|
302
|
+
}): Promise<string[]>;
|
|
303
|
+
/**
|
|
304
|
+
* Harness-dispatched interpretation pass over this perspective (design v3
|
|
305
|
+
* §6 — the tool-calling counterpart to {@link runInterpretation}). The LLM
|
|
306
|
+
* sees a live per-class tool surface (`{Class}_query`, `{Class}_get`,
|
|
307
|
+
* `{Class}_propose_create`, `{Class}_propose_link_child`, …) and drives
|
|
308
|
+
* the extraction via tool calls; buffered proposals drain through the
|
|
309
|
+
* same overlay gate the single-shot path uses.
|
|
310
|
+
*
|
|
311
|
+
* @param transcript ordered `{ speaker, text }` turns
|
|
312
|
+
* @param basePrefix URI namespace new instance identities are minted under
|
|
313
|
+
* @param maxToolCalls upper bound on tool calls the harness will make in
|
|
314
|
+
* one pass (must be > 0 — use {@link runInterpretation} for the
|
|
315
|
+
* classic single-shot path)
|
|
316
|
+
* @param classes local names of the subject classes to extract into; omit for all
|
|
317
|
+
* @param modelOverride optional model override; omit for the default LLM
|
|
318
|
+
*/
|
|
319
|
+
runInterpretationWithHarness(transcript: TranscriptTurn[], basePrefix: string, maxToolCalls: number, classes?: string[], modelOverride?: string, observationId?: string, emitDebugEvents?: boolean): Promise<string[]>;
|
|
297
320
|
/**
|
|
298
321
|
* Register a neighbourhood auto-processor on this perspective. The executor
|
|
299
322
|
* then runs interpretation automatically over new source items (like Flux
|
|
@@ -301,6 +324,22 @@ export declare class PerspectiveProxy {
|
|
|
301
324
|
* processor id. Subscribe to progress via {@link addAutoProcessorEventListener}.
|
|
302
325
|
*/
|
|
303
326
|
addAutoProcessor(config: AddAutoProcessorConfig): Promise<string>;
|
|
327
|
+
/**
|
|
328
|
+
* Stop an auto-processor by deleting its config.
|
|
329
|
+
*
|
|
330
|
+
* The registration is data — the watch loop reads the processor set back out of the
|
|
331
|
+
* perspective's graph on every tick — so deleting the config is what stops it, and there is
|
|
332
|
+
* nothing else to unregister. The config is `Shared`, so this stops the processor for the
|
|
333
|
+
* neighbourhood rather than only for this peer.
|
|
334
|
+
*
|
|
335
|
+
* Resolves `true` when there was a processor to remove and `false` when there was not; a
|
|
336
|
+
* processor another peer has already removed is not an error.
|
|
337
|
+
*
|
|
338
|
+
* The processor's `InterpretationRun` nodes stay: they are the record of what it did and the
|
|
339
|
+
* processed-turn cursor, so a processor later registered under the same id resumes where this
|
|
340
|
+
* one left off rather than re-reading every turn.
|
|
341
|
+
*/
|
|
342
|
+
removeAutoProcessor(processorId: string): Promise<boolean>;
|
|
304
343
|
/**
|
|
305
344
|
* Pending interpretation overlays on this perspective — LLM suggestions the
|
|
306
345
|
* §4 divergence gate staged rather than applied, awaiting human accept/reject.
|
|
@@ -320,6 +359,14 @@ export declare class PerspectiveProxy {
|
|
|
320
359
|
rejectInterpretation(base: string, property?: string): Promise<boolean>;
|
|
321
360
|
/** Subscribe to this perspective's auto-processor step signals. */
|
|
322
361
|
addAutoProcessorEventListener(cb: (event: AutoProcessorEvent) => void): Promise<void>;
|
|
362
|
+
/**
|
|
363
|
+
* Subscribe to this perspective's auto-processor neighbourhood-state
|
|
364
|
+
* events — fires when this executor claims / finishes / abandons a
|
|
365
|
+
* batch. Perspective-scoped, so a UI can render "someone is
|
|
366
|
+
* auto-processing this" without receiving the batch payload. See
|
|
367
|
+
* `AutoProcessorNeighbourhoodStateEvent`.
|
|
368
|
+
*/
|
|
369
|
+
addAutoProcessorNeighbourhoodStateListener(cb: (event: AutoProcessorNeighbourhoodStateEvent) => void): Promise<void>;
|
|
323
370
|
/**
|
|
324
371
|
* Executes a Prolog query against the perspective's knowledge base.
|
|
325
372
|
* This is a powerful way to find complex patterns in the graph.
|
|
@@ -343,7 +390,7 @@ export declare class PerspectiveProxy {
|
|
|
343
390
|
* `);
|
|
344
391
|
* ```
|
|
345
392
|
*/
|
|
346
|
-
infer(query: string): Promise<any>;
|
|
393
|
+
infer(query: string, options?: CallOptions): Promise<any>;
|
|
347
394
|
/**
|
|
348
395
|
* Executes a SPARQL query against the perspective's link cache.
|
|
349
396
|
* This allows powerful SQL-like queries on the link data stored in SPARQL.
|
|
@@ -352,15 +399,21 @@ export declare class PerspectiveProxy {
|
|
|
352
399
|
* Mutating operations (DELETE, UPDATE, INSERT, CREATE, DROP, DEFINE, etc.) are
|
|
353
400
|
* blocked for security reasons. Use the perspective's add/remove methods to modify links.
|
|
354
401
|
*
|
|
355
|
-
*
|
|
356
|
-
*
|
|
357
|
-
*
|
|
358
|
-
*
|
|
402
|
+
* **Cancellation:** Pass `{ signal }` from an `AbortController` to abort
|
|
403
|
+
* an in-flight query. The executor receives `request.cancel` over the
|
|
404
|
+
* WebSocket and short-circuits the JSON reply. Caveat: Oxigraph itself
|
|
405
|
+
* cannot be interrupted mid-evaluation, so an already-running scan will
|
|
406
|
+
* keep its blocking thread busy until it completes; what's saved is the
|
|
407
|
+
* serialise + network + client-deserialise tax on the result. Aborted
|
|
408
|
+
* calls reject with `DOMException('Aborted', 'AbortError')` — match
|
|
409
|
+
* `fetch()` for handling. Cached results bypass the round-trip entirely
|
|
410
|
+
* and are returned synchronously, ignoring the signal.
|
|
359
411
|
*
|
|
360
|
-
* @param query - SPARQL query string
|
|
412
|
+
* @param query - SPARQL query string (read-only operations only)
|
|
413
|
+
* @param options - Optional call options (e.g. AbortSignal for cancellation)
|
|
361
414
|
* @returns Query results as parsed JSON
|
|
362
415
|
*/
|
|
363
|
-
querySparql<T = any>(query: string): Promise<T>;
|
|
416
|
+
querySparql<T = any>(query: string, options?: CallOptions): Promise<T>;
|
|
364
417
|
/**
|
|
365
418
|
* Execute a model query — the executor-side replacement for SPARQL query building + JS hydration.
|
|
366
419
|
*
|
|
@@ -372,10 +425,41 @@ export declare class PerspectiveProxy {
|
|
|
372
425
|
* @param queryJson - Structured query as JSON string
|
|
373
426
|
* @returns Object with `instances` array and `totalCount`
|
|
374
427
|
*/
|
|
375
|
-
modelQuery(className: string, queryJson: string): Promise<{
|
|
428
|
+
modelQuery(className: string, queryJson: string, options?: CallOptions): Promise<{
|
|
376
429
|
instances: any[];
|
|
377
430
|
totalCount: number;
|
|
378
431
|
}>;
|
|
432
|
+
/** Resolve each URI to the names of every subject class it is an instance of.
|
|
433
|
+
*
|
|
434
|
+
* The counterpart of {@link isSubjectInstance}, which asks the same question
|
|
435
|
+
* one class at a time. Without this, finding the class of an arbitrary URI
|
|
436
|
+
* meant looping over every registered class — a round trip each — and doing
|
|
437
|
+
* it again for every URI.
|
|
438
|
+
*
|
|
439
|
+
* Class membership in AD4M is structural — a URI belongs to a class when it
|
|
440
|
+
* carries that class's flags and required properties — so membership is **not
|
|
441
|
+
* exclusive**: an instance conforms to its parent classes, and to any
|
|
442
|
+
* unrelated class whose required set happens to be a subset of what it
|
|
443
|
+
* carries. Every match is returned.
|
|
444
|
+
*
|
|
445
|
+
* The list is ordered **most specific first**, meaning by the number of
|
|
446
|
+
* triples the class requires — a subclass requires everything its parent does
|
|
447
|
+
* and more — with ties broken alphabetically so that every peer answers
|
|
448
|
+
* identically. A caller that can only act on one class should take
|
|
449
|
+
* `classes[0]`, but that head is only a heuristic: it is arbitrary between two
|
|
450
|
+
* unrelated classes requiring the same number of triples, which is exactly
|
|
451
|
+
* the case the full list exists to expose.
|
|
452
|
+
*
|
|
453
|
+
* A URI is **absent from the result** when no *registered* class matched it.
|
|
454
|
+
* That covers two situations, and nothing here separates them: the URI may
|
|
455
|
+
* not be a subject instance at all, or it may be an instance of a class this
|
|
456
|
+
* perspective has not registered. Absence is used rather than an empty list
|
|
457
|
+
* because an empty list would claim the stronger thing — that the URI belongs
|
|
458
|
+
* to no class — which this cannot know.
|
|
459
|
+
*
|
|
460
|
+
* @param uris The expression URIs to classify.
|
|
461
|
+
*/
|
|
462
|
+
subjectClassesOf(uris: string[]): Promise<Record<string, string[]>>;
|
|
379
463
|
/**
|
|
380
464
|
* Evaluate property getters for a batch of instances in a single RPC call.
|
|
381
465
|
* Returns a map of `{ instanceId: { prop: value, ... } }`.
|
|
@@ -594,18 +678,28 @@ export declare class PerspectiveProxy {
|
|
|
594
678
|
setSingleTarget(link: Link, status?: LinkStatus): Promise<void>;
|
|
595
679
|
/** Returns all the Social DNA flows defined in this perspective */
|
|
596
680
|
sdnaFlows(): Promise<string[]>;
|
|
597
|
-
/**
|
|
681
|
+
/**
|
|
682
|
+
* Returns all Social DNA flows that can be started from the given expression.
|
|
683
|
+
*
|
|
684
|
+
* Post-`flowable` retirement: a flow is a candidate iff its `inputTypes`
|
|
685
|
+
* declaration is compatible with the expression. Matching rules:
|
|
686
|
+
* - Empty `inputTypes` or one containing the `"any"` wildcard → always
|
|
687
|
+
* matches (same behaviour as the legacy `flowable === "any"` case).
|
|
688
|
+
* - Otherwise, at least one of the expression's registered subject-class
|
|
689
|
+
* URIs (resolved via {@link subjectClassesOf}) must appear in
|
|
690
|
+
* `inputTypes`. This is the concrete-type match the design doc's §5
|
|
691
|
+
* spawn engine calls for; without it, a flow declaring
|
|
692
|
+
* `inputTypes: ["Task"]` was previously *never* returned by
|
|
693
|
+
* `availableFlows("some-task-uri")` — the entire point of typed
|
|
694
|
+
* flows was silently unreachable (James PR #929 J#3).
|
|
695
|
+
*
|
|
696
|
+
* The expression is classified against the perspective's registered
|
|
697
|
+
* classes only. An expression whose class is not registered on this
|
|
698
|
+
* perspective matches no typed flow (absence, not falsehood — same
|
|
699
|
+
* discipline as {@link subjectClassesOf}); typed flows requiring
|
|
700
|
+
* unknown classes are still returned to their untyped-caller peers.
|
|
701
|
+
*/
|
|
598
702
|
availableFlows(exprAddr: string): Promise<string[]>;
|
|
599
|
-
/** Starts the Social DNA flow @param flowName on the expression @param exprAddr */
|
|
600
|
-
startFlow(flowName: string, exprAddr: string): Promise<void>;
|
|
601
|
-
/** Returns all expressions in the given state of given Social DNA flow */
|
|
602
|
-
expressionsInFlowState(flowName: string, flowState: number): Promise<string[]>;
|
|
603
|
-
/** Returns the given expression's flow state with regard to given Social DNA flow */
|
|
604
|
-
flowState(flowName: string, exprAddr: string): Promise<number>;
|
|
605
|
-
/** Returns available action names, with regard to Social DNA flow and expression's flow state */
|
|
606
|
-
flowActions(flowName: string, exprAddr: string): Promise<string[]>;
|
|
607
|
-
/** Runs given Social DNA flow action */
|
|
608
|
-
runFlowAction(flowName: string, exprAddr: string, actionName: string): Promise<void>;
|
|
609
703
|
/** Returns the perspective's Social DNA code
|
|
610
704
|
* This will return all SDNA code elements in an array.
|
|
611
705
|
*/
|
|
@@ -684,28 +778,27 @@ export declare class PerspectiveProxy {
|
|
|
684
778
|
*/
|
|
685
779
|
addShacl(name: string, shape: SHACLShape): Promise<void>;
|
|
686
780
|
/**
|
|
687
|
-
* Retrieve a SHACL shape by name from this Perspective
|
|
781
|
+
* Retrieve a SHACL shape by name from this Perspective (one RPC call).
|
|
782
|
+
* The executor resolves the full shape (including property sub-shapes)
|
|
783
|
+
* in-process and returns link triples for client-side reconstruction.
|
|
688
784
|
*/
|
|
689
785
|
getShacl(name: string): Promise<SHACLShape | null>;
|
|
690
786
|
/**
|
|
691
|
-
* List the names of every SHACL shape stored in this Perspective
|
|
692
|
-
* each shape's full definition (properties, target class, etc.) — just the cheap
|
|
693
|
-
* `ad4m://has_shacl` enumeration, one round trip regardless of how many shapes exist.
|
|
694
|
-
* Use this to check which shapes are actually worth resolving via `getShacl()` before
|
|
695
|
-
* paying for each one's full (multi-round-trip) fetch.
|
|
787
|
+
* List the names of every SHACL shape stored in this Perspective (one RPC call).
|
|
696
788
|
*/
|
|
697
789
|
getShaclNames(): Promise<string[]>;
|
|
698
790
|
/**
|
|
699
|
-
* Resolve
|
|
700
|
-
*
|
|
701
|
-
* `
|
|
702
|
-
*
|
|
703
|
-
*
|
|
704
|
-
*
|
|
791
|
+
* Resolve a shape's `sh:targetClass` by name (one RPC call).
|
|
792
|
+
*
|
|
793
|
+
* `PerspectiveClient.getShaclTargetClass` now returns `undefined` on
|
|
794
|
+
* "not found" already (see review r3897752023 — the null→undefined
|
|
795
|
+
* coercion used to happen here and be duplicated one layer down),
|
|
796
|
+
* so this method is a pure passthrough.
|
|
705
797
|
*/
|
|
706
798
|
getShaclTargetClass(name: string): Promise<string | undefined>;
|
|
707
799
|
/**
|
|
708
|
-
* Get all SHACL shapes stored in this Perspective
|
|
800
|
+
* Get all SHACL shapes stored in this Perspective (one RPC call).
|
|
801
|
+
* The executor resolves all shapes in-process and returns them in bulk.
|
|
709
802
|
*/
|
|
710
803
|
getAllShacl(): Promise<Array<{
|
|
711
804
|
name: string;
|
|
@@ -724,28 +817,26 @@ export declare class PerspectiveProxy {
|
|
|
724
817
|
* ```typescript
|
|
725
818
|
* import { SHACLFlow } from '@coasys/ad4m';
|
|
726
819
|
*
|
|
727
|
-
* const
|
|
728
|
-
*
|
|
729
|
-
*
|
|
730
|
-
*
|
|
731
|
-
*
|
|
732
|
-
*
|
|
733
|
-
*
|
|
734
|
-
*
|
|
735
|
-
*
|
|
736
|
-
*
|
|
737
|
-
*
|
|
738
|
-
*
|
|
739
|
-
*
|
|
740
|
-
*
|
|
741
|
-
*
|
|
742
|
-
*
|
|
743
|
-
*
|
|
744
|
-
*
|
|
745
|
-
* ]
|
|
746
|
-
* });
|
|
820
|
+
* const deliveryFlow = new SHACLFlow('Delivery', 'delivery://');
|
|
821
|
+
* deliveryFlow.inputTypes = ['Task'];
|
|
822
|
+
* deliveryFlow.interpretationHint =
|
|
823
|
+
* 'Advance a Task through delivery: Identified → Scoped → InProgress → Review → Done.';
|
|
824
|
+
*
|
|
825
|
+
* deliveryFlow.addState({ name: 'Identified', value: 0 });
|
|
826
|
+
* deliveryFlow.addState({ name: 'Scoped', value: 1 });
|
|
827
|
+
* deliveryFlow.addState({ name: 'InProgress', value: 2 });
|
|
828
|
+
* deliveryFlow.addState({ name: 'Review', value: 3 });
|
|
829
|
+
* deliveryFlow.addState({ name: 'Done', value: 4 });
|
|
830
|
+
*
|
|
831
|
+
* deliveryFlow.addTransition({ actionName: 'Scope', fromState: 'Identified', toState: 'Scoped', actions: [] });
|
|
832
|
+
* deliveryFlow.addTransition({ actionName: 'Start', fromState: 'Scoped', toState: 'InProgress', actions: [] });
|
|
833
|
+
* deliveryFlow.addTransition({ actionName: 'Submit', fromState: 'InProgress', toState: 'Review', actions: [] });
|
|
834
|
+
* deliveryFlow.addTransition({ actionName: 'Accept', fromState: 'Review', toState: 'Done', actions: [] });
|
|
835
|
+
*
|
|
836
|
+
* // Optional: n distinct DIDs must co-sign a proposal before it fires.
|
|
837
|
+
* deliveryFlow.consensusRule = { n: 2 };
|
|
747
838
|
*
|
|
748
|
-
* await perspective.addFlow('
|
|
839
|
+
* await perspective.addFlow('Delivery', deliveryFlow);
|
|
749
840
|
* ```
|
|
750
841
|
*/
|
|
751
842
|
addFlow(name: string, flow: SHACLFlow): Promise<void>;
|
|
@@ -769,7 +860,9 @@ export declare class PerspectiveProxy {
|
|
|
769
860
|
* with the properties of the subject class.
|
|
770
861
|
* @param exprAddr The address of the expression to be turned into a subject instance
|
|
771
862
|
* @param initialValues Optional initial values for properties. If provided, these will be
|
|
772
|
-
* merged with constructor actions for better performance.
|
|
863
|
+
* merged with constructor actions for better performance. A collection property accepts
|
|
864
|
+
* an array value and stores one entry per element; scalar properties store arrays/objects
|
|
865
|
+
* as a single JSON value.
|
|
773
866
|
* @param batchId Optional batch ID for grouping operations. If provided, returns the expression address
|
|
774
867
|
* instead of the subject proxy since the subject won't exist until the batch is committed.
|
|
775
868
|
* @returns A proxy object for the created subject, or just the expression address if in batch mode
|