picocode-core 0.9.122 → 0.9.124

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.122",
3
+ "version": "0.9.124",
4
4
  "description": "The agent runtime behind pico: sessions, tools, subagents, MCP, memory, and model access",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/agent.js CHANGED
@@ -1,13 +1,16 @@
1
1
  import { readFile } from 'node:fs/promises'
2
2
  import { compose, scope, model, noToolsCalled, Inherit, getText } from '@prsm/ai'
3
+ import { mediaTypeFor } from './attachments.js'
3
4
 
4
5
  async function hydratePart(part) {
5
6
  if (part.type !== 'image' || part.source?.kind !== 'path') return part
7
+ const mediaType = part.source.mediaType || mediaTypeFor(part.source.path)
8
+ if (!mediaType) return { type: 'text', text: `[image unavailable: ${part.source.path}]` }
6
9
  try {
7
10
  const data = await readFile(part.source.path)
8
11
  return {
9
12
  type: 'image',
10
- source: { kind: 'base64', mediaType: part.source.mediaType, data: data.toString('base64') },
13
+ source: { kind: 'base64', mediaType, data: data.toString('base64') },
11
14
  }
12
15
  } catch {
13
16
  return { type: 'text', text: `[image unavailable: ${part.source.path}]` }
@@ -99,7 +99,7 @@ export function placeholderizeImagePaths(text, { attachments, nextId, exists = e
99
99
  out += part.text
100
100
  } else {
101
101
  const placeholder = `[Image #${nextId()}]`
102
- attachments.set(placeholder, { path: part.source.path, mediaType: part.source.mediaType })
102
+ attachments.set(placeholder, { path: part.source.path, mediaType: part.source.mediaType || mediaTypeFor(part.source.path) })
103
103
  out += placeholder
104
104
  }
105
105
  }
@@ -114,7 +114,7 @@ export function inputTextFromContent(content, { attachments, nextId }) {
114
114
  out += part.text
115
115
  } else if (part.type === 'image' && part.source?.path) {
116
116
  const placeholder = `[Image #${nextId()}]`
117
- attachments.set(placeholder, { path: part.source.path, mediaType: part.source.mediaType })
117
+ attachments.set(placeholder, { path: part.source.path, mediaType: part.source.mediaType || mediaTypeFor(part.source.path) })
118
118
  out += placeholder
119
119
  } else {
120
120
  out += '[image]'
@@ -24,6 +24,7 @@ export function createRecorder(onChange) {
24
24
  this.pending = {
25
25
  callId: this.currentCall?.id ?? null,
26
26
  name,
27
+ args,
27
28
  title: defaultTitle(name, args),
28
29
  description: args.description,
29
30
  status: 'done',