picocode-core 0.9.136 → 0.9.138

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.138",
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
  }
@@ -11,8 +11,13 @@ export function validateDeliberation({ brief, rounds = DEFAULT_DELIBERATION_ROUN
11
11
  return { brief: brief.trim(), rounds }
12
12
  }
13
13
 
14
+ const ROLE_BRIEFS = {
15
+ proposer: 'You are the proposer: take a position on the decision and argue for it with evidence, laying out the reasoning and the tradeoffs you accept.',
16
+ reviewer: 'You are the reviewer: scrutinize the proposal, test its evidence and premises, and put forward the strongest alternative where one exists.',
17
+ }
18
+
14
19
  function participantPrompt(brief, role, rounds) {
15
- return `You are the ${role} in a ${rounds}-round deliberation about the following decision:\n\n${brief}\n\nResearch before making claims. Use the available project and web tools whenever they can replace assumption with evidence. Cite URLs and project paths in your response. Challenge weak premises and address the peer's strongest points. Do not seek agreement for its own sake or defend a fixed position. Change your position only when evidence warrants it, and preserve material disagreement and uncertainty. Do not modify project files. Return a concise message addressed to the other participant.`
20
+ return `${ROLE_BRIEFS[role]} This is a ${rounds}-round deliberation about the following decision:\n\n${brief}\n\nResearch before making claims. Use the available project and web tools whenever they can replace assumption with evidence. Cite URLs and project paths in your response. Challenge weak premises and address the peer's strongest points. Do not seek agreement for its own sake or defend a fixed position. Change your position only when evidence warrants it, and preserve material disagreement and uncertainty. Do not modify project files. Write your own argument and reasoning; never instruct the other participant what to say or conclude. Be concise.`
16
21
  }
17
22
 
18
23
  function peerMessage(role, text, round, rounds) {