picocode-core 0.9.158 → 0.9.160

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.158",
3
+ "version": "0.9.160",
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/controller.js CHANGED
@@ -205,7 +205,7 @@ export function createController({ boot }) {
205
205
  const requestedTools = agent.tools?.length ? agent.tools.filter((name) => WORKER_TOOLS.includes(name)) : WORKER_TOOLS
206
206
  const { tools, recorder } = createToolset({
207
207
  cwd: boot.cwd,
208
- env: { PICO_SCRATCHPAD: scratchpad },
208
+ env: { ...boot.env, PICO_SCRATCHPAD: scratchpad },
209
209
  // a private tracker seeded from the main one: a worker may read an
210
210
  // AGENTS.md the main agent has not seen, and consuming it from the
211
211
  // shared set would mean the main agent never receives it
@@ -279,7 +279,7 @@ export function createController({ boot }) {
279
279
  const scratchpad = ensureDir(agentScratchDir(boot.root, sessionId, `deliberation-${id}-${role}`))
280
280
  const toolset = createToolset({
281
281
  cwd: boot.cwd,
282
- env: { PICO_SCRATCHPAD: scratchpad },
282
+ env: { ...boot.env, PICO_SCRATCHPAD: scratchpad },
283
283
  tracker: createContextTracker({ stopDir: boot.startupContext.stopDir, loaded: new Set(boot.tracker.loaded) }),
284
284
  shells: boot.shells,
285
285
  sessionId,
@@ -361,8 +361,12 @@ export function createController({ boot }) {
361
361
  )
362
362
  })
363
363
 
364
- function noteSystem(text, { wake, agentId, sessionId = state.session?.id, sessionFile = state.session?.file } = {}) {
365
- pendingSystemNotes.push({ text, wake, agentId, sessionId, sessionFile })
364
+ // a note for a session that has not started yet waits for its first
365
+ // message; `ensure` starts the session now so the note is persisted and
366
+ // in view before the first turn, not after it
367
+ function noteSystem(text, { wake, agentId, ensure = false, sessionId = state.session?.id, sessionFile = state.session?.file } = {}) {
368
+ if (ensure && !state.session && !state.busy) ensureSession()
369
+ pendingSystemNotes.push({ text, wake, agentId, sessionId: sessionId ?? state.session?.id, sessionFile: sessionFile ?? state.session?.file })
366
370
  flushSystemNotes()
367
371
  }
368
372
 
@@ -605,6 +609,8 @@ export function createController({ boot }) {
605
609
  const freshSkills = boot.skills
606
610
  const { tools, recorder } = createToolset({
607
611
  cwd: boot.cwd,
612
+ env: boot.env,
613
+ hostTools: boot.hostTools ?? [],
608
614
  tracker,
609
615
  skills: freshSkills,
610
616
  shells: boot.shells,
@@ -1190,6 +1196,8 @@ export function createController({ boot }) {
1190
1196
  function baseToolset(extra = {}) {
1191
1197
  return createToolset({
1192
1198
  cwd: boot.cwd,
1199
+ env: boot.env,
1200
+ hostTools: boot.hostTools ?? [],
1193
1201
  tracker: boot.tracker,
1194
1202
  skills: boot.skills,
1195
1203
  shells: boot.shells,
package/src/shells.js CHANGED
@@ -22,6 +22,7 @@ export function createShellManager({ onChange = () => {}, onExit = () => {} } =
22
22
  id: shell.id,
23
23
  command: shell.command,
24
24
  description: shell.description,
25
+ pid: shell.child?.pid ?? null,
25
26
  sessionId: shell.sessionId,
26
27
  sessionFile: shell.sessionFile,
27
28
  cwd: shell.cwd,
@@ -8,7 +8,7 @@ import { createGrep } from './grep.js'
8
8
  import { createWebTools } from './web.js'
9
9
  import { createView } from './view.js'
10
10
 
11
- export function createToolset({ cwd, env, tracker, skills, shells, sessionId, sessionFile, wakeups, memory, agents, deliberations, onAgentsCollected, askUser, dredge, mcpTools = [], userTools = [], signal, maxToolCalls, maxAgentStarts, requireAgentPlan = false, allowNames, onToolUpdate, viewer }) {
11
+ export function createToolset({ cwd, env, tracker, skills, shells, sessionId, sessionFile, wakeups, memory, agents, deliberations, onAgentsCollected, askUser, dredge, mcpTools = [], userTools = [], hostTools = [], signal, maxToolCalls, maxAgentStarts, requireAgentPlan = false, allowNames, onToolUpdate, viewer }) {
12
12
  const recorder = createRecorder(onToolUpdate)
13
13
  let agentStarts = 0
14
14
  let plannedAgentStarts = requireAgentPlan ? null : maxAgentStarts
@@ -286,7 +286,7 @@ export function createToolset({ cwd, env, tracker, skills, shells, sessionId, se
286
286
  const describedToolNames = new Set(['read', 'write', 'edit', 'bash', 'glob', 'grep', 'web_search', 'schedule_wakeup'])
287
287
  const describedTools = new Set(local.filter((tool) => describedToolNames.has(tool.name)).map((tool) => tool.name))
288
288
  const byName = new Map()
289
- for (const tool of [...local, ...userTools, ...mcpTools]) {
289
+ for (const tool of [...local, ...hostTools, ...userTools, ...mcpTools]) {
290
290
  if (allowNames && !allowNames.includes(tool.name)) continue
291
291
  if (!byName.has(tool.name)) byName.set(tool.name, tool)
292
292
  }