comisai 1.0.19 → 1.0.22
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/cli-entry.js +0 -0
- package/node_modules/@comis/agent/dist/context-engine/context-engine.js +43 -2
- package/node_modules/@comis/agent/dist/context-engine/signature-replay-scrubber.d.ts +51 -0
- package/node_modules/@comis/agent/dist/context-engine/signature-replay-scrubber.js +110 -0
- package/node_modules/@comis/agent/dist/context-engine/signature-surrogate-guard.d.ts +54 -0
- package/node_modules/@comis/agent/dist/context-engine/signature-surrogate-guard.js +145 -0
- package/node_modules/@comis/agent/dist/context-engine/types-core.d.ts +17 -0
- package/node_modules/@comis/agent/dist/executor/error-classifier.d.ts +11 -1
- package/node_modules/@comis/agent/dist/executor/error-classifier.js +13 -0
- package/node_modules/@comis/agent/dist/executor/executor-context-engine-setup.d.ts +1 -0
- package/node_modules/@comis/agent/dist/executor/executor-context-engine-setup.js +55 -0
- package/node_modules/@comis/agent/dist/executor/executor-prompt-runner.js +106 -5
- package/node_modules/@comis/agent/dist/executor/executor-tool-assembly.js +1 -0
- package/node_modules/@comis/agent/dist/executor/pi-executor.d.ts +1 -4
- package/node_modules/@comis/agent/dist/executor/replay-drift-detector.d.ts +85 -0
- package/node_modules/@comis/agent/dist/executor/replay-drift-detector.js +92 -0
- package/node_modules/@comis/agent/dist/executor/signature-block-scrubber.d.ts +34 -0
- package/node_modules/@comis/agent/dist/executor/signature-block-scrubber.js +69 -0
- package/node_modules/@comis/agent/dist/executor/signed-replay-detector.d.ts +39 -0
- package/node_modules/@comis/agent/dist/executor/signed-replay-detector.js +72 -0
- package/node_modules/@comis/agent/package.json +1 -1
- package/node_modules/@comis/channels/package.json +1 -1
- package/node_modules/@comis/cli/dist/cli.js +0 -0
- package/node_modules/@comis/cli/package.json +1 -1
- package/node_modules/@comis/core/dist/config/git-manager.js +10 -4
- package/node_modules/@comis/core/dist/config/index.d.ts +1 -0
- package/node_modules/@comis/core/dist/config/index.js +2 -0
- package/node_modules/@comis/core/dist/config/managed-sections.d.ts +67 -0
- package/node_modules/@comis/core/dist/config/managed-sections.js +124 -0
- package/node_modules/@comis/core/dist/config/schema-agent.d.ts +28 -10
- package/node_modules/@comis/core/dist/config/schema-agent.js +6 -0
- package/node_modules/@comis/core/dist/config/schema-gateway.d.ts +2 -2
- package/node_modules/@comis/core/dist/config/schema.d.ts +65 -64
- package/node_modules/@comis/core/dist/event-bus/events-messaging.d.ts +16 -0
- package/node_modules/@comis/core/dist/exports/config.d.ts +1 -1
- package/node_modules/@comis/core/dist/exports/config.js +1 -1
- package/node_modules/@comis/core/package.json +1 -1
- package/node_modules/@comis/daemon/bundled-skills/skill-creator/scripts/init-skill.py +0 -0
- package/node_modules/@comis/daemon/bundled-skills/skill-creator/scripts/validate-skill.py +0 -0
- package/node_modules/@comis/daemon/dist/daemon.js +0 -0
- package/node_modules/@comis/daemon/dist/rpc/config-handlers.js +20 -7
- package/node_modules/@comis/daemon/dist/rpc/session-handlers.js +27 -1
- package/node_modules/@comis/daemon/package.json +1 -1
- package/node_modules/@comis/gateway/package.json +1 -1
- package/node_modules/@comis/infra/package.json +1 -1
- package/node_modules/@comis/memory/package.json +1 -1
- package/node_modules/@comis/scheduler/package.json +1 -1
- package/node_modules/@comis/shared/package.json +1 -1
- package/node_modules/@comis/skills/dist/bridge/tool-metadata-registry.js +23 -8
- package/node_modules/@comis/skills/dist/builtin/platform/gateway-tool.d.ts +1 -1
- package/node_modules/@comis/skills/dist/builtin/platform/gateway-tool.js +18 -14
- package/node_modules/@comis/skills/dist/builtin/platform/unified-session-tool.js +1 -1
- package/node_modules/@comis/skills/package.json +1 -1
- package/node_modules/@comis/web/package.json +1 -1
- package/package.json +24 -26
- package/node_modules/@comis/agent/dist/provider/response/strip-minimax-xml.d.ts +0 -9
- package/node_modules/@comis/agent/dist/provider/response/strip-minimax-xml.js +0 -17
- package/node_modules/@comis/agent/dist/provider/response/strip-model-tokens.d.ts +0 -13
- package/node_modules/@comis/agent/dist/provider/response/strip-model-tokens.js +0 -19
- package/node_modules/@comis/agent/dist/provider/response/strip-tool-text.d.ts +0 -11
- package/node_modules/@comis/agent/dist/provider/response/strip-tool-text.js +0 -32
- package/node_modules/@comis/agent/dist/safety/follow-through-detector.d.ts +0 -46
- package/node_modules/@comis/agent/dist/safety/follow-through-detector.js +0 -76
- package/node_modules/@comis/agent/dist/safety/post-compaction-safety.d.ts +0 -30
- package/node_modules/@comis/agent/dist/safety/post-compaction-safety.js +0 -51
- package/node_modules/@comis/agent/dist/safety/schema-normalizer.d.ts +0 -37
- package/node_modules/@comis/agent/dist/safety/schema-normalizer.js +0 -137
- package/node_modules/@comis/agent/dist/safety/schema-pruning.d.ts +0 -50
- package/node_modules/@comis/agent/dist/safety/schema-pruning.js +0 -112
- package/node_modules/@comis/agent/dist/safety/tool-image-sanitizer.d.ts +0 -43
- package/node_modules/@comis/agent/dist/safety/tool-image-sanitizer.js +0 -96
- package/node_modules/@comis/agent/dist/safety/tool-sanitizer.d.ts +0 -44
- package/node_modules/@comis/agent/dist/safety/tool-sanitizer.js +0 -94
- package/node_modules/@comis/channels/dist/shared/thinking-tag-filter.d.ts +0 -28
- package/node_modules/@comis/channels/dist/shared/thinking-tag-filter.js +0 -206
- package/node_modules/@comis/cli/dist/wizard/config-writer.d.ts +0 -25
- package/node_modules/@comis/cli/dist/wizard/config-writer.js +0 -144
- package/node_modules/@comis/cli/dist/wizard/flow-types.d.ts +0 -48
- package/node_modules/@comis/cli/dist/wizard/flow-types.js +0 -70
- package/node_modules/@comis/cli/dist/wizard/manual-flow.d.ts +0 -21
- package/node_modules/@comis/cli/dist/wizard/manual-flow.js +0 -345
- package/node_modules/@comis/cli/dist/wizard/quickstart-flow.d.ts +0 -21
- package/node_modules/@comis/cli/dist/wizard/quickstart-flow.js +0 -116
- package/node_modules/@comis/core/dist/config/schema-agent-model.d.ts +0 -135
- package/node_modules/@comis/core/dist/config/schema-agent-model.js +0 -114
- package/node_modules/@comis/core/dist/config/schema-agent-session.d.ts +0 -177
- package/node_modules/@comis/core/dist/config/schema-agent-session.js +0 -116
- package/node_modules/@comis/core/dist/config/schema-context-engine.d.ts +0 -92
- package/node_modules/@comis/core/dist/config/schema-context-engine.js +0 -92
- package/node_modules/@comis/core/dist/config/schema-context-guard.d.ts +0 -34
- package/node_modules/@comis/core/dist/config/schema-context-guard.js +0 -32
- package/node_modules/@comis/core/dist/config/schema-delivery-mirror.d.ts +0 -27
- package/node_modules/@comis/core/dist/config/schema-delivery-mirror.js +0 -26
- package/node_modules/@comis/core/dist/config/schema-delivery-queue.d.ts +0 -31
- package/node_modules/@comis/core/dist/config/schema-delivery-queue.js +0 -30
- package/node_modules/@comis/core/dist/config/schema-delivery-timing.d.ts +0 -41
- package/node_modules/@comis/core/dist/config/schema-delivery-timing.js +0 -31
- package/node_modules/@comis/core/dist/config/schema-monitoring.d.ts +0 -105
- package/node_modules/@comis/core/dist/config/schema-monitoring.js +0 -67
- package/node_modules/@comis/core/dist/ports/media-ports.d.ts +0 -278
- package/node_modules/@comis/core/dist/ports/media-ports.js +0 -1
- package/node_modules/@comis/core/dist/security/input-guard.d.ts +0 -46
- package/node_modules/@comis/core/dist/security/input-guard.js +0 -166
- package/node_modules/@comis/core/dist/security/scoped-secret-manager.d.ts +0 -38
- package/node_modules/@comis/core/dist/security/scoped-secret-manager.js +0 -94
- package/node_modules/@comis/daemon/dist/observability/delivery-context.d.ts +0 -37
- package/node_modules/@comis/daemon/dist/observability/delivery-context.js +0 -1
- package/node_modules/@comis/daemon/dist/observability/log-level-manager.d.ts +0 -23
- package/node_modules/@comis/daemon/dist/observability/log-level-manager.js +0 -34
- package/node_modules/@comis/daemon/dist/observability/log-transport.d.ts +0 -44
- package/node_modules/@comis/daemon/dist/observability/log-transport.js +0 -74
- package/node_modules/@comis/daemon/dist/observability/obs-write-buffer.d.ts +0 -53
- package/node_modules/@comis/daemon/dist/observability/obs-write-buffer.js +0 -68
- package/node_modules/@comis/daemon/dist/observability/types.d.ts +0 -6
- package/node_modules/@comis/daemon/dist/observability/types.js +0 -1
- package/node_modules/@comis/daemon/dist/wiring/seed-bundled-skills.d.ts +0 -41
- package/node_modules/@comis/daemon/dist/wiring/seed-bundled-skills.js +0 -84
- package/node_modules/@comis/daemon/dist/wiring/setup-delivery-mirror.d.ts +0 -24
- package/node_modules/@comis/daemon/dist/wiring/setup-delivery-mirror.js +0 -88
- package/node_modules/@comis/daemon/dist/wiring/setup-delivery-queue.d.ts +0 -31
- package/node_modules/@comis/daemon/dist/wiring/setup-delivery-queue.js +0 -132
- package/node_modules/@comis/daemon/dist/wiring/setup-monitoring.d.ts +0 -38
- package/node_modules/@comis/daemon/dist/wiring/setup-monitoring.js +0 -100
- package/node_modules/@comis/daemon/dist/wiring/setup-rpc-bridge.d.ts +0 -34
- package/node_modules/@comis/daemon/dist/wiring/setup-rpc-bridge.js +0 -52
- package/node_modules/@comis/daemon/dist/wiring/setup-task-extraction.d.ts +0 -41
- package/node_modules/@comis/daemon/dist/wiring/setup-task-extraction.js +0 -86
- package/node_modules/@comis/memory/dist/embedding-cache.d.ts +0 -36
- package/node_modules/@comis/memory/dist/embedding-cache.js +0 -94
- package/node_modules/@comis/skills/dist/bridge/tool-output-schemas.d.ts +0 -17
- package/node_modules/@comis/skills/dist/bridge/tool-output-schemas.js +0 -125
- package/node_modules/@comis/skills/dist/bridge/tool-parallelism-metadata.d.ts +0 -14
- package/node_modules/@comis/skills/dist/bridge/tool-parallelism-metadata.js +0 -92
- package/node_modules/@comis/skills/dist/bridge/tool-result-caps.d.ts +0 -14
- package/node_modules/@comis/skills/dist/bridge/tool-result-caps.js +0 -36
- package/node_modules/@comis/skills/dist/bridge/tool-search-hints.d.ts +0 -15
- package/node_modules/@comis/skills/dist/bridge/tool-search-hints.js +0 -68
- package/node_modules/@comis/skills/dist/bridge/tool-validators.d.ts +0 -11
- package/node_modules/@comis/skills/dist/bridge/tool-validators.js +0 -105
- package/node_modules/@comis/skills/dist/builtin/file/find-sort-wrapper.d.ts +0 -22
- package/node_modules/@comis/skills/dist/builtin/file/find-sort-wrapper.js +0 -95
- package/node_modules/@comis/skills/dist/builtin/file/grep-output-mode-wrapper.d.ts +0 -24
- package/node_modules/@comis/skills/dist/builtin/file/grep-output-mode-wrapper.js +0 -167
- package/node_modules/@comis/skills/dist/builtin/task-plan-tool.d.ts +0 -25
- package/node_modules/@comis/skills/dist/builtin/task-plan-tool.js +0 -67
- package/node_modules/@comis/skills/dist/integrations/mcp-tool-bridge.d.ts +0 -75
- package/node_modules/@comis/skills/dist/integrations/mcp-tool-bridge.js +0 -235
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
/**
|
|
3
|
-
* Model selection configuration schemas.
|
|
4
|
-
*
|
|
5
|
-
* Owns budget limits, circuit breaker thresholds, model route overrides,
|
|
6
|
-
* fallback model entries, auth profile rotation, and failover configuration.
|
|
7
|
-
*/
|
|
8
|
-
export declare const BudgetConfigSchema: z.ZodObject<{
|
|
9
|
-
/** Max tokens per single execution */
|
|
10
|
-
perExecution: z.ZodDefault<z.ZodNumber>;
|
|
11
|
-
/** Max tokens per hour (rolling window) */
|
|
12
|
-
perHour: z.ZodDefault<z.ZodNumber>;
|
|
13
|
-
/** Max tokens per day (rolling window) */
|
|
14
|
-
perDay: z.ZodDefault<z.ZodNumber>;
|
|
15
|
-
}, z.core.$strict>;
|
|
16
|
-
export declare const CircuitBreakerConfigSchema: z.ZodObject<{
|
|
17
|
-
/** Number of consecutive failures before opening circuit */
|
|
18
|
-
failureThreshold: z.ZodDefault<z.ZodNumber>;
|
|
19
|
-
/** Milliseconds to wait before attempting recovery */
|
|
20
|
-
resetTimeoutMs: z.ZodDefault<z.ZodNumber>;
|
|
21
|
-
/** Milliseconds for half-open probe timeout */
|
|
22
|
-
halfOpenTimeoutMs: z.ZodDefault<z.ZodNumber>;
|
|
23
|
-
}, z.core.$strict>;
|
|
24
|
-
/**
|
|
25
|
-
* Per-agent model route overrides.
|
|
26
|
-
*
|
|
27
|
-
* Maps task types to specific model identifiers. The `default` key
|
|
28
|
-
* falls back to the agent's top-level `model` field when not set.
|
|
29
|
-
* Additional named routes (e.g. "summarization", "classification")
|
|
30
|
-
* allow task-specific model selection.
|
|
31
|
-
*
|
|
32
|
-
* Uses .catchall(z.string()) for extensibility -- any string key maps
|
|
33
|
-
* to a model identifier string.
|
|
34
|
-
*/
|
|
35
|
-
export declare const ModelRoutesSchema: z.ZodDefault<z.ZodObject<{
|
|
36
|
-
default: z.ZodOptional<z.ZodString>;
|
|
37
|
-
}, z.core.$catchall<z.ZodString>>>;
|
|
38
|
-
/**
|
|
39
|
-
* Schema for a single fallback model entry (provider + modelId pair).
|
|
40
|
-
*/
|
|
41
|
-
export declare const FallbackModelSchema: z.ZodObject<{
|
|
42
|
-
/** LLM provider (e.g. "anthropic", "openai") */
|
|
43
|
-
provider: z.ZodString;
|
|
44
|
-
/** Model identifier at the provider */
|
|
45
|
-
modelId: z.ZodString;
|
|
46
|
-
}, z.core.$strict>;
|
|
47
|
-
/**
|
|
48
|
-
* Schema for an auth profile entry (key name + provider association).
|
|
49
|
-
*
|
|
50
|
-
* Each profile maps a SecretManager key name to a provider, enabling
|
|
51
|
-
* multiple API keys per provider for rotation during rate limiting.
|
|
52
|
-
*/
|
|
53
|
-
export declare const AuthProfileSchema: z.ZodObject<{
|
|
54
|
-
/** Key name in SecretManager (e.g. "ANTHROPIC_API_KEY_2") */
|
|
55
|
-
keyName: z.ZodString;
|
|
56
|
-
/** Provider this key belongs to (e.g. "anthropic") */
|
|
57
|
-
provider: z.ZodString;
|
|
58
|
-
}, z.core.$strict>;
|
|
59
|
-
/**
|
|
60
|
-
* Model failover configuration schema.
|
|
61
|
-
*
|
|
62
|
-
* Controls automatic model failover behavior, auth profile rotation
|
|
63
|
-
* with exponential cooldowns, and model allowlisting.
|
|
64
|
-
*/
|
|
65
|
-
export declare const ModelFailoverConfigSchema: z.ZodObject<{
|
|
66
|
-
/** Ordered list of fallback models to try when primary fails */
|
|
67
|
-
fallbackModels: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
68
|
-
/** LLM provider (e.g. "anthropic", "openai") */
|
|
69
|
-
provider: z.ZodString;
|
|
70
|
-
/** Model identifier at the provider */
|
|
71
|
-
modelId: z.ZodString;
|
|
72
|
-
}, z.core.$strict>>>;
|
|
73
|
-
/** Per-provider API key profiles for auth rotation */
|
|
74
|
-
authProfiles: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
75
|
-
/** Key name in SecretManager (e.g. "ANTHROPIC_API_KEY_2") */
|
|
76
|
-
keyName: z.ZodString;
|
|
77
|
-
/** Provider this key belongs to (e.g. "anthropic") */
|
|
78
|
-
provider: z.ZodString;
|
|
79
|
-
}, z.core.$strict>>>;
|
|
80
|
-
/** Model allowlist (empty = allow all models) */
|
|
81
|
-
allowedModels: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
82
|
-
/** Maximum total attempts across all models/keys */
|
|
83
|
-
maxAttempts: z.ZodDefault<z.ZodNumber>;
|
|
84
|
-
/** Initial cooldown duration in milliseconds (1 min) */
|
|
85
|
-
cooldownInitialMs: z.ZodDefault<z.ZodNumber>;
|
|
86
|
-
/** Exponential cooldown multiplier */
|
|
87
|
-
cooldownMultiplier: z.ZodDefault<z.ZodNumber>;
|
|
88
|
-
/** Maximum cooldown duration in milliseconds (1 hr) */
|
|
89
|
-
cooldownCapMs: z.ZodDefault<z.ZodNumber>;
|
|
90
|
-
}, z.core.$strict>;
|
|
91
|
-
export declare const PromptTimeoutConfigSchema: z.ZodObject<{
|
|
92
|
-
/** Wall-clock timeout for primary prompt calls in milliseconds. Default: 180s. */
|
|
93
|
-
promptTimeoutMs: z.ZodDefault<z.ZodNumber>;
|
|
94
|
-
/** Wall-clock timeout for retry prompt calls in milliseconds. Default: 60s. */
|
|
95
|
-
retryPromptTimeoutMs: z.ZodDefault<z.ZodNumber>;
|
|
96
|
-
}, z.core.$strict>;
|
|
97
|
-
/**
|
|
98
|
-
* Valid operation type keys for model resolution.
|
|
99
|
-
*
|
|
100
|
-
* Named ModelOperationType (not OperationType) to avoid collision with
|
|
101
|
-
* the existing OperationType in packages/daemon/src/observability/latency-recorder.ts.
|
|
102
|
-
*/
|
|
103
|
-
export type ModelOperationType = "interactive" | "cron" | "heartbeat" | "subagent" | "compaction" | "taskExtraction" | "condensation";
|
|
104
|
-
/**
|
|
105
|
-
* Per-operation model override configuration.
|
|
106
|
-
*
|
|
107
|
-
* Each operation type has an optional model field (accepts "provider:modelId"
|
|
108
|
-
* format or "primary" keyword to opt out of tiering) and an optional timeout
|
|
109
|
-
* field (milliseconds, overrides per-operation defaults).
|
|
110
|
-
*
|
|
111
|
-
* When no fields are set (default: {}), the resolver uses provider-family
|
|
112
|
-
* smart defaults for automatic model tiering.
|
|
113
|
-
*/
|
|
114
|
-
export declare const OperationModelsSchema: z.ZodDefault<z.ZodObject<{
|
|
115
|
-
cron: z.ZodOptional<z.ZodString>;
|
|
116
|
-
cronTimeout: z.ZodOptional<z.ZodNumber>;
|
|
117
|
-
heartbeat: z.ZodOptional<z.ZodString>;
|
|
118
|
-
heartbeatTimeout: z.ZodOptional<z.ZodNumber>;
|
|
119
|
-
subagent: z.ZodOptional<z.ZodString>;
|
|
120
|
-
subagentTimeout: z.ZodOptional<z.ZodNumber>;
|
|
121
|
-
compaction: z.ZodOptional<z.ZodString>;
|
|
122
|
-
compactionTimeout: z.ZodOptional<z.ZodNumber>;
|
|
123
|
-
taskExtraction: z.ZodOptional<z.ZodString>;
|
|
124
|
-
taskExtractionTimeout: z.ZodOptional<z.ZodNumber>;
|
|
125
|
-
condensation: z.ZodOptional<z.ZodString>;
|
|
126
|
-
condensationTimeout: z.ZodOptional<z.ZodNumber>;
|
|
127
|
-
}, z.core.$strict>>;
|
|
128
|
-
export type BudgetConfig = z.infer<typeof BudgetConfigSchema>;
|
|
129
|
-
export type CircuitBreakerConfig = z.infer<typeof CircuitBreakerConfigSchema>;
|
|
130
|
-
export type ModelRoutes = z.infer<typeof ModelRoutesSchema>;
|
|
131
|
-
export type FallbackModel = z.infer<typeof FallbackModelSchema>;
|
|
132
|
-
export type AuthProfileEntry = z.infer<typeof AuthProfileSchema>;
|
|
133
|
-
export type ModelFailoverConfig = z.infer<typeof ModelFailoverConfigSchema>;
|
|
134
|
-
export type PromptTimeoutConfig = z.infer<typeof PromptTimeoutConfigSchema>;
|
|
135
|
-
export type OperationModels = z.infer<typeof OperationModelsSchema>;
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
/**
|
|
3
|
-
* Model selection configuration schemas.
|
|
4
|
-
*
|
|
5
|
-
* Owns budget limits, circuit breaker thresholds, model route overrides,
|
|
6
|
-
* fallback model entries, auth profile rotation, and failover configuration.
|
|
7
|
-
*/
|
|
8
|
-
export const BudgetConfigSchema = z.strictObject({
|
|
9
|
-
/** Max tokens per single execution */
|
|
10
|
-
perExecution: z.number().int().positive().default(2_000_000),
|
|
11
|
-
/** Max tokens per hour (rolling window) */
|
|
12
|
-
perHour: z.number().int().positive().default(10_000_000),
|
|
13
|
-
/** Max tokens per day (rolling window) */
|
|
14
|
-
perDay: z.number().int().positive().default(100_000_000),
|
|
15
|
-
});
|
|
16
|
-
export const CircuitBreakerConfigSchema = z.strictObject({
|
|
17
|
-
/** Number of consecutive failures before opening circuit */
|
|
18
|
-
failureThreshold: z.number().int().positive().default(5),
|
|
19
|
-
/** Milliseconds to wait before attempting recovery */
|
|
20
|
-
resetTimeoutMs: z.number().int().positive().default(60_000),
|
|
21
|
-
/** Milliseconds for half-open probe timeout */
|
|
22
|
-
halfOpenTimeoutMs: z.number().int().positive().default(30_000),
|
|
23
|
-
});
|
|
24
|
-
/**
|
|
25
|
-
* Per-agent model route overrides.
|
|
26
|
-
*
|
|
27
|
-
* Maps task types to specific model identifiers. The `default` key
|
|
28
|
-
* falls back to the agent's top-level `model` field when not set.
|
|
29
|
-
* Additional named routes (e.g. "summarization", "classification")
|
|
30
|
-
* allow task-specific model selection.
|
|
31
|
-
*
|
|
32
|
-
* Uses .catchall(z.string()) for extensibility -- any string key maps
|
|
33
|
-
* to a model identifier string.
|
|
34
|
-
*/
|
|
35
|
-
export const ModelRoutesSchema = z
|
|
36
|
-
.object({
|
|
37
|
-
/** Default model for unrouted tasks (falls back to agent.model) */
|
|
38
|
-
default: z.string().min(1).optional(),
|
|
39
|
-
})
|
|
40
|
-
.catchall(z.string())
|
|
41
|
-
.default({});
|
|
42
|
-
/**
|
|
43
|
-
* Schema for a single fallback model entry (provider + modelId pair).
|
|
44
|
-
*/
|
|
45
|
-
export const FallbackModelSchema = z.strictObject({
|
|
46
|
-
/** LLM provider (e.g. "anthropic", "openai") */
|
|
47
|
-
provider: z.string().min(1),
|
|
48
|
-
/** Model identifier at the provider */
|
|
49
|
-
modelId: z.string().min(1),
|
|
50
|
-
});
|
|
51
|
-
/**
|
|
52
|
-
* Schema for an auth profile entry (key name + provider association).
|
|
53
|
-
*
|
|
54
|
-
* Each profile maps a SecretManager key name to a provider, enabling
|
|
55
|
-
* multiple API keys per provider for rotation during rate limiting.
|
|
56
|
-
*/
|
|
57
|
-
export const AuthProfileSchema = z.strictObject({
|
|
58
|
-
/** Key name in SecretManager (e.g. "ANTHROPIC_API_KEY_2") */
|
|
59
|
-
keyName: z.string().min(1),
|
|
60
|
-
/** Provider this key belongs to (e.g. "anthropic") */
|
|
61
|
-
provider: z.string().min(1),
|
|
62
|
-
});
|
|
63
|
-
/**
|
|
64
|
-
* Model failover configuration schema.
|
|
65
|
-
*
|
|
66
|
-
* Controls automatic model failover behavior, auth profile rotation
|
|
67
|
-
* with exponential cooldowns, and model allowlisting.
|
|
68
|
-
*/
|
|
69
|
-
export const ModelFailoverConfigSchema = z.strictObject({
|
|
70
|
-
/** Ordered list of fallback models to try when primary fails */
|
|
71
|
-
fallbackModels: z.array(FallbackModelSchema).default([]),
|
|
72
|
-
/** Per-provider API key profiles for auth rotation */
|
|
73
|
-
authProfiles: z.array(AuthProfileSchema).default([]),
|
|
74
|
-
/** Model allowlist (empty = allow all models) */
|
|
75
|
-
allowedModels: z.array(z.string().min(1)).default([]),
|
|
76
|
-
/** Maximum total attempts across all models/keys */
|
|
77
|
-
maxAttempts: z.number().int().positive().default(6),
|
|
78
|
-
/** Initial cooldown duration in milliseconds (1 min) */
|
|
79
|
-
cooldownInitialMs: z.number().int().positive().default(60_000),
|
|
80
|
-
/** Exponential cooldown multiplier */
|
|
81
|
-
cooldownMultiplier: z.number().positive().default(5),
|
|
82
|
-
/** Maximum cooldown duration in milliseconds (1 hr) */
|
|
83
|
-
cooldownCapMs: z.number().int().positive().default(3_600_000),
|
|
84
|
-
});
|
|
85
|
-
export const PromptTimeoutConfigSchema = z.strictObject({
|
|
86
|
-
/** Wall-clock timeout for primary prompt calls in milliseconds. Default: 180s. */
|
|
87
|
-
promptTimeoutMs: z.number().int().positive().default(180_000),
|
|
88
|
-
/** Wall-clock timeout for retry prompt calls in milliseconds. Default: 60s. */
|
|
89
|
-
retryPromptTimeoutMs: z.number().int().positive().default(60_000),
|
|
90
|
-
});
|
|
91
|
-
/**
|
|
92
|
-
* Per-operation model override configuration.
|
|
93
|
-
*
|
|
94
|
-
* Each operation type has an optional model field (accepts "provider:modelId"
|
|
95
|
-
* format or "primary" keyword to opt out of tiering) and an optional timeout
|
|
96
|
-
* field (milliseconds, overrides per-operation defaults).
|
|
97
|
-
*
|
|
98
|
-
* When no fields are set (default: {}), the resolver uses provider-family
|
|
99
|
-
* smart defaults for automatic model tiering.
|
|
100
|
-
*/
|
|
101
|
-
export const OperationModelsSchema = z.strictObject({
|
|
102
|
-
cron: z.string().min(1).optional(),
|
|
103
|
-
cronTimeout: z.number().int().positive().optional(),
|
|
104
|
-
heartbeat: z.string().min(1).optional(),
|
|
105
|
-
heartbeatTimeout: z.number().int().positive().optional(),
|
|
106
|
-
subagent: z.string().min(1).optional(),
|
|
107
|
-
subagentTimeout: z.number().int().positive().optional(),
|
|
108
|
-
compaction: z.string().min(1).optional(),
|
|
109
|
-
compactionTimeout: z.number().int().positive().optional(),
|
|
110
|
-
taskExtraction: z.string().min(1).optional(),
|
|
111
|
-
taskExtractionTimeout: z.number().int().positive().optional(),
|
|
112
|
-
condensation: z.string().min(1).optional(),
|
|
113
|
-
condensationTimeout: z.number().int().positive().optional(),
|
|
114
|
-
}).default({});
|
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
/**
|
|
3
|
-
* Session lifecycle configuration schemas.
|
|
4
|
-
*
|
|
5
|
-
* Owns session reset policy, DM scope isolation, pruning of oversized
|
|
6
|
-
* tool results, and per-agent compaction thresholds.
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* Per-session-type reset policy override.
|
|
10
|
-
* All fields are optional -- omitted fields inherit from the parent policy.
|
|
11
|
-
*/
|
|
12
|
-
export declare const ResetPolicyOverrideSchema: z.ZodObject<{
|
|
13
|
-
/** Override reset mode for this session type */
|
|
14
|
-
mode: z.ZodOptional<z.ZodEnum<{
|
|
15
|
-
none: "none";
|
|
16
|
-
daily: "daily";
|
|
17
|
-
idle: "idle";
|
|
18
|
-
hybrid: "hybrid";
|
|
19
|
-
}>>;
|
|
20
|
-
/** Override daily reset hour (0-23) */
|
|
21
|
-
dailyResetHour: z.ZodOptional<z.ZodNumber>;
|
|
22
|
-
/** Override IANA timezone for daily reset */
|
|
23
|
-
dailyResetTimezone: z.ZodOptional<z.ZodString>;
|
|
24
|
-
/** Override idle timeout in milliseconds */
|
|
25
|
-
idleTimeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
26
|
-
}, z.core.$strict>;
|
|
27
|
-
/**
|
|
28
|
-
* Session reset policy configuration.
|
|
29
|
-
* Controls automatic session expiry via daily, idle, or hybrid modes.
|
|
30
|
-
*/
|
|
31
|
-
export declare const SessionResetPolicySchema: z.ZodObject<{
|
|
32
|
-
/** Reset mode: daily, idle, hybrid (first-to-expire), or none (disabled) */
|
|
33
|
-
mode: z.ZodDefault<z.ZodEnum<{
|
|
34
|
-
none: "none";
|
|
35
|
-
daily: "daily";
|
|
36
|
-
idle: "idle";
|
|
37
|
-
hybrid: "hybrid";
|
|
38
|
-
}>>;
|
|
39
|
-
/** Hour of day for daily reset (0-23, default 4 = 4 AM) */
|
|
40
|
-
dailyResetHour: z.ZodDefault<z.ZodNumber>;
|
|
41
|
-
/** IANA timezone for daily reset (empty string = system local) */
|
|
42
|
-
dailyResetTimezone: z.ZodDefault<z.ZodString>;
|
|
43
|
-
/** Idle timeout in milliseconds (default 4 hours = 14_400_000) */
|
|
44
|
-
idleTimeoutMs: z.ZodDefault<z.ZodNumber>;
|
|
45
|
-
/** Sweep interval in milliseconds (how often to check sessions, default 5 min) */
|
|
46
|
-
sweepIntervalMs: z.ZodDefault<z.ZodNumber>;
|
|
47
|
-
/** Phrases that trigger immediate session reset when sent as a message */
|
|
48
|
-
resetTriggers: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
49
|
-
/** Per-session-type overrides (dm, group, thread) */
|
|
50
|
-
perType: z.ZodDefault<z.ZodObject<{
|
|
51
|
-
dm: z.ZodOptional<z.ZodObject<{
|
|
52
|
-
/** Override reset mode for this session type */
|
|
53
|
-
mode: z.ZodOptional<z.ZodEnum<{
|
|
54
|
-
none: "none";
|
|
55
|
-
daily: "daily";
|
|
56
|
-
idle: "idle";
|
|
57
|
-
hybrid: "hybrid";
|
|
58
|
-
}>>;
|
|
59
|
-
/** Override daily reset hour (0-23) */
|
|
60
|
-
dailyResetHour: z.ZodOptional<z.ZodNumber>;
|
|
61
|
-
/** Override IANA timezone for daily reset */
|
|
62
|
-
dailyResetTimezone: z.ZodOptional<z.ZodString>;
|
|
63
|
-
/** Override idle timeout in milliseconds */
|
|
64
|
-
idleTimeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
65
|
-
}, z.core.$strict>>;
|
|
66
|
-
group: z.ZodOptional<z.ZodObject<{
|
|
67
|
-
/** Override reset mode for this session type */
|
|
68
|
-
mode: z.ZodOptional<z.ZodEnum<{
|
|
69
|
-
none: "none";
|
|
70
|
-
daily: "daily";
|
|
71
|
-
idle: "idle";
|
|
72
|
-
hybrid: "hybrid";
|
|
73
|
-
}>>;
|
|
74
|
-
/** Override daily reset hour (0-23) */
|
|
75
|
-
dailyResetHour: z.ZodOptional<z.ZodNumber>;
|
|
76
|
-
/** Override IANA timezone for daily reset */
|
|
77
|
-
dailyResetTimezone: z.ZodOptional<z.ZodString>;
|
|
78
|
-
/** Override idle timeout in milliseconds */
|
|
79
|
-
idleTimeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
80
|
-
}, z.core.$strict>>;
|
|
81
|
-
thread: z.ZodOptional<z.ZodObject<{
|
|
82
|
-
/** Override reset mode for this session type */
|
|
83
|
-
mode: z.ZodOptional<z.ZodEnum<{
|
|
84
|
-
none: "none";
|
|
85
|
-
daily: "daily";
|
|
86
|
-
idle: "idle";
|
|
87
|
-
hybrid: "hybrid";
|
|
88
|
-
}>>;
|
|
89
|
-
/** Override daily reset hour (0-23) */
|
|
90
|
-
dailyResetHour: z.ZodOptional<z.ZodNumber>;
|
|
91
|
-
/** Override IANA timezone for daily reset */
|
|
92
|
-
dailyResetTimezone: z.ZodOptional<z.ZodString>;
|
|
93
|
-
/** Override idle timeout in milliseconds */
|
|
94
|
-
idleTimeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
95
|
-
}, z.core.$strict>>;
|
|
96
|
-
}, z.core.$strict>>;
|
|
97
|
-
}, z.core.$strict>;
|
|
98
|
-
/**
|
|
99
|
-
* DM scope configuration for session key isolation granularity.
|
|
100
|
-
*
|
|
101
|
-
* Controls how DM (direct message) conversations are scoped:
|
|
102
|
-
* - "main": all DMs share a single session (userId="main", channelId="dm")
|
|
103
|
-
* - "per-peer": one session per peer across all channels
|
|
104
|
-
* - "per-channel-peer": one session per channel+peer (default)
|
|
105
|
-
* - "per-account-channel-peer": includes bot account identifier in channel for multi-bot isolation
|
|
106
|
-
*/
|
|
107
|
-
export declare const DmScopeConfigSchema: z.ZodObject<{
|
|
108
|
-
/** DM scope mode controlling session isolation granularity */
|
|
109
|
-
mode: z.ZodDefault<z.ZodEnum<{
|
|
110
|
-
main: "main";
|
|
111
|
-
"per-peer": "per-peer";
|
|
112
|
-
"per-channel-peer": "per-channel-peer";
|
|
113
|
-
"per-account-channel-peer": "per-account-channel-peer";
|
|
114
|
-
}>>;
|
|
115
|
-
/** Prepend agent:<agentId>: to session keys for multi-agent isolation */
|
|
116
|
-
agentPrefix: z.ZodDefault<z.ZodBoolean>;
|
|
117
|
-
/** Append :thread:<threadId> to session keys for forum/thread isolation */
|
|
118
|
-
threadIsolation: z.ZodDefault<z.ZodBoolean>;
|
|
119
|
-
}, z.core.$strict>;
|
|
120
|
-
/**
|
|
121
|
-
* Session pruning configuration for in-memory tool result trimming.
|
|
122
|
-
*
|
|
123
|
-
* Controls how oversized tool results are trimmed before each LLM call.
|
|
124
|
-
* Pruning operates on copies only -- persisted session data is never affected.
|
|
125
|
-
*/
|
|
126
|
-
export declare const PruningConfigSchema: z.ZodObject<{
|
|
127
|
-
/** Enable session pruning of oversized tool results */
|
|
128
|
-
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
129
|
-
/** Character threshold above which tool results are soft-trimmed (head + tail with marker) */
|
|
130
|
-
softTrimThresholdChars: z.ZodDefault<z.ZodNumber>;
|
|
131
|
-
/** Character threshold above which tool results are hard-cleared (entire content replaced) */
|
|
132
|
-
hardClearThresholdChars: z.ZodDefault<z.ZodNumber>;
|
|
133
|
-
/** Number of characters to preserve at the start of a soft-trimmed result */
|
|
134
|
-
preserveHeadChars: z.ZodDefault<z.ZodNumber>;
|
|
135
|
-
/** Number of characters to preserve at the end of a soft-trimmed result */
|
|
136
|
-
preserveTailChars: z.ZodDefault<z.ZodNumber>;
|
|
137
|
-
/** Tools whose results are eligible for pruning (empty = all tools eligible) */
|
|
138
|
-
pruneableTools: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
139
|
-
/** Tools whose results are never pruned (takes precedence over pruneableTools) */
|
|
140
|
-
protectedTools: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
141
|
-
/** Protect tool results containing image content blocks from pruning */
|
|
142
|
-
protectImageBlocks: z.ZodDefault<z.ZodBoolean>;
|
|
143
|
-
/** Number of recent messages (from end of array) exempt from pruning */
|
|
144
|
-
preserveRecentCount: z.ZodDefault<z.ZodNumber>;
|
|
145
|
-
}, z.core.$strict>;
|
|
146
|
-
/**
|
|
147
|
-
* Session compaction configuration.
|
|
148
|
-
*
|
|
149
|
-
* Controls when pre-compaction memory flushes and hard compaction triggers
|
|
150
|
-
* fire, based on context window usage ratios. The flushModel option allows
|
|
151
|
-
* using a cheaper model for memory extraction.
|
|
152
|
-
*/
|
|
153
|
-
export declare const SessionCompactionConfigSchema: z.ZodObject<{
|
|
154
|
-
/** Fraction of maxContextChars at which soft flush triggers (memory extraction only) */
|
|
155
|
-
softThresholdRatio: z.ZodDefault<z.ZodNumber>;
|
|
156
|
-
/** Fraction of maxContextChars at which hard compaction triggers (flush + trim) */
|
|
157
|
-
hardThresholdRatio: z.ZodDefault<z.ZodNumber>;
|
|
158
|
-
/** Model to use for memory extraction during flush (defaults to cheap model) */
|
|
159
|
-
flushModel: z.ZodOptional<z.ZodString>;
|
|
160
|
-
/** Max characters per summarization chunk. Default: 50_000. */
|
|
161
|
-
chunkMaxChars: z.ZodDefault<z.ZodNumber>;
|
|
162
|
-
/** Number of overlap messages between chunks. Default: 2. */
|
|
163
|
-
chunkOverlapMessages: z.ZodDefault<z.ZodNumber>;
|
|
164
|
-
/** Whether to merge chunk summaries via LLM. Default: true. */
|
|
165
|
-
chunkMergeSummaries: z.ZodDefault<z.ZodBoolean>;
|
|
166
|
-
/** Tokens reserved for summary during SDK auto-compaction. Default: 16384. */
|
|
167
|
-
reserveTokens: z.ZodDefault<z.ZodNumber>;
|
|
168
|
-
/** Tokens worth of recent messages to keep after SDK auto-compaction. Default: 32768. */
|
|
169
|
-
keepRecentTokens: z.ZodDefault<z.ZodNumber>;
|
|
170
|
-
/** AGENTS.md section names to re-inject after compaction (COMP-04). */
|
|
171
|
-
postCompactionSections: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
172
|
-
}, z.core.$strict>;
|
|
173
|
-
export type SessionResetPolicyConfig = z.infer<typeof SessionResetPolicySchema>;
|
|
174
|
-
export type ResetPolicyOverride = z.infer<typeof ResetPolicyOverrideSchema>;
|
|
175
|
-
export type DmScopeConfig = z.infer<typeof DmScopeConfigSchema>;
|
|
176
|
-
export type PruningConfig = z.infer<typeof PruningConfigSchema>;
|
|
177
|
-
export type SessionCompactionConfig = z.infer<typeof SessionCompactionConfigSchema>;
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
/**
|
|
3
|
-
* Session lifecycle configuration schemas.
|
|
4
|
-
*
|
|
5
|
-
* Owns session reset policy, DM scope isolation, pruning of oversized
|
|
6
|
-
* tool results, and per-agent compaction thresholds.
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* Per-session-type reset policy override.
|
|
10
|
-
* All fields are optional -- omitted fields inherit from the parent policy.
|
|
11
|
-
*/
|
|
12
|
-
export const ResetPolicyOverrideSchema = z.strictObject({
|
|
13
|
-
/** Override reset mode for this session type */
|
|
14
|
-
mode: z.enum(["daily", "idle", "hybrid", "none"]).optional(),
|
|
15
|
-
/** Override daily reset hour (0-23) */
|
|
16
|
-
dailyResetHour: z.number().int().min(0).max(23).optional(),
|
|
17
|
-
/** Override IANA timezone for daily reset */
|
|
18
|
-
dailyResetTimezone: z.string().optional(),
|
|
19
|
-
/** Override idle timeout in milliseconds */
|
|
20
|
-
idleTimeoutMs: z.number().int().positive().optional(),
|
|
21
|
-
});
|
|
22
|
-
/**
|
|
23
|
-
* Session reset policy configuration.
|
|
24
|
-
* Controls automatic session expiry via daily, idle, or hybrid modes.
|
|
25
|
-
*/
|
|
26
|
-
export const SessionResetPolicySchema = z.strictObject({
|
|
27
|
-
/** Reset mode: daily, idle, hybrid (first-to-expire), or none (disabled) */
|
|
28
|
-
mode: z.enum(["daily", "idle", "hybrid", "none"]).default("none"),
|
|
29
|
-
/** Hour of day for daily reset (0-23, default 4 = 4 AM) */
|
|
30
|
-
dailyResetHour: z.number().int().min(0).max(23).default(4),
|
|
31
|
-
/** IANA timezone for daily reset (empty string = system local) */
|
|
32
|
-
dailyResetTimezone: z.string().default(""),
|
|
33
|
-
/** Idle timeout in milliseconds (default 4 hours = 14_400_000) */
|
|
34
|
-
idleTimeoutMs: z.number().int().positive().default(14_400_000),
|
|
35
|
-
/** Sweep interval in milliseconds (how often to check sessions, default 5 min) */
|
|
36
|
-
sweepIntervalMs: z.number().int().positive().default(300_000),
|
|
37
|
-
/** Phrases that trigger immediate session reset when sent as a message */
|
|
38
|
-
resetTriggers: z.array(z.string()).default([]),
|
|
39
|
-
/** Per-session-type overrides (dm, group, thread) */
|
|
40
|
-
perType: z.strictObject({
|
|
41
|
-
dm: ResetPolicyOverrideSchema.optional(),
|
|
42
|
-
group: ResetPolicyOverrideSchema.optional(),
|
|
43
|
-
thread: ResetPolicyOverrideSchema.optional(),
|
|
44
|
-
}).default({}),
|
|
45
|
-
});
|
|
46
|
-
/**
|
|
47
|
-
* DM scope configuration for session key isolation granularity.
|
|
48
|
-
*
|
|
49
|
-
* Controls how DM (direct message) conversations are scoped:
|
|
50
|
-
* - "main": all DMs share a single session (userId="main", channelId="dm")
|
|
51
|
-
* - "per-peer": one session per peer across all channels
|
|
52
|
-
* - "per-channel-peer": one session per channel+peer (default)
|
|
53
|
-
* - "per-account-channel-peer": includes bot account identifier in channel for multi-bot isolation
|
|
54
|
-
*/
|
|
55
|
-
export const DmScopeConfigSchema = z.strictObject({
|
|
56
|
-
/** DM scope mode controlling session isolation granularity */
|
|
57
|
-
mode: z.enum(["main", "per-peer", "per-channel-peer", "per-account-channel-peer"])
|
|
58
|
-
.default("per-channel-peer"),
|
|
59
|
-
/** Prepend agent:<agentId>: to session keys for multi-agent isolation */
|
|
60
|
-
agentPrefix: z.boolean().default(false),
|
|
61
|
-
/** Append :thread:<threadId> to session keys for forum/thread isolation */
|
|
62
|
-
threadIsolation: z.boolean().default(true),
|
|
63
|
-
});
|
|
64
|
-
/**
|
|
65
|
-
* Session pruning configuration for in-memory tool result trimming.
|
|
66
|
-
*
|
|
67
|
-
* Controls how oversized tool results are trimmed before each LLM call.
|
|
68
|
-
* Pruning operates on copies only -- persisted session data is never affected.
|
|
69
|
-
*/
|
|
70
|
-
export const PruningConfigSchema = z.strictObject({
|
|
71
|
-
/** Enable session pruning of oversized tool results */
|
|
72
|
-
enabled: z.boolean().default(true),
|
|
73
|
-
/** Character threshold above which tool results are soft-trimmed (head + tail with marker) */
|
|
74
|
-
softTrimThresholdChars: z.number().int().positive().default(8_000),
|
|
75
|
-
/** Character threshold above which tool results are hard-cleared (entire content replaced) */
|
|
76
|
-
hardClearThresholdChars: z.number().int().positive().default(30_000),
|
|
77
|
-
/** Number of characters to preserve at the start of a soft-trimmed result */
|
|
78
|
-
preserveHeadChars: z.number().int().nonnegative().default(500),
|
|
79
|
-
/** Number of characters to preserve at the end of a soft-trimmed result */
|
|
80
|
-
preserveTailChars: z.number().int().nonnegative().default(500),
|
|
81
|
-
/** Tools whose results are eligible for pruning (empty = all tools eligible) */
|
|
82
|
-
pruneableTools: z.array(z.string()).default([]),
|
|
83
|
-
/** Tools whose results are never pruned (takes precedence over pruneableTools) */
|
|
84
|
-
protectedTools: z.array(z.string()).default([]),
|
|
85
|
-
/** Protect tool results containing image content blocks from pruning */
|
|
86
|
-
protectImageBlocks: z.boolean().default(true),
|
|
87
|
-
/** Number of recent messages (from end of array) exempt from pruning */
|
|
88
|
-
preserveRecentCount: z.number().int().nonnegative().default(6),
|
|
89
|
-
});
|
|
90
|
-
/**
|
|
91
|
-
* Session compaction configuration.
|
|
92
|
-
*
|
|
93
|
-
* Controls when pre-compaction memory flushes and hard compaction triggers
|
|
94
|
-
* fire, based on context window usage ratios. The flushModel option allows
|
|
95
|
-
* using a cheaper model for memory extraction.
|
|
96
|
-
*/
|
|
97
|
-
export const SessionCompactionConfigSchema = z.strictObject({
|
|
98
|
-
/** Fraction of maxContextChars at which soft flush triggers (memory extraction only) */
|
|
99
|
-
softThresholdRatio: z.number().min(0).max(1).default(0.75),
|
|
100
|
-
/** Fraction of maxContextChars at which hard compaction triggers (flush + trim) */
|
|
101
|
-
hardThresholdRatio: z.number().min(0).max(1).default(0.90),
|
|
102
|
-
/** Model to use for memory extraction during flush (defaults to cheap model) */
|
|
103
|
-
flushModel: z.string().optional(),
|
|
104
|
-
/** Max characters per summarization chunk. Default: 50_000. */
|
|
105
|
-
chunkMaxChars: z.number().int().positive().default(50_000),
|
|
106
|
-
/** Number of overlap messages between chunks. Default: 2. */
|
|
107
|
-
chunkOverlapMessages: z.number().int().nonnegative().default(2),
|
|
108
|
-
/** Whether to merge chunk summaries via LLM. Default: true. */
|
|
109
|
-
chunkMergeSummaries: z.boolean().default(true),
|
|
110
|
-
/** Tokens reserved for summary during SDK auto-compaction. Default: 16384. */
|
|
111
|
-
reserveTokens: z.number().int().positive().default(16384),
|
|
112
|
-
/** Tokens worth of recent messages to keep after SDK auto-compaction. Default: 32768. */
|
|
113
|
-
keepRecentTokens: z.number().int().positive().default(32768),
|
|
114
|
-
/** AGENTS.md section names to re-inject after compaction (COMP-04). */
|
|
115
|
-
postCompactionSections: z.array(z.string()).default(["Session Startup", "Red Lines"]),
|
|
116
|
-
});
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
/**
|
|
3
|
-
* Context engine configuration schema.
|
|
4
|
-
*
|
|
5
|
-
* Controls the context engine operating in either **pipeline** mode
|
|
6
|
-
* (sequential layer composition: thinking cleaner, history window,
|
|
7
|
-
* dead content evictor, observation masker, LLM compaction, rehydration)
|
|
8
|
-
* or **DAG** mode (graph-based context management with leaf/condensed
|
|
9
|
-
* nodes, incremental recall, and annotation-driven eviction).
|
|
10
|
-
*
|
|
11
|
-
* All fields have sensible defaults so an empty `{}` is always valid.
|
|
12
|
-
* The flat schema validates all fields regardless of the active `version`
|
|
13
|
-
* to prevent invalid saved configurations.
|
|
14
|
-
*
|
|
15
|
-
* Only top-level settings are exposed to users; internal budget
|
|
16
|
-
* components (safety margin, output reserve, rot buffer) are
|
|
17
|
-
* controlled by constants in @comis/agent.
|
|
18
|
-
*
|
|
19
|
-
* @module
|
|
20
|
-
*/
|
|
21
|
-
/** Context engine configuration (per-agent). */
|
|
22
|
-
export declare const ContextEngineConfigSchema: z.ZodObject<{
|
|
23
|
-
/** Master toggle for the context engine pipeline (enabled by default). */
|
|
24
|
-
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
25
|
-
/** Operating mode: "pipeline" for sequential layer composition, "dag" for graph-based context management. */
|
|
26
|
-
version: z.ZodDefault<z.ZodEnum<{
|
|
27
|
-
pipeline: "pipeline";
|
|
28
|
-
dag: "dag";
|
|
29
|
-
}>>;
|
|
30
|
-
/** Number of recent assistant turns that retain thinking blocks (older turns get stripped). */
|
|
31
|
-
thinkingKeepTurns: z.ZodDefault<z.ZodNumber>;
|
|
32
|
-
/** Model for LLM compaction in "provider:modelId" format. Defaults to Haiku for cost efficiency. Empty string falls through to session model. */
|
|
33
|
-
compactionModel: z.ZodDefault<z.ZodString>;
|
|
34
|
-
/** Minimum age (in tool result positions) before content is eligible for dead content eviction. */
|
|
35
|
-
evictionMinAge: z.ZodDefault<z.ZodNumber>;
|
|
36
|
-
/** Number of recent user turns to keep in context (default 15). */
|
|
37
|
-
historyTurns: z.ZodDefault<z.ZodNumber>;
|
|
38
|
-
/** Per-agent or per-channel-type turn count overrides (e.g., { dm: 10, "trader-1": 30 }). */
|
|
39
|
-
historyTurnOverrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
40
|
-
/** Number of most recent tool uses that retain full content (older ones are masked). */
|
|
41
|
-
observationKeepWindow: z.ZodDefault<z.ZodNumber>;
|
|
42
|
-
/** Character threshold before observation masking activates (below this, masking is skipped). */
|
|
43
|
-
observationTriggerChars: z.ZodDefault<z.ZodNumber>;
|
|
44
|
-
/** Character threshold below which observation masking deactivates (CACHE-14 hysteresis). */
|
|
45
|
-
observationDeactivationChars: z.ZodDefault<z.ZodNumber>;
|
|
46
|
-
/** Keep window for ephemeral-tier tools (web_search, brave_search, web_fetch, link_reader, fetch_url). Shorter than observationKeepWindow. Default: 10. */
|
|
47
|
-
ephemeralKeepWindow: z.ZodDefault<z.ZodNumber>;
|
|
48
|
-
/** Turns to wait before re-triggering LLM compaction after a successful compaction. */
|
|
49
|
-
compactionCooldownTurns: z.ZodDefault<z.ZodNumber>;
|
|
50
|
-
/** Output escalation configuration: auto-retry with higher output budget on max_tokens truncation (CTX-04). */
|
|
51
|
-
outputEscalation: z.ZodDefault<z.ZodObject<{
|
|
52
|
-
/** Master toggle for output escalation. When false, max_tokens truncation is not retried. */
|
|
53
|
-
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
54
|
-
/** Escalated max output tokens for the retry attempt. Must be between 4096 and 128000. */
|
|
55
|
-
escalatedMaxTokens: z.ZodDefault<z.ZodNumber>;
|
|
56
|
-
}, z.core.$strict>>;
|
|
57
|
-
/** Number of most recent turns always included verbatim in DAG context. */
|
|
58
|
-
freshTailTurns: z.ZodDefault<z.ZodNumber>;
|
|
59
|
-
/** Context utilization fraction that triggers DAG compaction (0.1 to 0.95). */
|
|
60
|
-
contextThreshold: z.ZodDefault<z.ZodNumber>;
|
|
61
|
-
/** Minimum fan-out for leaf nodes in the DAG. */
|
|
62
|
-
leafMinFanout: z.ZodDefault<z.ZodNumber>;
|
|
63
|
-
/** Minimum fan-out for condensed (non-leaf) nodes in the DAG. */
|
|
64
|
-
condensedMinFanout: z.ZodDefault<z.ZodNumber>;
|
|
65
|
-
/** Hard minimum fan-out for condensed nodes (lowest allowed). */
|
|
66
|
-
condensedMinFanoutHard: z.ZodDefault<z.ZodNumber>;
|
|
67
|
-
/** Maximum depth for incremental DAG rebuilds (-1 = full rebuild). */
|
|
68
|
-
incrementalMaxDepth: z.ZodDefault<z.ZodNumber>;
|
|
69
|
-
/** Token budget for leaf node chunks in the DAG. */
|
|
70
|
-
leafChunkTokens: z.ZodDefault<z.ZodNumber>;
|
|
71
|
-
/** Target token size for leaf node summaries. */
|
|
72
|
-
leafTargetTokens: z.ZodDefault<z.ZodNumber>;
|
|
73
|
-
/** Target token size for condensed node summaries. */
|
|
74
|
-
condensedTargetTokens: z.ZodDefault<z.ZodNumber>;
|
|
75
|
-
/** Maximum tokens for expanded context retrieval. */
|
|
76
|
-
maxExpandTokens: z.ZodDefault<z.ZodNumber>;
|
|
77
|
-
/** Maximum recall operations per day per agent. */
|
|
78
|
-
maxRecallsPerDay: z.ZodDefault<z.ZodNumber>;
|
|
79
|
-
/** Timeout for recall operations in milliseconds. */
|
|
80
|
-
recallTimeoutMs: z.ZodDefault<z.ZodNumber>;
|
|
81
|
-
/** Token threshold above which a file is considered "large" for DAG processing. */
|
|
82
|
-
largeFileTokenThreshold: z.ZodDefault<z.ZodNumber>;
|
|
83
|
-
/** Number of most recent annotations retained in DAG mode (analogous to observationKeepWindow). */
|
|
84
|
-
annotationKeepWindow: z.ZodDefault<z.ZodNumber>;
|
|
85
|
-
/** Character threshold before annotation eviction activates in DAG mode. */
|
|
86
|
-
annotationTriggerChars: z.ZodDefault<z.ZodNumber>;
|
|
87
|
-
/** Optional model override for DAG summary generation in "provider:modelId" format. */
|
|
88
|
-
summaryModel: z.ZodOptional<z.ZodString>;
|
|
89
|
-
/** Optional provider override for DAG summary generation. */
|
|
90
|
-
summaryProvider: z.ZodOptional<z.ZodString>;
|
|
91
|
-
}, z.core.$strict>;
|
|
92
|
-
export type ContextEngineConfig = z.infer<typeof ContextEngineConfigSchema>;
|