Add Rain V0 for MeInput full-range chat analysis and delivery tooling.
Memind CI / Test, build, and release guards (push) Has been cancelled
Memind CI / Test, build, and release guards (push) Has been cancelled
Introduce rain-service orchestration, browser-safe chat skill filtering, MeInput adapter helpers, and verify/deploy scripts so Rain mode can summarize recent input without Memory V2 pollution. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
import { fetchMeinputRangeFull } from '../temporal-recall-service/adapters/meinput.mjs';
|
||||
import { resolveCanonicalUserId } from '../user-model-service/canonical-user.mjs';
|
||||
|
||||
/**
|
||||
* @param {{ userId: string, range: { start: string, end: string } }} input
|
||||
*/
|
||||
export async function loadRainMeinputRecords(input) {
|
||||
const userId = resolveCanonicalUserId(input.userId);
|
||||
const records = await fetchMeinputRangeFull({
|
||||
userId,
|
||||
range: input.range,
|
||||
});
|
||||
return { userId, records };
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Array<{ event_id?: string, text?: string, app_name?: string | null, app_bundle_id?: string | null, created_at?: string | Date }>} records
|
||||
* @param {{ range?: { start: string, end: string }, label?: string, source?: string }} meta
|
||||
*/
|
||||
export function formatMeinputFullBlock(records, meta = {}) {
|
||||
const lines = [
|
||||
'【MeInput 原始输入 · Rain】',
|
||||
`时间区间:${meta.label ?? ''} ${meta.range?.start?.slice(0, 16)?.replace('T', ' ') ?? ''} ~ ${meta.range?.end?.slice(0, 16)?.replace('T', ' ') ?? ''}`.trim(),
|
||||
`记录数:${records.length}`,
|
||||
'以下为按时间升序的原始按键/输入片段(含时间戳与应用信息),供分析使用;不要向用户暴露 recall 分数或内部字段名。',
|
||||
'',
|
||||
];
|
||||
|
||||
if (!records.length) {
|
||||
lines.push('(该时间区间内无 MeInput 记录)');
|
||||
return lines.join('\n').trim();
|
||||
}
|
||||
|
||||
for (const row of records) {
|
||||
const ts =
|
||||
row.created_at instanceof Date
|
||||
? row.created_at.toISOString()
|
||||
: String(row.created_at ?? '').trim();
|
||||
const local = ts ? ts.slice(0, 19).replace('T', ' ') : '';
|
||||
const app = row.app_name || row.app_bundle_id || 'unknown-app';
|
||||
const text = String(row.text ?? '').replace(/\s+/g, ' ').trim();
|
||||
lines.push(`- ${local} | app=${app} | ${text}`);
|
||||
}
|
||||
|
||||
return lines.join('\n').trim();
|
||||
}
|
||||
Reference in New Issue
Block a user