picocode-core 0.9.121 → 0.9.123

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.121",
3
+ "version": "0.9.123",
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]'
package/src/controller.js CHANGED
@@ -773,14 +773,16 @@ export function createController({ boot }) {
773
773
  let value
774
774
  if (!input) {
775
775
  value = values[(values.indexOf(state.derived.color) + 1) % values.length]
776
+ } else if (input.toLowerCase() === 'none') {
777
+ value = null
776
778
  } else {
777
779
  value = SESSION_COLORS[input.toLowerCase()] || (/^#[0-9a-fA-F]{6}$/.test(input) ? input : null)
778
- if (!value) return flash(`usage: /color to cycle, or /color <${names.join('|')}|#hex>`)
780
+ if (!value) return flash(`usage: /color to cycle, /color none to clear, or /color <${names.join('|')}|#hex>`)
779
781
  }
780
782
  persist(makeEvent('color', { value }))
781
783
  ensureSession()
782
784
  reDerive()
783
- flash(`session color: ${names[values.indexOf(value)] || value}`)
785
+ flash(value ? `session color: ${names[values.indexOf(value)] || value}` : 'session color cleared')
784
786
  }
785
787
 
786
788
  function clear() {