Files
gemini-cli/packages/core/src/context/sidecar/schema.ts
T

100 lines
2.8 KiB
TypeScript
Raw Normal View History

2026-04-06 21:10:58 +00:00
/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
2026-04-07 04:03:54 +00:00
import type { ProcessorRegistry } from './registry.js';
2026-04-06 21:10:58 +00:00
import './builtins.js';
2026-04-07 03:58:50 +00:00
export function getSidecarConfigSchema(registry: ProcessorRegistry) {
return {
$schema: "http://json-schema.org/draft-07/schema#",
title: "SidecarConfig",
description: "The Data-Driven Schema for the Context Manager.",
type: "object",
required: ["budget", "gcBackstop", "pipelines"],
properties: {
budget: {
2026-04-06 21:10:58 +00:00
type: "object",
2026-04-07 03:58:50 +00:00
description: "Defines the token ceilings and limits for the pipeline.",
required: ["retainedTokens", "maxTokens"],
2026-04-06 21:10:58 +00:00
properties: {
2026-04-07 03:58:50 +00:00
retainedTokens: {
type: "number",
description: "The ideal token count the pipeline tries to shrink down to."
2026-04-06 21:10:58 +00:00
},
2026-04-07 03:58:50 +00:00
maxTokens: {
type: "number",
description: "The absolute maximum token count allowed before synchronous truncation kicks in."
}
}
},
gcBackstop: {
type: "object",
description: "Defines what happens when the pipeline fails to compress under 'maxTokens'",
required: ["strategy", "target"],
properties: {
strategy: {
type: "string",
enum: ["truncate", "compress", "rollingSummarizer"]
2026-04-06 21:10:58 +00:00
},
2026-04-07 03:58:50 +00:00
target: {
2026-04-06 21:10:58 +00:00
type: "string",
2026-04-07 03:58:50 +00:00
enum: ["incremental", "freeNTokens", "max"]
2026-04-06 21:10:58 +00:00
},
2026-04-07 03:58:50 +00:00
freeTokensTarget: {
type: "number"
}
}
},
pipelines: {
type: "array",
description: "The execution graphs for context manipulation.",
items: {
type: "object",
required: ["name", "triggers", "execution", "processors"],
properties: {
name: {
type: "string"
},
triggers: {
type: "array",
items: {
anyOf: [
{
type: "string",
enum: ["on_turn", "post_turn", "budget_exceeded"]
},
{
type: "object",
required: ["type", "intervalMs"],
properties: {
type: {
type: "string",
const: "timer"
},
intervalMs: {
type: "number"
}
}
}
]
}
},
execution: {
type: "string",
enum: ["blocking", "background"]
},
processors: {
type: "array",
items: {
oneOf: registry.getSchemas()
}
2026-04-06 21:10:58 +00:00
}
}
}
}
}
2026-04-07 03:58:50 +00:00
};
}