shadok-ai 0.17.49 → 0.17.50
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/prompt-args.d.ts +1 -0
- package/dist/prompt-args.js +34 -0
- package/dist/prompt-args.js.map +1 -0
- package/dist/server.js +5 -2
- package/dist/server.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function mergeAppendedPrompts(args: readonly string[]): string[];
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude Code's `--append-system-prompt <prompt>` takes ONE value. Given the
|
|
3
|
+
* flag several times, the model sees only the LAST one — measured on 2.1.319:
|
|
4
|
+
* three flags carrying three codewords, and the model reported only the third.
|
|
5
|
+
*
|
|
6
|
+
* shadok appended four separate blocks at spawn — the profile's role, the
|
|
7
|
+
* environment note, the pilot prompt and the ledger reflex — so with the ledger
|
|
8
|
+
* on, every agent silently kept the ledger reflex alone: no role, no cockpit
|
|
9
|
+
* context. Nothing errors and nothing shows; the agent just behaves as if it had
|
|
10
|
+
* never been told. This collapses them into ONE flag, in their order, at the
|
|
11
|
+
* position of the first, joined by a blank line. Pure, tested.
|
|
12
|
+
*/
|
|
13
|
+
const FLAG = "--append-system-prompt";
|
|
14
|
+
export function mergeAppendedPrompts(args) {
|
|
15
|
+
const out = [];
|
|
16
|
+
const values = [];
|
|
17
|
+
let at = -1;
|
|
18
|
+
for (let i = 0; i < args.length; i++) {
|
|
19
|
+
if (args[i] === FLAG && i + 1 < args.length) {
|
|
20
|
+
if (at < 0) {
|
|
21
|
+
at = out.length;
|
|
22
|
+
out.push(FLAG, "");
|
|
23
|
+
}
|
|
24
|
+
values.push(args[i + 1]);
|
|
25
|
+
i++; // the value is consumed whatever it looks like
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
out.push(args[i]);
|
|
29
|
+
}
|
|
30
|
+
if (at >= 0)
|
|
31
|
+
out[at + 1] = values.join("\n\n");
|
|
32
|
+
return out;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=prompt-args.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt-args.js","sourceRoot":"","sources":["../src/prompt-args.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,IAAI,GAAG,wBAAwB,CAAC;AAEtC,MAAM,UAAU,oBAAoB,CAAC,IAAuB;IAC1D,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;IACZ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;YAC5C,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC;gBACX,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC;gBAChB,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YACrB,CAAC;YACD,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YACzB,CAAC,EAAE,CAAC,CAAC,+CAA+C;YACpD,SAAS;QACX,CAAC;QACD,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;IACD,IAAI,EAAE,IAAI,CAAC;QAAE,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC/C,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/dist/server.js
CHANGED
|
@@ -24,6 +24,7 @@ import { backgroundTasks, screenShowsWork, moveToOption, boxText } from "./detec
|
|
|
24
24
|
import { autoReloadVerdict, autoReloadEnabled } from "./auto-reload.js";
|
|
25
25
|
import { PtyPilot } from "./session.js";
|
|
26
26
|
import { ensureClaudeHome, ensureProjectTrusted, getDefaultModel, setDefaultModel, parseClaudeVersion, seedPlanForCwds, settingsPlan, } from "./claude-home.js";
|
|
27
|
+
import { mergeAppendedPrompts } from "./prompt-args.js";
|
|
27
28
|
import { authStatus, cancelLogin, invalidateAuthStatus, startLogin, submitLoginCode } from "./claude-auth.js";
|
|
28
29
|
import { startSetupToken, submitSetupTokenCode, cancelSetupToken } from "./setup-token.js";
|
|
29
30
|
import { startAgentLogin, submitAgentLoginCode, cancelAgentLogin, agentLoginPending, agentLoginInfo, } from "./agent-login.js";
|
|
@@ -6302,7 +6303,9 @@ group) {
|
|
|
6302
6303
|
instanceDefault: user ? getDefaultModel() : null,
|
|
6303
6304
|
dropped: !!user,
|
|
6304
6305
|
});
|
|
6305
|
-
|
|
6306
|
+
// ONE --append-system-prompt: Claude Code keeps only the last of several
|
|
6307
|
+
// (src/prompt-args.ts), which silently dropped the role and the pilot prompt.
|
|
6308
|
+
const fullArgs = mergeAppendedPrompts([
|
|
6306
6309
|
...args,
|
|
6307
6310
|
...permissionModeArgs(permissionMode),
|
|
6308
6311
|
// A flag+value pair, before the profile's flags: nothing here can land
|
|
@@ -6312,7 +6315,7 @@ group) {
|
|
|
6312
6315
|
...(note ? ["--append-system-prompt", note] : []),
|
|
6313
6316
|
...(sp ? ["--append-system-prompt", sp] : []),
|
|
6314
6317
|
...(lr ? ["--append-system-prompt", lr] : []),
|
|
6315
|
-
];
|
|
6318
|
+
]);
|
|
6316
6319
|
// NAMES only: the values are in `env`, and never travel to a client. Built
|
|
6317
6320
|
// through the shared `buildPreprompt`, so this spawn snapshot is comparable
|
|
6318
6321
|
// byte-for-byte with the one the staleness check recomputes later.
|