neoctl 0.2.38 → 0.2.39
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/context/context-manager.js +2 -1
- package/dist/context/context-manager.js.map +1 -1
- package/dist/context/prompt-config.test.js +4 -0
- package/dist/context/prompt-config.test.js.map +1 -1
- package/dist/context/prompts.d.ts +3 -0
- package/dist/context/prompts.js +10 -4
- package/dist/context/prompts.js.map +1 -1
- package/dist/context/system.md +1 -1
- package/dist/core/query-engine.d.ts +5 -2
- package/dist/core/query-engine.js +31 -13
- package/dist/core/query-engine.js.map +1 -1
- package/dist/core/query.js +2 -2
- package/dist/core/query.js.map +1 -1
- package/dist/core/session-prompt-inheritance.test.d.ts +1 -0
- package/dist/core/session-prompt-inheritance.test.js +132 -0
- package/dist/core/session-prompt-inheritance.test.js.map +1 -0
- package/dist/core/session-settings-prompt.d.ts +12 -4
- package/dist/core/session-settings-prompt.js +50 -27
- package/dist/core/session-settings-prompt.js.map +1 -1
- package/dist/core/session-settings-prompt.test.js +31 -22
- package/dist/core/session-settings-prompt.test.js.map +1 -1
- package/dist/plugins/plugin-system.js +3 -0
- package/dist/plugins/plugin-system.js.map +1 -1
- package/dist/session/session-export.d.ts +4 -0
- package/dist/session/session-export.js.map +1 -1
- package/dist/session/session-store.js +4 -6
- package/dist/session/session-store.js.map +1 -1
- package/dist/web/index.d.ts +5 -1
- package/dist/web/index.js +28 -6
- package/dist/web/index.js.map +1 -1
- package/dist/web/session-prompt-integration.test.js +1 -1
- package/dist/web/session-prompt-integration.test.js.map +1 -1
- package/docs/prompt-config.md +19 -4
- package/package.json +1 -1
package/dist/web/index.js
CHANGED
|
@@ -194,6 +194,14 @@ export async function createWebRuntime(options = {}) {
|
|
|
194
194
|
modelGateway,
|
|
195
195
|
tools,
|
|
196
196
|
contextManagerFactory: (cwd) => new DefaultContextManager({ cwd }),
|
|
197
|
+
refreshTools: () => {
|
|
198
|
+
if (!options.resolveGlobalToolOverrides)
|
|
199
|
+
return;
|
|
200
|
+
if (runtime)
|
|
201
|
+
refreshGlobalToolOverrides(runtime);
|
|
202
|
+
else
|
|
203
|
+
applyToolOverrides(tools, toolCatalog, normalizeToolOverrides(options.resolveGlobalToolOverrides(), toolCatalog), sessionToolOverrides);
|
|
204
|
+
},
|
|
197
205
|
additionalPromptSections: [
|
|
198
206
|
...(options.externalPromptSections ?? []),
|
|
199
207
|
...activePlugins.flatMap((plugin) => plugin.promptSections ?? []),
|
|
@@ -242,6 +250,7 @@ export async function createWebRuntime(options = {}) {
|
|
|
242
250
|
globalOverrides: globalToolOverrides,
|
|
243
251
|
sessionOverrides: sessionToolOverrides,
|
|
244
252
|
persistGlobal: options.persistGlobalToolOverrides,
|
|
253
|
+
resolveGlobal: options.resolveGlobalToolOverrides,
|
|
245
254
|
persistSession: options.persistSessionToolOverrides,
|
|
246
255
|
resolveSession: options.resolveSessionToolOverrides,
|
|
247
256
|
},
|
|
@@ -279,6 +288,14 @@ function applyToolOverrides(registry, catalog, globalOverrides, sessionOverrides
|
|
|
279
288
|
for (const tool of catalog)
|
|
280
289
|
registry.setEnabled(tool.name, sessionOverrides[tool.name] ?? globalOverrides[tool.name] ?? true);
|
|
281
290
|
}
|
|
291
|
+
/** Called only at a safe turn boundary or while idle, never during tool execution. */
|
|
292
|
+
export function refreshGlobalToolOverrides(runtime) {
|
|
293
|
+
const support = runtime.toolSupport;
|
|
294
|
+
if (!support?.resolveGlobal)
|
|
295
|
+
return;
|
|
296
|
+
support.globalOverrides = normalizeToolOverrides(support.resolveGlobal(), support.catalog);
|
|
297
|
+
applyToolOverrides(runtime.tools, support.catalog, support.globalOverrides, support.sessionOverrides);
|
|
298
|
+
}
|
|
282
299
|
/** Bind only the foreground view; never stop work owned by another session. */
|
|
283
300
|
export function activateSession(runtime) {
|
|
284
301
|
const sessionDir = runtime.engine.snapshot().session?.sessionDir || undefined;
|
|
@@ -561,6 +578,7 @@ export class WebRepl {
|
|
|
561
578
|
};
|
|
562
579
|
}
|
|
563
580
|
globalTools() {
|
|
581
|
+
this.runtime.engine.refreshToolsIfIdle();
|
|
564
582
|
const support = this.runtime.toolSupport;
|
|
565
583
|
if (!support)
|
|
566
584
|
return { items: [] };
|
|
@@ -572,6 +590,7 @@ export class WebRepl {
|
|
|
572
590
|
};
|
|
573
591
|
}
|
|
574
592
|
sessionTools() {
|
|
593
|
+
this.runtime.engine.refreshToolsIfIdle();
|
|
575
594
|
const support = this.runtime.toolSupport;
|
|
576
595
|
const sessionId = this.runtime.engine.snapshot().session?.sessionId;
|
|
577
596
|
if (!support)
|
|
@@ -608,11 +627,12 @@ export class WebRepl {
|
|
|
608
627
|
if (!normalized.ok)
|
|
609
628
|
return normalized;
|
|
610
629
|
try {
|
|
630
|
+
// Persist before publishing so a failed write never changes active capabilities.
|
|
631
|
+
if (support.persistGlobal)
|
|
632
|
+
await support.persistGlobal(normalized.value);
|
|
611
633
|
support.globalOverrides = normalized.value;
|
|
612
634
|
this.syncPluginToolRegistration();
|
|
613
635
|
applyToolOverrides(this.runtime.tools, support.catalog, support.globalOverrides, support.sessionOverrides);
|
|
614
|
-
if (support.persistGlobal)
|
|
615
|
-
await support.persistGlobal(support.globalOverrides);
|
|
616
636
|
await this.refreshToolConfiguration();
|
|
617
637
|
return { ok: true, state: this.globalTools() };
|
|
618
638
|
}
|
|
@@ -710,12 +730,14 @@ export class WebRepl {
|
|
|
710
730
|
const support = this.runtime.toolSupport;
|
|
711
731
|
if (!support)
|
|
712
732
|
return;
|
|
713
|
-
|
|
714
|
-
this.syncPluginToolRegistration();
|
|
715
|
-
applyToolOverrides(this.runtime.tools, support.catalog, support.globalOverrides, support.sessionOverrides);
|
|
733
|
+
const normalized = normalizeToolOverrides(overrides, support.catalog);
|
|
716
734
|
const sessionId = this.runtime.engine.snapshot().session?.sessionId;
|
|
717
735
|
if (persist && sessionId && support.persistSession)
|
|
718
|
-
await support.persistSession(sessionId,
|
|
736
|
+
await support.persistSession(sessionId, normalized);
|
|
737
|
+
support.sessionOverrides = normalized;
|
|
738
|
+
this.runtime.engine.refreshToolsIfIdle();
|
|
739
|
+
this.syncPluginToolRegistration();
|
|
740
|
+
applyToolOverrides(this.runtime.tools, support.catalog, support.globalOverrides, support.sessionOverrides);
|
|
719
741
|
await this.refreshToolConfiguration();
|
|
720
742
|
}
|
|
721
743
|
syncPluginToolRegistration() {
|