@temporal-cortex/truth-engine 0.2.0 → 0.2.1
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/dist/index.d.ts
CHANGED
|
@@ -110,6 +110,10 @@ export interface ResolvedDatetime {
|
|
|
110
110
|
timezone: string;
|
|
111
111
|
interpretation: string;
|
|
112
112
|
}
|
|
113
|
+
export interface ResolveOptions {
|
|
114
|
+
/** Which day starts the week: "monday" (default) or "sunday". */
|
|
115
|
+
week_start?: "monday" | "sunday";
|
|
116
|
+
}
|
|
113
117
|
/**
|
|
114
118
|
* Convert a datetime to a different timezone representation.
|
|
115
119
|
*
|
|
@@ -144,3 +148,13 @@ export declare function adjustTimestamp(datetime: string, adjustment: string, ti
|
|
|
144
148
|
* @returns Resolved datetime in UTC and local time with interpretation
|
|
145
149
|
*/
|
|
146
150
|
export declare function resolveRelative(anchor: string, expression: string, timezone: string): ResolvedDatetime;
|
|
151
|
+
/**
|
|
152
|
+
* Resolve a relative time expression with configurable options.
|
|
153
|
+
*
|
|
154
|
+
* @param anchor - RFC 3339 datetime string (the "now" reference point)
|
|
155
|
+
* @param expression - Time expression (e.g., "start of last week", "next week")
|
|
156
|
+
* @param timezone - IANA timezone for interpreting local-time expressions
|
|
157
|
+
* @param options - Resolution options (week start day, etc.)
|
|
158
|
+
* @returns Resolved datetime in UTC and local time with interpretation
|
|
159
|
+
*/
|
|
160
|
+
export declare function resolveRelativeWithOptions(anchor: string, expression: string, timezone: string, options?: ResolveOptions): ResolvedDatetime;
|
package/dist/index.js
CHANGED
|
@@ -156,3 +156,16 @@ export function resolveRelative(anchor, expression, timezone) {
|
|
|
156
156
|
const json = wasm.resolveRelative(anchor, expression, timezone);
|
|
157
157
|
return JSON.parse(json);
|
|
158
158
|
}
|
|
159
|
+
/**
|
|
160
|
+
* Resolve a relative time expression with configurable options.
|
|
161
|
+
*
|
|
162
|
+
* @param anchor - RFC 3339 datetime string (the "now" reference point)
|
|
163
|
+
* @param expression - Time expression (e.g., "start of last week", "next week")
|
|
164
|
+
* @param timezone - IANA timezone for interpreting local-time expressions
|
|
165
|
+
* @param options - Resolution options (week start day, etc.)
|
|
166
|
+
* @returns Resolved datetime in UTC and local time with interpretation
|
|
167
|
+
*/
|
|
168
|
+
export function resolveRelativeWithOptions(anchor, expression, timezone, options = {}) {
|
|
169
|
+
const json = wasm.resolveRelativeWithOptions(anchor, expression, timezone, JSON.stringify(options));
|
|
170
|
+
return JSON.parse(json);
|
|
171
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@temporal-cortex/truth-engine",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Truth Engine — deterministic temporal resolution, timezone conversion, RRULE expansion, conflict detection, and availability merging for AI calendar agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -393,6 +393,53 @@ function resolveRelative(anchor, expression, timezone) {
|
|
|
393
393
|
}
|
|
394
394
|
exports.resolveRelative = resolveRelative;
|
|
395
395
|
|
|
396
|
+
/**
|
|
397
|
+
* Resolve a relative time expression with configurable options.
|
|
398
|
+
*
|
|
399
|
+
* Same as `resolveRelative` but accepts an `options_json` parameter:
|
|
400
|
+
* `{"week_start": "monday"|"sunday"}`.
|
|
401
|
+
*
|
|
402
|
+
* Returns a JSON string with `{resolved_utc, resolved_local, timezone, interpretation}`.
|
|
403
|
+
* @param {string} anchor
|
|
404
|
+
* @param {string} expression
|
|
405
|
+
* @param {string} timezone
|
|
406
|
+
* @param {string} options_json
|
|
407
|
+
* @returns {string}
|
|
408
|
+
*/
|
|
409
|
+
function resolveRelativeWithOptions(anchor, expression, timezone, options_json) {
|
|
410
|
+
let deferred6_0;
|
|
411
|
+
let deferred6_1;
|
|
412
|
+
try {
|
|
413
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
414
|
+
const ptr0 = passStringToWasm0(anchor, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
415
|
+
const len0 = WASM_VECTOR_LEN;
|
|
416
|
+
const ptr1 = passStringToWasm0(expression, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
417
|
+
const len1 = WASM_VECTOR_LEN;
|
|
418
|
+
const ptr2 = passStringToWasm0(timezone, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
419
|
+
const len2 = WASM_VECTOR_LEN;
|
|
420
|
+
const ptr3 = passStringToWasm0(options_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
421
|
+
const len3 = WASM_VECTOR_LEN;
|
|
422
|
+
wasm.resolveRelativeWithOptions(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
423
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
424
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
425
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
426
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
427
|
+
var ptr5 = r0;
|
|
428
|
+
var len5 = r1;
|
|
429
|
+
if (r3) {
|
|
430
|
+
ptr5 = 0; len5 = 0;
|
|
431
|
+
throw takeObject(r2);
|
|
432
|
+
}
|
|
433
|
+
deferred6_0 = ptr5;
|
|
434
|
+
deferred6_1 = len5;
|
|
435
|
+
return getStringFromWasm0(ptr5, len5);
|
|
436
|
+
} finally {
|
|
437
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
438
|
+
wasm.__wbindgen_export3(deferred6_0, deferred6_1, 1);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
exports.resolveRelativeWithOptions = resolveRelativeWithOptions;
|
|
442
|
+
|
|
396
443
|
function __wbg_get_imports() {
|
|
397
444
|
const import0 = {
|
|
398
445
|
__proto__: null,
|
|
@@ -89,3 +89,13 @@ export function mergeAvailability(streams_json: string, window_start: string, wi
|
|
|
89
89
|
* Returns a JSON string with `{resolved_utc, resolved_local, timezone, interpretation}`.
|
|
90
90
|
*/
|
|
91
91
|
export function resolveRelative(anchor: string, expression: string, timezone: string): string;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Resolve a relative time expression with configurable options.
|
|
95
|
+
*
|
|
96
|
+
* Same as `resolveRelative` but accepts an `options_json` parameter:
|
|
97
|
+
* `{"week_start": "monday"|"sunday"}`.
|
|
98
|
+
*
|
|
99
|
+
* Returns a JSON string with `{resolved_utc, resolved_local, timezone, interpretation}`.
|
|
100
|
+
*/
|
|
101
|
+
export function resolveRelativeWithOptions(anchor: string, expression: string, timezone: string, options_json: string): string;
|
|
Binary file
|
|
@@ -10,6 +10,7 @@ export const findFirstFreeAcross: (a: number, b: number, c: number, d: number, e
|
|
|
10
10
|
export const findFreeSlots: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
11
11
|
export const mergeAvailability: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
12
12
|
export const resolveRelative: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
13
|
+
export const resolveRelativeWithOptions: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
13
14
|
export const __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
14
15
|
export const __wbindgen_export: (a: number, b: number) => number;
|
|
15
16
|
export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|