@remnic/core 1.0.0 → 1.0.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/dist/access-cli.js +10 -9
- package/dist/access-cli.js.map +1 -1
- package/dist/access-http.d.ts +1 -1
- package/dist/access-mcp.d.ts +1 -1
- package/dist/access-schema.d.ts +40 -40
- package/dist/access-service.d.ts +1 -1
- package/dist/bootstrap.d.ts +1 -1
- package/dist/calibration.js +3 -2
- package/dist/calibration.js.map +1 -1
- package/dist/causal-consolidation.js +3 -2
- package/dist/causal-consolidation.js.map +1 -1
- package/dist/{chunk-QFQVZOGA.js → chunk-6UJQNRIO.js} +2 -2
- package/dist/{chunk-CDW777AI.js → chunk-LP47L3ZX.js} +2 -2
- package/dist/{chunk-LU3GQNDQ.js → chunk-M5ZBBBJI.js} +12 -1
- package/dist/chunk-M5ZBBBJI.js.map +1 -0
- package/dist/chunk-OOSWAUYB.js +47 -0
- package/dist/chunk-OOSWAUYB.js.map +1 -0
- package/dist/{chunk-YAPUAHAY.js → chunk-OTFNI3OO.js} +32 -32
- package/dist/{chunk-TKO4HZCK.js → chunk-UYSKNO6E.js} +1 -1
- package/dist/{chunk-KT4NEUNF.js → chunk-XUHI52HK.js} +80 -22
- package/dist/chunk-XUHI52HK.js.map +1 -0
- package/dist/cli.d.ts +2 -2
- package/dist/cli.js +1 -1
- package/dist/{engine-P26JFSVY.js → engine-2A6J4XEX.js} +2 -2
- package/dist/explicit-capture.d.ts +1 -1
- package/dist/extraction.js +4 -3
- package/dist/fallback-llm.d.ts +22 -3
- package/dist/fallback-llm.js +3 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +10 -9
- package/dist/index.js.map +1 -1
- package/dist/models-json.d.ts +17 -0
- package/dist/models-json.js +12 -0
- package/dist/models-json.js.map +1 -0
- package/dist/orchestrator.d.ts +1 -1
- package/dist/orchestrator.js +10 -9
- package/dist/resolve-provider-secret.d.ts +29 -1
- package/dist/resolve-provider-secret.js +3 -1
- package/dist/schemas.d.ts +42 -42
- package/dist/summarizer.js +4 -3
- package/package.json +2 -1
- package/dist/chunk-KT4NEUNF.js.map +0 -1
- package/dist/chunk-LU3GQNDQ.js.map +0 -1
- package/dist/{chunk-QFQVZOGA.js.map → chunk-6UJQNRIO.js.map} +0 -0
- package/dist/{chunk-CDW777AI.js.map → chunk-LP47L3ZX.js.map} +0 -0
- package/dist/{chunk-YAPUAHAY.js.map → chunk-OTFNI3OO.js.map} +0 -0
- package/dist/{chunk-TKO4HZCK.js.map → chunk-UYSKNO6E.js.map} +0 -0
- package/dist/{engine-P26JFSVY.js.map → engine-2A6J4XEX.js.map} +0 -0
- package/dist/{orchestrator-zTa-Qo-1.d.ts → orchestrator-CIvLFHx3.d.ts} +2 -2
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ModelProviderConfig } from './types.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Load the full providers map from the gateway's models.json.
|
|
5
|
+
* Returns an empty object if the file doesn't exist or can't be parsed.
|
|
6
|
+
*/
|
|
7
|
+
declare function loadModelsJsonProviders(): Record<string, ModelProviderConfig>;
|
|
8
|
+
/**
|
|
9
|
+
* Clear the cached providers (useful for testing).
|
|
10
|
+
*/
|
|
11
|
+
declare function clearModelsJsonCache(): void;
|
|
12
|
+
/**
|
|
13
|
+
* Inject a providers map for testing, bypassing file I/O.
|
|
14
|
+
*/
|
|
15
|
+
declare function __setModelsJsonForTest(providers: Record<string, ModelProviderConfig>): void;
|
|
16
|
+
|
|
17
|
+
export { __setModelsJsonForTest, clearModelsJsonCache, loadModelsJsonProviders };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__setModelsJsonForTest,
|
|
3
|
+
clearModelsJsonCache,
|
|
4
|
+
loadModelsJsonProviders
|
|
5
|
+
} from "./chunk-OOSWAUYB.js";
|
|
6
|
+
import "./chunk-KWBU5S5U.js";
|
|
7
|
+
export {
|
|
8
|
+
__setModelsJsonForTest,
|
|
9
|
+
clearModelsJsonCache,
|
|
10
|
+
loadModelsJsonProviders
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=models-json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/orchestrator.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import './negative.js';
|
|
|
10
10
|
import './recall-state.js';
|
|
11
11
|
import './session-observer-state.js';
|
|
12
12
|
import './embedding-fallback.js';
|
|
13
|
-
export { c as GraphRecallRankedResult, e as GraphRecallShadowComparison, G as GraphRecallSnapshot, I as IntentDebugSnapshot, O as Orchestrator, Q as QmdRecallSnapshot, f as RecallInvocationOptions, g as RecallModeDecision, h as appendMemoryToGraphContext, i as blendGraphExpandedRecallScore, j as buildCompressionGuidelinesMarkdown, k as buildMemoryPathById, l as computeArtifactCandidateFetchLimit, m as computeArtifactRecallLimit, n as computeQmdHybridFetchLimit, d as defaultWorkspaceDir, o as deriveTopicsFromExtraction, p as filterRecallCandidates, q as formatCompressionGuidelinesForRecall, r as graphPathRelativeToStorage, t as hasIdentityRecoveryIntent, u as isArtifactMemoryPath, v as lifecycleRecallScoreAdjustment, w as mergeArtifactRecallCandidates, x as mergeGraphExpandedResults, y as resolveEffectiveIdentityInjectionMode, z as resolveEffectiveRecallMode, A as resolvePersistedMemoryRelativePath, B as resolveRecallModeDecision, D as resolveRecentThreadMemoryPaths, s as sanitizeSessionKeyForFilename, E as shouldFilterLifecycleRecallCandidate, F as summarizeGraphShadowComparison } from './orchestrator-
|
|
13
|
+
export { c as GraphRecallRankedResult, e as GraphRecallShadowComparison, G as GraphRecallSnapshot, I as IntentDebugSnapshot, O as Orchestrator, Q as QmdRecallSnapshot, f as RecallInvocationOptions, g as RecallModeDecision, h as appendMemoryToGraphContext, i as blendGraphExpandedRecallScore, j as buildCompressionGuidelinesMarkdown, k as buildMemoryPathById, l as computeArtifactCandidateFetchLimit, m as computeArtifactRecallLimit, n as computeQmdHybridFetchLimit, d as defaultWorkspaceDir, o as deriveTopicsFromExtraction, p as filterRecallCandidates, q as formatCompressionGuidelinesForRecall, r as graphPathRelativeToStorage, t as hasIdentityRecoveryIntent, u as isArtifactMemoryPath, v as lifecycleRecallScoreAdjustment, w as mergeArtifactRecallCandidates, x as mergeGraphExpandedResults, y as resolveEffectiveIdentityInjectionMode, z as resolveEffectiveRecallMode, A as resolvePersistedMemoryRelativePath, B as resolveRecallModeDecision, D as resolveRecentThreadMemoryPaths, s as sanitizeSessionKeyForFilename, E as shouldFilterLifecycleRecallCandidate, F as summarizeGraphShadowComparison } from './orchestrator-CIvLFHx3.js';
|
|
14
14
|
import './types.js';
|
|
15
15
|
import './semantic-consolidation.js';
|
|
16
16
|
import './policy-runtime.js';
|
package/dist/orchestrator.js
CHANGED
|
@@ -25,30 +25,30 @@ import {
|
|
|
25
25
|
sanitizeSessionKeyForFilename,
|
|
26
26
|
shouldFilterLifecycleRecallCandidate,
|
|
27
27
|
summarizeGraphShadowComparison
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-OTFNI3OO.js";
|
|
29
|
+
import "./chunk-UYSKNO6E.js";
|
|
29
30
|
import "./chunk-IFFFR3MR.js";
|
|
30
|
-
import "./chunk-TKO4HZCK.js";
|
|
31
31
|
import "./chunk-Z5AAYHUC.js";
|
|
32
32
|
import "./chunk-4A24LIM2.js";
|
|
33
33
|
import "./chunk-TPB3I2AC.js";
|
|
34
34
|
import "./chunk-UHGBNIOS.js";
|
|
35
35
|
import "./chunk-ZKYI7UVO.js";
|
|
36
|
-
import "./chunk-
|
|
36
|
+
import "./chunk-LP47L3ZX.js";
|
|
37
37
|
import "./chunk-ETOW6ACV.js";
|
|
38
|
+
import "./chunk-GPGBSNKM.js";
|
|
39
|
+
import "./chunk-V3RXWQIE.js";
|
|
38
40
|
import "./chunk-G3AG3KZN.js";
|
|
39
41
|
import "./chunk-2CJCWDMR.js";
|
|
42
|
+
import "./chunk-HG2NKWR2.js";
|
|
40
43
|
import "./chunk-X7XN6YU4.js";
|
|
41
44
|
import "./chunk-BRK4ODMI.js";
|
|
42
45
|
import "./chunk-C7VW7C3F.js";
|
|
43
|
-
import "./chunk-GPGBSNKM.js";
|
|
44
|
-
import "./chunk-V3RXWQIE.js";
|
|
45
46
|
import "./chunk-YCN4BVDK.js";
|
|
46
47
|
import "./chunk-L5RPWGFK.js";
|
|
47
|
-
import "./chunk-HG2NKWR2.js";
|
|
48
48
|
import "./chunk-GJR6D6KC.js";
|
|
49
49
|
import "./chunk-H63EDPFJ.js";
|
|
50
50
|
import "./chunk-WWIQTB2Y.js";
|
|
51
|
-
import "./chunk-
|
|
51
|
+
import "./chunk-6UJQNRIO.js";
|
|
52
52
|
import "./chunk-MWGVGUIS.js";
|
|
53
53
|
import "./chunk-763GUIOU.js";
|
|
54
54
|
import "./chunk-ONRU4L2N.js";
|
|
@@ -87,8 +87,9 @@ import "./chunk-JWPLJLDU.js";
|
|
|
87
87
|
import "./chunk-YNI4S5WT.js";
|
|
88
88
|
import "./chunk-DORBM6OB.js";
|
|
89
89
|
import "./chunk-XYIK4LF6.js";
|
|
90
|
-
import "./chunk-
|
|
91
|
-
import "./chunk-
|
|
90
|
+
import "./chunk-XUHI52HK.js";
|
|
91
|
+
import "./chunk-M5ZBBBJI.js";
|
|
92
|
+
import "./chunk-OOSWAUYB.js";
|
|
92
93
|
import "./chunk-Y27UJK6V.js";
|
|
93
94
|
import "./chunk-UZB5KHKX.js";
|
|
94
95
|
import "./chunk-M5KEYE5E.js";
|
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve request-ready auth for a model, including provider-owned transforms
|
|
3
|
+
* (e.g., OAuth token exchange, base URL override for openai-codex).
|
|
4
|
+
*/
|
|
5
|
+
type GetRuntimeAuthForModelFn = (params: {
|
|
6
|
+
model: {
|
|
7
|
+
provider: string;
|
|
8
|
+
id: string;
|
|
9
|
+
api?: string;
|
|
10
|
+
baseUrl?: string;
|
|
11
|
+
};
|
|
12
|
+
cfg?: unknown;
|
|
13
|
+
workspaceDir?: string;
|
|
14
|
+
}) => Promise<{
|
|
15
|
+
apiKey?: string;
|
|
16
|
+
baseUrl?: string;
|
|
17
|
+
source?: string;
|
|
18
|
+
mode?: string;
|
|
19
|
+
profileId?: string;
|
|
20
|
+
} | null>;
|
|
1
21
|
/**
|
|
2
22
|
* Resolve a provider API key from various OpenClaw formats.
|
|
3
23
|
*
|
|
@@ -8,9 +28,17 @@
|
|
|
8
28
|
* 4. undefined → provider is skipped in the fallback chain
|
|
9
29
|
*/
|
|
10
30
|
declare function resolveProviderApiKey(providerId: string, apiKeyValue: unknown, gatewayConfig?: unknown, agentDir?: string): Promise<string | undefined>;
|
|
31
|
+
/**
|
|
32
|
+
* Get the gateway's getRuntimeAuthForModel function, if available.
|
|
33
|
+
* This resolves request-ready auth including provider-owned transforms
|
|
34
|
+
* (OAuth token exchange, base URL override for codex/copilot/etc.).
|
|
35
|
+
* Must be called after at least one resolveProviderApiKey() call to
|
|
36
|
+
* trigger the lazy module load.
|
|
37
|
+
*/
|
|
38
|
+
declare function getGatewayRuntimeAuthForModel(): Promise<GetRuntimeAuthForModelFn | null>;
|
|
11
39
|
/**
|
|
12
40
|
* Clear the resolution cache (useful for testing or key rotation).
|
|
13
41
|
*/
|
|
14
42
|
declare function clearSecretCache(): void;
|
|
15
43
|
|
|
16
|
-
export { clearSecretCache, resolveProviderApiKey };
|
|
44
|
+
export { type GetRuntimeAuthForModelFn, clearSecretCache, getGatewayRuntimeAuthForModel, resolveProviderApiKey };
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
clearSecretCache,
|
|
3
|
+
getGatewayRuntimeAuthForModel,
|
|
3
4
|
resolveProviderApiKey
|
|
4
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-M5ZBBBJI.js";
|
|
5
6
|
import "./chunk-MARWOCVP.js";
|
|
6
7
|
import "./chunk-KWBU5S5U.js";
|
|
7
8
|
export {
|
|
8
9
|
clearSecretCache,
|
|
10
|
+
getGatewayRuntimeAuthForModel,
|
|
9
11
|
resolveProviderApiKey
|
|
10
12
|
};
|
|
11
13
|
//# sourceMappingURL=resolve-provider-secret.js.map
|
package/dist/schemas.d.ts
CHANGED
|
@@ -8,13 +8,13 @@ declare const MemoryActionEligibilityContextSchema: z.ZodObject<{
|
|
|
8
8
|
source: z.ZodEnum<["extraction", "consolidation", "replay", "manual", "unknown"]>;
|
|
9
9
|
}, "strict", z.ZodTypeAny, {
|
|
10
10
|
confidence: number;
|
|
11
|
-
source: "
|
|
12
|
-
lifecycleState: "
|
|
11
|
+
source: "manual" | "unknown" | "replay" | "extraction" | "consolidation";
|
|
12
|
+
lifecycleState: "validated" | "active" | "archived" | "candidate" | "stale";
|
|
13
13
|
importance: number;
|
|
14
14
|
}, {
|
|
15
15
|
confidence: number;
|
|
16
|
-
source: "
|
|
17
|
-
lifecycleState: "
|
|
16
|
+
source: "manual" | "unknown" | "replay" | "extraction" | "consolidation";
|
|
17
|
+
lifecycleState: "validated" | "active" | "archived" | "candidate" | "stale";
|
|
18
18
|
importance: number;
|
|
19
19
|
}>;
|
|
20
20
|
declare function parseMemoryActionType(value: unknown): z.infer<typeof MemoryActionTypeSchema>;
|
|
@@ -28,16 +28,16 @@ declare const ExtractedFactSchema: z.ZodObject<{
|
|
|
28
28
|
promptedByQuestion: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
29
29
|
structuredAttributes: z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
|
|
30
30
|
}, "strip", z.ZodTypeAny, {
|
|
31
|
-
category: "fact" | "preference" | "correction" | "entity" | "decision" | "relationship" | "principle" | "commitment" | "moment" | "skill" | "rule";
|
|
32
31
|
content: string;
|
|
32
|
+
category: "fact" | "preference" | "correction" | "entity" | "decision" | "relationship" | "principle" | "commitment" | "moment" | "skill" | "rule";
|
|
33
33
|
confidence: number;
|
|
34
34
|
tags: string[];
|
|
35
35
|
entityRef?: string | null | undefined;
|
|
36
36
|
structuredAttributes?: Record<string, string> | null | undefined;
|
|
37
37
|
promptedByQuestion?: string | null | undefined;
|
|
38
38
|
}, {
|
|
39
|
-
category: "fact" | "preference" | "correction" | "entity" | "decision" | "relationship" | "principle" | "commitment" | "moment" | "skill" | "rule";
|
|
40
39
|
content: string;
|
|
40
|
+
category: "fact" | "preference" | "correction" | "entity" | "decision" | "relationship" | "principle" | "commitment" | "moment" | "skill" | "rule";
|
|
41
41
|
confidence: number;
|
|
42
42
|
tags: string[];
|
|
43
43
|
entityRef?: string | null | undefined;
|
|
@@ -50,14 +50,14 @@ declare const EntityMentionSchema: z.ZodObject<{
|
|
|
50
50
|
facts: z.ZodArray<z.ZodString, "many">;
|
|
51
51
|
promptedByQuestion: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
52
52
|
}, "strip", z.ZodTypeAny, {
|
|
53
|
-
facts: string[];
|
|
54
|
-
name: string;
|
|
55
53
|
type: "person" | "project" | "tool" | "company" | "place" | "other";
|
|
54
|
+
name: string;
|
|
55
|
+
facts: string[];
|
|
56
56
|
promptedByQuestion?: string | null | undefined;
|
|
57
57
|
}, {
|
|
58
|
-
facts: string[];
|
|
59
|
-
name: string;
|
|
60
58
|
type: "person" | "project" | "tool" | "company" | "place" | "other";
|
|
59
|
+
name: string;
|
|
60
|
+
facts: string[];
|
|
61
61
|
promptedByQuestion?: string | null | undefined;
|
|
62
62
|
}>;
|
|
63
63
|
declare const ExtractedQuestionSchema: z.ZodObject<{
|
|
@@ -126,16 +126,16 @@ declare const ProactiveExtractionResultSchema: z.ZodObject<{
|
|
|
126
126
|
promptedByQuestion: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
127
127
|
structuredAttributes: z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
|
|
128
128
|
}, "strip", z.ZodTypeAny, {
|
|
129
|
-
category: "fact" | "preference" | "correction" | "entity" | "decision" | "relationship" | "principle" | "commitment" | "moment" | "skill" | "rule";
|
|
130
129
|
content: string;
|
|
130
|
+
category: "fact" | "preference" | "correction" | "entity" | "decision" | "relationship" | "principle" | "commitment" | "moment" | "skill" | "rule";
|
|
131
131
|
confidence: number;
|
|
132
132
|
tags: string[];
|
|
133
133
|
entityRef?: string | null | undefined;
|
|
134
134
|
structuredAttributes?: Record<string, string> | null | undefined;
|
|
135
135
|
promptedByQuestion?: string | null | undefined;
|
|
136
136
|
}, {
|
|
137
|
-
category: "fact" | "preference" | "correction" | "entity" | "decision" | "relationship" | "principle" | "commitment" | "moment" | "skill" | "rule";
|
|
138
137
|
content: string;
|
|
138
|
+
category: "fact" | "preference" | "correction" | "entity" | "decision" | "relationship" | "principle" | "commitment" | "moment" | "skill" | "rule";
|
|
139
139
|
confidence: number;
|
|
140
140
|
tags: string[];
|
|
141
141
|
entityRef?: string | null | undefined;
|
|
@@ -149,14 +149,14 @@ declare const ProactiveExtractionResultSchema: z.ZodObject<{
|
|
|
149
149
|
facts: z.ZodArray<z.ZodString, "many">;
|
|
150
150
|
promptedByQuestion: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
151
151
|
}, "strip", z.ZodTypeAny, {
|
|
152
|
-
facts: string[];
|
|
153
|
-
name: string;
|
|
154
152
|
type: "person" | "project" | "tool" | "company" | "place" | "other";
|
|
153
|
+
name: string;
|
|
154
|
+
facts: string[];
|
|
155
155
|
promptedByQuestion?: string | null | undefined;
|
|
156
156
|
}, {
|
|
157
|
-
facts: string[];
|
|
158
|
-
name: string;
|
|
159
157
|
type: "person" | "project" | "tool" | "company" | "place" | "other";
|
|
158
|
+
name: string;
|
|
159
|
+
facts: string[];
|
|
160
160
|
promptedByQuestion?: string | null | undefined;
|
|
161
161
|
}>, "many">;
|
|
162
162
|
relationships: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -177,8 +177,8 @@ declare const ProactiveExtractionResultSchema: z.ZodObject<{
|
|
|
177
177
|
}>, "many">>>;
|
|
178
178
|
}, "strip", z.ZodTypeAny, {
|
|
179
179
|
facts: {
|
|
180
|
-
category: "fact" | "preference" | "correction" | "entity" | "decision" | "relationship" | "principle" | "commitment" | "moment" | "skill" | "rule";
|
|
181
180
|
content: string;
|
|
181
|
+
category: "fact" | "preference" | "correction" | "entity" | "decision" | "relationship" | "principle" | "commitment" | "moment" | "skill" | "rule";
|
|
182
182
|
confidence: number;
|
|
183
183
|
tags: string[];
|
|
184
184
|
entityRef?: string | null | undefined;
|
|
@@ -186,9 +186,9 @@ declare const ProactiveExtractionResultSchema: z.ZodObject<{
|
|
|
186
186
|
promptedByQuestion?: string | null | undefined;
|
|
187
187
|
}[];
|
|
188
188
|
entities: {
|
|
189
|
-
facts: string[];
|
|
190
|
-
name: string;
|
|
191
189
|
type: "person" | "project" | "tool" | "company" | "place" | "other";
|
|
190
|
+
name: string;
|
|
191
|
+
facts: string[];
|
|
192
192
|
promptedByQuestion?: string | null | undefined;
|
|
193
193
|
}[];
|
|
194
194
|
profileUpdates: string[];
|
|
@@ -200,8 +200,8 @@ declare const ProactiveExtractionResultSchema: z.ZodObject<{
|
|
|
200
200
|
}[] | null | undefined;
|
|
201
201
|
}, {
|
|
202
202
|
facts: {
|
|
203
|
-
category: "fact" | "preference" | "correction" | "entity" | "decision" | "relationship" | "principle" | "commitment" | "moment" | "skill" | "rule";
|
|
204
203
|
content: string;
|
|
204
|
+
category: "fact" | "preference" | "correction" | "entity" | "decision" | "relationship" | "principle" | "commitment" | "moment" | "skill" | "rule";
|
|
205
205
|
confidence: number;
|
|
206
206
|
tags: string[];
|
|
207
207
|
entityRef?: string | null | undefined;
|
|
@@ -209,9 +209,9 @@ declare const ProactiveExtractionResultSchema: z.ZodObject<{
|
|
|
209
209
|
promptedByQuestion?: string | null | undefined;
|
|
210
210
|
}[];
|
|
211
211
|
entities: {
|
|
212
|
-
facts: string[];
|
|
213
|
-
name: string;
|
|
214
212
|
type: "person" | "project" | "tool" | "company" | "place" | "other";
|
|
213
|
+
name: string;
|
|
214
|
+
facts: string[];
|
|
215
215
|
promptedByQuestion?: string | null | undefined;
|
|
216
216
|
}[];
|
|
217
217
|
profileUpdates: string[];
|
|
@@ -232,16 +232,16 @@ declare const ExtractionResultSchema: z.ZodObject<{
|
|
|
232
232
|
promptedByQuestion: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
233
233
|
structuredAttributes: z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
|
|
234
234
|
}, "strip", z.ZodTypeAny, {
|
|
235
|
-
category: "fact" | "preference" | "correction" | "entity" | "decision" | "relationship" | "principle" | "commitment" | "moment" | "skill" | "rule";
|
|
236
235
|
content: string;
|
|
236
|
+
category: "fact" | "preference" | "correction" | "entity" | "decision" | "relationship" | "principle" | "commitment" | "moment" | "skill" | "rule";
|
|
237
237
|
confidence: number;
|
|
238
238
|
tags: string[];
|
|
239
239
|
entityRef?: string | null | undefined;
|
|
240
240
|
structuredAttributes?: Record<string, string> | null | undefined;
|
|
241
241
|
promptedByQuestion?: string | null | undefined;
|
|
242
242
|
}, {
|
|
243
|
-
category: "fact" | "preference" | "correction" | "entity" | "decision" | "relationship" | "principle" | "commitment" | "moment" | "skill" | "rule";
|
|
244
243
|
content: string;
|
|
244
|
+
category: "fact" | "preference" | "correction" | "entity" | "decision" | "relationship" | "principle" | "commitment" | "moment" | "skill" | "rule";
|
|
245
245
|
confidence: number;
|
|
246
246
|
tags: string[];
|
|
247
247
|
entityRef?: string | null | undefined;
|
|
@@ -255,14 +255,14 @@ declare const ExtractionResultSchema: z.ZodObject<{
|
|
|
255
255
|
facts: z.ZodArray<z.ZodString, "many">;
|
|
256
256
|
promptedByQuestion: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
257
257
|
}, "strip", z.ZodTypeAny, {
|
|
258
|
-
facts: string[];
|
|
259
|
-
name: string;
|
|
260
258
|
type: "person" | "project" | "tool" | "company" | "place" | "other";
|
|
259
|
+
name: string;
|
|
260
|
+
facts: string[];
|
|
261
261
|
promptedByQuestion?: string | null | undefined;
|
|
262
262
|
}, {
|
|
263
|
-
facts: string[];
|
|
264
|
-
name: string;
|
|
265
263
|
type: "person" | "project" | "tool" | "company" | "place" | "other";
|
|
264
|
+
name: string;
|
|
265
|
+
facts: string[];
|
|
266
266
|
promptedByQuestion?: string | null | undefined;
|
|
267
267
|
}>, "many">;
|
|
268
268
|
questions: z.ZodArray<z.ZodObject<{
|
|
@@ -302,8 +302,8 @@ declare const ExtractionResultSchema: z.ZodObject<{
|
|
|
302
302
|
context: string;
|
|
303
303
|
}[];
|
|
304
304
|
facts: {
|
|
305
|
-
category: "fact" | "preference" | "correction" | "entity" | "decision" | "relationship" | "principle" | "commitment" | "moment" | "skill" | "rule";
|
|
306
305
|
content: string;
|
|
306
|
+
category: "fact" | "preference" | "correction" | "entity" | "decision" | "relationship" | "principle" | "commitment" | "moment" | "skill" | "rule";
|
|
307
307
|
confidence: number;
|
|
308
308
|
tags: string[];
|
|
309
309
|
entityRef?: string | null | undefined;
|
|
@@ -311,9 +311,9 @@ declare const ExtractionResultSchema: z.ZodObject<{
|
|
|
311
311
|
promptedByQuestion?: string | null | undefined;
|
|
312
312
|
}[];
|
|
313
313
|
entities: {
|
|
314
|
-
facts: string[];
|
|
315
|
-
name: string;
|
|
316
314
|
type: "person" | "project" | "tool" | "company" | "place" | "other";
|
|
315
|
+
name: string;
|
|
316
|
+
facts: string[];
|
|
317
317
|
promptedByQuestion?: string | null | undefined;
|
|
318
318
|
}[];
|
|
319
319
|
profileUpdates: string[];
|
|
@@ -331,8 +331,8 @@ declare const ExtractionResultSchema: z.ZodObject<{
|
|
|
331
331
|
context: string;
|
|
332
332
|
}[];
|
|
333
333
|
facts: {
|
|
334
|
-
category: "fact" | "preference" | "correction" | "entity" | "decision" | "relationship" | "principle" | "commitment" | "moment" | "skill" | "rule";
|
|
335
334
|
content: string;
|
|
335
|
+
category: "fact" | "preference" | "correction" | "entity" | "decision" | "relationship" | "principle" | "commitment" | "moment" | "skill" | "rule";
|
|
336
336
|
confidence: number;
|
|
337
337
|
tags: string[];
|
|
338
338
|
entityRef?: string | null | undefined;
|
|
@@ -340,9 +340,9 @@ declare const ExtractionResultSchema: z.ZodObject<{
|
|
|
340
340
|
promptedByQuestion?: string | null | undefined;
|
|
341
341
|
}[];
|
|
342
342
|
entities: {
|
|
343
|
-
facts: string[];
|
|
344
|
-
name: string;
|
|
345
343
|
type: "person" | "project" | "tool" | "company" | "place" | "other";
|
|
344
|
+
name: string;
|
|
345
|
+
facts: string[];
|
|
346
346
|
promptedByQuestion?: string | null | undefined;
|
|
347
347
|
}[];
|
|
348
348
|
profileUpdates: string[];
|
|
@@ -400,14 +400,14 @@ declare const ConsolidationResultSchema: z.ZodObject<{
|
|
|
400
400
|
facts: z.ZodArray<z.ZodString, "many">;
|
|
401
401
|
promptedByQuestion: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
402
402
|
}, "strip", z.ZodTypeAny, {
|
|
403
|
-
facts: string[];
|
|
404
|
-
name: string;
|
|
405
403
|
type: "person" | "project" | "tool" | "company" | "place" | "other";
|
|
404
|
+
name: string;
|
|
405
|
+
facts: string[];
|
|
406
406
|
promptedByQuestion?: string | null | undefined;
|
|
407
407
|
}, {
|
|
408
|
-
facts: string[];
|
|
409
|
-
name: string;
|
|
410
408
|
type: "person" | "project" | "tool" | "company" | "place" | "other";
|
|
409
|
+
name: string;
|
|
410
|
+
facts: string[];
|
|
411
411
|
promptedByQuestion?: string | null | undefined;
|
|
412
412
|
}>, "many">;
|
|
413
413
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -420,9 +420,9 @@ declare const ConsolidationResultSchema: z.ZodObject<{
|
|
|
420
420
|
updatedContent?: string | null | undefined;
|
|
421
421
|
}[];
|
|
422
422
|
entityUpdates: {
|
|
423
|
-
facts: string[];
|
|
424
|
-
name: string;
|
|
425
423
|
type: "person" | "project" | "tool" | "company" | "place" | "other";
|
|
424
|
+
name: string;
|
|
425
|
+
facts: string[];
|
|
426
426
|
promptedByQuestion?: string | null | undefined;
|
|
427
427
|
}[];
|
|
428
428
|
}, {
|
|
@@ -435,9 +435,9 @@ declare const ConsolidationResultSchema: z.ZodObject<{
|
|
|
435
435
|
updatedContent?: string | null | undefined;
|
|
436
436
|
}[];
|
|
437
437
|
entityUpdates: {
|
|
438
|
-
facts: string[];
|
|
439
|
-
name: string;
|
|
440
438
|
type: "person" | "project" | "tool" | "company" | "place" | "other";
|
|
439
|
+
name: string;
|
|
440
|
+
facts: string[];
|
|
441
441
|
promptedByQuestion?: string | null | undefined;
|
|
442
442
|
}[];
|
|
443
443
|
}>;
|
package/dist/summarizer.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
HourlySummarizer
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LP47L3ZX.js";
|
|
4
4
|
import "./chunk-ETOW6ACV.js";
|
|
5
5
|
import "./chunk-ONRU4L2N.js";
|
|
6
6
|
import "./chunk-MDDAA2AO.js";
|
|
7
7
|
import "./chunk-LK6SGL53.js";
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-XUHI52HK.js";
|
|
9
|
+
import "./chunk-M5ZBBBJI.js";
|
|
10
|
+
import "./chunk-OOSWAUYB.js";
|
|
10
11
|
import "./chunk-Y27UJK6V.js";
|
|
11
12
|
import "./chunk-UZB5KHKX.js";
|
|
12
13
|
import "./chunk-MARWOCVP.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remnic/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Framework-agnostic Remnic memory engine — orchestrator, storage, extraction, search, trust zones",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"@orama/orama": "^3.0.0",
|
|
34
34
|
"@orama/plugin-data-persistence": "^3.0.0",
|
|
35
35
|
"@sinclair/typebox": "^0.34.0",
|
|
36
|
+
"apache-arrow": "^18.1.0",
|
|
36
37
|
"better-sqlite3": "^12.6.2",
|
|
37
38
|
"meilisearch": "^0.46.0",
|
|
38
39
|
"openai": "^6.0.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/fallback-llm.ts"],"sourcesContent":["import { log } from \"./logger.js\";\nimport type { GatewayConfig, ModelProviderConfig, AgentPersona } from \"./types.js\";\nimport { extractJsonCandidates } from \"./json-extract.js\";\nimport {\n buildChatCompletionTokenLimit,\n shouldAssumeOpenAiChatCompletions,\n} from \"./openai-chat-compat.js\";\nimport { resolveProviderApiKey } from \"./resolve-provider-secret.js\";\n\nexport interface FallbackLlmOptions {\n temperature?: number;\n maxTokens?: number;\n timeoutMs?: number;\n /** Override which agent persona's model chain to use (by ID from agents.list[]). */\n agentId?: string;\n}\n\nexport interface FallbackLlmResponse {\n content: string;\n modelUsed: string;\n usage?: {\n inputTokens?: number;\n outputTokens?: number;\n totalTokens?: number;\n };\n}\n\ninterface ModelRef {\n providerId: string;\n modelId: string;\n providerConfig: ModelProviderConfig;\n modelString: string;\n}\n\n/**\n * Generic fallback LLM client that uses the gateway's default AI configuration\n * and walks through the full fallback chain (primary + fallbacks).\n * Supports OpenAI and Anthropic API formats.\n */\nexport class FallbackLlmClient {\n private gatewayConfig: GatewayConfig | undefined;\n\n constructor(gatewayConfig?: GatewayConfig) {\n this.gatewayConfig = gatewayConfig;\n }\n\n /**\n * Check if fallback is available (gateway config has at least one model).\n */\n isAvailable(agentId?: string): boolean {\n const models = this.getModelChain(agentId);\n return models.length > 0;\n }\n\n /**\n * Make a chat completion request using the gateway's default AI chain.\n * Tries primary first, then each fallback in order.\n * When agentId is provided, uses that agent persona's model chain instead of defaults.\n */\n async chatCompletion(\n messages: Array<{ role: \"system\" | \"user\" | \"assistant\"; content: string }>,\n options: FallbackLlmOptions = {},\n ): Promise<FallbackLlmResponse | null> {\n const models = this.getModelChain(options.agentId);\n if (models.length === 0) {\n log.warn(\"fallback LLM: no models configured in gateway\");\n return null;\n }\n\n const runChain = async (): Promise<FallbackLlmResponse | null> => {\n // Try each model in the chain\n for (let i = 0; i < models.length; i++) {\n const model = models[i];\n const isFallback = i > 0;\n\n try {\n const result = await this.tryModel(model, messages, options);\n if (result) {\n if (isFallback) {\n log.debug(`fallback LLM: succeeded using ${model.modelString} (fallback ${i})`);\n }\n return {\n content: result.content,\n modelUsed: model.modelString,\n usage: result.usage,\n };\n }\n } catch (err) {\n const errorMsg = err instanceof Error ? err.message : String(err);\n log.debug(`fallback LLM: ${model.modelString} failed (${errorMsg}), trying next...`);\n // Continue to next model in chain\n }\n }\n\n log.warn(`fallback LLM: all ${models.length} models in chain failed`);\n return null;\n };\n\n if (typeof options.timeoutMs === \"number\") {\n if (options.timeoutMs <= 0) {\n log.warn(\"fallback LLM: timed out before request started\");\n return null;\n }\n let timeoutHandle: ReturnType<typeof setTimeout> | undefined;\n try {\n return await Promise.race([\n runChain(),\n new Promise<null>((resolve) => {\n timeoutHandle = setTimeout(() => {\n log.warn(`fallback LLM: timed out after ${options.timeoutMs}ms`);\n resolve(null);\n }, options.timeoutMs);\n }),\n ]);\n } finally {\n if (timeoutHandle) clearTimeout(timeoutHandle);\n }\n }\n\n return await runChain();\n }\n\n /**\n * Make a request with structured output (Zod schema).\n * Returns parsed JSON or null on failure.\n */\n async parseWithSchema<T>(\n messages: Array<{ role: \"system\" | \"user\" | \"assistant\"; content: string }>,\n schema: { parse: (data: unknown) => T },\n options: FallbackLlmOptions = {},\n ): Promise<T | null> {\n const detailed = await this.parseWithSchemaDetailed(messages, schema, options);\n return detailed?.result ?? null;\n }\n\n /**\n * Like parseWithSchema but also returns the model that was used,\n * so callers can emit accurate trace events.\n */\n async parseWithSchemaDetailed<T>(\n messages: Array<{ role: \"system\" | \"user\" | \"assistant\"; content: string }>,\n schema: { parse: (data: unknown) => T },\n options: FallbackLlmOptions = {},\n ): Promise<{ result: T; modelUsed: string } | null> {\n const response = await this.chatCompletion(messages, options);\n if (!response?.content) return null;\n\n try {\n const candidates = extractJsonCandidates(response.content);\n for (const c of candidates) {\n try {\n const parsed = JSON.parse(c);\n return { result: schema.parse(parsed), modelUsed: response.modelUsed };\n } catch {\n // keep trying other candidates\n }\n }\n return null;\n } catch (err) {\n log.warn(\"fallback LLM: failed to parse structured output:\", err);\n return null;\n }\n }\n\n /**\n * Get the full model chain from gateway config.\n * Returns array of models in order: [primary, fallback1, fallback2, ...]\n *\n * When agentId is provided, looks up the matching entry in agents.list[]\n * and uses that persona's model chain. Falls back to agents.defaults.model\n * if agentId is not found or not provided.\n */\n private getModelChain(agentId?: string): ModelRef[] {\n const chain: ModelRef[] = [];\n const providers = this.gatewayConfig?.models?.providers;\n\n if (!providers) return chain;\n\n // Resolve the model config: agent persona chain or global defaults\n let modelConfig: { primary?: string; fallbacks?: string[] } | undefined;\n\n if (agentId) {\n const persona = this.gatewayConfig?.agents?.list?.find(\n (a) => a.id === agentId,\n );\n if (persona?.model) {\n modelConfig = persona.model;\n log.debug(`fallback LLM: using agent persona \"${agentId}\" model chain`);\n } else {\n log.warn(\n `fallback LLM: agent persona \"${agentId}\" not found or has no model config, falling back to defaults`,\n );\n }\n }\n\n if (!modelConfig) {\n modelConfig = this.gatewayConfig?.agents?.defaults?.model;\n }\n\n // Build list of model strings: primary + fallbacks\n const modelStrings: string[] = [];\n\n if (modelConfig?.primary) {\n modelStrings.push(modelConfig.primary);\n }\n\n if (Array.isArray(modelConfig?.fallbacks)) {\n for (const fb of modelConfig.fallbacks) {\n if (typeof fb === \"string\" && !modelStrings.includes(fb)) {\n modelStrings.push(fb);\n }\n }\n }\n\n // Parse each model string and look up provider config\n for (const modelString of modelStrings) {\n const modelRef = this.parseModelString(modelString, providers);\n if (modelRef) {\n chain.push(modelRef);\n }\n }\n\n return chain;\n }\n\n /**\n * Parse a \"provider/model\" string and look up its config.\n */\n private parseModelString(\n modelString: string,\n providers: Record<string, ModelProviderConfig>,\n ): ModelRef | null {\n // Parse \"provider/model\" format (e.g., \"openai/gpt-5.2\", \"anthropic/claude-opus-4-6\")\n const parts = modelString.split(\"/\");\n if (parts.length < 2) {\n log.warn(`fallback LLM: invalid model format: ${modelString}`);\n return null;\n }\n\n const providerId = parts[0];\n const modelId = parts.slice(1).join(\"/\"); // Handle cases like \"openai/gpt-5.2-turbo\"\n\n const providerConfig = providers[providerId];\n if (!providerConfig) {\n log.warn(`fallback LLM: provider not found: ${providerId}`);\n return null;\n }\n\n return { providerId, modelId, providerConfig, modelString };\n }\n\n /**\n * Resolve the API key for a provider, handling OpenClaw secret ref formats.\n * Results are cached per provider so exec calls only happen once.\n */\n private async resolveApiKey(\n providerId: string,\n providerConfig: ModelProviderConfig,\n ): Promise<string | undefined> {\n return resolveProviderApiKey(providerId, providerConfig.apiKey, this.gatewayConfig);\n }\n\n /**\n * Try to call a single model.\n */\n private async tryModel(\n model: ModelRef,\n messages: Array<{ role: \"system\" | \"user\" | \"assistant\"; content: string }>,\n options: FallbackLlmOptions,\n ): Promise<{ content: string; usage?: FallbackLlmResponse[\"usage\"] } | null> {\n // Resolve the API key from secret refs before making the call.\n // If the raw key looks like an unresolved secret ref and resolution fails,\n // skip this provider entirely so the chain falls through to the next.\n const rawKey = model.providerConfig.apiKey;\n const needsResolution = rawKey === \"secretref-managed\"\n || (typeof rawKey === \"object\" && rawKey !== null);\n const resolvedApiKey = await this.resolveApiKey(model.providerId, model.providerConfig);\n\n if (needsResolution && !resolvedApiKey) {\n throw new Error(`API key for provider \"${model.providerId}\" could not be resolved from secret ref`);\n }\n\n const configWithResolvedKey = resolvedApiKey\n ? { ...model.providerConfig, apiKey: resolvedApiKey }\n : model.providerConfig;\n\n switch (model.providerConfig.api) {\n case \"anthropic-messages\":\n return await this.callAnthropic(configWithResolvedKey, model.modelId, messages, options);\n case \"openai-completions\":\n default:\n return await this.callOpenAI(\n configWithResolvedKey,\n model.modelId,\n messages,\n options,\n shouldAssumeOpenAiChatCompletions(model.providerConfig.baseUrl),\n );\n }\n }\n\n /**\n * Call OpenAI-compatible API.\n */\n private async callOpenAI(\n config: ModelProviderConfig,\n modelId: string,\n messages: Array<{ role: \"system\" | \"user\" | \"assistant\"; content: string }>,\n options: FallbackLlmOptions,\n assumeOpenAI: boolean,\n ): Promise<{ content: string; usage?: FallbackLlmResponse[\"usage\"] } | null> {\n const base = config.baseUrl.replace(/\\/$/, \"\");\n const url = base.endsWith(\"/v1\")\n ? `${base}/chat/completions`\n : `${base}/v1/chat/completions`;\n\n const headers: Record<string, string> = {\n \"Content-Type\": \"application/json\",\n ...config.headers,\n };\n\n // Handle auth — apiKey is already resolved to a string by tryModel()\n if (config.apiKey && typeof config.apiKey === \"string\") {\n if (config.authHeader !== false) {\n headers[\"Authorization\"] = `Bearer ${config.apiKey}`;\n }\n }\n\n const body = {\n model: modelId,\n messages,\n temperature: options.temperature ?? 0.3,\n ...buildChatCompletionTokenLimit(modelId, options.maxTokens ?? 4096, {\n assumeOpenAI,\n }),\n };\n\n const response = await fetch(url, {\n method: \"POST\",\n headers,\n body: JSON.stringify(body),\n });\n\n if (!response.ok) {\n const error = await response.text();\n throw new Error(`OpenAI API error: ${response.status} ${error}`);\n }\n\n const data = (await response.json()) as {\n choices: Array<{\n message: {\n content: string;\n };\n }>;\n usage?: {\n prompt_tokens?: number;\n completion_tokens?: number;\n total_tokens?: number;\n };\n };\n\n const content = data.choices?.[0]?.message?.content;\n if (!content) {\n throw new Error(\"Empty response from OpenAI API\");\n }\n\n return {\n content,\n usage: data.usage\n ? {\n inputTokens: data.usage.prompt_tokens,\n outputTokens: data.usage.completion_tokens,\n totalTokens: data.usage.total_tokens,\n }\n : undefined,\n };\n }\n\n /**\n * Call Anthropic Messages API.\n */\n private async callAnthropic(\n config: ModelProviderConfig,\n modelId: string,\n messages: Array<{ role: \"system\" | \"user\" | \"assistant\"; content: string }>,\n options: FallbackLlmOptions,\n ): Promise<{ content: string; usage?: FallbackLlmResponse[\"usage\"] } | null> {\n const url = `${config.baseUrl.replace(/\\/$/, \"\")}/messages`;\n\n const headers: Record<string, string> = {\n \"Content-Type\": \"application/json\",\n \"anthropic-version\": \"2023-06-01\",\n ...config.headers,\n };\n\n // Handle auth - Anthropic uses x-api-key header (apiKey resolved by tryModel)\n if (config.apiKey && typeof config.apiKey === \"string\") {\n headers[\"x-api-key\"] = config.apiKey;\n }\n\n // Extract system message (Anthropic handles it separately)\n const systemMessage = messages.find((m) => m.role === \"system\")?.content;\n const nonSystemMessages = messages.filter((m) => m.role !== \"system\");\n\n // Convert messages to Anthropic format\n const anthropicMessages = nonSystemMessages.map((m) => ({\n role: m.role,\n content: m.content,\n }));\n\n const body: Record<string, unknown> = {\n model: modelId,\n messages: anthropicMessages,\n max_tokens: options.maxTokens ?? 4096,\n temperature: options.temperature ?? 0.3,\n };\n\n if (systemMessage) {\n body.system = systemMessage;\n }\n\n const response = await fetch(url, {\n method: \"POST\",\n headers,\n body: JSON.stringify(body),\n });\n\n if (!response.ok) {\n const error = await response.text();\n throw new Error(`Anthropic API error: ${response.status} ${error}`);\n }\n\n const data = (await response.json()) as {\n content: Array<{\n type: string;\n text: string;\n }>;\n usage?: {\n input_tokens?: number;\n output_tokens?: number;\n };\n };\n\n const content = data.content?.[0]?.text;\n if (!content) {\n throw new Error(\"Empty response from Anthropic API\");\n }\n\n return {\n content,\n usage: data.usage\n ? {\n inputTokens: data.usage.input_tokens,\n outputTokens: data.usage.output_tokens,\n totalTokens: (data.usage.input_tokens ?? 0) + (data.usage.output_tokens ?? 0),\n }\n : undefined,\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAuCO,IAAM,oBAAN,MAAwB;AAAA,EACrB;AAAA,EAER,YAAY,eAA+B;AACzC,SAAK,gBAAgB;AAAA,EACvB;AAAA;AAAA;AAAA;AAAA,EAKA,YAAY,SAA2B;AACrC,UAAM,SAAS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AAA,IACtC;AAEA,QAAI,eAAe;AACjB,WAAK,SAAS;AAAA,IAChB;AAEA,UAAM,WAAW,MAAM,MAAM,KAAK;AAAA,MAChC,QAAQ;AAAA,MACR;AAAA,MACA,MAAM,KAAK,UAAU,IAAI;AAAA,IAC3B,CAAC;AAED,QAAI,CAAC,SAAS,IAAI;AAChB,YAAM,QAAQ,MAAM,SAAS,KAAK;AAClC,YAAM,IAAI,MAAM,wBAAwB,SAAS,MAAM,IAAI,KAAK,EAAE;AAAA,IACpE;AAEA,UAAM,OAAQ,MAAM,SAAS,KAAK;AAWlC,UAAM,UAAU,KAAK,UAAU,CAAC,GAAG;AACnC,QAAI,CAAC,SAAS;AACZ,YAAM,IAAI,MAAM,mCAAmC;AAAA,IACrD;AAEA,WAAO;AAAA,MACL;AAAA,MACA,OAAO,KAAK,QACR;AAAA,QACE,aAAa,KAAK,MAAM;AAAA,QACxB,cAAc,KAAK,MAAM;AAAA,QACzB,cAAc,KAAK,MAAM,gBAAgB,MAAM,KAAK,MAAM,iBAAiB;AAAA,MAC7E,IACA;AAAA,IACN;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/resolve-provider-secret.ts"],"sourcesContent":["import { log } from \"./logger.js\";\nimport { readEnvVar } from \"./runtime/env.js\";\nimport path from \"node:path\";\nimport os from \"node:os\";\n\n/**\n * Resolve a provider API key using OpenClaw's own auth resolution system.\n *\n * This module delegates to the gateway's `resolveApiKeyForProvider()` function,\n * which handles all secret reference formats (SecretRef objects, auth profiles,\n * \"secretref-managed\" markers, environment variables, etc.) using the same\n * codepath the gateway uses for its own agent sessions.\n *\n * For plain-text API keys, a fast path returns them directly without\n * involving the gateway auth system.\n *\n * Results are cached per provider for the gateway process lifetime.\n */\n\ntype ResolveApiKeyFn = (params: {\n provider: string;\n cfg?: unknown;\n agentDir?: string;\n}) => Promise<{ apiKey?: string; source?: string; mode?: string } | null>;\n\nlet _resolveApiKeyForProvider: ResolveApiKeyFn | null = null;\nlet _resolverLoaded = false;\nlet _resolverNextRetryAt = 0;\nconst RESOLVER_RETRY_BACKOFF_MS = 60_000; // 1 minute between retries after first failure\nconst resolvedCache = new Map<string, string | undefined>();\n\n/**\n * Lazily load the gateway's resolveApiKeyForProvider function.\n * Returns null if not available (e.g., running outside the gateway process).\n */\nasync function getGatewayResolver(): Promise<ResolveApiKeyFn | null> {\n if (_resolverLoaded) {\n return _resolveApiKeyForProvider;\n }\n // Backoff: don't re-scan filesystem on every call when module wasn't found.\n // After a failure, wait RESOLVER_RETRY_BACKOFF_MS before trying again.\n if (_resolverNextRetryAt > 0 && Date.now() < _resolverNextRetryAt) {\n return null;\n }\n\n try {\n // The gateway bundles this in a runtime chunk — import it dynamically.\n // This import path is stable across gateway versions since it's a named runtime export.\n const candidates = [\n // Try glob-matching the runtime module name (hash varies per build)\n ...await findRuntimeModules(),\n ];\n\n const { pathToFileURL } = await import(\"node:url\");\n for (const candidate of candidates) {\n try {\n // Convert native path to file:// URL for cross-platform ESM import compatibility\n const importUrl = pathToFileURL(candidate).href;\n const mod = await import(importUrl);\n if (typeof mod.resolveApiKeyForProvider === \"function\") {\n _resolveApiKeyForProvider = mod.resolveApiKeyForProvider;\n _resolverLoaded = true;\n log.debug(\"loaded gateway resolveApiKeyForProvider from runtime module\");\n return _resolveApiKeyForProvider;\n }\n } catch {\n // Try next candidate\n }\n }\n } catch {\n // Silent\n }\n\n // Backoff before retrying — avoid repeated fs scanning.\n // Retries after RESOLVER_RETRY_BACKOFF_MS so the resolver can\n // recover if the gateway restarts or the module becomes available.\n _resolverNextRetryAt = Date.now() + RESOLVER_RETRY_BACKOFF_MS;\n log.debug(`gateway resolveApiKeyForProvider not available — will retry after ${RESOLVER_RETRY_BACKOFF_MS / 1000}s`);\n return null;\n}\n\n/**\n * Find the gateway's model-auth runtime module by scanning the dist directory.\n * Uses require.resolve to find the openclaw package regardless of install method.\n */\nasync function findRuntimeModules(): Promise<string[]> {\n const { readdirSync } = await import(\"node:fs\");\n const { createRequire } = await import(\"node:module\");\n const candidates: string[] = [];\n\n // Discover the openclaw dist directory from the installed package,\n // regardless of how it was installed (Homebrew, npm global, local, etc.)\n const distDirs: string[] = [];\n\n try {\n // require.resolve finds the package from the current process context\n const req = createRequire(import.meta.url);\n const openclawMain = req.resolve(\"openclaw\");\n const openclawDist = path.join(path.dirname(openclawMain), \"..\", \"dist\");\n if (openclawDist) distDirs.push(path.resolve(openclawDist));\n } catch {\n // openclaw not resolvable from plugin context — try alternate paths\n }\n\n // Fallback: infer from the running process (gateway runs from its own dist/)\n // Use fs.realpathSync to resolve symlinks (e.g., /usr/local/bin/openclaw → actual path)\n try {\n const { realpathSync } = await import(\"node:fs\");\n const mainScript = process.argv[1];\n if (mainScript) {\n const realScript = realpathSync(mainScript);\n if (realScript.includes(\"openclaw\")) {\n const distDir = path.dirname(realScript);\n if (!distDirs.includes(distDir)) distDirs.push(distDir);\n }\n }\n } catch {\n // Silent\n }\n\n for (const dir of distDirs) {\n try {\n const files = readdirSync(dir);\n for (const f of files) {\n if (f.startsWith(\"runtime-model-auth.runtime-\") && f.endsWith(\".js\")) {\n candidates.push(path.join(dir, f));\n }\n }\n } catch {\n // Directory doesn't exist — skip\n }\n }\n\n return candidates;\n}\n\n/**\n * Resolve a provider API key from various OpenClaw formats.\n *\n * Resolution order:\n * 1. Plain-text string → returned immediately\n * 2. Gateway's resolveApiKeyForProvider → handles all secret ref formats\n * 3. Environment variable fallback (PROVIDER_NAME_API_KEY)\n * 4. undefined → provider is skipped in the fallback chain\n */\nexport async function resolveProviderApiKey(\n providerId: string,\n apiKeyValue: unknown,\n gatewayConfig?: unknown,\n agentDir?: string,\n): Promise<string | undefined> {\n // Check cache first\n const cacheKey = `provider:${providerId}`;\n if (resolvedCache.has(cacheKey)) {\n return resolvedCache.get(cacheKey);\n }\n\n let resolved: string | undefined;\n\n // Fast path: plain-text string that looks like an actual API key\n if (typeof apiKeyValue === \"string\" && apiKeyValue.trim().length > 0) {\n // Skip known non-API-key markers used by the gateway for auth modes\n // that don't use bearer tokens (OAuth, local endpoints, GCP credentials)\n if (\n apiKeyValue === \"secretref-managed\" ||\n apiKeyValue.endsWith(\"-oauth\") ||\n apiKeyValue.endsWith(\"-local\") ||\n apiKeyValue === \"lm-studio\" ||\n apiKeyValue.startsWith(\"gcp-\")\n ) {\n // Fall through to gateway resolver / env var fallback\n } else {\n resolved = apiKeyValue;\n resolvedCache.set(cacheKey, resolved);\n return resolved;\n }\n }\n\n // The API key is either a SecretRef object, \"secretref-managed\", or empty.\n // Try the gateway's own auth resolution system first.\n const resolver = await getGatewayResolver();\n if (resolver) {\n try {\n const resolvedAgentDir = agentDir ?? path.join(os.homedir(), \".openclaw\", \"agents\", \"main\", \"agent\");\n const auth = await resolver({ provider: providerId, cfg: gatewayConfig, agentDir: resolvedAgentDir });\n if (auth?.apiKey) {\n resolved = auth.apiKey;\n log.debug(`resolved API key for provider \"${providerId}\" via gateway auth (source: ${auth.source ?? \"unknown\"}, mode: ${auth.mode ?? \"unknown\"})`);\n resolvedCache.set(cacheKey, resolved);\n return resolved;\n }\n } catch (err) {\n log.debug(\n `gateway auth resolution failed for provider \"${providerId}\": ${err instanceof Error ? err.message : String(err)}`,\n );\n }\n }\n\n // Environment variable fallback\n resolved = resolveFromEnv(providerId);\n if (resolved) {\n log.debug(`resolved API key for provider \"${providerId}\" from environment variable`);\n } else {\n log.debug(`could not resolve API key for provider \"${providerId}\" — skipping`);\n }\n\n // Only cache successful resolutions — failures are retried on next call\n // so providers can recover after transient issues (e.g., 1Password agent restart)\n if (resolved) {\n resolvedCache.set(cacheKey, resolved);\n }\n return resolved;\n}\n\n/**\n * Try to resolve an API key from environment variables.\n */\nfunction resolveFromEnv(providerId: string): string | undefined {\n const normalized = providerId.toUpperCase().replace(/[^A-Z0-9]/g, \"_\");\n const candidates = [\n `${normalized}_API_KEY`,\n `${normalized}_TOKEN`,\n ];\n for (const envVar of candidates) {\n const value = readEnvVar(envVar);\n if (value && value.trim().length > 0) {\n return value.trim();\n }\n }\n return undefined;\n}\n\n/**\n * Clear the resolution cache (useful for testing or key rotation).\n */\nexport function clearSecretCache(): void {\n resolvedCache.clear();\n _resolveApiKeyForProvider = null;\n _resolverLoaded = false;\n _resolverNextRetryAt = 0;\n}\n"],"mappings":";;;;;;;;AAEA,OAAO,UAAU;AACjB,OAAO,QAAQ;AAsBf,IAAI,4BAAoD;AACxD,IAAI,kBAAkB;AACtB,IAAI,uBAAuB;AAC3B,IAAM,4BAA4B;AAClC,IAAM,gBAAgB,oBAAI,IAAgC;AAM1D,eAAe,qBAAsD;AACnE,MAAI,iBAAiB;AACnB,WAAO;AAAA,EACT;AAGA,MAAI,uBAAuB,KAAK,KAAK,IAAI,IAAI,sBAAsB;AACjE,WAAO;AAAA,EACT;AAEA,MAAI;AAGF,UAAM,aAAa;AAAA;AAAA,MAEjB,GAAG,MAAM,mBAAmB;AAAA,IAC9B;AAEA,UAAM,EAAE,cAAc,IAAI,MAAM,OAAO,KAAU;AACjD,eAAW,aAAa,YAAY;AAClC,UAAI;AAEF,cAAM,YAAY,cAAc,SAAS,EAAE;AAC3C,cAAM,MAAM,MAAM,OAAO;AACzB,YAAI,OAAO,IAAI,6BAA6B,YAAY;AACtD,sCAA4B,IAAI;AAChC,4BAAkB;AAClB,cAAI,MAAM,6DAA6D;AACvE,iBAAO;AAAA,QACT;AAAA,MACF,QAAQ;AAAA,MAER;AAAA,IACF;AAAA,EACF,QAAQ;AAAA,EAER;AAKA,yBAAuB,KAAK,IAAI,IAAI;AACpC,MAAI,MAAM,0EAAqE,4BAA4B,GAAI,GAAG;AAClH,SAAO;AACT;AAMA,eAAe,qBAAwC;AACrD,QAAM,EAAE,YAAY,IAAI,MAAM,OAAO,IAAS;AAC9C,QAAM,EAAE,cAAc,IAAI,MAAM,OAAO,QAAa;AACpD,QAAM,aAAuB,CAAC;AAI9B,QAAM,WAAqB,CAAC;AAE5B,MAAI;AAEF,UAAM,MAAM,cAAc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AuB;AACzB;","names":[]}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -167,10 +167,10 @@ declare const SharedFeedbackEntrySchema: z.ZodObject<{
|
|
|
167
167
|
evidenceWindowEnd: z.ZodOptional<z.ZodString>;
|
|
168
168
|
refs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
169
169
|
}, "strip", z.ZodTypeAny, {
|
|
170
|
+
date: string;
|
|
170
171
|
decision: "rejected" | "approved" | "approved_with_feedback";
|
|
171
172
|
reason: string;
|
|
172
173
|
agent: string;
|
|
173
|
-
date: string;
|
|
174
174
|
confidence?: number | undefined;
|
|
175
175
|
tags?: string[] | undefined;
|
|
176
176
|
severity?: "low" | "medium" | "high" | undefined;
|
|
@@ -181,10 +181,10 @@ declare const SharedFeedbackEntrySchema: z.ZodObject<{
|
|
|
181
181
|
evidenceWindowStart?: string | undefined;
|
|
182
182
|
evidenceWindowEnd?: string | undefined;
|
|
183
183
|
}, {
|
|
184
|
+
date: string;
|
|
184
185
|
decision: "rejected" | "approved" | "approved_with_feedback";
|
|
185
186
|
reason: string;
|
|
186
187
|
agent: string;
|
|
187
|
-
date: string;
|
|
188
188
|
confidence?: number | undefined;
|
|
189
189
|
tags?: string[] | undefined;
|
|
190
190
|
severity?: "low" | "medium" | "high" | undefined;
|