@niracler/encore 0.2.0 → 0.4.0

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/src/workbuddy.mjs CHANGED
@@ -10,10 +10,10 @@ import {
10
10
  } from './common.mjs'
11
11
 
12
12
  // WorkBuddy sessions: ~/.workbuddy/projects/<workspace>/<id>.jsonl, records in OpenAI Responses shape.
13
- export function workBuddyUserText(content) {
13
+ export function workBuddyUserText(content, references) {
14
14
  const text = textOf(content)
15
15
  const queries = [...text.matchAll(/<user_query>([\s\S]*?)<\/user_query>/g)].map(match => match[1].trim())
16
- return mentions(queries.length ? queries.join('\n\n') : stripInjected(text))
16
+ return mentions(queries.length ? queries.join('\n\n') : stripInjected(text), references)
17
17
  }
18
18
 
19
19
  export function readWorkBuddy(records) {
@@ -31,15 +31,16 @@ export function readWorkBuddy(records) {
31
31
  if (record.type === 'ai-title') {
32
32
  title = record.aiTitle
33
33
  } else if (record.type === 'message' && record.role === 'user') {
34
- transcript.user(workBuddyUserText(record.content), time, { images: imagesOf(record.content) })
34
+ const references = []
35
+ transcript.user(workBuddyUserText(record.content, references), time, { images: imagesOf(record.content), references, cwd: record.cwd })
35
36
  } else if (record.type === 'message' && record.role === 'assistant') {
36
- transcript.assistant(textOf(record.content), time)
37
+ transcript.assistant(textOf(record.content), time, { cwd: record.cwd })
37
38
  } else if (record.type === 'reasoning') {
38
39
  transcript.reasoning(textOf(record.rawContent?.length ? record.rawContent : record.content), time)
39
40
  } else if (record.type === 'function_call') {
40
41
  transcript.tool(record.callId, describeTool(record.name, parseArguments(record.arguments)), time)
41
42
  } else if (record.type === 'function_call_result') {
42
- transcript.result(record.callId, stripInjected(textOf(record.output)), time, imagesOf(record.output))
43
+ transcript.result(record.callId, stripInjected(textOf(record.output)), time, imagesOf(record.output), record.cwd)
43
44
  }
44
45
  }
45
46
  const tokens = [...usage.values()].reduce((sum, value) => sum + value, 0) || undefined