Skip to content

Interface: OsfqlResponse

@kortexya/reasoninglayer


@kortexya/reasoninglayer / OsfqlResponse

Defined in: src/types/osfql.ts:292

Response from OSFQL execution.

Contains the results of executing an OSFQL program, including variable bindings from MATCH queries, IDs of produced terms and defined sorts, and diagnostic messages from the execution pipeline.

bindings: Record<string, OsfqlValue>[]

Defined in: src/types/osfql.ts:326

Variable bindings from MATCH queries. Each entry represents one solution.


chainCompletions: OsfqlChainCompletion[]

Defined in: src/types/osfql.ts:317

The completion of every forward-chain run, in execution order: explicit CHAINs and the re-derivations that writes and PROVE ran, each labelled with its statement.

Empty means no chain ran; it proves nothing. A run with fixpointReached: false left a partial set of conclusions: for a write’s re-derivation, the conclusions the write left in the store are incomplete.


computationTimeMs: number

Defined in: src/types/osfql.ts:385

Milliseconds the engine spent running the program — its own solve time, without the network round trip.


optional definedSortIds?: string[]

Defined in: src/types/osfql.ts:373

Sort IDs produced by DEFINE statements.


diagnostics: string[]

Defined in: src/types/osfql.ts:376

Diagnostic messages from the execution pipeline.


optional fetched?: Record<string, OsfqlValue>[]

Defined in: src/types/osfql.ts:333

Nested documents produced by a FETCH clause: one map per match row, each fetched variable resolved to a nested Psi-term (OsfqlValue term, coreference inlined). Omitted when the program has no FETCH.


producedTermIds: string[]

Defined in: src/types/osfql.ts:348

The ids of the terms this program CREATED.

An INSERT or NEW endpoint, an UPSERT or UPSERT LINK endpoint that found no term to merge into, a link’s edge term, a DERIVE or CHAIN conclusion. A term that existed before the program is never here: a write into it is reported in updatedTermIds. A term the program created and then modified is here ONLY. The two lists are disjoint.

One exception: the read-only ROW SEARCH, ROW QUERY and COLLECTION QUERY statements list the terms they MATCHED here.


proveCompletions: OsfqlProveCompletion[]

Defined in: src/types/osfql.ts:323

The enumeration completeness of each PROVE, in execution order. Empty when the program ran no PROVE.


optional rowStatus?: OsfqlRowVerdict[]

Defined in: src/types/osfql.ts:305

The verdict of each binding row, parallel to bindings.

Present only when some row is not plainly true. unknown marks a row that binds a well-founded UNDEFINED conclusion, answered because the statement asked with INCLUDING UNDEFINED, never as true. Absent means every row is true.


optional sortDelete?: DeleteSortResponse | null

Defined in: src/types/osfql.ts:403

What a DROP SORT removed, when the program dropped a sort.

The same body SortsClient.deleteSort answers: DROP SORT name [CASCADE TERMS] [ORPHAN RULES] [CASCADE DESCENDANTS] runs the same guarded, durable delete after the program, with its options as the terms: 'delete', rules: 'orphan' and descendants: 'delete' dispositions. Each option defaults to refuse.

A refused DROP SORT does not answer here: it throws an ApiError with the status of the REST delete and error_type: "refused". Read its refusal with sortDeleteRefusalOf.

Absent when the program dropped no sort.


optional sortReparent?: SortReparentReport | null

Defined in: src/types/osfql.ts:417

What an ALTER SORT <name> PARENTS (…) changed, when the program moved a sort.

The report SortsClient.reparentSort answers, without the moved sort. The move runs after the program. A refused move throws an ApiError with status 400 and error_type: "refused"; the message names the cause.

Absent when no sort moved.


statementCount: number

Defined in: src/types/osfql.ts:379

Number of statements executed.


success: boolean

Defined in: src/types/osfql.ts:294

Whether execution succeeded.


updatedTermIds: string[]

Defined in: src/types/osfql.ts:370

The ids of the terms that existed BEFORE this program and that it modified in place.

An UPDATE / SET / REMOVE; an UPSERT that merged into an existing term through its @key; a designated link endpoint that gained the edge feature; the source an UNLINK or an edge-term DELETE removed the edge feature from; a referrer that RETRACT … DETACH or MATCH … DETACH DELETE rewrote. An exact-match UPSERT writes nothing and is in neither list; a term the same statement deleted is not listed.

Disjoint from producedTermIds, so the counts are direct: producedTermIds.length created and updatedTermIds.length updated. Do not subtract one list from the other.

Always present. [] means the program modified no existing term — a zero-match UPDATE answers [], so a non-empty list is how a caller knows an UPDATE matched anything.