@picassohq/cli 1.0.3 → 1.0.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.
- package/dist/build-info.json +2 -1
- package/dist/index.js +1860 -1316
- package/package.json +1 -1
- package/runtime/dsh/picasso-ecosystem.cordis.patch.yml +4 -7
- package/runtime/dsh/picasso-sdk.patch.yml +47 -0
- package/runtime/engine-manifest.json +37 -16
- package/runtime/packages/picasso-compaction/cordis.patch.yml +4 -0
- package/runtime/packages/picasso-compaction/index.js +875 -0
- package/runtime/packages/picasso-compaction/package.json +27 -0
- package/runtime/packages/picasso-hooks/cordis.patch.yml +4 -0
- package/runtime/packages/picasso-hooks/index.js +302 -0
- package/runtime/packages/picasso-hooks/lifecycle-events.js +651 -0
- package/runtime/packages/picasso-hooks/package.json +29 -0
- package/runtime/packages/picasso-lean-context/argument-repair.js +422 -0
- package/runtime/packages/picasso-lean-context/glob-walk.js +518 -0
- package/runtime/packages/picasso-lean-context/index.js +159 -11
- package/runtime/packages/picasso-memory/index.js +66 -24
- package/runtime/packages/picasso-model-router/connections.js +213 -10
- package/runtime/packages/picasso-model-router/index.js +128 -1
- package/runtime/packages/picasso-model-router/package.json +3 -1
- package/runtime/packages/picasso-model-router/thinking-default.js +236 -0
- package/runtime/packages/picasso-progress-reports/index.js +128 -18
- package/runtime/packages/picasso-sdk-server/command-runs.js +37 -0
- package/runtime/packages/picasso-sdk-server/ignore-file.js +5 -1
- package/runtime/packages/picasso-sdk-server/index.js +11 -3
- package/runtime/packages/picasso-sdk-server/package.json +1 -0
- package/runtime/packages/picasso-sdk-server/wave2-hooks.js +26 -6
- package/runtime/packages/picasso-web-search/backends.js +245 -195
- package/runtime/packages/picasso-web-search/config.js +75 -27
- package/runtime/packages/picasso-web-search/cordis.patch.yml +2 -1
- package/runtime/packages/picasso-web-search/failure.js +7 -1
- package/runtime/packages/picasso-web-search/index.js +7 -5
- package/runtime/packages/picasso-web-search/package.json +6 -0
- package/runtime/packages/picasso-web-search/requests.js +339 -0
- package/runtime/packages/picasso-web-search/router.js +17 -12
- package/runtime/packages/picasso-x-reader/settings.js +4 -1
- package/runtime/plugins/picasso-auto-approve/index.js +21 -8
- package/runtime/plugins/picasso-compaction/index.js +875 -0
- package/runtime/plugins/picasso-compaction/package.json +27 -0
- package/runtime/plugins/picasso-hooks/index.js +302 -0
- package/runtime/plugins/picasso-hooks/lifecycle-events.js +651 -0
- package/runtime/plugins/picasso-hooks/package.json +29 -0
- package/runtime/plugins/picasso-lean-context/argument-repair.js +422 -0
- package/runtime/plugins/picasso-lean-context/glob-walk.js +518 -0
- package/runtime/plugins/picasso-lean-context/index.js +159 -11
- package/runtime/plugins/picasso-memory/index.js +66 -24
- package/runtime/plugins/picasso-model-router/connections.js +213 -10
- package/runtime/plugins/picasso-model-router/index.js +128 -1
- package/runtime/plugins/picasso-model-router/package.json +3 -1
- package/runtime/plugins/picasso-model-router/thinking-default.js +236 -0
- package/runtime/plugins/picasso-progress-reports/index.js +128 -18
- package/runtime/plugins/picasso-provider-models/index.js +236 -4
- package/runtime/plugins/picasso-trackers/index.js +12 -2
- package/runtime/plugins/picasso-web-search/backends.js +245 -195
- package/runtime/plugins/picasso-web-search/config.js +75 -27
- package/runtime/plugins/picasso-web-search/failure.js +7 -1
- package/runtime/plugins/picasso-web-search/index.js +7 -5
- package/runtime/plugins/picasso-web-search/package.json +6 -0
- package/runtime/plugins/picasso-web-search/requests.js +339 -0
- package/runtime/plugins/picasso-web-search/router.js +17 -12
- package/runtime/plugins/picasso-x-reader/settings.js +4 -1
- package/runtime/relay/main.mjs +3877 -1989
- package/runtime/relay/model-listing.mjs +337 -26
- package/runtime/relay/versions-routes.mjs +86 -20
|
@@ -101,12 +101,12 @@ import { join as join5 } from "node:path";
|
|
|
101
101
|
var KEYCHAIN_COMMAND_TIMEOUT_MS = 1e4;
|
|
102
102
|
var KEYCHAIN_TIMEOUT_EXIT_CODE = 124;
|
|
103
103
|
function createSecurityRunner(timeoutMs = KEYCHAIN_COMMAND_TIMEOUT_MS) {
|
|
104
|
-
return (command, args, options) => new Promise((
|
|
104
|
+
return (command, args, options) => new Promise((resolve7) => {
|
|
105
105
|
let timedOut = false;
|
|
106
106
|
const child = execFile(command, [...args], { encoding: "utf8", maxBuffer: 1024 * 1024, windowsHide: true }, (error, stdout, stderr) => {
|
|
107
107
|
clearTimeout(timer);
|
|
108
108
|
if (timedOut) {
|
|
109
|
-
|
|
109
|
+
resolve7({
|
|
110
110
|
exitCode: KEYCHAIN_TIMEOUT_EXIT_CODE,
|
|
111
111
|
stdout: "",
|
|
112
112
|
stderr: `The Keychain did not answer within ${Math.ceil(timeoutMs / 1e3)} s (${command} was stopped); it may be waiting for an unlock prompt.`
|
|
@@ -114,7 +114,7 @@ function createSecurityRunner(timeoutMs = KEYCHAIN_COMMAND_TIMEOUT_MS) {
|
|
|
114
114
|
return;
|
|
115
115
|
}
|
|
116
116
|
const code = error?.code;
|
|
117
|
-
|
|
117
|
+
resolve7({
|
|
118
118
|
exitCode: error === null ? 0 : typeof code === "number" ? code : 1,
|
|
119
119
|
stdout: String(stdout),
|
|
120
120
|
stderr: String(stderr)
|
|
@@ -545,11 +545,18 @@ import { isMap, isScalar, isSeq, parseDocument } from "yaml";
|
|
|
545
545
|
import { copyFileSync as copyFileSync2, existsSync as existsSync4, readFileSync as readFileSync7, readdirSync as readdirSync3 } from "node:fs";
|
|
546
546
|
import { join as join19 } from "node:path";
|
|
547
547
|
|
|
548
|
+
// ../../packages/shared-home/dist/disconnected-routes.js
|
|
549
|
+
import { readFileSync as readFileSync8 } from "node:fs";
|
|
550
|
+
|
|
551
|
+
// ../../packages/shared-home/dist/project-models.js
|
|
552
|
+
import { mkdirSync as mkdirSync5, readFileSync as readFileSync9, realpathSync as realpathSync2, renameSync as renameSync4, statSync as statSync2, writeFileSync as writeFileSync4 } from "node:fs";
|
|
553
|
+
import { dirname as dirname8, isAbsolute as isAbsolute2, join as join20, resolve as resolve3 } from "node:path";
|
|
554
|
+
|
|
548
555
|
// ../../packages/sessions/dist/index.js
|
|
549
556
|
import { createHash as createHash3, randomBytes as randomBytes4 } from "node:crypto";
|
|
550
|
-
import { createReadStream, readFileSync as
|
|
557
|
+
import { createReadStream, readFileSync as readFileSync12, statSync as statSync5 } from "node:fs";
|
|
551
558
|
import { appendFile, chmod as chmod4, mkdir as mkdir4, readdir as readdir2, rename as rename3, rm as rm5, writeFile } from "node:fs/promises";
|
|
552
|
-
import { isAbsolute as
|
|
559
|
+
import { isAbsolute as isAbsolute4, join as join24, resolve as resolve6 } from "node:path";
|
|
553
560
|
import { createInterface } from "node:readline/promises";
|
|
554
561
|
|
|
555
562
|
// ../../packages/shared/dist/logger.js
|
|
@@ -703,6 +710,12 @@ function isNaiveName(name, id) {
|
|
|
703
710
|
return false;
|
|
704
711
|
return name.split(/[-_\s/]+/u).every((token) => token.slice(1) === token.slice(1).toLowerCase());
|
|
705
712
|
}
|
|
713
|
+
function displayModelName(id, name) {
|
|
714
|
+
const given = name?.trim();
|
|
715
|
+
if (given && !isNaiveName(given, id))
|
|
716
|
+
return given;
|
|
717
|
+
return tidyModelId(id);
|
|
718
|
+
}
|
|
706
719
|
function displayProviderName(id, name) {
|
|
707
720
|
const given = name?.trim();
|
|
708
721
|
if (given && !isNaiveName(given, id))
|
|
@@ -735,8 +748,61 @@ function connectHint(surface, route) {
|
|
|
735
748
|
return "set up the connection first";
|
|
736
749
|
}
|
|
737
750
|
}
|
|
751
|
+
function newConversationHint(surface) {
|
|
752
|
+
switch (surface) {
|
|
753
|
+
case "tui":
|
|
754
|
+
return "try again, or start a new conversation (/new)";
|
|
755
|
+
case "cli":
|
|
756
|
+
return "try again, or start a new conversation";
|
|
757
|
+
case "mac":
|
|
758
|
+
return "try again, or start a new thread";
|
|
759
|
+
case "any":
|
|
760
|
+
return "try again, or start a new conversation";
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
var SHORTEN_FAILED = "Couldn't shorten this conversation";
|
|
738
764
|
var connection = (route) => `The ${displayProviderName(route)} connection`;
|
|
739
765
|
var RULES = [
|
|
766
|
+
{
|
|
767
|
+
// The model library's settings checks (`llm-pi-ai: provider "X" model "Y" needs an api; …`), worded for the people
|
|
768
|
+
// who configure the engine. Picasso fills a connection's api and endpoint in from its catalogue, so what is left is
|
|
769
|
+
// a connection that names neither.
|
|
770
|
+
pattern: /llm-pi-ai: provider "([^"]+)" model "([^"]+)" needs an api\b[^\n]*/u,
|
|
771
|
+
plain: (m, surface) => `${connection(m[1])} doesn't say which API its endpoint speaks, so it can't run ${m[2]} \xB7 ${connectHint(surface, m[1])}`
|
|
772
|
+
},
|
|
773
|
+
{
|
|
774
|
+
pattern: /llm-pi-ai: provider "([^"]+)" model "([^"]+)" needs a baseURL\b[^\n]*/u,
|
|
775
|
+
plain: (m, surface) => `${connection(m[1])} has no endpoint address, so it can't run ${m[2]} \xB7 ${connectHint(surface, m[1])}`
|
|
776
|
+
},
|
|
777
|
+
{
|
|
778
|
+
// Any other settings check: the connection is named in plain words, the check itself is kept.
|
|
779
|
+
pattern: /llm-pi-ai: provider "([^"]+)"\s*/u,
|
|
780
|
+
plain: (m) => `${connection(m[1])}: `
|
|
781
|
+
},
|
|
782
|
+
{
|
|
783
|
+
// A model switch whose compaction failed (dsh-compaction-basic). First, so the inner reason is still raw here; the
|
|
784
|
+
// rules below then put any engine phrase inside it in plain words.
|
|
785
|
+
pattern: /Cannot switch to [^\s/]+\/(\S+?): context compaction failed: ([\s\S]*?)\.? The previous request model is preserved; retry or select a model with a larger context window\./u,
|
|
786
|
+
plain: (m, surface) => {
|
|
787
|
+
const model = displayModelName(m[1]);
|
|
788
|
+
const reason = m[2].trim();
|
|
789
|
+
if (reason.startsWith(SHORTEN_FAILED)) {
|
|
790
|
+
const own = reason.slice(SHORTEN_FAILED.length).replace(/^[:\s]+/u, "");
|
|
791
|
+
return `${SHORTEN_FAILED} to fit ${model}${own === "" ? "" : `: ${own}`} \xB7 ${newConversationHint(surface)}`;
|
|
792
|
+
}
|
|
793
|
+
return `${SHORTEN_FAILED} to fit ${model}${reason === "" ? "" : ` (${reason})`} \xB7 ${newConversationHint(surface)}`;
|
|
794
|
+
}
|
|
795
|
+
},
|
|
796
|
+
{
|
|
797
|
+
// The engine refuses to compact for a model whose window cannot hold its output reservation plus compaction headroom.
|
|
798
|
+
pattern: /compaction-basic: \S+ reserves \d+ completion tokens[^;]*?leaving no (?:message|pressure) budget; (?:reduce the effective request maxTokens or compaction headroomTokens, or configure a larger adapter model contextWindow|configure the adapter model's contextWindow above the effective request maxTokens)/u,
|
|
799
|
+
plain: () => "its context window is too small to hold a shortened copy of this conversation"
|
|
800
|
+
},
|
|
801
|
+
{
|
|
802
|
+
// `/compact`'s failure (dsh-command-compact); the reason is on the compaction itself.
|
|
803
|
+
pattern: /Compaction could not produce a useful summary\. The attempt is recorded in the session log\./u,
|
|
804
|
+
plain: (_m, surface) => `${SHORTEN_FAILED} \xB7 ${newConversationHint(surface)}`
|
|
805
|
+
},
|
|
740
806
|
{
|
|
741
807
|
pattern: /pi-ai provider "([^"]+)" has no configured model "([^"]+)"/u,
|
|
742
808
|
plain: (m, surface) => `${connection(m[1])} doesn't have ${m[2]} set up \xB7 ${addModelHint(surface, m[1], m[2])}`
|
|
@@ -797,9 +863,9 @@ function namesEngineLibrary(text) {
|
|
|
797
863
|
}
|
|
798
864
|
|
|
799
865
|
// ../../packages/sessions/dist/dsh-log.js
|
|
800
|
-
import { existsSync as existsSync5, readdirSync as readdirSync4, readFileSync as
|
|
866
|
+
import { existsSync as existsSync5, readdirSync as readdirSync4, readFileSync as readFileSync10, statSync as statSync3 } from "node:fs";
|
|
801
867
|
import { homedir as homedir3 } from "node:os";
|
|
802
|
-
import { join as
|
|
868
|
+
import { join as join21 } from "node:path";
|
|
803
869
|
import * as zlib from "node:zlib";
|
|
804
870
|
var LOG_FILE = /^session\.v(\d+)\.jsonl(\.zstd)?$/u;
|
|
805
871
|
var ZSTD_MAGIC = Buffer.from([40, 181, 47, 253]);
|
|
@@ -807,10 +873,10 @@ var MEMORY_PREAMBLE = "Background memory recalled from EARLIER";
|
|
|
807
873
|
var MEMORY_REQUEST_MARKER = "\n\nUser request:\n";
|
|
808
874
|
var PROMPT_SOURCES = ["user", "goal", "agent-message", "subagent-settled"];
|
|
809
875
|
function defaultDshHome() {
|
|
810
|
-
return process.env.DSH_HOME ??
|
|
876
|
+
return process.env.DSH_HOME ?? join21(homedir3(), ".dsh");
|
|
811
877
|
}
|
|
812
878
|
function dshSessionsRoot(dshHome2 = defaultDshHome()) {
|
|
813
|
-
return
|
|
879
|
+
return join21(dshHome2, "sessions");
|
|
814
880
|
}
|
|
815
881
|
function safeReaddir(path) {
|
|
816
882
|
try {
|
|
@@ -827,10 +893,10 @@ function logInSessionDir(sessionDir, sessionId, projectDir) {
|
|
|
827
893
|
const match = LOG_FILE.exec(entry.name);
|
|
828
894
|
if (match === null)
|
|
829
895
|
continue;
|
|
830
|
-
const path =
|
|
896
|
+
const path = join21(sessionDir, entry.name);
|
|
831
897
|
let stats;
|
|
832
898
|
try {
|
|
833
|
-
stats =
|
|
899
|
+
stats = statSync3(path);
|
|
834
900
|
} catch {
|
|
835
901
|
continue;
|
|
836
902
|
}
|
|
@@ -854,11 +920,11 @@ function indexDshSessionLogs(dshHome2) {
|
|
|
854
920
|
for (const project of safeReaddir(root)) {
|
|
855
921
|
if (!project.isDirectory())
|
|
856
922
|
continue;
|
|
857
|
-
const projectDir =
|
|
923
|
+
const projectDir = join21(root, project.name);
|
|
858
924
|
for (const session of safeReaddir(projectDir)) {
|
|
859
925
|
if (!session.isDirectory())
|
|
860
926
|
continue;
|
|
861
|
-
const found = logInSessionDir(
|
|
927
|
+
const found = logInSessionDir(join21(projectDir, session.name), session.name, projectDir);
|
|
862
928
|
if (found === void 0)
|
|
863
929
|
continue;
|
|
864
930
|
const existing = index.get(found.sessionId);
|
|
@@ -1137,13 +1203,13 @@ function projectDshTranscript(records, options = {}) {
|
|
|
1137
1203
|
}
|
|
1138
1204
|
|
|
1139
1205
|
// ../../packages/sessions/dist/last-session.js
|
|
1140
|
-
import { realpathSync as
|
|
1141
|
-
import { resolve as
|
|
1206
|
+
import { realpathSync as realpathSync3 } from "node:fs";
|
|
1207
|
+
import { resolve as resolve4 } from "node:path";
|
|
1142
1208
|
|
|
1143
1209
|
// ../../packages/sessions/dist/dsh-log-diagnostics.js
|
|
1144
1210
|
import { createHash } from "node:crypto";
|
|
1145
|
-
import { existsSync as existsSync6, readFileSync as
|
|
1146
|
-
import { basename as basename3, dirname as
|
|
1211
|
+
import { existsSync as existsSync6, readFileSync as readFileSync11, statSync as statSync4 } from "node:fs";
|
|
1212
|
+
import { basename as basename3, dirname as dirname9, join as join22 } from "node:path";
|
|
1147
1213
|
|
|
1148
1214
|
// ../../packages/sessions/dist/sharing.js
|
|
1149
1215
|
import { createHash as createHash2 } from "node:crypto";
|
|
@@ -1158,10 +1224,10 @@ var CLOUD_SESSION_SYNC_AVAILABILITY = Object.freeze({
|
|
|
1158
1224
|
import { execFile as execFile3 } from "node:child_process";
|
|
1159
1225
|
import { existsSync as existsSync7, readdirSync as readdirSync5 } from "node:fs";
|
|
1160
1226
|
import { readdir, readlink, realpath } from "node:fs/promises";
|
|
1161
|
-
import { join as
|
|
1227
|
+
import { join as join23, resolve as resolve5 } from "node:path";
|
|
1162
1228
|
|
|
1163
1229
|
// ../../packages/sessions/dist/work-artifacts.js
|
|
1164
|
-
import { isAbsolute as
|
|
1230
|
+
import { isAbsolute as isAbsolute3, posix } from "node:path";
|
|
1165
1231
|
|
|
1166
1232
|
// src/versions-routes.ts
|
|
1167
1233
|
var IMPORTED_VERSIONS_REASON = "Imported threads are read-only, so their versions cannot be switched.";
|
|
@@ -1242,7 +1308,7 @@ var LineageIndex = class {
|
|
|
1242
1308
|
for (const location of found) {
|
|
1243
1309
|
let head = this.heads.get(location.path);
|
|
1244
1310
|
if (head === void 0) {
|
|
1245
|
-
if (++reads % 32 === 0) await new Promise((
|
|
1311
|
+
if (++reads % 32 === 0) await new Promise((resolve7) => setImmediate(resolve7));
|
|
1246
1312
|
try {
|
|
1247
1313
|
const records = await readHeadRecords(location);
|
|
1248
1314
|
head = records === void 0 ? void 0 : headOf(location, records);
|