@cjhyy/code-shell-capability-coding 0.9.42 → 0.9.43
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.
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
* makes room titles start with AGENTS/plugin boilerplate; dropping the whole
|
|
5
5
|
* message when its joined text starts with `<environment_context>` drops the
|
|
6
6
|
* real prompt too. Keep user-authored parts and discard only known host
|
|
7
|
-
* context parts.
|
|
7
|
+
* context parts. Page context may also prefix the real input in one part.
|
|
8
8
|
*/
|
|
9
9
|
export declare function codexUserText(content: unknown): string;
|
|
@@ -4,19 +4,26 @@
|
|
|
4
4
|
* makes room titles start with AGENTS/plugin boilerplate; dropping the whole
|
|
5
5
|
* message when its joined text starts with `<environment_context>` drops the
|
|
6
6
|
* real prompt too. Keep user-authored parts and discard only known host
|
|
7
|
-
* context parts.
|
|
7
|
+
* context parts. Page context may also prefix the real input in one part.
|
|
8
8
|
*/
|
|
9
9
|
export function codexUserText(content) {
|
|
10
10
|
if (typeof content === "string") {
|
|
11
|
-
return
|
|
11
|
+
return stripInjectedCodexContext(content);
|
|
12
12
|
}
|
|
13
13
|
if (!Array.isArray(content))
|
|
14
14
|
return "";
|
|
15
15
|
return content
|
|
16
16
|
.map((part) => (typeof part?.text === "string" ? part.text : ""))
|
|
17
|
-
.
|
|
17
|
+
.map(stripInjectedCodexContext)
|
|
18
|
+
.filter((text) => text.trim())
|
|
18
19
|
.join("\n");
|
|
19
20
|
}
|
|
21
|
+
function stripInjectedCodexContext(text) {
|
|
22
|
+
// Strip only complete leading Page snapshots, preserving any prompt after
|
|
23
|
+
// them and literal examples quoted later in user-authored text.
|
|
24
|
+
const prompt = text.replace(/^(?:\s*<external_codex_apps_open_page>[\s\S]*?<\/external_codex_apps_open_page>)+\s*/, "");
|
|
25
|
+
return isInjectedCodexContext(prompt) ? "" : prompt;
|
|
26
|
+
}
|
|
20
27
|
function isInjectedCodexContext(text) {
|
|
21
28
|
const trimmed = text.trimStart();
|
|
22
29
|
return (trimmed.startsWith("<environment_context>") ||
|
|
@@ -53,6 +53,7 @@ export interface ExternalRuntimeSessionOptions {
|
|
|
53
53
|
approvalBackend?: Parameters<typeof createSessionToolHost>[0]["approvalBackend"];
|
|
54
54
|
/** Host seams the tools need (panels, browser, askUser, …). */
|
|
55
55
|
contextOverrides?: Parameters<typeof createSessionToolHost>[0]["contextOverrides"];
|
|
56
|
+
captureRunContext?: Parameters<typeof createSessionToolHost>[0]["captureRunContext"];
|
|
56
57
|
settingsScope?: Parameters<typeof createSessionToolHost>[0]["settingsScope"];
|
|
57
58
|
model?: string;
|
|
58
59
|
/** Runtime thread/session id recovered from durable Desktop state. */
|
|
@@ -58,6 +58,7 @@ export async function startExternalRuntimeSession(options) {
|
|
|
58
58
|
// Outside a concrete provider call there is no run output owner. Never
|
|
59
59
|
// capture the lifetime callback and let it borrow a later active turn.
|
|
60
60
|
getStreamCallback: () => turnSink,
|
|
61
|
+
...(options.captureRunContext ? { captureRunContext: options.captureRunContext } : {}),
|
|
61
62
|
...(options.settingsScope ? { settingsScope: options.settingsScope } : {}),
|
|
62
63
|
});
|
|
63
64
|
// 3. Register before the runtime starts, so a tool call on the very first
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cjhyy/code-shell-capability-coding",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.43",
|
|
4
4
|
"description": "Coding capability pack for the generic code-shell agent core.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\""
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@cjhyy/code-shell-core": "0.9.
|
|
42
|
+
"@cjhyy/code-shell-core": "0.9.43"
|
|
43
43
|
},
|
|
44
44
|
"engines": {
|
|
45
45
|
"node": ">=20.10"
|