@wrongstack/runtime 0.300.0 → 0.301.0
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/index.js +13 -2
- package/dist/tool-registration.d.ts +9 -1
- package/dist/tool-registration.js +26 -3
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -513,6 +513,7 @@ function makeLightSubagentFactory(deps) {
|
|
|
513
513
|
cwd: subCwd,
|
|
514
514
|
projectRoot: deps.projectRoot,
|
|
515
515
|
tools: allowed,
|
|
516
|
+
catalogTools: allowed,
|
|
516
517
|
model: effModel,
|
|
517
518
|
provider: effProvider,
|
|
518
519
|
subagent: true
|
|
@@ -535,6 +536,7 @@ function makeLightSubagentFactory(deps) {
|
|
|
535
536
|
allowOutsideProjectRoot: config.features?.allowOutsideProjectRoot ?? !(config.tools?.restrictToProjectRoot ?? false),
|
|
536
537
|
model: effModel,
|
|
537
538
|
tools: allowed,
|
|
539
|
+
catalogTools: allowed,
|
|
538
540
|
agentId: agentName,
|
|
539
541
|
agentName,
|
|
540
542
|
traceId: deps.session.traceId
|
|
@@ -607,11 +609,20 @@ function makeLightSubagentFactory(deps) {
|
|
|
607
609
|
return { agent, events };
|
|
608
610
|
};
|
|
609
611
|
}
|
|
612
|
+
var HIDDEN_FROM_SUBAGENTS = /* @__PURE__ */ new Set(["nextsteps"]);
|
|
610
613
|
function filterToolList(registry, allow) {
|
|
611
|
-
const all = registry.list();
|
|
614
|
+
const all = registry.list().filter((t) => !HIDDEN_FROM_SUBAGENTS.has(t.name));
|
|
612
615
|
if (!allow || allow.length === 0) return all;
|
|
613
616
|
const allowSet = new Set(allow);
|
|
614
|
-
|
|
617
|
+
const selected = all.filter((t) => allowSet.has(t.name));
|
|
618
|
+
const selectedNames = new Set(selected.map((tool) => tool.name));
|
|
619
|
+
const missing = [...allowSet].filter(
|
|
620
|
+
(name) => !selectedNames.has(name) && !HIDDEN_FROM_SUBAGENTS.has(name)
|
|
621
|
+
);
|
|
622
|
+
if (missing.length > 0) {
|
|
623
|
+
throw new Error(`Subagent tool contract is not registered: ${missing.sort().join(", ")}`);
|
|
624
|
+
}
|
|
625
|
+
return selected;
|
|
615
626
|
}
|
|
616
627
|
function buildProvider(registry, config, providerId, model) {
|
|
617
628
|
const providerConfig = config.providers?.[providerId] ?? {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ConcreteTokenSavingTier, MemoryPort, Tool, ToolDescriptionModeConfig, ToolResultRenderModeConfig } from '@wrongstack/core/types';
|
|
2
1
|
import type { ToolRegistry } from '@wrongstack/core/registry';
|
|
2
|
+
import type { ConcreteTokenSavingTier, MemoryPort, Tool, ToolDescriptionModeConfig, ToolResultRenderModeConfig } from '@wrongstack/core/types';
|
|
3
3
|
export interface CanonicalHostToolRegistrationOptions {
|
|
4
4
|
registry: ToolRegistry;
|
|
5
5
|
tier: ConcreteTokenSavingTier;
|
|
@@ -9,6 +9,14 @@ export interface CanonicalHostToolRegistrationOptions {
|
|
|
9
9
|
enabled: boolean;
|
|
10
10
|
store?: MemoryPort | null | undefined;
|
|
11
11
|
} | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Opt-in `nextsteps` tool (`tools.nextsteps.enabled`). Off unless the host
|
|
14
|
+
* explicitly enables it, so the default surface is unchanged and the leader
|
|
15
|
+
* keeps producing `<nextsteps>` the way it always has.
|
|
16
|
+
*/
|
|
17
|
+
nextSteps?: {
|
|
18
|
+
enabled: boolean;
|
|
19
|
+
} | undefined;
|
|
12
20
|
descriptionMode?: ToolDescriptionModeConfig | undefined;
|
|
13
21
|
resultRenderMode?: ToolResultRenderModeConfig | undefined;
|
|
14
22
|
disabledTools?: readonly string[] | undefined;
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
// src/tool-registration.ts
|
|
2
2
|
import { applyToolDescriptionModes, applyToolResultRenderModes } from "@wrongstack/core/utils";
|
|
3
3
|
import { createSageTools, getSageService } from "@wrongstack/sage";
|
|
4
|
+
import { nextStepsTool } from "@wrongstack/tools";
|
|
4
5
|
import {
|
|
5
6
|
forgetTool,
|
|
6
7
|
relatedMemoryTool,
|
|
7
8
|
rememberTool,
|
|
8
9
|
searchMemoryTool
|
|
9
10
|
} from "@wrongstack/tools/memory";
|
|
10
|
-
import { registerBuiltinToolTier } from "@wrongstack/tools/tool-tier";
|
|
11
|
+
import { registerBuiltinToolTier, selectBuiltinToolsForTier } from "@wrongstack/tools/tool-tier";
|
|
12
|
+
var DIRECT_LAZY_GATEWAYS = ["tool_search", "tool_use", "tool_help"];
|
|
11
13
|
function registerCanonicalHostTools(options) {
|
|
12
|
-
const
|
|
14
|
+
const catalogBuiltinTools = registerBuiltinToolTier({
|
|
13
15
|
registry: options.registry,
|
|
14
|
-
tier:
|
|
16
|
+
tier: "off"
|
|
15
17
|
});
|
|
18
|
+
const builtinTools = selectBuiltinToolsForTier(options.tier, catalogBuiltinTools);
|
|
16
19
|
if (options.contextTool) options.registry.registerDefault(options.contextTool);
|
|
17
20
|
let memoryBackend = "disabled";
|
|
18
21
|
const memoryStore = options.memory?.store;
|
|
@@ -20,6 +23,10 @@ function registerCanonicalHostTools(options) {
|
|
|
20
23
|
const Sage = getSageService(memoryStore);
|
|
21
24
|
if (Sage) {
|
|
22
25
|
options.registry.registerAllOrThrow(createSageTools(Sage), "sage");
|
|
26
|
+
options.registry.registerAllOrThrow(
|
|
27
|
+
[searchMemoryTool(memoryStore), relatedMemoryTool(memoryStore)],
|
|
28
|
+
"sage-compatibility"
|
|
29
|
+
);
|
|
23
30
|
memoryBackend = "sage";
|
|
24
31
|
} else {
|
|
25
32
|
options.registry.registerAllOrThrow(
|
|
@@ -34,7 +41,23 @@ function registerCanonicalHostTools(options) {
|
|
|
34
41
|
memoryBackend = "legacy";
|
|
35
42
|
}
|
|
36
43
|
}
|
|
44
|
+
if (options.nextSteps?.enabled) options.registry.register(nextStepsTool);
|
|
37
45
|
for (const tool of options.coordinationTools ?? []) options.registry.register(tool);
|
|
46
|
+
if (options.tier !== "off") {
|
|
47
|
+
const directNames = new Set(builtinTools.map((tool) => tool.name));
|
|
48
|
+
for (const name of DIRECT_LAZY_GATEWAYS) directNames.add(name);
|
|
49
|
+
if (options.contextTool) directNames.add(options.contextTool.name);
|
|
50
|
+
if (options.nextSteps?.enabled) directNames.add(nextStepsTool.name);
|
|
51
|
+
for (const tool of options.coordinationTools ?? []) directNames.add(tool.name);
|
|
52
|
+
if (options.memory?.enabled && memoryStore) {
|
|
53
|
+
for (const name of ["remember", "search_memory", "memory_search"]) {
|
|
54
|
+
directNames.add(name);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
options.registry.setProviderToolNames([...directNames]);
|
|
58
|
+
} else {
|
|
59
|
+
options.registry.setProviderToolNames(void 0);
|
|
60
|
+
}
|
|
38
61
|
applyToolDescriptionModes(options.registry, options.descriptionMode);
|
|
39
62
|
applyToolResultRenderModes(options.registry, options.resultRenderMode);
|
|
40
63
|
if (options.disabledTools) options.registry.applyDisabled([...options.disabledTools]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wrongstack/runtime",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.301.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "WrongStack default runtime implementations and host-level composition helpers built on @wrongstack/core.",
|
|
6
6
|
"repository": {
|
|
@@ -64,10 +64,10 @@
|
|
|
64
64
|
"README.md"
|
|
65
65
|
],
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@wrongstack/core": "0.
|
|
68
|
-
"@wrongstack/
|
|
69
|
-
"@wrongstack/
|
|
70
|
-
"@wrongstack/
|
|
67
|
+
"@wrongstack/core": "0.301.0",
|
|
68
|
+
"@wrongstack/sage": "0.301.0",
|
|
69
|
+
"@wrongstack/governance": "0.301.0",
|
|
70
|
+
"@wrongstack/tools": "0.301.0"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@types/node": "^26.1.2",
|