Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
808ba56
Query related obvious memory improvements
lucksus Jan 7, 2026
96044e1
Short prolog engine pool clean-up timings
lucksus Jan 7, 2026
66a7d2c
Reuse whisper model for multiple streams
lucksus Jan 7, 2026
9670dd5
Don't update prolog engines when links change
lucksus Jan 7, 2026
ff4b33e
No filtered pools
lucksus Jan 7, 2026
862a999
Reuse multiple whisper models of different size, but only one per siz…
lucksus Jan 7, 2026
7d3ba8e
Prolog mode simple
lucksus Jan 8, 2026
934cd76
Reactivate prolog subscriptions in simple mode
lucksus Jan 8, 2026
9e03f8f
FIx updating SDNA in prolog simple mode
lucksus Jan 8, 2026
d41bc13
Ad4mModel write operations wihtout Prolog
lucksus Jan 8, 2026
6686201
Prolog disabled mode
lucksus Jan 9, 2026
2c18906
PrologMode::SdnaOnly
lucksus Jan 9, 2026
58d33dd
Fix SdnaOnly mode with correct ownder_did and case differentiation.
lucksus Jan 9, 2026
102f28f
Always recreate SdnaOnly Prolog engine (no memory creep but slow)
lucksus Jan 9, 2026
61baa48
Update SdnaOnly prolog engine only if sdna links have changed
lucksus Jan 9, 2026
46c9db4
fmt
lucksus Jan 9, 2026
6492e60
Allow AI task creation wiht PROMPT capability
lucksus Jan 12, 2026
be96913
Set pool's FILTERING_THRESHOLD back to 6000 to fix test builds
lucksus Jan 12, 2026
8c84c61
Reduce log-level of new Prolog mode debug logs
lucksus Jan 12, 2026
92a78f1
Replace Prolog in isSubjectInstance() with Surreal
lucksus Jan 12, 2026
a52e03a
Don't try to resolve empty string target
lucksus Jan 12, 2026
08babbe
FIx new collection queries
lucksus Jan 13, 2026
0aef120
Collection ordering
lucksus Jan 13, 2026
a980367
Ad4mModel.getData() with surreal
lucksus Jan 13, 2026
ec99aa6
Static instance queries with surreal
lucksus Jan 13, 2026
fa49105
Skip tests for Prolog in Ad4mModels (will change this with SDNA refac…
lucksus Jan 13, 2026
d63056f
Clean up tests
lucksus Jan 13, 2026
ad52121
Fix @Flags by parsing also target from instance triples
lucksus Jan 13, 2026
0609c1b
Fix test by cleaning up first
lucksus Jan 13, 2026
3ace84f
Skip prolog embedding vector encoding test
lucksus Jan 13, 2026
d40af15
Unflake some tests
lucksus Jan 13, 2026
e3d3eb7
Remove subscription truncation
lucksus Jan 13, 2026
18c56e5
Ignore Prolog pool unit test for SdnaOnly mode
lucksus Jan 14, 2026
1346b8e
Skip tests that don't work in SdnaOnly Prolog mode
lucksus Jan 14, 2026
9706bbd
Prevent SQL injections by escaping values put into surreal queries
lucksus Jan 14, 2026
7395c58
More surreal string escaping
lucksus Jan 14, 2026
3d9187b
SDNA parsing robustness
lucksus Jan 15, 2026
6ca5c68
getCollectionValuesViaSurreal(): avoid N+1 isSubjectInstance() checks…
lucksus Jan 15, 2026
936d6b6
Make getAllSubjectProxies() actually return subject proxies again
lucksus Jan 15, 2026
bb38c41
Improve SdnaOnly mode link filtering, split from simple mode, don't p…
lucksus Jan 15, 2026
5f05954
warning--
lucksus Jan 15, 2026
f8f83a1
Scope locks in Prolog service to avoid waiting and deadlocks
lucksus Jan 15, 2026
e6f3c6f
Clarify test case interdependency
lucksus Jan 15, 2026
98f102d
fmt
lucksus Jan 15, 2026
b05d683
Link predicate queries: don't get all and filter in mem, constrain DB…
lucksus Jan 15, 2026
83e73fc
Try to unflake subscription test
lucksus Jan 15, 2026
d3fd341
Don't try Prolog first where we have surreal fallback - only surreal
lucksus Jan 15, 2026
cbd8f5c
Refactor PrologModes in perspective_instace
lucksus Jan 15, 2026
795d868
Refactor PrologModes in prolog_service/mod.rs
lucksus Jan 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
355 changes: 261 additions & 94 deletions core/src/model/Ad4mModel.ts

Large diffs are not rendered by default.

43 changes: 12 additions & 31 deletions core/src/model/Subject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,31 +50,12 @@ export class Subject {
Object.defineProperty(this, p, {
configurable: true,
get: async () => {
let results = await this.#perspective.infer(`subject_class("${this.#subjectClassName}", C), property_getter(C, "${this.#baseExpression}", "${p}", Value)`)
if(results && results.length > 0) {
let expressionURI = results[0].Value
if(resolveExpressionURI) {
try {
if (expressionURI) {
const expression = await this.#perspective.getExpression(expressionURI)
try {
return JSON.parse(expression.data)
} catch(e) {
return expression.data
}
} else {
return expressionURI
}
} catch (err) {
return expressionURI
}
} else {
return expressionURI
}
} else if(results) {
return results
} else {
return undefined
// Use SurrealDB for data queries
try {
return await this.#perspective.getPropertyValueViaSurreal(this.#baseExpression, this.#subjectClassName, p);
} catch (err) {
console.warn(`Failed to get property ${p} via SurrealDB:`, err);
return undefined;
}
}
})
Expand Down Expand Up @@ -110,12 +91,12 @@ export class Subject {
Object.defineProperty(this, c, {
configurable: true,
get: async () => {
let results = await this.#perspective.infer(`subject_class("${this.#subjectClassName}", C), collection_getter(C, "${this.#baseExpression}", "${c}", Value)`)
if(results && results.length > 0 && results[0].Value) {
let collectionContent = results[0].Value.filter((v: any) => v !== "" && v !== '')
return collectionContent
} else {
return []
// Use SurrealDB for data queries
try {
return await this.#perspective.getCollectionValuesViaSurreal(this.#baseExpression, this.#subjectClassName, c);
} catch (err) {
console.warn(`Failed to get collection ${c} via SurrealDB:`, err);
return [];
}
}
})
Expand Down
51 changes: 39 additions & 12 deletions core/src/model/decorators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,21 +97,48 @@ export function InstanceQuery(options?: InstanceQueryParams) {
query += ', ' + options.condition
}

let results = await perspective.infer(query)
if(results == false) {
return instances
}
if(typeof results == "string") {
throw results
// Try Prolog first
try {
let results = await perspective.infer(query)
if(results && results !== false && typeof results !== "string" && results.length > 0) {
for(let result of results) {
let instance = result.Instance
let subject = new Subject(perspective, instance, subjectClassName)
await subject.init()
instances.push(subject as T)
}
return instances
}
} catch (e) {
// Prolog failed, fall through to SurrealDB
}
for(let result of results) {
let instance = result.Instance
let subject = new Subject(perspective, instance, subjectClassName)
await subject.init()
instances.push(subject as T)

// Fallback to SurrealDB (SdnaOnly mode)
// Get all instances first
let allInstances = await perspective.getAllSubjectInstances(subjectClassName)

// Filter by where clause if provided
if(options && options.where) {
let filtered = []
for(let instance of allInstances) {
let matches = true
for(let prop in options.where) {
let expectedValue = options.where[prop]
//@ts-ignore
let actualValue = await instance[prop]
if(actualValue !== expectedValue) {
matches = false
break
}
}
if(matches) {
filtered.push(instance as T)
}
}
return filtered
}

return instances
return allInstances as T[]
}
};
}
Expand Down
Loading