@proagentstore/cli 0.4.24 → 0.4.25
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.
|
@@ -362,14 +362,23 @@ export class HeadlessSession {
|
|
|
362
362
|
function stamp() {
|
|
363
363
|
return new Date().toTimeString().slice(0, 8);
|
|
364
364
|
}
|
|
365
|
-
/**
|
|
365
|
+
/**
|
|
366
|
+
* Split a launch command into bin + args, respecting single/double quotes — the way a shell
|
|
367
|
+
* would, because that is what a user editing an engine preset is writing.
|
|
368
|
+
*
|
|
369
|
+
* Quotes are stripped wherever they appear in a token, not only when they wrap the whole thing.
|
|
370
|
+
* The earlier alternation (`"…" | '…' | \S+`) only recognised a fully-quoted token, so
|
|
371
|
+
* `-c model="o3"` reached the engine as the literal `model="o3"` and
|
|
372
|
+
* `--append-system-prompt="be terse"` split at the space. A preset is free text; it has to
|
|
373
|
+
* tokenize like the command line it looks like.
|
|
374
|
+
*/
|
|
366
375
|
export function parseCommand(command) {
|
|
367
376
|
const tokens = [];
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
377
|
+
// One token = a run of unquoted chars and/or quoted spans, glued together (`"a b"c` → `a bc`).
|
|
378
|
+
const re = /(?:[^\s"']+|"[^"]*"|'[^']*')+/g;
|
|
379
|
+
for (const raw of (command ?? "").match(re) ?? []) {
|
|
380
|
+
tokens.push(raw.replace(/"([^"]*)"|'([^']*)'/g, (_m, d, s) => d ?? s ?? ""));
|
|
381
|
+
}
|
|
373
382
|
return { bin: tokens[0] ?? "", args: tokens.slice(1) };
|
|
374
383
|
}
|
|
375
384
|
/** Structural flags PAGS owns for the Claude stream-json engine — a user command
|