@code-yeongyu/senpi-codemode 2026.11.15 → 2026.11.17
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/CHANGELOG.md +53 -0
- package/README.md +1 -1
- package/package.json +5 -5
- package/src/bridges/schema-bridge.ts +1 -0
- package/src/extension/eval-notifier.ts +6 -2
- package/src/extension/kernel-preludes.ts +9 -3
- package/src/extension/reachable-tools.ts +5 -0
- package/src/extension/runtime-factory.ts +11 -1
- package/src/index.ts +11 -5
- package/src/kernels/js/worker-shell-capture.js +18 -7
- package/src/prompt/eval-prompt-template.ts +3 -2
- package/src/prompt/eval-prompt.ts +3 -0
- package/src/tool/eval-tool-options.ts +2 -0
- package/src/tool/eval-tool.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,58 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2026.11.17] - 2026-11-17
|
|
4
|
+
|
|
5
|
+
### Breaking Changes
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Eval kernels and their children get the same withheld view of declared credentials as the bash tool ([#6828](https://github.com/code-yeongyu/senpi/pull/6828))
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
|
|
15
|
+
- `Bun.spawn` with `null` options or `env: null` inside an eval kernel keeps the pinned worker environment ([#6830](https://github.com/code-yeongyu/senpi/pull/6830))
|
|
16
|
+
- The eval description names every eval-only tool, and the `tool_schema()` prelude entry documents its `{ tools: [...] }` result ([#6887](https://github.com/code-yeongyu/senpi/pull/6887))
|
|
17
|
+
|
|
18
|
+
### Removed
|
|
19
|
+
|
|
20
|
+
## [2026.11.15-4] - 2026-11-15
|
|
21
|
+
|
|
22
|
+
### Breaking Changes
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
|
|
26
|
+
### Changed
|
|
27
|
+
|
|
28
|
+
### Fixed
|
|
29
|
+
|
|
30
|
+
### Removed
|
|
31
|
+
|
|
32
|
+
## [2026.11.15-3] - 2026-11-15
|
|
33
|
+
|
|
34
|
+
### Breaking Changes
|
|
35
|
+
|
|
36
|
+
### Added
|
|
37
|
+
|
|
38
|
+
### Changed
|
|
39
|
+
|
|
40
|
+
### Fixed
|
|
41
|
+
|
|
42
|
+
### Removed
|
|
43
|
+
|
|
44
|
+
## [2026.11.15-2] - 2026-11-15
|
|
45
|
+
|
|
46
|
+
### Breaking Changes
|
|
47
|
+
|
|
48
|
+
### Added
|
|
49
|
+
|
|
50
|
+
### Changed
|
|
51
|
+
|
|
52
|
+
### Fixed
|
|
53
|
+
|
|
54
|
+
### Removed
|
|
55
|
+
|
|
3
56
|
## [2026.11.15] - 2026-11-15
|
|
4
57
|
|
|
5
58
|
### Breaking Changes
|
package/README.md
CHANGED
|
@@ -380,7 +380,7 @@ options object and asynchronous helpers are `await`-able.
|
|
|
380
380
|
| `env(key?, value?)` | Reads all kernel environment values, one value, or sets one value. Includes the session's `PI_*` values (see [Session environment](#session-environment)). |
|
|
381
381
|
| `tool.<name>(args)` | Invokes an active Senpi tool through the normal `pi.executeTool` pipeline and returns `{ text, images?, details?, hasError? }` in every kernel; image blocks arrive as `images[i] = { mimeType, dataBase64 }`. |
|
|
382
382
|
| `packages.install(manager, requirements, {timeout?})` (js, py) | The `%pip install` (py, manager `"pip"`) or `%bun add` / `%npm add` (js, `"bun"` / `"npm"`) installer as a call: same session environment, receipt (`py`: manager, mode, root, revision, requested, resolved, changed; `js`: installer, mode, revision, added, shadowed), cancellation by `stop` and `environment_install_*` codes; `timeout` defaults to 600 seconds and fails with `environment_install_timeout`. Python: `packages.install("pip", [...], timeout=...)`. |
|
|
383
|
-
| `tool_schema(name?)` | Returns a tool
|
|
383
|
+
| `tool_schema(name?)` | Returns `{ name, description, parameters }` for a tool without calling it; omit `name` to get `{ tools: [every tool name] }`. Five virtual entries document codemode itself on demand and are never listed: `eval:wait`, `eval:helpers`, `eval:kernel-tools`, `eval:environments` (the `%pip`, `%bun`/`%npm`, `%environment` and `%load` magics, their results and error codes) and `eval:isolation` (`isolate: true` cells, their limits and error codes). |
|
|
384
384
|
| `require(specifier)`, `createRequire(path)` (js) | CommonJS loading inside a cell, resolved like `import`: builtins (with or without `node:`), relative files and JSON from the cell's directory, bare packages from the session's project and then its managed package environment (`%bun add`/`%npm add`). A missing module raises the runtime's own `MODULE_NOT_FOUND` error. Like Node's `require`, it carries `require.resolve` (the same lookup the call uses, so both name the same copy; builtins resolve to the runtime's own id), `require.resolve.paths` and `require.cache` (the runtime's CommonJS cache). |
|
|
385
385
|
| `tool(fn, metadata?)` (js) | Registers a named function as a kernel tool for in-process children. `metadata.name` registers it under that name instead of the function's; arguments are still passed in the function's parameter order. |
|
|
386
386
|
| `tool.defined()` / `tool.undefine(name)` (js) | List the kernel tools this kernel defines (sorted), and remove one (`true` if it existed). A descriptor taken before `undefine` can no longer be invoked. Both names are reserved: a kernel tool can't be registered as `defined` or `undefine` (`reserved_tool_name`), and a host tool with either name is shadowed in the `tool` namespace, so it can't be called from a JavaScript cell. |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@code-yeongyu/senpi-codemode",
|
|
3
|
-
"version": "2026.11.
|
|
3
|
+
"version": "2026.11.17",
|
|
4
4
|
"description": "Source-only senpi extension package for codemode evaluation tools",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -33,16 +33,16 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@babel/parser": "8.0.4",
|
|
36
|
-
"@earendil-works/pi-ai": "npm:@code-yeongyu/senpi-ai@2026.11.
|
|
37
|
-
"@earendil-works/pi-realm-registry": "npm:@code-yeongyu/senpi-realm-registry@2026.11.
|
|
36
|
+
"@earendil-works/pi-ai": "npm:@code-yeongyu/senpi-ai@2026.11.17",
|
|
37
|
+
"@earendil-works/pi-realm-registry": "npm:@code-yeongyu/senpi-realm-registry@2026.11.17",
|
|
38
38
|
"quickjs-wasi": "3.6.2",
|
|
39
39
|
"typebox": "1.3.34"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"@code-yeongyu/senpi": "2026.11.
|
|
42
|
+
"@code-yeongyu/senpi": "2026.11.17"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@code-yeongyu/senpi": "2026.11.
|
|
45
|
+
"@code-yeongyu/senpi": "2026.11.17"
|
|
46
46
|
},
|
|
47
47
|
"keywords": [
|
|
48
48
|
"senpi",
|
|
@@ -14,6 +14,7 @@ export interface EvalSchemaToolInfo {
|
|
|
14
14
|
readonly name: string;
|
|
15
15
|
readonly description?: string | undefined;
|
|
16
16
|
readonly exposure?: string | undefined;
|
|
17
|
+
readonly evalOnly?: boolean | undefined;
|
|
17
18
|
readonly parameters?: unknown;
|
|
18
19
|
readonly kernelPrelude?: KernelPreludeContribution | undefined;
|
|
19
20
|
}
|
|
@@ -21,6 +21,8 @@ export interface EvalNotifierDeps {
|
|
|
21
21
|
) => void;
|
|
22
22
|
readonly getContext: () => ExtensionContext | undefined;
|
|
23
23
|
readonly getMode: () => EvalNotifyMode;
|
|
24
|
+
/** On a hand (`pi.isLoopRemote()`), the loop that receives a notice applies the session guards, not this side. */
|
|
25
|
+
readonly loopRemote?: () => boolean;
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
/** Session-scoped completion injector with the same no-spin guards as terminal notifications. */
|
|
@@ -40,8 +42,10 @@ export class EvalNotifier implements EvalDetachedCellNotifier {
|
|
|
40
42
|
notify(cells: readonly EvalDetachedCellNotification[]): void {
|
|
41
43
|
const mode = this.#deps.getMode();
|
|
42
44
|
if (mode === "off") return;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
+
if (this.#deps.loopRemote?.() !== true) {
|
|
46
|
+
const ctx = this.#deps.getContext();
|
|
47
|
+
if (ctx === undefined || NON_INTERACTIVE_MODES.has(ctx.mode) || ctx.model === undefined) return;
|
|
48
|
+
}
|
|
45
49
|
const pending = cells.filter((cell) => !this.#notified.has(cell.cellId));
|
|
46
50
|
if (pending.length === 0) return;
|
|
47
51
|
for (const cell of pending) this.#notified.add(cell.cellId);
|
|
@@ -14,9 +14,15 @@ export function activeKernelPreludes(pi: ToolRegistry): readonly KernelPreludeCo
|
|
|
14
14
|
return pi.getAllTools().flatMap((tool) => (tool.kernelPrelude && active.has(tool.name) ? [tool.kernelPrelude] : []));
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
/**
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Identity of the registry-derived parts of the eval description (contribution doc lines and the eval-only tool
|
|
19
|
+
* names); the eval tool re-registers only when it changes.
|
|
20
|
+
*/
|
|
21
|
+
export function evalDescriptionKey(
|
|
22
|
+
preludes: readonly KernelPreludeContribution[],
|
|
23
|
+
evalOnlyTools: readonly string[],
|
|
24
|
+
): string {
|
|
25
|
+
return JSON.stringify([preludes.map((prelude) => prelude.documentation), evalOnlyTools]);
|
|
20
26
|
}
|
|
21
27
|
|
|
22
28
|
/**
|
|
@@ -19,6 +19,11 @@ export function reachableToolNames(pi: ReachableToolRegistry): Set<string> {
|
|
|
19
19
|
return names;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
/** The tools the session withholds from the model and routes through eval only, in registration order (senpi#6886). */
|
|
23
|
+
export function evalOnlyToolNames(pi: ReachableToolRegistry): string[] {
|
|
24
|
+
return registeredTools(pi).flatMap((tool) => (tool.evalOnly === true ? [tool.name] : []));
|
|
25
|
+
}
|
|
26
|
+
|
|
22
27
|
// The loader's registry methods throw until the runtime binds (the dedupe probe in
|
|
23
28
|
// coding-agent's codemode-builtin-dedupe.test.ts registers eval before that point); an
|
|
24
29
|
// unreadable registry adds nothing, like promptKernelPreludes.
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
type ExtensionContext,
|
|
4
4
|
readKillGuardSetting,
|
|
5
5
|
withBundledBunCommands,
|
|
6
|
+
withCredentialProxy,
|
|
6
7
|
} from "@code-yeongyu/senpi";
|
|
7
8
|
import type { AgentExecuteTool } from "../bridges/agent-bridge.ts";
|
|
8
9
|
import type { EvalSchemaToolInfo } from "../bridges/schema-bridge.ts";
|
|
@@ -100,7 +101,7 @@ export async function createRuntime(
|
|
|
100
101
|
// The kill guard's runtime layer (senpi#5349): kernels and their children get the shims first on PATH and
|
|
101
102
|
// bash's BASH_ENV wrapper, as the bash tool does.
|
|
102
103
|
const killGuardEnv = killGuard ? activeKillGuardEnvironment({ ...process.env, ...pathEntry }) : {};
|
|
103
|
-
const sessionEnv = { ...sessionEnvironmentFrom(ctx), ...pathEntry, ...killGuardEnv };
|
|
104
|
+
const sessionEnv = { ...sessionEnvironmentFrom(ctx), ...pathEntry, ...killGuardEnv, ...withheldCredentialEntries() };
|
|
104
105
|
const configuredPoolWidth = settings.parallelPoolWidth;
|
|
105
106
|
const parallelPoolWidth = Number.isFinite(configuredPoolWidth) ? Math.max(1, Math.trunc(configuredPoolWidth)) : 1;
|
|
106
107
|
const pythonEnvironments =
|
|
@@ -194,6 +195,15 @@ function bundledBunPathEntry(): Record<string, string> {
|
|
|
194
195
|
return value === undefined ? {} : { [pathKey]: value };
|
|
195
196
|
}
|
|
196
197
|
|
|
198
|
+
// senpi#6820: kernels and their children get the bash tool's view of declared credentials (a placeholder plus the
|
|
199
|
+
// proxy route). The session environment overrides each kernel's inherited environment, so the value never reaches one.
|
|
200
|
+
function withheldCredentialEntries(): Record<string, string> {
|
|
201
|
+
const entries: Record<string, string> = {};
|
|
202
|
+
for (const [name, value] of Object.entries(withCredentialProxy(process.env)))
|
|
203
|
+
if (value !== undefined && value !== process.env[name]) entries[name] = value;
|
|
204
|
+
return entries;
|
|
205
|
+
}
|
|
206
|
+
|
|
197
207
|
function sessionIdFrom(event: unknown): string {
|
|
198
208
|
if (typeof event === "object" && event !== null && "sessionId" in event && typeof event.sessionId === "string") {
|
|
199
209
|
return event.sessionId;
|
package/src/index.ts
CHANGED
|
@@ -15,7 +15,8 @@ import { type EvalNotificationContent, EvalNotifier } from "./extension/eval-not
|
|
|
15
15
|
import { EVAL_CELLS_STATUS_KEY } from "./extension/eval-status.ts";
|
|
16
16
|
import { EvalStatusTicker } from "./extension/eval-status-ticker.ts";
|
|
17
17
|
import { hostLine, modelIdFrom } from "./extension/host-facts.ts";
|
|
18
|
-
import { activeKernelPreludes,
|
|
18
|
+
import { activeKernelPreludes, evalDescriptionKey, promptKernelPreludes } from "./extension/kernel-preludes.ts";
|
|
19
|
+
import { evalOnlyToolNames } from "./extension/reachable-tools.ts";
|
|
19
20
|
import { registerRemovedToolHints } from "./extension/removed-tool-hints.ts";
|
|
20
21
|
import {
|
|
21
22
|
createExecuteTool,
|
|
@@ -61,6 +62,8 @@ export interface CodemodeExtensionAPI {
|
|
|
61
62
|
message: { customType: string; content: EvalNotificationContent; display: boolean },
|
|
62
63
|
options?: { triggerTurn?: boolean; deliverAs?: "steer" | "followUp" | "nextTurn" },
|
|
63
64
|
): void;
|
|
65
|
+
/** True on a hand whose loop runs elsewhere (senpi H3); a host without it is never one. */
|
|
66
|
+
isLoopRemote?(): boolean;
|
|
64
67
|
/** Optional host event bus; a host without one turns extension event emission into a harmless no-op. */
|
|
65
68
|
events?: { emit(name: string, data: unknown): void };
|
|
66
69
|
/** Optional host RPC surface for forwarding extension-owned events to connected clients. */
|
|
@@ -99,11 +102,12 @@ export default function senpiCodemode(pi: CodemodeExtensionAPI, options: SenpiCo
|
|
|
99
102
|
let activeCells: EvalDetachedCellManager | undefined;
|
|
100
103
|
let activeHandles: HandleRegistry | undefined;
|
|
101
104
|
registerEvalCellsRpc(pi.rpc, () => activeCells);
|
|
102
|
-
let
|
|
105
|
+
let promptDocsKey = "";
|
|
103
106
|
const notifier = new EvalNotifier({
|
|
104
107
|
sendMessage: (message, notifyOptions) => pi.sendMessage(message, notifyOptions),
|
|
105
108
|
getContext: () => activeContext,
|
|
106
109
|
getMode: () => "wake",
|
|
110
|
+
loopRemote: () => pi.isLoopRemote?.() === true,
|
|
107
111
|
});
|
|
108
112
|
const statusTicker = new EvalStatusTicker({
|
|
109
113
|
...(options.now === undefined ? {} : { now: options.now }),
|
|
@@ -146,7 +150,8 @@ export default function senpiCodemode(pi: CodemodeExtensionAPI, options: SenpiCo
|
|
|
146
150
|
// a tool we cannot confirm"; session_start / model_select re-register once it is live.
|
|
147
151
|
const monitor = monitorIsRegistered(pi);
|
|
148
152
|
const preludes = promptKernelPreludes(pi);
|
|
149
|
-
|
|
153
|
+
const evalOnlyTools = evalOnlyToolNames(pi);
|
|
154
|
+
promptDocsKey = evalDescriptionKey(preludes, evalOnlyTools);
|
|
150
155
|
pi.registerTool(
|
|
151
156
|
withStartRecovery(
|
|
152
157
|
recovery,
|
|
@@ -176,6 +181,7 @@ export default function senpiCodemode(pi: CodemodeExtensionAPI, options: SenpiCo
|
|
|
176
181
|
runtimes: runtime.runtimes,
|
|
177
182
|
kernelPreludes: () => activeKernelPreludes(pi),
|
|
178
183
|
promptKernelPreludes: preludes,
|
|
184
|
+
evalOnlyTools,
|
|
179
185
|
...(bunSkillPath === undefined ? {} : { bunSkillPath }),
|
|
180
186
|
...(modelId === undefined ? {} : { modelId }),
|
|
181
187
|
}),
|
|
@@ -287,13 +293,13 @@ export default function senpiCodemode(pi: CodemodeExtensionAPI, options: SenpiCo
|
|
|
287
293
|
if (cellManager === undefined || handles === undefined) return;
|
|
288
294
|
registerEvalForRuntime(runtime, modelId, cellManager, handles);
|
|
289
295
|
});
|
|
290
|
-
// Tool activation has no event of its own; the next turn re-documents a changed contribution set.
|
|
296
|
+
// Tool activation has no event of its own; the next turn re-documents a changed contribution or eval-only set.
|
|
291
297
|
pi.on("turn_start", async () => {
|
|
292
298
|
const runtime = activeRuntime;
|
|
293
299
|
const cellManager = activeCells;
|
|
294
300
|
const handles = activeHandles;
|
|
295
301
|
if (runtime === undefined || cellManager === undefined || handles === undefined) return;
|
|
296
|
-
if (
|
|
302
|
+
if (evalDescriptionKey(promptKernelPreludes(pi), evalOnlyToolNames(pi)) === promptDocsKey) return;
|
|
297
303
|
registerEvalForRuntime(runtime, activeModelId, cellManager, handles);
|
|
298
304
|
});
|
|
299
305
|
}
|
|
@@ -172,12 +172,12 @@ function capturedSpawnSync(originalSpawnSync, pinEnv, guard) {
|
|
|
172
172
|
if (!pinEnv) return originalSpawnSync(...args);
|
|
173
173
|
const [first, second] = args;
|
|
174
174
|
if (Array.isArray(first)) {
|
|
175
|
-
const spawnOptions = second
|
|
176
|
-
if (
|
|
175
|
+
const spawnOptions = second ?? {};
|
|
176
|
+
if (typeof spawnOptions !== "object" || spawnOptions.env != null)
|
|
177
177
|
return originalSpawnSync(...args);
|
|
178
178
|
return originalSpawnSync(first, { ...spawnOptions, env: { ...process.env } });
|
|
179
179
|
}
|
|
180
|
-
if (first !== null && typeof first === "object" && first.env
|
|
180
|
+
if (first !== null && typeof first === "object" && first.env == null)
|
|
181
181
|
return originalSpawnSync({ ...first, env: { ...process.env } });
|
|
182
182
|
return originalSpawnSync(...args);
|
|
183
183
|
};
|
|
@@ -192,19 +192,30 @@ function capturedSpawn(originalSpawn, options, pinEnv, guard) {
|
|
|
192
192
|
return (...args) => {
|
|
193
193
|
assertCellLive();
|
|
194
194
|
judgeSpawn(guard, args[0]);
|
|
195
|
-
if (!options.isActive()) return originalSpawn(...args);
|
|
196
195
|
const [first, second] = args;
|
|
196
|
+
// The pinned environment applies whether or not a cell is running: a spawn from a timer or callback after its cell
|
|
197
|
+
// settled would otherwise inherit the OS environ, which still holds withheld credentials (senpi#6820).
|
|
198
|
+
if (!options.isActive()) {
|
|
199
|
+
if (!pinEnv) return originalSpawn(...args);
|
|
200
|
+
if (Array.isArray(first)) {
|
|
201
|
+
const spawnOptions = second ?? {};
|
|
202
|
+
return spawnOptions.env == null ? originalSpawn(first, { ...spawnOptions, env: { ...process.env } }) : originalSpawn(...args);
|
|
203
|
+
}
|
|
204
|
+
return first !== null && typeof first === "object" && first.env == null
|
|
205
|
+
? originalSpawn({ ...first, env: { ...process.env } })
|
|
206
|
+
: originalSpawn(...args);
|
|
207
|
+
}
|
|
197
208
|
let child;
|
|
198
209
|
if (Array.isArray(first)) {
|
|
199
|
-
const spawnOptions = second
|
|
200
|
-
const effective = pinEnv && spawnOptions.env
|
|
210
|
+
const spawnOptions = second ?? {};
|
|
211
|
+
const effective = pinEnv && spawnOptions.env == null ? { ...spawnOptions, env: { ...process.env } } : spawnOptions;
|
|
201
212
|
child = needsStderrCapture(effective)
|
|
202
213
|
? drainStderr(originalSpawn(first, { ...effective, stderr: "pipe" }), options.emitText)
|
|
203
214
|
: effective === spawnOptions
|
|
204
215
|
? originalSpawn(...args)
|
|
205
216
|
: originalSpawn(first, effective);
|
|
206
217
|
} else {
|
|
207
|
-
const effective = pinEnv && first !== null && typeof first === "object" && first.env
|
|
218
|
+
const effective = pinEnv && first !== null && typeof first === "object" && first.env == null ? { ...first, env: { ...process.env } } : first;
|
|
208
219
|
child = needsStderrCapture(effective)
|
|
209
220
|
? drainStderr(originalSpawn({ ...effective, stderr: "pipe" }), options.emitText)
|
|
210
221
|
: effective === first
|
|
@@ -52,8 +52,9 @@ env(key?=None, value?=None) → str | None | dict
|
|
|
52
52
|
Task/agent output by id. Reads immediately: running tasks return their status; \`format\` \`"raw"\` = full, \`"tail"\` = trailing.
|
|
53
53
|
{{/if}}tool.<name>(args) → { text, images?, details?, hasError? }
|
|
54
54
|
Invoke any session tool; image results (e.g. \`tool.read\` on a png) arrive in \`images[i]\` as { mimeType, dataBase64 }.
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
{{#if evalOnlyTools}} Eval-only tools (absent from your direct tool list, reachable only here): {{evalOnlyTools}}.
|
|
56
|
+
{{/if}}tool_schema(name?) → dict
|
|
57
|
+
{ name, description, parameters } of a tool; omit \`name\` → { tools: [every tool name] }; a failed \`tool.<name>()\` call also returns the expected parameters.
|
|
57
58
|
completion(prompt, model?="default", system?=None, schema?=None) → str | dict
|
|
58
59
|
Oneshot, stateless. \`model\`: \`"smol"\` fast | \`"default"\` session | \`"slow"\` most capable. \`schema\` (JSON-Schema) → parsed structured output.
|
|
59
60
|
{{#if spawns}}agent(prompt, agent?="{{spawnDefaultAgent}}", model?=None, label?=None, schema?=None, isolated?=None, apply?=None, merge?=None, handle?=False) → str | dict
|
|
@@ -40,6 +40,8 @@ export interface EvalPromptOptions {
|
|
|
40
40
|
readonly maxDetachedCells?: number;
|
|
41
41
|
/** Active tools' kernel globals; each documentation line joins the prelude helper list. */
|
|
42
42
|
readonly kernelPreludes?: readonly KernelPreludeContribution[];
|
|
43
|
+
/** Tools withheld from the model's direct list and reachable only as `tool.<name>(...)` in a cell (senpi#6886). */
|
|
44
|
+
readonly evalOnlyTools?: readonly string[];
|
|
43
45
|
}
|
|
44
46
|
|
|
45
47
|
/** Prompt dialect for the eval-first batching emphasis. */
|
|
@@ -113,6 +115,7 @@ export function buildEvalPrompt(
|
|
|
113
115
|
runBudgetSeconds: String(options.runBudgetSeconds ?? DEFAULT_RUN_BUDGET_SECONDS),
|
|
114
116
|
maxDetachedCells: String(options.maxDetachedCells ?? DEFAULT_MAX_DETACHED_CELLS),
|
|
115
117
|
kernelPreludeDocs: (options.kernelPreludes ?? []).map((prelude) => prelude.documentation).join("\n"),
|
|
118
|
+
evalOnlyTools: (options.evalOnlyTools ?? []).join(", "),
|
|
116
119
|
};
|
|
117
120
|
const rendered = renderTemplate(EVAL_PROMPT_TEMPLATE, context)
|
|
118
121
|
.replace(/\n{3,}/g, "\n\n")
|
|
@@ -77,6 +77,8 @@ export interface CreateEvalToolOptions {
|
|
|
77
77
|
readonly jsEnvironments?: JsEnvironments;
|
|
78
78
|
/** Contributions whose documentation lines the description lists; snapshot taken when the tool is (re)registered. */
|
|
79
79
|
readonly promptKernelPreludes?: readonly KernelPreludeContribution[];
|
|
80
|
+
/** Tools the session reaches only through eval; the description names them. Snapshot taken at (re)registration. */
|
|
81
|
+
readonly evalOnlyTools?: readonly string[];
|
|
80
82
|
}
|
|
81
83
|
|
|
82
84
|
export interface EvalCellInvocation {
|
package/src/tool/eval-tool.ts
CHANGED
|
@@ -67,6 +67,7 @@ export function createEvalTool(options: CreateEvalToolOptions) {
|
|
|
67
67
|
...(options.runtimes?.js === undefined ? {} : { jsRuntime: options.runtimes.js }),
|
|
68
68
|
...(options.bunSkillPath === undefined ? {} : { bunSkillPath: options.bunSkillPath }),
|
|
69
69
|
...(options.promptKernelPreludes === undefined ? {} : { kernelPreludes: options.promptKernelPreludes }),
|
|
70
|
+
...(options.evalOnlyTools === undefined ? {} : { evalOnlyTools: options.evalOnlyTools }),
|
|
70
71
|
});
|
|
71
72
|
const languages = enabledLanguageList(options.enabledLanguages);
|
|
72
73
|
registerEvalArgumentValidator(parameters, languages);
|