@farazirfan/costar-server-executor 1.7.13 → 1.7.14

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.
Files changed (62) hide show
  1. package/dist/agent/pi-embedded-runner/system-prompt.d.ts.map +1 -1
  2. package/dist/agent/pi-embedded-runner/system-prompt.js +33 -1
  3. package/dist/agent/pi-embedded-runner/system-prompt.js.map +1 -1
  4. package/dist/agent/pi-embedded-runner/tools.d.ts.map +1 -1
  5. package/dist/agent/pi-embedded-runner/tools.js +5 -8
  6. package/dist/agent/pi-embedded-runner/tools.js.map +1 -1
  7. package/dist/config/types.d.ts +0 -2
  8. package/dist/config/types.d.ts.map +1 -1
  9. package/dist/heartbeat/runner.d.ts +21 -0
  10. package/dist/heartbeat/runner.d.ts.map +1 -1
  11. package/dist/heartbeat/runner.js +141 -24
  12. package/dist/heartbeat/runner.js.map +1 -1
  13. package/dist/memory/curation-state.d.ts +2 -16
  14. package/dist/memory/curation-state.d.ts.map +1 -1
  15. package/dist/memory/curation-state.js +0 -18
  16. package/dist/memory/curation-state.js.map +1 -1
  17. package/dist/memory/curator.d.ts +9 -13
  18. package/dist/memory/curator.d.ts.map +1 -1
  19. package/dist/memory/curator.js +32 -79
  20. package/dist/memory/curator.js.map +1 -1
  21. package/dist/memory/index.d.ts +2 -3
  22. package/dist/memory/index.d.ts.map +1 -1
  23. package/dist/memory/index.js +2 -4
  24. package/dist/memory/index.js.map +1 -1
  25. package/dist/supabase/activity.d.ts +102 -0
  26. package/dist/supabase/activity.d.ts.map +1 -0
  27. package/dist/supabase/activity.js +312 -0
  28. package/dist/supabase/activity.js.map +1 -0
  29. package/dist/supabase/index.d.ts +3 -3
  30. package/dist/supabase/index.d.ts.map +1 -1
  31. package/dist/supabase/index.js +4 -2
  32. package/dist/supabase/index.js.map +1 -1
  33. package/dist/supabase/types.d.ts +5 -2
  34. package/dist/supabase/types.d.ts.map +1 -1
  35. package/dist/supabase/workspace-storage.d.ts +0 -24
  36. package/dist/supabase/workspace-storage.d.ts.map +1 -1
  37. package/dist/supabase/workspace-storage.js +4 -86
  38. package/dist/supabase/workspace-storage.js.map +1 -1
  39. package/dist/tools/complete-turn.d.ts +26 -0
  40. package/dist/tools/complete-turn.d.ts.map +1 -0
  41. package/dist/tools/complete-turn.js +60 -0
  42. package/dist/tools/complete-turn.js.map +1 -0
  43. package/dist/tools/index.d.ts +4 -3
  44. package/dist/tools/index.d.ts.map +1 -1
  45. package/dist/tools/index.js +8 -4
  46. package/dist/tools/index.js.map +1 -1
  47. package/dist/tools/memory.d.ts +2 -2
  48. package/dist/tools/memory.js +10 -10
  49. package/dist/tools/memory.js.map +1 -1
  50. package/dist/workspace/index.d.ts +2 -2
  51. package/dist/workspace/index.d.ts.map +1 -1
  52. package/dist/workspace/index.js +2 -2
  53. package/dist/workspace/index.js.map +1 -1
  54. package/dist/workspace/templates.d.ts +3 -2
  55. package/dist/workspace/templates.d.ts.map +1 -1
  56. package/dist/workspace/templates.js +27 -14
  57. package/dist/workspace/templates.js.map +1 -1
  58. package/dist/workspace/workspace.d.ts +2 -1
  59. package/dist/workspace/workspace.d.ts.map +1 -1
  60. package/dist/workspace/workspace.js +5 -1
  61. package/dist/workspace/workspace.js.map +1 -1
  62. package/package.json +1 -1
@@ -15,9 +15,6 @@ const CURATION_STATE_FILE = ".curation_state.json";
15
15
  const DEFAULT_STATE = {
16
16
  lastProcessedRequestId: null,
17
17
  lastProcessedRequestAt: null,
18
- lastProcessedLogDate: null,
19
- lastProcessedLogSize: 0,
20
- lastPrunedAt: null,
21
18
  totalEntriesCurated: 0,
22
19
  };
23
20
  /**
@@ -64,19 +61,4 @@ export function saveCurationState(workspaceDir, state) {
64
61
  console.error(`[MEMORY] Failed to save curation state:`, err);
65
62
  }
66
63
  }
67
- /**
68
- * Check if daily log pruning should run.
69
- * Returns true if lastPrunedAt is null or more than 24 hours ago.
70
- *
71
- * @param state - Current curation state
72
- * @returns true if pruning should run
73
- */
74
- export function shouldPrune(state) {
75
- if (!state.lastPrunedAt)
76
- return true;
77
- const lastPruned = new Date(state.lastPrunedAt).getTime();
78
- const now = Date.now();
79
- const twentyFourHours = 24 * 60 * 60 * 1000;
80
- return now - lastPruned >= twentyFourHours;
81
- }
82
64
  //# sourceMappingURL=curation-state.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"curation-state.js","sourceRoot":"","sources":["../../src/memory/curation-state.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,mCAAmC;AACnC,MAAM,mBAAmB,GAAG,sBAAsB,CAAC;AAqBnD;;GAEG;AACH,MAAM,aAAa,GAAkB;IACnC,sBAAsB,EAAE,IAAI;IAC5B,sBAAsB,EAAE,IAAI;IAC5B,oBAAoB,EAAE,IAAI;IAC1B,oBAAoB,EAAE,CAAC;IACvB,YAAY,EAAE,IAAI;IAClB,mBAAmB,EAAE,CAAC;CACvB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,YAAoB;IACpD,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,mBAAmB,CAAC,CAAC;IAE9D,IAAI,CAAC;QACH,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC7B,OAAO,EAAE,GAAG,aAAa,EAAE,CAAC;QAC9B,CAAC;QAED,MAAM,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC/C,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAE/B,iDAAiD;QACjD,OAAO;YACL,GAAG,aAAa;YAChB,GAAG,MAAM;SACV,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,IAAI,CAAC,yDAAyD,EAAE,GAAG,CAAC,CA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C,CAAC;IAChE,CAAC;AACH,CAAC"}
@@ -2,11 +2,11 @@
2
2
  * CoStar Server Executor - Memory Curator
3
3
  *
4
4
  * Incremental, cursor-based memory curation.
5
- * Fetches only new/unprocessed data (client conversations + daily logs),
5
+ * Fetches only new/unprocessed client conversations from agent_activity,
6
6
  * builds a compact digest, and produces a curation prompt to append to heartbeats.
7
7
  *
8
- * The LLM then processes the digest and updates MEMORY.md, USER.md,
9
- * and the daily log in a single heartbeat turn.
8
+ * The LLM then processes the digest and updates MEMORY.md and USER.md
9
+ * in a single heartbeat turn.
10
10
  */
11
11
  import type { CurationState } from "./curation-state.js";
12
12
  /**
@@ -24,26 +24,22 @@ export type ConversationEntry = {
24
24
  export type CurationDelta = {
25
25
  /** New client conversations since last cursor */
26
26
  newConversations: ConversationEntry[];
27
- /** New content appended to daily logs since last offset */
28
- newLogContent: string;
29
27
  /** Whether there is any new data to process */
30
28
  hasNewData: boolean;
31
29
  };
32
30
  /**
33
31
  * Fetch unprocessed data since the last curation cursors.
34
32
  *
35
- * 1. Queries user_requests after lastProcessedRequestAt (new client conversations)
36
- * 2. Reads today's daily log from lastProcessedLogSize offset (new LLM-written entries)
37
- * Also checks yesterday if lastProcessedLogDate != today (handles midnight rollover)
38
- * 3. Returns only the delta — if both empty, hasNewData = false
33
+ * Queries agent_activity after lastProcessedRequestAt (new client conversations).
34
+ * Returns only the delta if empty, hasNewData = false.
39
35
  *
40
36
  * @param userId - User ID for querying conversations
41
- * @param workspaceDir - Workspace root for reading daily logs
37
+ * @param _workspaceDir - Workspace root (unused, kept for API compatibility)
42
38
  * @param state - Current curation state (cursors)
43
39
  * @param maxConversations - Max conversations to fetch per curation cycle
44
40
  * @returns The delta of new data
45
41
  */
46
- export declare function fetchUnprocessedData(userId: string, workspaceDir: string, state: CurationState, maxConversations?: number): Promise<CurationDelta>;
42
+ export declare function fetchUnprocessedData(userId: string, _workspaceDir: string, state: CurationState, maxConversations?: number): Promise<CurationDelta>;
47
43
  /**
48
44
  * Build a compact markdown digest from the curation delta.
49
45
  * Caps total content at maxChars to keep the heartbeat prompt small.
@@ -66,8 +62,8 @@ export declare function buildCurationPrompt(digest: string): string;
66
62
  *
67
63
  * @param state - Previous curation state
68
64
  * @param delta - The delta that was just processed
69
- * @param workspaceDir - Workspace root for reading current log size
65
+ * @param _workspaceDir - Workspace root (unused, kept for API compatibility)
70
66
  * @returns New curation state with updated cursors
71
67
  */
72
- export declare function updatedCursors(state: CurationState, delta: CurationDelta, workspaceDir: string): CurationState;
68
+ export declare function updatedCursors(state: CurationState, delta: CurationDelta, _workspaceDir: string): CurationState;
73
69
  //# sourceMappingURL=curator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"curator.d.ts","sourceRoot":"","sources":["../../src/memory/curator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,iDAAiD;IACjD,gBAAgB,EAAE,iBAAiB,EAAE,CAAC;IACtC,2DAA2D;IAC3D,aAAa,EAAE,MAAM,CAAC;IACtB,+CAA+C;IAC/C,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,aAAa,EACpB,gBAAgB,GAAE,MAAW,GAC5B,OAAO,CAAC,aAAa,CAAC,CA6DxB;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,aAAa,EACpB,QAAQ,GAAE,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a,CAcf"}
@@ -2,33 +2,30 @@
2
2
  * CoStar Server Executor - Memory Curator
3
3
  *
4
4
  * Incremental, cursor-based memory curation.
5
- * Fetches only new/unprocessed data (client conversations + daily logs),
5
+ * Fetches only new/unprocessed client conversations from agent_activity,
6
6
  * builds a compact digest, and produces a curation prompt to append to heartbeats.
7
7
  *
8
- * The LLM then processes the digest and updates MEMORY.md, USER.md,
9
- * and the daily log in a single heartbeat turn.
8
+ * The LLM then processes the digest and updates MEMORY.md and USER.md
9
+ * in a single heartbeat turn.
10
10
  */
11
- import { getNewUserRequestsSince } from "../supabase/requests.js";
12
- import { readDailyLogSince, todayDateString } from "./daily-log.js";
11
+ import { getNewClientActivitySince } from "../supabase/activity.js";
13
12
  /**
14
13
  * Fetch unprocessed data since the last curation cursors.
15
14
  *
16
- * 1. Queries user_requests after lastProcessedRequestAt (new client conversations)
17
- * 2. Reads today's daily log from lastProcessedLogSize offset (new LLM-written entries)
18
- * Also checks yesterday if lastProcessedLogDate != today (handles midnight rollover)
19
- * 3. Returns only the delta — if both empty, hasNewData = false
15
+ * Queries agent_activity after lastProcessedRequestAt (new client conversations).
16
+ * Returns only the delta if empty, hasNewData = false.
20
17
  *
21
18
  * @param userId - User ID for querying conversations
22
- * @param workspaceDir - Workspace root for reading daily logs
19
+ * @param _workspaceDir - Workspace root (unused, kept for API compatibility)
23
20
  * @param state - Current curation state (cursors)
24
21
  * @param maxConversations - Max conversations to fetch per curation cycle
25
22
  * @returns The delta of new data
26
23
  */
