@@ -5,43 +5,25 @@ var __getProtoOf = Object.getPrototypeOf;
55var __defProp = Object.defineProperty;
66var __getOwnPropNames = Object.getOwnPropertyNames;
77var __hasOwnProp = Object.prototype.hasOwnProperty;
8- function __accessProp(key) {
9- return this[key];
10- }
11- var __toESMCache_node;
12- var __toESMCache_esm;
138var __toESM = (mod, isNodeMode, target) => {
14- var canCache = mod != null && typeof mod === "object";
15- if (canCache) {
16- var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
17- var cached = cache.get(mod);
18- if (cached)
19- return cached;
20- }
219 target = mod != null ? __create(__getProtoOf(mod)) : {};
2210 const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
2311 for (let key of __getOwnPropNames(mod))
2412 if (!__hasOwnProp.call(to, key))
2513 __defProp(to, key, {
26- get: __accessProp.bind(mod, key) ,
14+ get: () => mod[ key] ,
2715 enumerable: true
2816 });
29- if (canCache)
30- cache.set(mod, to);
3117 return to;
3218};
3319var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
34- var __returnValue = (v) => v;
35- function __exportSetter(name, newValue) {
36- this[name] = __returnValue.bind(null, newValue);
37- }
3820var __export = (target, all) => {
3921 for (var name in all)
4022 __defProp(target, name, {
4123 get: all[name],
4224 enumerable: true,
4325 configurable: true,
44- set: __exportSetter.bind(all, name)
26+ set: (newValue) => all[ name] = () => newValue
4527 });
4628};
4729var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
@@ -321,6 +303,18 @@ function setCachedUserContext(data) {
321303 cache.userContext = { data, fetchedAt: Date.now() };
322304 saveContextCache(cache);
323305}
306+ function getCachedClaudeContext() {
307+ const cache = loadContextCache();
308+ if (cache.claudeContext && Date.now() - cache.claudeContext.fetchedAt < getContextTTL()) {
309+ return cache.claudeContext.data;
310+ }
311+ return null;
312+ }
313+ function setCachedClaudeContext(data) {
314+ const cache = loadContextCache();
315+ cache.claudeContext = { data, fetchedAt: Date.now() };
316+ saveContextCache(cache);
317+ }
324318function isContextCacheStale() {
325319 const cache = loadContextCache();
326320 if (!cache.userContext)
@@ -17310,8 +17304,9 @@ async function handleSessionStart() {
1731017304 const fetchStart = Date.now();
1731117305 const dialecticLevel = config.reasoningLevel ?? "low";
1731217306 const contextLabel = observationMode === "unified" ? "userPeer.context()" : "aiPeer.context(target=user)";
17313- const [userContextResult] = await Promise.allSettled([
17314- observationMode === "unified" ? userPeer.context({ maxConclusions: 25, includeMostFrequent: true }) : aiPeer.context({ target: config.peerName, maxConclusions: 25, includeMostFrequent: true })
17307+ const [userContextResult, claudeContextResult] = await Promise.allSettled([
17308+ observationMode === "unified" ? userPeer.context({ maxConclusions: 25, includeMostFrequent: true }) : aiPeer.context({ target: config.peerName, maxConclusions: 25, includeMostFrequent: true }),
17309+ aiPeer.context({ target: config.aiPeer, maxConclusions: 10, includeMostFrequent: false })
1731517310 ]);
1731617311 if (observationMode === "unified") {
1731717312 userPeer.chat(`Summarize what you know about ${config.peerName}. Focus on preferences, current projects, and working style.${branchContext}${featureHint}`, { session, reasoningLevel: dialecticLevel }).catch((e) => logHook("session-start", `Dialectic (user) failed: ${e}`));
@@ -17322,10 +17317,11 @@ async function handleSessionStart() {
1732217317 }
1732317318 const fetchDuration = Date.now() - fetchStart;
1732417319 const asyncResults = [
17325- { name: contextLabel, success: userContextResult.status === "fulfilled" }
17320+ { name: contextLabel, success: userContextResult.status === "fulfilled" },
17321+ { name: "aiPeer.context(target=self)", success: claudeContextResult.status === "fulfilled" }
1732617322 ];
1732717323 const successCount = asyncResults.filter((r) => r.success).length;
17328- logAsync("context-fetch", `Context: ${successCount}/1 succeeded in ${fetchDuration}ms (dialectic fire-and-forget)`, asyncResults);
17324+ logAsync("context-fetch", `Context: ${successCount}/2 succeeded in ${fetchDuration}ms (dialectic fire-and-forget)`, asyncResults);
1732917325 if (userContextResult.status === "fulfilled" && userContextResult.value) {
1733017326 const ctx = userContextResult.value;
1733117327 verboseApiResult(`${contextLabel} \u2192 representation`, ctx.representation);
@@ -17339,6 +17335,14 @@ async function handleSessionStart() {
1733917335`).filter((l) => l.trim() && !l.startsWith("#")).length : 0;
1734017336 logCache("write", "userContext", `${count} conclusions`);
1734117337 }
17338+ if (claudeContextResult.status === "fulfilled" && claudeContextResult.value) {
17339+ const selfCtx = claudeContextResult.value;
17340+ setCachedClaudeContext(selfCtx);
17341+ const rep = selfCtx.representation;
17342+ const count = typeof rep === "string" ? rep.split(`
17343+ `).filter((l) => l.trim() && !l.startsWith("#")).length : 0;
17344+ logCache("write", "claudeContext", `${count} self-conclusions`);
17345+ }
1734217346 spinner.stop();
1734317347 logFlow("complete", `Cache warmed: ${successCount}/1 context + 2 dialectic (fire-and-forget)`);
1734417348 process.exit(0);
0 commit comments