picocode-core 0.9.136 → 0.9.137

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "picocode-core",
3
- "version": "0.9.136",
3
+ "version": "0.9.137",
4
4
  "description": "The agent runtime behind pico: sessions, tools, subagents, MCP, memory, and model access",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -33,25 +33,40 @@ function settleTool(tools, event) {
33
33
  item.fullOutput = event.result === undefined ? null : typeof event.result === 'string' ? event.result : JSON.stringify(event.result, null, 2)
34
34
  }
35
35
 
36
+ // a deliberation reads as turns: each turn owns the tool runs its
37
+ // participant made before speaking. every recorded event carries the
38
+ // speaker's role and round, so a turn opens on its first tool call and
39
+ // closes when its text arrives; a turn with tools and no text is running
36
40
  function deliberationTranscript(agent) {
37
41
  const items = [{ kind: 'user', text: agent.prompt }]
38
42
  const tools = new Map()
43
+ const turns = new Map()
44
+ const turnFor = (role, round) => {
45
+ const key = `${role}:${round}`
46
+ if (!turns.has(key)) {
47
+ const turn = { kind: 'deliberation-turn', role, round, text: null, tools: [], active: agent.status === 'running' }
48
+ turns.set(key, turn)
49
+ items.push(turn)
50
+ }
51
+ return turns.get(key)
52
+ }
39
53
  for (const entry of agent.timeline) {
40
54
  if (entry.kind === 'turn') {
41
- const turn = entry.value
42
- items.push({ kind: 'deliberation-turn', role: turn.role, round: turn.round, text: turn.text })
55
+ const turn = turnFor(entry.value.role, entry.value.round)
56
+ turn.text = entry.value.text
57
+ turn.active = false
43
58
  continue
44
59
  }
45
60
  const event = entry.value
46
61
  if (event.type === 'tool_executing') {
47
62
  const item = toolItem(event.call || {}, event.at)
48
63
  tools.set(item.callId, item)
49
- items.push(item)
64
+ turnFor(event.role, event.round).tools.push(item)
50
65
  }
51
66
  if (event.type === 'tool_complete' || event.type === 'tool_error') settleTool(tools, event)
52
67
  }
53
68
  if (agent.result) {
54
- items.push({ kind: 'deliberation-turn', role: 'synthesis', text: agent.result, interrupted: agent.status === 'cancelled' })
69
+ items.push({ kind: 'deliberation-turn', role: 'synthesis', text: agent.result, tools: [], interrupted: agent.status === 'cancelled' })
55
70
  } else if (agent.error) {
56
71
  items.push({ kind: 'assistant', text: agent.error, interrupted: true })
57
72
  }