@aislop-inc/opencode-mem 2.41.1 → 2.42.1
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/README.md +107 -1
- package/dist/config.d.ts +69 -3
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +80 -16
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +84 -5
- package/dist/services/ai/ai-provider-factory.d.ts.map +1 -1
- package/dist/services/ai/ai-provider-factory.js +4 -0
- package/dist/services/ai/generation-ledger.d.ts +16 -0
- package/dist/services/ai/generation-ledger.d.ts.map +1 -0
- package/dist/services/ai/generation-ledger.js +20 -0
- package/dist/services/ai/memory-provider-presets.d.ts +16 -0
- package/dist/services/ai/memory-provider-presets.d.ts.map +1 -0
- package/dist/services/ai/memory-provider-presets.js +51 -0
- package/dist/services/ai/opencode-provider.d.ts +11 -0
- package/dist/services/ai/opencode-provider.d.ts.map +1 -1
- package/dist/services/ai/opencode-provider.js +31 -2
- package/dist/services/ai/provider-config.d.ts.map +1 -1
- package/dist/services/ai/provider-config.js +5 -8
- package/dist/services/ai/providers/api-route.d.ts +2 -2
- package/dist/services/ai/providers/api-route.d.ts.map +1 -1
- package/dist/services/ai/providers/api-route.js +3 -2
- package/dist/services/ai/providers/atlas-cloud.d.ts +2 -2
- package/dist/services/ai/providers/atlas-cloud.d.ts.map +1 -1
- package/dist/services/ai/providers/atlas-cloud.js +3 -2
- package/dist/services/ai/providers/cheaper-inference.d.ts +2 -2
- package/dist/services/ai/providers/cheaper-inference.d.ts.map +1 -1
- package/dist/services/ai/providers/cheaper-inference.js +3 -2
- package/dist/services/ai/providers/cloudgpu.d.ts +2 -2
- package/dist/services/ai/providers/cloudgpu.d.ts.map +1 -1
- package/dist/services/ai/providers/cloudgpu.js +3 -2
- package/dist/services/ai/providers/orcarouter.d.ts +2 -2
- package/dist/services/ai/providers/orcarouter.d.ts.map +1 -1
- package/dist/services/ai/providers/orcarouter.js +3 -2
- package/dist/services/ai/providers/runcrate.d.ts +2 -2
- package/dist/services/ai/providers/runcrate.d.ts.map +1 -1
- package/dist/services/ai/providers/runcrate.js +3 -2
- package/dist/services/ai/providers/standardcompute.d.ts +54 -0
- package/dist/services/ai/providers/standardcompute.d.ts.map +1 -0
- package/dist/services/ai/providers/standardcompute.js +63 -0
- package/dist/services/ai/session/session-types.d.ts +1 -1
- package/dist/services/ai/session/session-types.d.ts.map +1 -1
- package/dist/services/auto-capture.d.ts.map +1 -1
- package/dist/services/auto-capture.js +18 -1
- package/dist/services/memory-recall.d.ts +9 -1
- package/dist/services/memory-recall.d.ts.map +1 -1
- package/dist/services/memory-recall.js +16 -1
- package/dist/services/memory-review.d.ts +74 -0
- package/dist/services/memory-review.d.ts.map +1 -0
- package/dist/services/memory-review.js +259 -0
- package/dist/services/migration-service.d.ts.map +1 -1
- package/dist/services/migration-service.js +15 -11
- package/dist/services/user-profile/user-profile-manager.d.ts +1 -0
- package/dist/services/user-profile/user-profile-manager.d.ts.map +1 -1
- package/dist/services/user-profile/user-profile-manager.js +23 -0
- package/dist/services/user-prompt/user-prompt-manager.d.ts +6 -0
- package/dist/services/user-prompt/user-prompt-manager.d.ts.map +1 -1
- package/dist/services/user-prompt/user-prompt-manager.js +15 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/v2/adapter.d.ts +7 -0
- package/dist/v2/adapter.d.ts.map +1 -1
- package/dist/v2/adapter.js +33 -2
- package/dist/v2/legacy-client.d.ts +1 -1
- package/dist/v2/legacy-client.d.ts.map +1 -1
- package/dist/v2/legacy-client.js +26 -4
- package/dist/v2/plugin.d.ts.map +1 -1
- package/dist/v2/plugin.js +2 -1
- package/dist/web/assets/index-Bc7-K6u-.css +2 -0
- package/dist/web/assets/index-h_HQTX3Y.js +112 -0
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/web/assets/index-mTgxOb5l.css +0 -2
- package/dist/web/assets/index-ysje17yK.js +0 -109
package/dist/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { tool } from "@opencode-ai/plugin";
|
|
2
2
|
import { memoryClient } from "./services/client.js";
|
|
3
3
|
import { formatContextForPrompt } from "./services/context.js";
|
|
4
|
-
import { shouldRefreshRecallOnPrompt } from "./services/memory-recall.js";
|
|
4
|
+
import { memorySetSignature, shouldRefreshRecallOnPrompt } from "./services/memory-recall.js";
|
|
5
|
+
import { MemoryReviewScheduler, runMemoryReview } from "./services/memory-review.js";
|
|
5
6
|
import { buildMemoryProvenanceSuffix } from "./services/memory-provenance.js";
|
|
6
7
|
import { getTags } from "./services/tags.js";
|
|
7
8
|
import { stripPrivateContent, isFullyPrivate, sanitizeMemoryContent } from "./services/privacy.js";
|
|
@@ -244,12 +245,26 @@ export function applyStructuredOutputChatParams(input, output) {
|
|
|
244
245
|
};
|
|
245
246
|
}
|
|
246
247
|
export async function configureOpencodeHostTransport(ctx) {
|
|
247
|
-
const { createV2Client, resetHostFetch, setHostFetch, setV2Client, setStructuredOutputTimeoutConfig, } = await loadOpencodeProvider();
|
|
248
|
+
const { createV2Client, resetHostFetch, setHostFetch, setV2Client, setStructuredOutputTimeoutConfig, setStructuredOutputFallback, } = await loadOpencodeProvider();
|
|
248
249
|
resetHostFetch();
|
|
249
250
|
// Configured structured-output timeout (opencodeTimeoutMs): injected here so
|
|
250
251
|
// the lazily-bundled provider module never imports config.js (whose import
|
|
251
252
|
// side effects would leak into subprocess gates and loader bundles).
|
|
252
253
|
setStructuredOutputTimeoutConfig(CONFIG.opencodeTimeoutMs);
|
|
254
|
+
setStructuredOutputFallback(CONFIG.opencodeProvider &&
|
|
255
|
+
CONFIG.opencodeModel &&
|
|
256
|
+
CONFIG.opencodeFallbackProvider &&
|
|
257
|
+
CONFIG.opencodeFallbackModel
|
|
258
|
+
? {
|
|
259
|
+
providerID: CONFIG.opencodeProvider,
|
|
260
|
+
modelID: CONFIG.opencodeModel,
|
|
261
|
+
fallback: {
|
|
262
|
+
providerID: CONFIG.opencodeFallbackProvider,
|
|
263
|
+
modelID: CONFIG.opencodeFallbackModel,
|
|
264
|
+
variant: CONFIG.opencodeFallbackVariant,
|
|
265
|
+
},
|
|
266
|
+
}
|
|
267
|
+
: undefined);
|
|
253
268
|
const hostConfig = getHostClientConfig(ctx);
|
|
254
269
|
if (hostConfig.fetch) {
|
|
255
270
|
setHostFetch(hostConfig.fetch);
|
|
@@ -576,9 +591,52 @@ export const OpenCodeMemPlugin = async (ctx) => {
|
|
|
576
591
|
process.off("beforeExit", beforeExitHandler);
|
|
577
592
|
process.off("exit", exitHandler);
|
|
578
593
|
CHILD_SESSION_LOOKUPS.clear();
|
|
594
|
+
reviewScheduler.clear();
|
|
595
|
+
renderedContexts.clear();
|
|
579
596
|
await cleanupPlugin();
|
|
580
597
|
};
|
|
581
598
|
void resumePendingCaptures();
|
|
599
|
+
// Hermes-style periodic review: counts authored user turns per session and
|
|
600
|
+
// runs one background review after the reply of every Nth turn completes.
|
|
601
|
+
const reviewScheduler = new MemoryReviewScheduler();
|
|
602
|
+
const reviewEnabled = () => !cleanedUp && isConfigured() && CONFIG.memoryReview?.enabled === true;
|
|
603
|
+
const noteReviewTurn = async (sessionID, messageID) => {
|
|
604
|
+
if (!reviewEnabled())
|
|
605
|
+
return;
|
|
606
|
+
try {
|
|
607
|
+
if (!reviewScheduler.has(sessionID)) {
|
|
608
|
+
// After a host/plugin restart, resume the count from saved prompts
|
|
609
|
+
// (this prompt is already saved, so exclude it before noting it).
|
|
610
|
+
const stats = await userPromptManager.getSessionPromptStats(sessionID);
|
|
611
|
+
reviewScheduler.restore(sessionID, Math.max(0, stats.count - 1), CONFIG.memoryReview?.intervalTurns ?? 10);
|
|
612
|
+
}
|
|
613
|
+
reviewScheduler.noteTurn(sessionID, messageID);
|
|
614
|
+
}
|
|
615
|
+
catch (error) {
|
|
616
|
+
log("memory review: turn count failed", { error: String(error) });
|
|
617
|
+
}
|
|
618
|
+
};
|
|
619
|
+
const runReviewIfDue = async (sessionID) => {
|
|
620
|
+
if (!reviewEnabled() || !reviewScheduler.has(sessionID))
|
|
621
|
+
return;
|
|
622
|
+
// Internal structured-output sessions and (by default) child sessions never
|
|
623
|
+
// reach noteReviewTurn, so they are never counted or reviewed.
|
|
624
|
+
try {
|
|
625
|
+
await reviewScheduler.maybeRun(sessionID, CONFIG.memoryReview?.intervalTurns ?? 10, async () => {
|
|
626
|
+
const stats = await userPromptManager.getSessionPromptStats(sessionID);
|
|
627
|
+
const written = await runMemoryReview({
|
|
628
|
+
ctx,
|
|
629
|
+
sessionID,
|
|
630
|
+
directory,
|
|
631
|
+
sessionModel: { providerID: stats.providerId, modelID: stats.modelId },
|
|
632
|
+
});
|
|
633
|
+
log("memory review finished", { sessionID, written });
|
|
634
|
+
});
|
|
635
|
+
}
|
|
636
|
+
catch (error) {
|
|
637
|
+
log("memory review failed", { sessionID, error: String(error) });
|
|
638
|
+
}
|
|
639
|
+
};
|
|
582
640
|
// Capture remains tied to authored prompts. V2 can rebuild request context
|
|
583
641
|
// independently when its in-memory session cache is lost on host/plugin reload.
|
|
584
642
|
const capturePrompt = async (sessionID, messageID, parts) => {
|
|
@@ -611,8 +669,10 @@ export const OpenCodeMemPlugin = async (ctx) => {
|
|
|
611
669
|
return false;
|
|
612
670
|
}
|
|
613
671
|
await userPromptManager.savePrompt(sessionID, messageID, directory, userMessage);
|
|
672
|
+
await noteReviewTurn(sessionID, messageID);
|
|
614
673
|
return true;
|
|
615
674
|
};
|
|
675
|
+
const renderedContexts = new Map();
|
|
616
676
|
const loadMemoryContext = async (sessionID) => {
|
|
617
677
|
const { loadRecallMemoriesForSession } = await import("./services/memory-recall.js");
|
|
618
678
|
const queryText = await userPromptManager.getLatestPromptTextForSession(sessionID);
|
|
@@ -631,8 +691,16 @@ export const OpenCodeMemPlugin = async (ctx) => {
|
|
|
631
691
|
total: memories.length,
|
|
632
692
|
timing: 0,
|
|
633
693
|
};
|
|
694
|
+
// Same memory set as the last render for this session: reuse the exact
|
|
695
|
+
// text so scores/order changes alone never move the prompt prefix.
|
|
696
|
+
const signature = memorySetSignature(memories);
|
|
697
|
+
const previous = renderedContexts.get(sessionID);
|
|
698
|
+
if (previous && previous.signature === signature && signature !== "")
|
|
699
|
+
return previous.text;
|
|
634
700
|
const userId = tags.user.userEmail || null;
|
|
635
|
-
|
|
701
|
+
const text = await formatContextForPrompt(userId, projectMemories);
|
|
702
|
+
renderedContexts.set(sessionID, { signature, text });
|
|
703
|
+
return text;
|
|
636
704
|
};
|
|
637
705
|
return {
|
|
638
706
|
// V1 ignores this extra hook; the V2 adapter uses it during plugin reload.
|
|
@@ -644,7 +712,8 @@ export const OpenCodeMemPlugin = async (ctx) => {
|
|
|
644
712
|
CONFIG.autoCaptureEnabled &&
|
|
645
713
|
userPromptManager.hasPendingCaptureSession(sessionID, directory),
|
|
646
714
|
enabled: () => isConfigured() && CONFIG.chatMessage.enabled,
|
|
647
|
-
|
|
715
|
+
injectAs: () => CONFIG.chatMessage.injectAs ?? "system",
|
|
716
|
+
refreshOnPrompt: () => shouldRefreshRecallOnPrompt(CONFIG.chatMessage.recall ?? "relevant", CONFIG.chatMessage.injectOn ?? "first", CONFIG.chatMessage.snapshot ?? "live"),
|
|
648
717
|
capturePrompt: async (input, output) => capturePrompt(input.sessionID, output.message.id, output.parts),
|
|
649
718
|
load: async (sessionID) => {
|
|
650
719
|
if (!isConfigured() ||
|
|
@@ -680,7 +749,7 @@ export const OpenCodeMemPlugin = async (ctx) => {
|
|
|
680
749
|
const isAfterCompaction = lastMessage?.info?.summary === true;
|
|
681
750
|
// Relevance/both re-inject every authored turn so the query matches the
|
|
682
751
|
// current message (issue #460). Legacy recent keeps injectOn: first.
|
|
683
|
-
const shouldInject = shouldRefreshRecallOnPrompt(CONFIG.chatMessage.recall ?? "relevant", CONFIG.chatMessage.injectOn ?? "first") ||
|
|
752
|
+
const shouldInject = shouldRefreshRecallOnPrompt(CONFIG.chatMessage.recall ?? "relevant", CONFIG.chatMessage.injectOn ?? "first", CONFIG.chatMessage.snapshot ?? "live") ||
|
|
684
753
|
!hasNonSyntheticUserMessages ||
|
|
685
754
|
(isAfterCompaction &&
|
|
686
755
|
messages.filter((m) => m.info.role === "user" &&
|
|
@@ -1085,6 +1154,16 @@ export const OpenCodeMemPlugin = async (ctx) => {
|
|
|
1085
1154
|
return;
|
|
1086
1155
|
}
|
|
1087
1156
|
if (event.type === "session.idle") {
|
|
1157
|
+
const idleSessionID = event.properties?.sessionID;
|
|
1158
|
+
if (typeof idleSessionID === "string" && reviewEnabled()) {
|
|
1159
|
+
// Reply finished: run the due review off the event path so it never
|
|
1160
|
+
// delays the user or the auto-capture debounce below.
|
|
1161
|
+
void (async () => {
|
|
1162
|
+
if (await isInternalCaptureSession(ctx.client, idleSessionID))
|
|
1163
|
+
return;
|
|
1164
|
+
await runReviewIfDue(idleSessionID);
|
|
1165
|
+
})();
|
|
1166
|
+
}
|
|
1088
1167
|
if (!isConfigured() || !CONFIG.autoCaptureEnabled)
|
|
1089
1168
|
return;
|
|
1090
1169
|
if (cleanedUp)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-provider-factory.d.ts","sourceRoot":"","sources":["../../../src/services/ai/ai-provider-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"ai-provider-factory.d.ts","sourceRoot":"","sources":["../../../src/services/ai/ai-provider-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAcnF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAEjE,qBAAa,iBAAiB;IAC5B,MAAM,CAAC,cAAc,CAAC,YAAY,EAAE,cAAc,EAAE,MAAM,EAAE,cAAc,GAAG,cAAc;IA2C3F,MAAM,CAAC,qBAAqB,IAAI,cAAc,EAAE;WAiBnC,sBAAsB,IAAI,OAAO,CAAC,MAAM,CAAC;CAGvD"}
|
|
@@ -10,6 +10,7 @@ import { CheaperInferenceProvider } from "./providers/cheaper-inference.js";
|
|
|
10
10
|
import { OrcaRouterProvider } from "./providers/orcarouter.js";
|
|
11
11
|
import { RuncrateProvider } from "./providers/runcrate.js";
|
|
12
12
|
import { CloudGPUProvider } from "./providers/cloudgpu.js";
|
|
13
|
+
import { StandardComputeProvider } from "./providers/standardcompute.js";
|
|
13
14
|
import { aiSessionManager } from "./session/ai-session-manager.js";
|
|
14
15
|
export class AIProviderFactory {
|
|
15
16
|
static createProvider(providerType, config) {
|
|
@@ -22,6 +23,8 @@ export class AIProviderFactory {
|
|
|
22
23
|
return new RuncrateProvider(config, aiSessionManager);
|
|
23
24
|
case "cloudgpu":
|
|
24
25
|
return new CloudGPUProvider(config, aiSessionManager);
|
|
26
|
+
case "standardcompute":
|
|
27
|
+
return new StandardComputeProvider(config, aiSessionManager);
|
|
25
28
|
case "cheaper-inference":
|
|
26
29
|
return new CheaperInferenceProvider(config, aiSessionManager);
|
|
27
30
|
case "openai-chat":
|
|
@@ -53,6 +56,7 @@ export class AIProviderFactory {
|
|
|
53
56
|
"orcarouter",
|
|
54
57
|
"runcrate",
|
|
55
58
|
"cloudgpu",
|
|
59
|
+
"standardcompute",
|
|
56
60
|
];
|
|
57
61
|
}
|
|
58
62
|
static async cleanupExpiredSessions() {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type GenerationRecord = {
|
|
2
|
+
requestID: string;
|
|
3
|
+
startedAt: string;
|
|
4
|
+
durationMs: number;
|
|
5
|
+
model: {
|
|
6
|
+
providerID: string;
|
|
7
|
+
id: string;
|
|
8
|
+
variant?: string;
|
|
9
|
+
} | null;
|
|
10
|
+
status: "success" | "error";
|
|
11
|
+
inputBytes: number;
|
|
12
|
+
outputBytes: number | null;
|
|
13
|
+
};
|
|
14
|
+
/** Store measurements only: never prompts, generated memories or error bodies. */
|
|
15
|
+
export declare function recordGeneration(path: string | undefined, record: GenerationRecord): void;
|
|
16
|
+
//# sourceMappingURL=generation-ledger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generation-ledger.d.ts","sourceRoot":"","sources":["../../../src/services/ai/generation-ledger.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACnE,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B,CAAC;AAEF,kFAAkF;AAClF,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,EAAE,gBAAgB,GAAG,IAAI,CAkBzF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { appendFileSync, mkdirSync } from "node:fs";
|
|
2
|
+
import { dirname } from "node:path";
|
|
3
|
+
/** Store measurements only: never prompts, generated memories or error bodies. */
|
|
4
|
+
export function recordGeneration(path, record) {
|
|
5
|
+
if (!path)
|
|
6
|
+
return;
|
|
7
|
+
try {
|
|
8
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
9
|
+
appendFileSync(path, JSON.stringify({
|
|
10
|
+
...record,
|
|
11
|
+
// The host's stateless Generate API currently returns text only.
|
|
12
|
+
tokens: null,
|
|
13
|
+
cost: null,
|
|
14
|
+
usageStatus: "not_exposed_by_host",
|
|
15
|
+
}) + "\n", { mode: 0o600 });
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
console.warn("opencode-mem: could not append generation ledger");
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared endpoint/model defaults for OpenAI-compatible memory provider presets.
|
|
3
|
+
*
|
|
4
|
+
* Kept as a leaf module so `config.ts` can resolve key-only presets into
|
|
5
|
+
* runtime `CONFIG.memoryModel` / `CONFIG.memoryApiUrl` without importing
|
|
6
|
+
* provider classes (which pull in session managers that read `CONFIG`).
|
|
7
|
+
*/
|
|
8
|
+
export type MemoryProviderPresetId = "orcarouter" | "atlas-cloud" | "cheaper-inference" | "api-route" | "runcrate" | "cloudgpu" | "standardcompute";
|
|
9
|
+
export interface MemoryProviderPresetDefaults {
|
|
10
|
+
apiUrl: string;
|
|
11
|
+
model: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const MEMORY_PROVIDER_PRESET_DEFAULTS: Record<MemoryProviderPresetId, MemoryProviderPresetDefaults>;
|
|
14
|
+
export declare function isMemoryProviderPreset(provider: string | undefined): provider is MemoryProviderPresetId;
|
|
15
|
+
export declare function resolveMemoryProviderPresetDefaults(provider: string | undefined): MemoryProviderPresetDefaults | undefined;
|
|
16
|
+
//# sourceMappingURL=memory-provider-presets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory-provider-presets.d.ts","sourceRoot":"","sources":["../../../src/services/ai/memory-provider-presets.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,MAAM,sBAAsB,GAC9B,YAAY,GACZ,aAAa,GACb,mBAAmB,GACnB,WAAW,GACX,UAAU,GACV,UAAU,GACV,iBAAiB,CAAC;AAEtB,MAAM,WAAW,4BAA4B;IAC3C,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,+BAA+B,EAAE,MAAM,CAClD,sBAAsB,EACtB,4BAA4B,CA8B7B,CAAC;AAEF,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAC3B,QAAQ,IAAI,sBAAsB,CAUpC;AAED,wBAAgB,mCAAmC,CACjD,QAAQ,EAAE,MAAM,GAAG,SAAS,GAC3B,4BAA4B,GAAG,SAAS,CAG1C"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared endpoint/model defaults for OpenAI-compatible memory provider presets.
|
|
3
|
+
*
|
|
4
|
+
* Kept as a leaf module so `config.ts` can resolve key-only presets into
|
|
5
|
+
* runtime `CONFIG.memoryModel` / `CONFIG.memoryApiUrl` without importing
|
|
6
|
+
* provider classes (which pull in session managers that read `CONFIG`).
|
|
7
|
+
*/
|
|
8
|
+
export const MEMORY_PROVIDER_PRESET_DEFAULTS = {
|
|
9
|
+
orcarouter: {
|
|
10
|
+
apiUrl: "https://api.orcarouter.ai/v1",
|
|
11
|
+
model: "orcarouter/auto",
|
|
12
|
+
},
|
|
13
|
+
"atlas-cloud": {
|
|
14
|
+
apiUrl: "https://api.atlascloud.ai/v1",
|
|
15
|
+
model: "deepseek-ai/deepseek-v4-pro",
|
|
16
|
+
},
|
|
17
|
+
"cheaper-inference": {
|
|
18
|
+
apiUrl: "https://api.cheaperinference.com/v1",
|
|
19
|
+
model: "gpt-5.4-mini",
|
|
20
|
+
},
|
|
21
|
+
"api-route": {
|
|
22
|
+
apiUrl: "https://global.api-route.com/v1",
|
|
23
|
+
model: "gpt-6.1-sol",
|
|
24
|
+
},
|
|
25
|
+
runcrate: {
|
|
26
|
+
apiUrl: "https://api.runcrate.ai/v1",
|
|
27
|
+
model: "deepseek-ai/DeepSeek-V4.1-Flash",
|
|
28
|
+
},
|
|
29
|
+
cloudgpu: {
|
|
30
|
+
apiUrl: "https://cloudgpu.app/v1",
|
|
31
|
+
model: "deepseek-v4.1-flash",
|
|
32
|
+
},
|
|
33
|
+
standardcompute: {
|
|
34
|
+
apiUrl: "https://api.stdcmpt.com/v1",
|
|
35
|
+
model: "StandardCompute",
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
export function isMemoryProviderPreset(provider) {
|
|
39
|
+
return (provider === "orcarouter" ||
|
|
40
|
+
provider === "atlas-cloud" ||
|
|
41
|
+
provider === "cheaper-inference" ||
|
|
42
|
+
provider === "api-route" ||
|
|
43
|
+
provider === "runcrate" ||
|
|
44
|
+
provider === "cloudgpu" ||
|
|
45
|
+
provider === "standardcompute");
|
|
46
|
+
}
|
|
47
|
+
export function resolveMemoryProviderPresetDefaults(provider) {
|
|
48
|
+
if (!isMemoryProviderPreset(provider))
|
|
49
|
+
return undefined;
|
|
50
|
+
return MEMORY_PROVIDER_PRESET_DEFAULTS[provider];
|
|
51
|
+
}
|
|
@@ -61,6 +61,16 @@ export declare const STRUCTURED_OUTPUT_METADATA: {
|
|
|
61
61
|
purpose: string;
|
|
62
62
|
};
|
|
63
63
|
};
|
|
64
|
+
type StructuredOutputFallback = {
|
|
65
|
+
providerID: string;
|
|
66
|
+
modelID: string;
|
|
67
|
+
fallback: {
|
|
68
|
+
providerID: string;
|
|
69
|
+
modelID: string;
|
|
70
|
+
variant?: string;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
export declare function setStructuredOutputFallback(config?: StructuredOutputFallback): void;
|
|
64
74
|
export declare function setHostFetch(customFetch: typeof fetch): void;
|
|
65
75
|
export declare function resetHostFetch(): void;
|
|
66
76
|
export declare function setConnectedProviders(providers: string[]): void;
|
|
@@ -151,4 +161,5 @@ export declare function resolveOpencodeModelRef(opts: {
|
|
|
151
161
|
* missing structured/text JSON, timeout, or final Zod validation failure.
|
|
152
162
|
*/
|
|
153
163
|
export declare function generateStructuredOutput<T>(opts: StructuredOutputOptions<T>): Promise<T>;
|
|
164
|
+
export {};
|
|
154
165
|
//# sourceMappingURL=opencode-provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"opencode-provider.d.ts","sourceRoot":"","sources":["../../../src/services/ai/opencode-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;G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oEAAoE;AACpE,wBAAgB,mCAAmC,IAAI,IAAI,CAE1D;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE;IAC5C,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;CAClE,GAAG;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAmB1C;AAyBD;;;;;;;;;GASG;AACH,wBAAsB,wBAAwB,CAAC,CAAC,EAAE,IAAI,EAAE,uBAAuB,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAsB9F"}
|
|
@@ -85,6 +85,10 @@ const _internalSessions = new Set();
|
|
|
85
85
|
const _structuredStepCounts = new Map();
|
|
86
86
|
const _structuredStepAbortErrors = new Map();
|
|
87
87
|
let _connectedProviders = new Set();
|
|
88
|
+
let _structuredOutputFallback;
|
|
89
|
+
export function setStructuredOutputFallback(config) {
|
|
90
|
+
_structuredOutputFallback = config;
|
|
91
|
+
}
|
|
88
92
|
let _v2Client;
|
|
89
93
|
const _v2Clients = new Set();
|
|
90
94
|
let _v2BaseUrl;
|
|
@@ -121,7 +125,10 @@ export function clearConnectedProvidersRefresher(refresher) {
|
|
|
121
125
|
* the same call and never throws (refresh errors are logged by the refresher).
|
|
122
126
|
*/
|
|
123
127
|
export async function ensureProviderConnected(providerName) {
|
|
124
|
-
|
|
128
|
+
const available = () => _connectedProviders.has(providerName) ||
|
|
129
|
+
(_structuredOutputFallback?.providerID === providerName &&
|
|
130
|
+
_connectedProviders.has(_structuredOutputFallback.fallback.providerID));
|
|
131
|
+
if (available())
|
|
125
132
|
return true;
|
|
126
133
|
const refresher = _connectedProvidersRefresher;
|
|
127
134
|
if (!refresher)
|
|
@@ -132,7 +139,7 @@ export async function ensureProviderConnected(providerName) {
|
|
|
132
139
|
catch {
|
|
133
140
|
// The refresher logs; a failed refresh keeps the previous set.
|
|
134
141
|
}
|
|
135
|
-
return
|
|
142
|
+
return available();
|
|
136
143
|
}
|
|
137
144
|
export function setV2Client(client) {
|
|
138
145
|
_v2Client = client;
|
|
@@ -366,6 +373,28 @@ function readRecentOpencodeModel(preferredProvider) {
|
|
|
366
373
|
* missing structured/text JSON, timeout, or final Zod validation failure.
|
|
367
374
|
*/
|
|
368
375
|
export async function generateStructuredOutput(opts) {
|
|
376
|
+
const fallback = _structuredOutputFallback;
|
|
377
|
+
try {
|
|
378
|
+
return await generateStructuredOutputOnce(opts);
|
|
379
|
+
}
|
|
380
|
+
catch (error) {
|
|
381
|
+
if (!fallback ||
|
|
382
|
+
opts.providerID !== fallback.providerID ||
|
|
383
|
+
opts.modelID !== fallback.modelID ||
|
|
384
|
+
(opts.providerID === fallback.fallback.providerID &&
|
|
385
|
+
opts.modelID === fallback.fallback.modelID &&
|
|
386
|
+
opts.variant === fallback.fallback.variant)) {
|
|
387
|
+
throw error;
|
|
388
|
+
}
|
|
389
|
+
// One fallback attempt; callers retain ownership of any later retry policy.
|
|
390
|
+
return generateStructuredOutputOnce({
|
|
391
|
+
...opts,
|
|
392
|
+
...fallback.fallback,
|
|
393
|
+
variant: fallback.fallback.variant,
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
async function generateStructuredOutputOnce(opts) {
|
|
369
398
|
const resolved = resolveOpencodeModelRef({
|
|
370
399
|
providerID: opts.providerID,
|
|
371
400
|
modelID: opts.modelID,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-config.d.ts","sourceRoot":"","sources":["../../../src/services/ai/provider-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"provider-config.d.ts","sourceRoot":"","sources":["../../../src/services/ai/provider-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAInE,UAAU,2BAA2B;IACnC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IACnC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC5C,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,2BAA2B,CAAC,EAAE,MAAM,CAAC;CACtC;AAED,UAAU,uBAAuB;IAC/B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,2BAA2B,EACnC,SAAS,GAAE,uBAA4B,GACtC,cAAc,CA8BhB"}
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import { isPlaceholderApiKey } from "./api-key-placeholder.js";
|
|
2
|
+
import { isMemoryProviderPreset } from "./memory-provider-presets.js";
|
|
2
3
|
export function buildMemoryProviderConfig(config, overrides = {}) {
|
|
3
4
|
const memoryModel = config.memoryModel;
|
|
4
5
|
const memoryApiUrl = config.memoryApiUrl;
|
|
5
6
|
const memoryApiKey = config.memoryApiKey;
|
|
6
7
|
const issues = [];
|
|
7
|
-
// Preset providers fill endpoint/model themselves
|
|
8
|
-
//
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
config.memoryProvider === "cheaper-inference" ||
|
|
12
|
-
config.memoryProvider === "api-route" ||
|
|
13
|
-
config.memoryProvider === "runcrate" ||
|
|
14
|
-
config.memoryProvider === "cloudgpu";
|
|
8
|
+
// Preset providers fill endpoint/model themselves (and config resolution
|
|
9
|
+
// materializes those defaults into CONFIG), so memoryModel / memoryApiUrl
|
|
10
|
+
// are optional there. An API key is always required.
|
|
11
|
+
const isPresetProvider = isMemoryProviderPreset(config.memoryProvider);
|
|
15
12
|
if (!memoryModel && !isPresetProvider)
|
|
16
13
|
issues.push("missing memoryModel");
|
|
17
14
|
if (!memoryApiUrl && !isPresetProvider)
|
|
@@ -3,12 +3,12 @@ import type { ProviderConfig } from "./base-provider.js";
|
|
|
3
3
|
import type { AISessionManager } from "../session/ai-session-manager.js";
|
|
4
4
|
import type { AIProviderType } from "../session/session-types.js";
|
|
5
5
|
/** API Route OpenAI-compatible endpoint used when `memoryApiUrl` is omitted. */
|
|
6
|
-
export declare const API_ROUTE_API_URL
|
|
6
|
+
export declare const API_ROUTE_API_URL: string;
|
|
7
7
|
/**
|
|
8
8
|
* Default model when `memoryModel` is omitted. API Route model IDs are
|
|
9
9
|
* sent unchanged (e.g. `gpt-6.1-sol`).
|
|
10
10
|
*/
|
|
11
|
-
export declare const API_ROUTE_DEFAULT_MODEL
|
|
11
|
+
export declare const API_ROUTE_DEFAULT_MODEL: string;
|
|
12
12
|
/**
|
|
13
13
|
* API Route provider.
|
|
14
14
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-route.d.ts","sourceRoot":"","sources":["../../../../src/services/ai/providers/api-route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"api-route.d.ts","sourceRoot":"","sources":["../../../../src/services/ai/providers/api-route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAGlE,gFAAgF;AAChF,eAAO,MAAM,iBAAiB,QAAsD,CAAC;AAErF;;;GAGG;AACH,eAAO,MAAM,uBAAuB,QAAqD,CAAC;AAE1F;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,gBAAiB,SAAQ,4BAA4B;gBACpD,MAAM,EAAE,cAAc,EAAE,gBAAgB,EAAE,gBAAgB;IAI7D,eAAe,IAAI,MAAM;cAIf,kBAAkB,IAAI,cAAc;IAIvD;;;;;OAKG;IACM,eAAe,IAAI,MAAM;IAKlC;;;;OAIG;IACM,YAAY,IAAI,MAAM;CAIhC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { OpenAIChatCompletionProvider } from "./openai-chat-completion.js";
|
|
2
|
+
import { MEMORY_PROVIDER_PRESET_DEFAULTS } from "../memory-provider-presets.js";
|
|
2
3
|
/** API Route OpenAI-compatible endpoint used when `memoryApiUrl` is omitted. */
|
|
3
|
-
export const API_ROUTE_API_URL = "
|
|
4
|
+
export const API_ROUTE_API_URL = MEMORY_PROVIDER_PRESET_DEFAULTS["api-route"].apiUrl;
|
|
4
5
|
/**
|
|
5
6
|
* Default model when `memoryModel` is omitted. API Route model IDs are
|
|
6
7
|
* sent unchanged (e.g. `gpt-6.1-sol`).
|
|
7
8
|
*/
|
|
8
|
-
export const API_ROUTE_DEFAULT_MODEL = "
|
|
9
|
+
export const API_ROUTE_DEFAULT_MODEL = MEMORY_PROVIDER_PRESET_DEFAULTS["api-route"].model;
|
|
9
10
|
/**
|
|
10
11
|
* API Route provider.
|
|
11
12
|
*
|
|
@@ -3,12 +3,12 @@ import type { ProviderConfig } from "./base-provider.js";
|
|
|
3
3
|
import type { AISessionManager } from "../session/ai-session-manager.js";
|
|
4
4
|
import type { AIProviderType } from "../session/session-types.js";
|
|
5
5
|
/** Atlas Cloud OpenAI-compatible endpoint used when `memoryApiUrl` is omitted. */
|
|
6
|
-
export declare const ATLAS_CLOUD_API_URL
|
|
6
|
+
export declare const ATLAS_CLOUD_API_URL: string;
|
|
7
7
|
/**
|
|
8
8
|
* Default model when `memoryModel` is omitted. Atlas Cloud model IDs are
|
|
9
9
|
* typically namespaced (e.g. `deepseek-ai/deepseek-v4-pro`).
|
|
10
10
|
*/
|
|
11
|
-
export declare const ATLAS_CLOUD_DEFAULT_MODEL
|
|
11
|
+
export declare const ATLAS_CLOUD_DEFAULT_MODEL: string;
|
|
12
12
|
/**
|
|
13
13
|
* Atlas Cloud provider.
|
|
14
14
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"atlas-cloud.d.ts","sourceRoot":"","sources":["../../../../src/services/ai/providers/atlas-cloud.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"atlas-cloud.d.ts","sourceRoot":"","sources":["../../../../src/services/ai/providers/atlas-cloud.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAGlE,kFAAkF;AAClF,eAAO,MAAM,mBAAmB,QAAwD,CAAC;AAEzF;;;GAGG;AACH,eAAO,MAAM,yBAAyB,QAAuD,CAAC;AAE9F;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,kBAAmB,SAAQ,4BAA4B;gBACtD,MAAM,EAAE,cAAc,EAAE,gBAAgB,EAAE,gBAAgB;IAI7D,eAAe,IAAI,MAAM;cAIf,kBAAkB,IAAI,cAAc;IAIvD;;;;;OAKG;IACM,eAAe,IAAI,MAAM;IAKlC;;;;;OAKG;IACM,YAAY,IAAI,MAAM;CAIhC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { OpenAIChatCompletionProvider } from "./openai-chat-completion.js";
|
|
2
|
+
import { MEMORY_PROVIDER_PRESET_DEFAULTS } from "../memory-provider-presets.js";
|
|
2
3
|
/** Atlas Cloud OpenAI-compatible endpoint used when `memoryApiUrl` is omitted. */
|
|
3
|
-
export const ATLAS_CLOUD_API_URL = "
|
|
4
|
+
export const ATLAS_CLOUD_API_URL = MEMORY_PROVIDER_PRESET_DEFAULTS["atlas-cloud"].apiUrl;
|
|
4
5
|
/**
|
|
5
6
|
* Default model when `memoryModel` is omitted. Atlas Cloud model IDs are
|
|
6
7
|
* typically namespaced (e.g. `deepseek-ai/deepseek-v4-pro`).
|
|
7
8
|
*/
|
|
8
|
-
export const ATLAS_CLOUD_DEFAULT_MODEL = "
|
|
9
|
+
export const ATLAS_CLOUD_DEFAULT_MODEL = MEMORY_PROVIDER_PRESET_DEFAULTS["atlas-cloud"].model;
|
|
9
10
|
/**
|
|
10
11
|
* Atlas Cloud provider.
|
|
11
12
|
*
|
|
@@ -3,12 +3,12 @@ import type { ProviderConfig } from "./base-provider.js";
|
|
|
3
3
|
import type { AISessionManager } from "../session/ai-session-manager.js";
|
|
4
4
|
import type { AIProviderType } from "../session/session-types.js";
|
|
5
5
|
/** Cheaper Inference OpenAI-compatible endpoint used when `memoryApiUrl` is omitted. */
|
|
6
|
-
export declare const CHEAPER_INFERENCE_API_URL
|
|
6
|
+
export declare const CHEAPER_INFERENCE_API_URL: string;
|
|
7
7
|
/**
|
|
8
8
|
* Default model when `memoryModel` is omitted. Cheaper Inference model IDs are
|
|
9
9
|
* bare (e.g. `gpt-5.4-mini`, `claude-sonnet-5`).
|
|
10
10
|
*/
|
|
11
|
-
export declare const CHEAPER_INFERENCE_DEFAULT_MODEL
|
|
11
|
+
export declare const CHEAPER_INFERENCE_DEFAULT_MODEL: string;
|
|
12
12
|
/**
|
|
13
13
|
* Cheaper Inference provider.
|
|
14
14
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cheaper-inference.d.ts","sourceRoot":"","sources":["../../../../src/services/ai/providers/cheaper-inference.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"cheaper-inference.d.ts","sourceRoot":"","sources":["../../../../src/services/ai/providers/cheaper-inference.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAGlE,wFAAwF;AACxF,eAAO,MAAM,yBAAyB,QACuB,CAAC;AAE9D;;;GAGG;AACH,eAAO,MAAM,+BAA+B,QACgB,CAAC;AAE7D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,wBAAyB,SAAQ,4BAA4B;gBAC5D,MAAM,EAAE,cAAc,EAAE,gBAAgB,EAAE,gBAAgB;IAI7D,eAAe,IAAI,MAAM;cAIf,kBAAkB,IAAI,cAAc;IAIvD;;;;;OAKG;IACM,eAAe,IAAI,MAAM;IAKlC;;;;OAIG;IACM,YAAY,IAAI,MAAM;CAIhC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { OpenAIChatCompletionProvider } from "./openai-chat-completion.js";
|
|
2
|
+
import { MEMORY_PROVIDER_PRESET_DEFAULTS } from "../memory-provider-presets.js";
|
|
2
3
|
/** Cheaper Inference OpenAI-compatible endpoint used when `memoryApiUrl` is omitted. */
|
|
3
|
-
export const CHEAPER_INFERENCE_API_URL = "
|
|
4
|
+
export const CHEAPER_INFERENCE_API_URL = MEMORY_PROVIDER_PRESET_DEFAULTS["cheaper-inference"].apiUrl;
|
|
4
5
|
/**
|
|
5
6
|
* Default model when `memoryModel` is omitted. Cheaper Inference model IDs are
|
|
6
7
|
* bare (e.g. `gpt-5.4-mini`, `claude-sonnet-5`).
|
|
7
8
|
*/
|
|
8
|
-
export const CHEAPER_INFERENCE_DEFAULT_MODEL = "
|
|
9
|
+
export const CHEAPER_INFERENCE_DEFAULT_MODEL = MEMORY_PROVIDER_PRESET_DEFAULTS["cheaper-inference"].model;
|
|
9
10
|
/**
|
|
10
11
|
* Cheaper Inference provider.
|
|
11
12
|
*
|
|
@@ -3,12 +3,12 @@ import type { ProviderConfig } from "./base-provider.js";
|
|
|
3
3
|
import type { AISessionManager } from "../session/ai-session-manager.js";
|
|
4
4
|
import type { AIProviderType } from "../session/session-types.js";
|
|
5
5
|
/** CloudGPU OpenAI-compatible endpoint used when `memoryApiUrl` is omitted. */
|
|
6
|
-
export declare const CLOUDGPU_API_URL
|
|
6
|
+
export declare const CLOUDGPU_API_URL: string;
|
|
7
7
|
/**
|
|
8
8
|
* Default model when `memoryModel` is omitted. CloudGPU model IDs are listed
|
|
9
9
|
* at `https://cloudgpu.app/v1/models` and are sent unchanged (e.g. `deepseek-v4.1-flash`).
|
|
10
10
|
*/
|
|
11
|
-
export declare const CLOUDGPU_DEFAULT_MODEL
|
|
11
|
+
export declare const CLOUDGPU_DEFAULT_MODEL: string;
|
|
12
12
|
/**
|
|
13
13
|
* CloudGPU provider.
|
|
14
14
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloudgpu.d.ts","sourceRoot":"","sources":["../../../../src/services/ai/providers/cloudgpu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"cloudgpu.d.ts","sourceRoot":"","sources":["../../../../src/services/ai/providers/cloudgpu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAGlE,+EAA+E;AAC/E,eAAO,MAAM,gBAAgB,QAAkD,CAAC;AAEhF;;;GAGG;AACH,eAAO,MAAM,sBAAsB,QAAiD,CAAC;AAErF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,gBAAiB,SAAQ,4BAA4B;gBACpD,MAAM,EAAE,cAAc,EAAE,gBAAgB,EAAE,gBAAgB;IAI7D,eAAe,IAAI,MAAM;cAIf,kBAAkB,IAAI,cAAc;IAIvD;;;;;OAKG;IACM,eAAe,IAAI,MAAM;IAKlC;;;;OAIG;IACM,YAAY,IAAI,MAAM;CAIhC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { OpenAIChatCompletionProvider } from "./openai-chat-completion.js";
|
|
2
|
+
import { MEMORY_PROVIDER_PRESET_DEFAULTS } from "../memory-provider-presets.js";
|
|
2
3
|
/** CloudGPU OpenAI-compatible endpoint used when `memoryApiUrl` is omitted. */
|
|
3
|
-
export const CLOUDGPU_API_URL =
|
|
4
|
+
export const CLOUDGPU_API_URL = MEMORY_PROVIDER_PRESET_DEFAULTS.cloudgpu.apiUrl;
|
|
4
5
|
/**
|
|
5
6
|
* Default model when `memoryModel` is omitted. CloudGPU model IDs are listed
|
|
6
7
|
* at `https://cloudgpu.app/v1/models` and are sent unchanged (e.g. `deepseek-v4.1-flash`).
|
|
7
8
|
*/
|
|
8
|
-
export const CLOUDGPU_DEFAULT_MODEL =
|
|
9
|
+
export const CLOUDGPU_DEFAULT_MODEL = MEMORY_PROVIDER_PRESET_DEFAULTS.cloudgpu.model;
|
|
9
10
|
/**
|
|
10
11
|
* CloudGPU provider.
|
|
11
12
|
*
|
|
@@ -3,13 +3,13 @@ import type { ProviderConfig } from "./base-provider.js";
|
|
|
3
3
|
import type { AISessionManager } from "../session/ai-session-manager.js";
|
|
4
4
|
import type { AIProviderType } from "../session/session-types.js";
|
|
5
5
|
/** OrcaRouter OpenAI-compatible endpoint used when `memoryApiUrl` is omitted. */
|
|
6
|
-
export declare const ORCAROUTER_API_URL
|
|
6
|
+
export declare const ORCAROUTER_API_URL: string;
|
|
7
7
|
/**
|
|
8
8
|
* Default model when `memoryModel` is omitted. `orcarouter/auto` is the
|
|
9
9
|
* gateway's routing alias — it picks a capable upstream model per request
|
|
10
10
|
* (including structured / tool-call output, which auto-capture relies on).
|
|
11
11
|
*/
|
|
12
|
-
export declare const ORCAROUTER_DEFAULT_MODEL
|
|
12
|
+
export declare const ORCAROUTER_DEFAULT_MODEL: string;
|
|
13
13
|
/**
|
|
14
14
|
* OrcaRouter provider.
|
|
15
15
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orcarouter.d.ts","sourceRoot":"","sources":["../../../../src/services/ai/providers/orcarouter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"orcarouter.d.ts","sourceRoot":"","sources":["../../../../src/services/ai/providers/orcarouter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAGlE,iFAAiF;AACjF,eAAO,MAAM,kBAAkB,QAAoD,CAAC;AAEpF;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,QAAmD,CAAC;AAEzF;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,kBAAmB,SAAQ,4BAA4B;gBACtD,MAAM,EAAE,cAAc,EAAE,gBAAgB,EAAE,gBAAgB;IAI7D,eAAe,IAAI,MAAM;cAIf,kBAAkB,IAAI,cAAc;IAIvD;;;;;OAKG;IACM,eAAe,IAAI,MAAM;IAKlC;;;;;;;OAOG;IACM,YAAY,IAAI,MAAM;CAYhC"}
|