picocode-core 0.9.207 → 0.9.209
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/agent.js +4 -9
- package/src/catalog-snapshot.json +1 -1
- package/src/controller.js +65 -17
- package/src/derive.js +8 -5
- package/src/model-auth.js +32 -0
- package/src/peers.js +9 -1
- package/src/remote-controller.js +5 -0
- package/src/xai-auth.js +228 -0
- package/src/xai-models.js +47 -0
package/package.json
CHANGED
package/src/agent.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { modelRequest } from './model-auth.js'
|
|
1
2
|
import { prepareImages } from './images.js'
|
|
2
3
|
import { execFile } from 'node:child_process'
|
|
3
4
|
import { promisify } from 'node:util'
|
|
@@ -61,10 +62,8 @@ export function compactionHistory(history, prompt) {
|
|
|
61
62
|
export async function compactHistory({ history, modelName, speed, auth, prompt, signal, onStream }) {
|
|
62
63
|
const out = await compose(
|
|
63
64
|
model({
|
|
64
|
-
|
|
65
|
+
...modelRequest(modelName, auth),
|
|
65
66
|
...(speed && { speed }),
|
|
66
|
-
...(auth?.apiKey && { apiKey: auth.apiKey }),
|
|
67
|
-
...(auth?.headers && { headers: auth.headers }),
|
|
68
67
|
}),
|
|
69
68
|
)({
|
|
70
69
|
history: await compactionHistory(history, prompt),
|
|
@@ -90,10 +89,8 @@ export function compactProgress(streamed) {
|
|
|
90
89
|
export async function summarizeText({ text, modelName, auth }) {
|
|
91
90
|
const out = await compose(
|
|
92
91
|
model({
|
|
93
|
-
|
|
92
|
+
...modelRequest(modelName, auth),
|
|
94
93
|
system: 'Summarize the following conversation excerpt in 2-4 dense sentences. Capture decisions, changes made, and open questions. Output only the summary.',
|
|
95
|
-
...(auth?.apiKey && { apiKey: auth.apiKey }),
|
|
96
|
-
...(auth?.headers && { headers: auth.headers }),
|
|
97
94
|
}),
|
|
98
95
|
)(text.slice(0, 30000))
|
|
99
96
|
return getText(out.lastResponse?.content || '').trim()
|
|
@@ -190,7 +187,7 @@ export async function runTurn({ history, tools, recorder, modelName, effort, spe
|
|
|
190
187
|
estimatedPromptTokens = estimateTokens({ system, history: hydratedHistory, tools })
|
|
191
188
|
onStream?.({ type: 'usage_estimate', usage: estimatedUsage() })
|
|
192
189
|
const out = await model({
|
|
193
|
-
|
|
190
|
+
...modelRequest(modelName, auth),
|
|
194
191
|
beforeRequest: async (request) => {
|
|
195
192
|
if (internal.signal.aborted) return request
|
|
196
193
|
const messages = await beforeRequest?.() || []
|
|
@@ -203,8 +200,6 @@ export async function runTurn({ history, tools, recorder, modelName, effort, spe
|
|
|
203
200
|
},
|
|
204
201
|
...(effort && { effort }),
|
|
205
202
|
...(speed && { speed }),
|
|
206
|
-
...(auth?.apiKey && { apiKey: auth.apiKey }),
|
|
207
|
-
...(auth?.headers && { headers: auth.headers }),
|
|
208
203
|
})({ ...ctx, history: hydratedHistory, abortSignal: internal.signal })
|
|
209
204
|
// Prepared bytes and omission notices belong only to the request, not
|
|
210
205
|
// the conversation returned by the provider or subsequent tool rounds.
|