@peakflo/agent-harness 0.2.5-rc.2 → 0.2.5
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.
|
@@ -585,10 +585,11 @@ class SessionRunner {
|
|
|
585
585
|
*/
|
|
586
586
|
async run(lease, signal) {
|
|
587
587
|
const { session } = lease;
|
|
588
|
-
const
|
|
588
|
+
const logColdStart = (line) => {
|
|
589
589
|
this.logger.log(line);
|
|
590
590
|
this.deps.coldStartLog?.(line);
|
|
591
|
-
}
|
|
591
|
+
};
|
|
592
|
+
const coldStart = new cold_start_steps_1.ColdStartSteps(session.sessionId, session.turnId, logColdStart);
|
|
592
593
|
const startedAt = new Date().toISOString();
|
|
593
594
|
const release = this.deps.notifier.keepAwake();
|
|
594
595
|
let workspaceDir = null;
|
|
@@ -629,13 +630,21 @@ class SessionRunner {
|
|
|
629
630
|
if (refusal)
|
|
630
631
|
throw new Error(refusal);
|
|
631
632
|
// The catalogue is advisory. Fetch it while the independent workspace
|
|
632
|
-
// is prepared
|
|
633
|
+
// is prepared. Pi can start with the selected lease model while this
|
|
634
|
+
// request fills the cache for a later turn. OpenCode still waits for
|
|
635
|
+
// the reported limits before it builds its provider config.
|
|
633
636
|
const endModels = coldStart.begin('model_catalogue');
|
|
637
|
+
let completedModels = null;
|
|
634
638
|
const gatewayModels = session.agent.model.gatewayUrl
|
|
635
639
|
? (0, model_gateway_1.fetchGatewayModels)({
|
|
636
640
|
baseUrl: session.agent.model.gatewayUrl,
|
|
637
641
|
apiKey: lease.modelToken
|
|
638
|
-
})
|
|
642
|
+
})
|
|
643
|
+
.then((models) => {
|
|
644
|
+
completedModels = models;
|
|
645
|
+
return models;
|
|
646
|
+
})
|
|
647
|
+
.finally(endModels)
|
|
639
648
|
: Promise.resolve([]);
|
|
640
649
|
if (!session.agent.model.gatewayUrl)
|
|
641
650
|
endModels();
|
|
@@ -763,7 +772,25 @@ class SessionRunner {
|
|
|
763
772
|
* stop a turn whose model is already known, so we fall back to exactly
|
|
764
773
|
* the previous behaviour.
|
|
765
774
|
*/
|
|
766
|
-
const
|
|
775
|
+
const useSelectedPiModel = session.agent.backend === 'pi' && !!session.agent.model.model;
|
|
776
|
+
// A Pi turn takes whichever catalogue result has arrived by now.
|
|
777
|
+
// This is deliberate: the selected model below is enough to start,
|
|
778
|
+
// while a later result fills the cache for the next turn.
|
|
779
|
+
if (useSelectedPiModel && completedModels === null) {
|
|
780
|
+
try {
|
|
781
|
+
logColdStart(JSON.stringify({
|
|
782
|
+
event: 'model_catalogue_deferred',
|
|
783
|
+
sessionId: session.sessionId,
|
|
784
|
+
turnId: session.turnId
|
|
785
|
+
}));
|
|
786
|
+
}
|
|
787
|
+
catch {
|
|
788
|
+
// A diagnostic sink must never stop the turn.
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
const fetched = useSelectedPiModel
|
|
792
|
+
? (completedModels ?? [])
|
|
793
|
+
: await gatewayModels;
|
|
767
794
|
const named = session.agent.model.model
|
|
768
795
|
? [
|
|
769
796
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@peakflo/agent-harness",
|
|
3
|
-
"version": "0.2.5
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"description": "Headless Peakflo coding-agent harness. One codebase, three hosting modes: a Daytona cloud sandbox, a customer VM, and the 20x desktop.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "commonjs",
|