27
- export async function fetchUnprocessedData(userId, workspaceDir, state, maxConversations = 20) {
28
- // 1. Fetch new client conversations from user_requests
24
+ export async function fetchUnprocessedData(userId, _workspaceDir, state, maxConversations = 20) {
25
+ // Fetch new client conversations from agent_activity
29
26
  const newConversations = [];
30
27
  try {
31
- const rows = await getNewUserRequestsSince(userId, state.lastProcessedRequestAt, maxConversations);
28
+ const rows = await getNewClientActivitySince(userId, state.lastProcessedRequestAt, maxConversations);
32
29
  for (const row of rows) {
33
30
  newConversations.push({
34
31
  id: row.id,
@@ -39,41 +36,11 @@ export async function fetchUnprocessedData(userId, workspaceDir, state, maxConve
39
36
  }
40
37
  }
41
38
  catch (err) {
42
- console.warn("[MEMORY] Failed to fetch new user requests:", err);
39
+ console.warn("[MEMORY] Failed to fetch new client activity:", err);
43
40
  }
44
- // 2. Read new daily log content
45
- let newLogContent = "";
46
- const today = todayDateString();
47
- try {
48
- // If the last processed log was from a previous day, read yesterday's remaining content
49
- if (state.lastProcessedLogDate && state.lastProcessedLogDate !== today) {
50
- const yesterdayResult = readDailyLogSince(workspaceDir, state.lastProcessedLogDate, state.lastProcessedLogSize);
51
- if (yesterdayResult.content) {
52
- newLogContent += yesterdayResult.content;
53
- }
54
- // For today's log, start from 0 since we haven't read it yet
55
- const todayResult = readDailyLogSince(workspaceDir, today, 0);
56
- if (todayResult.content) {
57
- newLogContent += (newLogContent ? "\n\n" : "") + todayResult.content;
58
- }
59
- }
60
- else {
61
- // Same day or first run — read from last offset
62
- const offset = state.lastProcessedLogDate === today ? state.lastProcessedLogSize : 0;
63
- const result = readDailyLogSince(workspaceDir, today, offset);
64
- if (result.content) {
65
- newLogContent = result.content;
66
- }
67
- }
68
- }
69
- catch (err) {
70
- console.warn("[MEMORY] Failed to read daily log:", err);
71
- }
72
- const hasNewData = newConversations.length > 0 || newLogContent.length > 0;
73
41
  return {
74
42
  newConversations,
75
- newLogContent: newLogContent.trim(),
76
- hasNewData,
43
+ hasNewData: newConversations.length > 0,
77
44
  };
78
45
  }
79
46
  /**
@@ -98,11 +65,6 @@ export function buildCurationDigest(delta, maxChars = 3000) {
98
65
  parts.push("");
99
66
  }
100
67
  }
101
- // Format new daily log content
102
- if (delta.newLogContent) {
103
- parts.push("### Server Activity (new daily log entries)");
104
- parts.push(delta.newLogContent);
105
- }
106
68
  let digest = parts.join("\n");
107
69
  // Trim if over budget
108
70
  if (digest.length > maxChars) {
@@ -124,35 +86,34 @@ MEMORY CURATION + PROACTIVE SIGNALS: New activity since your last check is below
124
86
  MEMORY CURATION — review and update:
125
87
  1. Update MEMORY.md with new facts, preferences, decisions, or lessons worth keeping.
126
88
  2. Update USER.md if you learned something new about the user.
127
- 3. Write today's notes to memory/${todayDateString()}.md (create memory/ dir if needed).
128
- 4. Do NOT duplicate what's already in MEMORY.md or USER.md.
129
- 5. Keep MEMORY.md concise it is loaded in every session's system prompt.
130
- 6. Remove outdated entries from MEMORY.md if no longer relevant.
131
- 7. Conversations below are from the user's mobile app — treat as context, don't re-execute.
89
+ 3. Do NOT duplicate what's already in MEMORY.md or USER.md.
90
+ 4. Keep MEMORY.md concise it is loaded in every session's system prompt.
91
+ 5. Remove outdated entries from MEMORY.md if no longer relevant.
92
+ 6. Conversations below are from the user's mobile app — treat as context, don't re-execute.
132
93
 
133
94
  PROACTIVE ACTION — analyze the activity below and cross-reference with what you know from MEMORY.md and USER.md. Think about what a thoughtful human assistant would do — not just monitoring, but real, substantive help:
134
95
 
135
96
  TAKE ACTION NOW (during this heartbeat turn) when you spot opportunities to:
136
- 8. Do research the user would find valuable (competitor analysis, market trends, topic deep-dives)
137
- 9. Create useful documents (meeting prep notes, trip itineraries, project summaries, comparison tables)
138
- 10. Prepare for upcoming events (gather context for tomorrow's meeting, draft agendas, check travel details)
139
- 11. Follow up on things the user started but didn't finish (drafts, half-explored ideas, pending decisions)
140
- 12. Find information the user will need soon (based on their calendar, projects, or recent conversations)
97
+ 7. Do research the user would find valuable (competitor analysis, market trends, topic deep-dives)
98
+ 8. Create useful documents (meeting prep notes, trip itineraries, project summaries, comparison tables)
99
+ 9. Prepare for upcoming events (gather context for tomorrow's meeting, draft agendas, check travel details)
100
+ 10. Follow up on things the user started but didn't finish (drafts, half-explored ideas, pending decisions)
101
+ 11. Find information the user will need soon (based on their calendar, projects, or recent conversations)
141
102
  Save substantial outputs to /home/user/task/ (auto-synced to user's device) and notify via message tool.
142
103
 
143
104
  UPDATE HEARTBEAT.md for ongoing monitoring when you detect:
144
- 13. Recurring interests worth periodic checking (stocks, products, topics, people)
145
- 14. Things the user is waiting on (replies, deliveries, results, approvals)
146
- 15. Deadlines or events that need tracking over time
147
- 16. Behavioral patterns worth supporting (daily routines, recurring needs)
105
+ 12. Recurring interests worth periodic checking (stocks, products, topics, people)
106
+ 13. Things the user is waiting on (replies, deliveries, results, approvals)
107
+ 14. Deadlines or events that need tracking over time
108
+ 15. Behavioral patterns worth supporting (daily routines, recurring needs)
148
109
  Read HEARTBEAT.md first, then add: "- [ ] Check X — alert user if Y"
149
110
 
150
111
  HEARTBEAT.md RULES:
151
- 17. Do NOT add items already in HEARTBEAT.md — check before adding.
152
- 18. Remove stale or resolved items (event passed, task done, user said stop).
153
- 19. PRESERVE items the user added via the app — never remove user-requested monitoring.
154
- 20. Keep under 10 items — each costs tokens every 30 minutes.
155
- 21. If nothing warrants action or monitoring, that's fine. Don't force it.
112
+ 16. Do NOT add items already in HEARTBEAT.md — check before adding.
113
+ 17. Remove stale or resolved items (event passed, task done, user said stop).
114
+ 18. PRESERVE items the user added via the app — never remove user-requested monitoring.
115
+ 19. Keep under 10 items — each costs tokens every 30 minutes.
116
+ 20. If nothing warrants action or monitoring, that's fine. Don't force it.
156
117
 
157
118
  ## New Since Last Check
158
119
  ${digest}
@@ -163,11 +124,10 @@ ${digest}
163
124
  *
164
125
  * @param state - Previous curation state
165
126
  * @param delta - The delta that was just processed
166
- * @param workspaceDir - Workspace root for reading current log size
127
+ * @param _workspaceDir - Workspace root (unused, kept for API compatibility)
167
128
  * @returns New curation state with updated cursors
168
129
  */
169
- export function updatedCursors(state, delta, workspaceDir) {
170
- const today = todayDateString();
130
+ export function updatedCursors(state, delta, _workspaceDir) {
171
131
  const newState = { ...state };
172
132
  // Update conversation cursor to the last processed request
173
133
  if (delta.newConversations.length > 0) {
@@ -175,15 +135,8 @@ export function updatedCursors(state, delta, workspaceDir) {
175
135
  newState.lastProcessedRequestId = lastConv.id;
176
136
  newState.lastProcessedRequestAt = lastConv.createdAt;
177
137
  }
178
- // Update daily log cursor to today's current file size
179
- const todayLogResult = readDailyLogSince(workspaceDir, today, 0);
180
- newState.lastProcessedLogDate = today;
181
- newState.lastProcessedLogSize = todayLogResult.newSize;
182
138
  // Increment total entries curated
183
139
  newState.totalEntriesCurated += delta.newConversations.length;
184
- if (delta.newLogContent.length > 0) {
185
- newState.totalEntriesCurated += 1; // Count new log content as one entry
186
- }
187
140
  return newState;
188
141
  }
189
142
  // ---------- Helpers ----------
@@ -1 +1 @@
1
- {"version":3,"file":"curator.js","sourceRoot":"","sources":["../../src/memory/curator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAyBpE;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,MAAc,EACd,YAAoB,EACpB,KAAoB,EACpB,mBAA2B,EAAE;IAE7B,uDAAuD;IACvD,MAAM,gBAAgB,GAAwB,EAAE,CAAC;IACjD,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,uBAAuB,CACxC,MAAM,EACN,KAAK,CAAC,sBAAsB,EAC5B,gBAAgB,CACjB,CAAC;QAEF,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;YACvB,gBAAgB,CAAC,IAAI,CAAC;gBACpB,EAAE,EAAE,GAAG,CAAC,EAAE;gBACV,OAAO,EAAE,GAAG,CAAC,OAAO;gBACpB,QAAQ,EAAE,GAAG,CAAC,QAAQ,IAAI,IAAI;gBAC9B,SAAS,EAAE,GAAG,CAAC,UAAU;aAC1B,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,IAAI,CAAC,6CAA6C,EAAE,GAAG,CAAC,CAAC;IACnE,CAAC;IAED,gCAAgC;IAChC,IAAI,aAAa,GAAG,EAAE,CAAC;IACv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C;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAc;IAChD,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoCP,MAAM;CACP,CAAC,IAAI,EAAE,CAAC;AACT,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAC5B,KAAoB,EACpB,KAAoB,EACpB,aAAqB;IAErB,MAAM,QAAQ,GAAG,EAAE,GAAG,KAAK,EAAE,CAAC;IAE9B,2DAA2D;IAC3D,IAAI,KAAK,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtC,MAAM,QAAQ,GAAG,KAAK,CAAC,gBAAgB,CAAC,KAAK,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC3E,QAAQ,CAAC,sBAAsB,GAAG,QAAQ,CAAC,EAAE,CAAC;QAC9C,QAAQ,CAAC,sBAAsB,GAAG,QAAQ,CAAC,SAAS,CAAC;IACvD,CAAC;IAED,kCAAkC;IAClC,QAAQ,CAAC,mBAAmB,IAAI,KAAK,CAAC,gBAAgB,CAAC,MAAM,CAAC;IAE9D,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,gCAAgC;AAEhC;;GAEG;AACH,SAAS,QAAQ,CAAC,IAAY,EAAE,MAAc;IAC5C,IAAI,IAAI,CAAC,MAAM,IAAI,MAAM;QAAE,OAAO,IAAI,CAAC;IACvC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC;AAC3C,CAAC"}
@@ -2,9 +2,8 @@
2
2
  * CoStar Server Executor - Memory Module
3
3
  *
4
4
  * Incremental, cursor-based memory curation system.
5
- * LLM-written daily logs + automatic curation into MEMORY.md and USER.md.
5
+ * Fetches client conversations from agent_activity, curates into MEMORY.md and USER.md.
6
6
  */
7
- export { ensureMemoryDir, readDailyLogSince, listDailyLogFiles, pruneOldDailyLogs, pruneOldDailyLogsFromStorage, todayDateString, } from "./daily-log.js";
8
- export { loadCurationState, saveCurationState, shouldPrune, type CurationState, } from "./curation-state.js";
7
+ export { loadCurationState, saveCurationState, type CurationState, } from "./curation-state.js";
9
8
  export { fetchUnprocessedData, buildCurationDigest, buildCurationPrompt, updatedCursors, type CurationDelta, type ConversationEntry, } from "./curator.js";
10
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/memory/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,4BAA4B,EAC5B,eAAe,GAChB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,WAAW,EACX,KAAK,aAAa,GACnB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,EACd,KAAK,aAAa,EAClB,KAAK,iBAAiB,GACvB,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/memory/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,KAAK,aAAa,GACnB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,EACd,KAAK,aAAa,EAClB,KAAK,iBAAiB,GACvB,MAAM,cAAc,CAAC"}
@@ -2,12 +2,10 @@
2
2
  * CoStar Server Executor - Memory Module
3
3
  *
4
4
  * Incremental, cursor-based memory curation system.
5
- * LLM-written daily logs + automatic curation into MEMORY.md and USER.md.
5
+ * Fetches client conversations from agent_activity, curates into MEMORY.md and USER.md.
6
6
  */
7
- // Daily log utilities (read + prune only — LLM writes via tools)
8
- export { ensureMemoryDir, readDailyLogSince, listDailyLogFiles, pruneOldDailyLogs, pruneOldDailyLogsFromStorage, todayDateString, } from "./daily-log.js";
9
7
  // Curation state (cursor tracking)
10
- export { loadCurationState, saveCurationState, shouldPrune, } from "./curation-state.js";
8
+ export { loadCurationState, saveCurationState, } from "./curation-state.js";
11
9
  // Memory curator (fetch delta, build digest, build prompt)
12
10
  export { fetchUnprocessedData, buildCurationDigest, buildCurationPrompt, updatedCursors, } from "./curator.js";
13
11
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/memory/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,iEAAiE;AACjE,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,4BAA4B,EAC5B,eAAe,GAChB,MAAM,gBAAgB,CAAC;AAExB,mCAAmC;AACnC,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,WAAW,GAEZ,MAAM,qBAAqB,CAAC;AAE7B,2DAA2D;AAC3D,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,GAGf,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/memory/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,mCAAmC;AACnC,OAAO,EACL,iBAAiB,EACjB,iBAAiB,GAElB,MAAM,qBAAqB,CAAC;AAE7B,2DAA2D;AAC3D,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,GAGf,MAAM,cAAc,CAAC"}
@@ -0,0 +1,102 @@
1
+ /**
2
+ * CoStar Server Executor - Agent Activity Supabase Adapter
3
+ *
4
+ * Manages the agent_activity table (formerly user_requests).
5
+ * Both client and server executors write activity entries here.
6
+ */
7
+ import type { AgentActivity } from "./types.js";
8
+ /**
9
+ * Create a new agent activity entry
10
+ */
11
+ export declare function createAgentActivity(params: {
12
+ userId: string;
13
+ request: string;
14
+ executor: "client" | "server";
15
+ }): Promise<AgentActivity>;
16
+ /**
17
+ * Update agent activity with response and completion status
18
+ */
19
+ export declare function completeAgentActivity(params: {
20
+ activityId: string;
21
+ response: string;
22
+ request?: string;
23
+ toolCalls?: number;
24
+ duration?: number;
25
+ }): Promise<AgentActivity>;
26
+ /**
27
+ * Mark agent activity as failed
28
+ */
29
+ export declare function failAgentActivity(params: {
30
+ activityId: string;
31
+ error: string;
32
+ duration?: number;
33
+ }): Promise<AgentActivity>;
34
+ /**
35
+ * Get agent activity by ID
36
+ */
37
+ export declare function getAgentActivityById(activityId: string): Promise<AgentActivity | null>;
38
+ /**
39
+ * Get recent agent activity
40
+ */
41
+ export declare function getRecentAgentActivity(userId: string, limit?: number): Promise<AgentActivity[]>;
42
+ /**
43
+ * Get agent activity by status
44
+ */
45
+ export declare function getAgentActivityByStatus(userId: string, status: "pending" | "completed" | "failed", limit?: number): Promise<AgentActivity[]>;
46
+ /**
47
+ * Search agent activity using text search (for memory recall)
48
+ * This searches both request and response fields across both executors.
49
+ */
50
+ export declare function searchAgentActivity(params: {
51
+ userId: string;
52
+ query: string;
53
+ limit?: number;
54
+ daysBack?: number;
55
+ }): Promise<Array<{
56
+ id: string;
57
+ request: string;
58
+ response: string | null;
59
+ created_at: string;
60
+ score: number;
61
+ }>>;
62
+ /**
63
+ * Get new agent activity since a given cursor (timestamp + optional ID).
64
+ * Used by the memory curation system to fetch only unprocessed client conversations.
65
+ * Filters to client executor only to prevent server from curating its own actions.
66
+ *
67
+ * @param userId - User ID to filter by
68
+ * @param afterTimestamp - Only return entries created after this ISO timestamp (exclusive)
69
+ * @param limit - Max number of entries to return (default: 30)
70
+ * @returns Completed client activity ordered by created_at ASC (oldest first)
71
+ */
72
+ export declare function getNewClientActivitySince(userId: string, afterTimestamp?: string | null, limit?: number): Promise<AgentActivity[]>;
73
+ /**
74
+ * Get agent activity statistics
75
+ */
76
+ export declare function getAgentActivityStats(userId: string): Promise<{
77
+ total: number;
78
+ pending: number;
79
+ completed: number;
80
+ failed: number;
81
+ avgDuration?: number;
82
+ avgToolCalls?: number;
83
+ }>;
84
+ /** @deprecated Use createAgentActivity instead */
85
+ export declare const createUserRequest: typeof createAgentActivity;
86
+ /** @deprecated Use completeAgentActivity instead */
87
+ export declare const completeUserRequest: typeof completeAgentActivity;
88
+ /** @deprecated Use failAgentActivity instead */
89
+ export declare const failUserRequest: typeof failAgentActivity;
90
+ /** @deprecated Use getAgentActivityById instead */
91
+ export declare const getUserRequestById: typeof getAgentActivityById;
92
+ /** @deprecated Use getRecentAgentActivity instead */
93
+ export declare const getRecentUserRequests: typeof getRecentAgentActivity;
94
+ /** @deprecated Use getAgentActivityByStatus instead */
95
+ export declare const getUserRequestsByStatus: typeof getAgentActivityByStatus;
96
+ /** @deprecated Use searchAgentActivity instead */
97
+ export declare const searchUserRequests: typeof searchAgentActivity;
98
+ /** @deprecated Use getNewClientActivitySince instead */
99
+ export declare const getNewUserRequestsSince: typeof getNewClientActivitySince;
100
+ /** @deprecated Use getAgentActivityStats instead */
101
+ export declare const getUserRequestsStats: typeof getAgentActivityStats;
102
+ //# sourceMappingURL=activity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"activity.d.ts","sourceRoot":"","sources":["../../src/supabase/activity.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,MAAM,EAAE;IAChD,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,QAAQ,GAAG,QAAQ,CAAC;CAC/B,GAAG,OAAO,CAAC,aAAa,CAAC,CAsBzB;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,MAAM,EAAE;IAClD,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,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