picocode-core 0.9.131 → 0.9.133
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 +1 -1
- package/src/controller.js +19 -0
- package/src/git.js +8 -4
package/package.json
CHANGED
package/src/controller.js
CHANGED
|
@@ -1005,6 +1005,23 @@ export function createController({ boot }) {
|
|
|
1005
1005
|
send(text)
|
|
1006
1006
|
}
|
|
1007
1007
|
|
|
1008
|
+
// the worker and deliberation models are app-wide settings: they change
|
|
1009
|
+
// for every session in this process and persist to the config file
|
|
1010
|
+
async function setResearchModel(name) {
|
|
1011
|
+
if (name && !modelAvailable(name)) return flash(`${name} is not available`)
|
|
1012
|
+
boot.researchModel = name || null
|
|
1013
|
+
if (!boot.deliberationModel || boot.deliberationModel === name) boot.deliberationModel = name || null
|
|
1014
|
+
await writeConfig({ models: { researchWorker: name || null } })
|
|
1015
|
+
changed()
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
async function setDeliberationModel(name) {
|
|
1019
|
+
if (name && !modelAvailable(name)) return flash(`${name} is not available`)
|
|
1020
|
+
boot.deliberationModel = name || null
|
|
1021
|
+
await writeConfig({ models: { deliberation: name || null } })
|
|
1022
|
+
changed()
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1008
1025
|
function sendInit(args) {
|
|
1009
1026
|
send(initPrompt(args))
|
|
1010
1027
|
}
|
|
@@ -1266,6 +1283,8 @@ export function createController({ boot }) {
|
|
|
1266
1283
|
sendSkill,
|
|
1267
1284
|
sendCommand,
|
|
1268
1285
|
sendInit,
|
|
1286
|
+
setResearchModel,
|
|
1287
|
+
setDeliberationModel,
|
|
1269
1288
|
previewSteer,
|
|
1270
1289
|
applySteer,
|
|
1271
1290
|
rewind,
|
package/src/git.js
CHANGED
|
@@ -3,7 +3,7 @@ import { readFileSync, statSync, watch } from 'node:fs'
|
|
|
3
3
|
import { dirname, isAbsolute, join, resolve } from 'node:path'
|
|
4
4
|
|
|
5
5
|
const DEBOUNCE_MS = 500
|
|
6
|
-
const POLL_MS =
|
|
6
|
+
const POLL_MS = 5000
|
|
7
7
|
const GIT_TIMEOUT_MS = 5000
|
|
8
8
|
|
|
9
9
|
function findGitDir(startDir) {
|
|
@@ -107,7 +107,9 @@ export function createGitService({ onChange = () => {} } = {}) {
|
|
|
107
107
|
}
|
|
108
108
|
const started = epoch
|
|
109
109
|
const branch = readBranch(gitDir)
|
|
110
|
-
|
|
110
|
+
// one shell round trip: the tracked diff stat, then a marker, then the
|
|
111
|
+
// porcelain status so untracked files count too
|
|
112
|
+
const proc = spawn('sh', ['-c', 'git --no-optional-locks diff HEAD --shortstat; echo __status__; git --no-optional-locks status --porcelain --untracked-files=all'], {
|
|
111
113
|
cwd: root,
|
|
112
114
|
stdio: ['ignore', 'pipe', 'ignore'],
|
|
113
115
|
})
|
|
@@ -125,8 +127,10 @@ export function createGitService({ onChange = () => {} } = {}) {
|
|
|
125
127
|
clearTimeout(timeout)
|
|
126
128
|
if (child === proc) child = null
|
|
127
129
|
if (epoch !== started) return
|
|
128
|
-
const
|
|
129
|
-
const
|
|
130
|
+
const [diff = '', status = ''] = output.split('__status__')
|
|
131
|
+
const stats = code === 0 ? parseShortstat(diff) : { added: 0, removed: 0 }
|
|
132
|
+
const untracked = code === 0 ? status.split('\n').filter((line) => line.startsWith('??')).length : 0
|
|
133
|
+
const next = branch ? { branch, ...stats, untracked } : null
|
|
130
134
|
if (JSON.stringify(next) !== JSON.stringify(current)) {
|
|
131
135
|
current = next
|
|
132
136
|
onChange()
|