Skip to content

Commit 049376b

Browse files
gambletanclaude
andcommitted
fix: WASM extractor normalizes "based in" → "I'm based in" + rebuild docs/pkg
Bare "based in" clauses in multi-clause inputs (e.g. "I work at Acme and based in Berlin") were normalized to "I based in" which didn't match any extract_single pattern. Now normalizes to "I'm based in" so lives_in fact is correctly extracted. Rebuilt WASM binary and removed wasm-pack's auto-generated .gitignore so docs/pkg/ is properly tracked for GitHub Pages. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 37ff42a commit 049376b

6 files changed

Lines changed: 554 additions & 1 deletion

File tree

cortex-wasm/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,11 @@ impl CortexWasm {
214214
self.extract_single(first);
215215
// Prepend "I " to bare verb clauses so extract_single can match them
216216
let second_lower = second.to_lowercase();
217-
let bare_verbs = ["work at ", "work for ", "live in ", "based in "];
217+
let bare_verbs = ["work at ", "work for ", "live in "];
218218
let normalized = if bare_verbs.iter().any(|v| second_lower.starts_with(v)) {
219219
format!("I {}", second)
220+
} else if second_lower.starts_with("based in ") {
221+
format!("I'm {}", second)
220222
} else {
221223
second.to_string()
222224
};

docs/pkg/cortex_wasm.d.ts

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
/* tslint:disable */
2+
/* eslint-disable */
3+
4+
/**
5+
* In-memory Cortex engine for browser use.
6+
*/
7+
export class CortexWasm {
8+
free(): void;
9+
[Symbol.dispose](): void;
10+
/**
11+
* Add a fact (subject-predicate-object).
12+
*/
13+
add_fact(subject: string, predicate: string, object: string, confidence: number): void;
14+
/**
15+
* Get memory count.
16+
*/
17+
count(): number;
18+
/**
19+
* Get all beliefs as JSON.
20+
*/
21+
get_beliefs(): string;
22+
/**
23+
* Ingest a memory. Returns the memory ID.
24+
*/
25+
ingest(text: string, channel: string): string;
26+
/**
27+
* Create a new in-memory Cortex instance.
28+
*/
29+
constructor();
30+
/**
31+
* Observe evidence for a belief. Returns new probability.
32+
*/
33+
observe_belief(key: string, supports: boolean, strength: number): number;
34+
/**
35+
* Query facts by entity. Returns JSON array.
36+
*/
37+
query_facts(entity: string): string;
38+
/**
39+
* Search memories by query. Returns JSON array of results.
40+
*/
41+
search(query: string, limit: number): string;
42+
/**
43+
* Get stats as JSON.
44+
*/
45+
stats(): string;
46+
}
47+
48+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
49+
50+
export interface InitOutput {
51+
readonly memory: WebAssembly.Memory;
52+
readonly __wbg_cortexwasm_free: (a: number, b: number) => void;
53+
readonly cortexwasm_add_fact: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
54+
readonly cortexwasm_count: (a: number) => number;
55+
readonly cortexwasm_get_beliefs: (a: number, b: number) => void;
56+
readonly cortexwasm_ingest: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
57+
readonly cortexwasm_new: () => number;
58+
readonly cortexwasm_observe_belief: (a: number, b: number, c: number, d: number, e: number) => number;
59+
readonly cortexwasm_query_facts: (a: number, b: number, c: number, d: number) => void;
60+
readonly cortexwasm_search: (a: number, b: number, c: number, d: number, e: number) => void;
61+
readonly cortexwasm_stats: (a: number, b: number) => void;
62+
readonly __wbindgen_export: (a: number) => void;
63+
readonly __wbindgen_export2: (a: number, b: number) => number;
64+
readonly __wbindgen_export3: (a: number, b: number, c: number, d: number) => number;
65+
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
66+
readonly __wbindgen_export4: (a: number, b: number, c: number) => void;
67+
}
68+
69+
export type SyncInitInput = BufferSource | WebAssembly.Module;
70+
71+
/**
72+
* Instantiates the given `module`, which can either be bytes or
73+
* a precompiled `WebAssembly.Module`.
74+
*
75+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
76+
*
77+
* @returns {InitOutput}
78+
*/
79+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
80+
81+
/**
82+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
83+
* for everything else, calls `WebAssembly.instantiate` directly.
84+
*
85+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
86+
*
87+
* @returns {Promise<InitOutput>}
88+
*/
89+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;

0 commit comments

Comments
 (0)