@mandujs/core 0.39.3 → 0.40.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/package.json +1 -1
- package/src/brain/__tests__/redactor.test.ts +94 -0
- package/src/brain/adapters/__tests__/_helpers.ts +64 -0
- package/src/brain/adapters/__tests__/anthropic-oauth.test.ts +196 -0
- package/src/brain/adapters/__tests__/openai-oauth.test.ts +202 -0
- package/src/brain/adapters/__tests__/resolver.test.ts +122 -0
- package/src/brain/adapters/anthropic-oauth.ts +420 -0
- package/src/brain/adapters/index.ts +290 -2
- package/src/brain/adapters/oauth-flow.ts +439 -0
- package/src/brain/adapters/openai-oauth.ts +459 -0
- package/src/brain/consent.ts +240 -0
- package/src/brain/credentials.ts +396 -0
- package/src/brain/index.ts +39 -1
- package/src/brain/redactor.ts +196 -0
- package/src/config/mandu.ts +39 -0
- package/src/config/validate.ts +49 -0
package/src/config/validate.ts
CHANGED
|
@@ -587,6 +587,48 @@ const I18nConfigSchema = z
|
|
|
587
587
|
}
|
|
588
588
|
});
|
|
589
589
|
|
|
590
|
+
/**
|
|
591
|
+
* Issue #235 — Brain adapter block (strict).
|
|
592
|
+
*
|
|
593
|
+
* All fields optional; omitting the block is equivalent to
|
|
594
|
+
* `{ adapter: "auto" }`. `telemetryOptOut: true` forces the resolver
|
|
595
|
+
* to skip every cloud tier regardless of stored tokens.
|
|
596
|
+
*
|
|
597
|
+
* Per-provider sub-blocks are strict so stale `apiKey` / `endpoint` /
|
|
598
|
+
* etc. keys from ad-hoc configs fail fast — Mandu's connector model
|
|
599
|
+
* does NOT accept inline API keys.
|
|
600
|
+
*/
|
|
601
|
+
const BrainOpenAIConfigSchema = z
|
|
602
|
+
.object({
|
|
603
|
+
model: z.string().min(1).optional(),
|
|
604
|
+
})
|
|
605
|
+
.strict();
|
|
606
|
+
|
|
607
|
+
const BrainAnthropicConfigSchema = z
|
|
608
|
+
.object({
|
|
609
|
+
model: z.string().min(1).optional(),
|
|
610
|
+
})
|
|
611
|
+
.strict();
|
|
612
|
+
|
|
613
|
+
const BrainOllamaConfigSchema = z
|
|
614
|
+
.object({
|
|
615
|
+
model: z.string().min(1).optional(),
|
|
616
|
+
baseUrl: z.string().url().optional(),
|
|
617
|
+
})
|
|
618
|
+
.strict();
|
|
619
|
+
|
|
620
|
+
const BrainConfigSchema = z
|
|
621
|
+
.object({
|
|
622
|
+
adapter: z
|
|
623
|
+
.enum(["auto", "openai", "anthropic", "ollama", "template"])
|
|
624
|
+
.default("auto"),
|
|
625
|
+
openai: BrainOpenAIConfigSchema.optional(),
|
|
626
|
+
anthropic: BrainAnthropicConfigSchema.optional(),
|
|
627
|
+
ollama: BrainOllamaConfigSchema.optional(),
|
|
628
|
+
telemetryOptOut: z.boolean().optional(),
|
|
629
|
+
})
|
|
630
|
+
.strict();
|
|
631
|
+
|
|
590
632
|
export const ManduConfigSchema = z
|
|
591
633
|
.object({
|
|
592
634
|
adapter: AdapterConfigSchema.optional(),
|
|
@@ -643,6 +685,13 @@ export const ManduConfigSchema = z
|
|
|
643
685
|
* Optional; omission leaves i18n disabled with zero runtime overhead.
|
|
644
686
|
*/
|
|
645
687
|
i18n: I18nConfigSchema.optional(),
|
|
688
|
+
/**
|
|
689
|
+
* Issue #235 — Brain adapter selection. See {@link BrainConfigSchema}.
|
|
690
|
+
* Optional; omission is equivalent to `{ adapter: "auto" }`, which
|
|
691
|
+
* resolves in priority order: openai-oauth → anthropic-oauth →
|
|
692
|
+
* ollama → template.
|
|
693
|
+
*/
|
|
694
|
+
brain: BrainConfigSchema.optional(),
|
|
646
695
|
})
|
|
647
696
|
.strict();
|
|
648
697
|
|