mirror of
https://github.com/anomalyco/opencode.git
synced 2026-09-12 10:34:59 +00:00
fix(core): make namespace inventory optional
This commit is contained in:
parent
e55f53b078
commit
3ac848636d
2 changed files with 3 additions and 3 deletions
|
|
@ -51,7 +51,7 @@ type Tools = {
|
|||
|
||||
export type Inventory = {
|
||||
readonly tools: ReadonlyMap<string, Info>
|
||||
readonly namespaces: ReadonlyMap<string, ToolNamespace>
|
||||
readonly namespaces?: ReadonlyMap<string, ToolNamespace>
|
||||
}
|
||||
|
||||
// Invariant model-facing guidance; the changing tool catalog is delivered through Instructions.
|
||||
|
|
@ -173,7 +173,7 @@ function runtime(
|
|||
) {
|
||||
// A path may carry namespace metadata, a callable tool, child tools, or all three.
|
||||
const root: ToolNode = { children: new Map() }
|
||||
for (const namespace of inventory.namespaces.values()) getNode(root, namespace.name).namespace = namespace
|
||||
for (const namespace of inventory.namespaces?.values() ?? []) getNode(root, namespace.name).namespace = namespace
|
||||
for (const [name, registration] of inventory.tools) {
|
||||
const child = definition(registration)
|
||||
getNode(root, qualifiedName(registration)).tool = Tool.make({
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ const context = {
|
|||
}
|
||||
|
||||
const createCodeMode = (tools: ReadonlyMap<string, Info>) =>
|
||||
CodeModeTool.create({ tools, namespaces: new Map() }, (_, tool, input, context) => execute(tool, input, context))
|
||||
CodeModeTool.create({ tools }, (_, tool, input, context) => execute(tool, input, context))
|
||||
|
||||
test("execute describes invariant Code Mode behavior", () => {
|
||||
expect(createCodeMode(new Map()).description).toBe(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue