pi-orchestrator-config 4.3.13 → 4.3.14
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.
|
@@ -423,12 +423,23 @@ function setupPromptTemplateInterceptor(
|
|
|
423
423
|
item: AutocompleteItem,
|
|
424
424
|
prefix: string,
|
|
425
425
|
) {
|
|
426
|
-
// Suggestions above are for an argument token, but the wrapped provider
|
|
427
|
-
// only knows its own command completion prefix and can replace `/cron add`.
|
|
428
426
|
const line = lines[cursorLine] ?? "";
|
|
429
|
-
//
|
|
430
|
-
//
|
|
431
|
-
|
|
427
|
+
// We own only argument suggestions. Delegate slash-command completion
|
|
428
|
+
// unchanged, otherwise selecting `/pi-config-settings` drops its slash.
|
|
429
|
+
if (!/^\/\S+\s/.test(line.slice(0, cursorCol))) {
|
|
430
|
+
const result = current.applyCompletion(lines, cursorLine, cursorCol, item, prefix);
|
|
431
|
+
// Some wrapped providers return a bare command value. Keep the slash
|
|
432
|
+
// that put the editor into command mode so Enter dispatches it.
|
|
433
|
+
const completed = result.lines[result.cursorLine] ?? "";
|
|
434
|
+
if (line.startsWith("/") && !completed.startsWith("/")) {
|
|
435
|
+
const nextLines = [...result.lines];
|
|
436
|
+
nextLines[result.cursorLine] = `/${completed}`;
|
|
437
|
+
return { ...result, lines: nextLines, cursorCol: result.cursorCol + 1 };
|
|
438
|
+
}
|
|
439
|
+
return result;
|
|
440
|
+
}
|
|
441
|
+
// Pi passes the wrapped provider's prefix here, which can be broader
|
|
442
|
+
// than our argument token. Replace only the current argument token.
|
|
432
443
|
const start = line.lastIndexOf(" ", Math.max(0, cursorCol - 1)) + 1;
|
|
433
444
|
const nextLines = [...lines];
|
|
434
445
|
nextLines[cursorLine] = `${line.slice(0, start)}${item.value}${line.slice(cursorCol)}`;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* On session_start (providers already registered), restore the saved default
|
|
8
8
|
* when current differs (or is missing), unless the user passed --model /
|
|
9
9
|
* --provider / --models, enabledModels scopes the model list, or the session
|
|
10
|
-
* is
|
|
10
|
+
* is fork/reload.
|
|
11
11
|
*
|
|
12
12
|
* Kept free of @earendil-works/pi-ai so unit tests can import under tsx.
|
|
13
13
|
*/
|
|
@@ -20,14 +20,14 @@ import { createLogger } from "../shared/logger.js";
|
|
|
20
20
|
const log = createLogger("providers");
|
|
21
21
|
|
|
22
22
|
/** session_start reasons where cold-start restore is allowed. */
|
|
23
|
-
export const RESTORE_ALLOWED_REASONS = new Set(["startup", "new"]);
|
|
23
|
+
export const RESTORE_ALLOWED_REASONS = new Set(["startup", "new", "resume"]);
|
|
24
24
|
|
|
25
25
|
export type RestoreDefaultModelOpts = {
|
|
26
26
|
defaultProvider?: string | null;
|
|
27
27
|
defaultModelId?: string | null;
|
|
28
28
|
currentProvider?: string | null;
|
|
29
29
|
currentModelId?: string | null;
|
|
30
|
-
/** session_start reason; only "startup" | "new" may restore. */
|
|
30
|
+
/** session_start reason; only "startup" | "new" | "resume" may restore. */
|
|
31
31
|
reason?: string | null;
|
|
32
32
|
/**
|
|
33
33
|
* CLI argv to scan for --model / --provider / --models (user override).
|
|
@@ -78,7 +78,7 @@ export function hasEnabledModelsScope(
|
|
|
78
78
|
*
|
|
79
79
|
* Gates (all must pass):
|
|
80
80
|
* 1. defaultProvider and defaultModelId both non-empty
|
|
81
|
-
* 2. reason is startup|new
|
|
81
|
+
* 2. reason is startup|new|resume
|
|
82
82
|
* 3. current missing OR current provider/id ≠ default
|
|
83
83
|
* 4. argv does not contain --model, --provider, or --models
|
|
84
84
|
* 5. enabledModels is missing or empty (non-empty scopes like --models)
|