@mcoda/agents 0.1.60 → 0.1.65
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.
|
@@ -9,15 +9,27 @@ export interface AdapterConfig {
|
|
|
9
9
|
docdexBaseUrl?: string;
|
|
10
10
|
docdexRepoId?: string;
|
|
11
11
|
docdexRepoRoot?: string;
|
|
12
|
-
docdex?:
|
|
13
|
-
baseUrl?: string;
|
|
14
|
-
repoId?: string;
|
|
15
|
-
repoRoot?: string;
|
|
16
|
-
};
|
|
12
|
+
docdex?: DocdexRuntimeContext;
|
|
17
13
|
prompts?: AgentPromptManifest;
|
|
18
14
|
authMetadata?: AgentAuthMetadata;
|
|
19
15
|
adapter?: string;
|
|
20
16
|
}
|
|
17
|
+
export interface DocdexRuntimeContext {
|
|
18
|
+
enabled?: boolean;
|
|
19
|
+
baseUrl?: string;
|
|
20
|
+
repoId?: string;
|
|
21
|
+
repoRoot?: string;
|
|
22
|
+
dagSessionId?: string;
|
|
23
|
+
required?: boolean;
|
|
24
|
+
allowedOperations?: string[];
|
|
25
|
+
credentialSource?: "attached_mswarm_api_key" | string;
|
|
26
|
+
capabilities?: Record<string, boolean | undefined>;
|
|
27
|
+
initialize?: boolean;
|
|
28
|
+
allowWeb?: boolean;
|
|
29
|
+
allowMemoryWrite?: boolean;
|
|
30
|
+
allowProfileWrite?: boolean;
|
|
31
|
+
allowIndexRebuild?: boolean;
|
|
32
|
+
}
|
|
21
33
|
export interface AgentAdapter {
|
|
22
34
|
getCapabilities(): Promise<string[]>;
|
|
23
35
|
healthCheck(): Promise<AgentHealth>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AdapterTypes.d.ts","sourceRoot":"","sources":["../../src/adapters/AdapterTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAE3F,MAAM,WAAW,aAAa;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ter.d.ts","sourceRoot":"","sources":["../../../src/adapters/openai/OpenAiAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,
|
|
1
|
+
{"version":3,"file":"OpenAiAdapter.d.ts","sourceRoot":"","sources":["../../../src/adapters/openai/OpenAiAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EACL,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAEjB,MAAM,oBAAoB,CAAC;AAsW5B,KAAK,YAAY,GAAG,aAAa,GAAG;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACrC,CAAC;AAEF,qBAAa,aAAc,YAAW,YAAY;IAMpC,OAAO,CAAC,MAAM;IAL1B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,OAAO,CAAqC;IACpD,OAAO,CAAC,WAAW,CAAqB;IACxC,OAAO,CAAC,SAAS,CAAsC;gBAEnC,MAAM,EAAE,YAAY;IAUlC,eAAe,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAIpC,WAAW,IAAI,OAAO,CAAC,WAAW,CAAC;IA6GnC,MAAM,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAyC5D,YAAY,CAAC,OAAO,EAAE,iBAAiB,GAAG,cAAc,CAAC,gBAAgB,EAAE,IAAI,EAAE,OAAO,CAAC;IAyFhG,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,WAAW;IAOnB,OAAO,CAAC,YAAY;IASpB,OAAO,CAAC,YAAY;IAgBpB,OAAO,CAAC,SAAS;IA4BjB,OAAO,CAAC,oBAAoB;CAU7B"}
|
|
@@ -13,6 +13,7 @@ const resolveString = (value) => {
|
|
|
13
13
|
const raw = asString(value)?.trim();
|
|
14
14
|
return raw ? raw : undefined;
|
|
15
15
|
};
|
|
16
|
+
const resolveBoolean = (value) => typeof value === "boolean" ? value : undefined;
|
|
16
17
|
const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
17
18
|
const normalizeBaseUrl = (value) => {
|
|
18
19
|
const str = resolveString(value);
|
|
@@ -20,6 +21,29 @@ const normalizeBaseUrl = (value) => {
|
|
|
20
21
|
return undefined;
|
|
21
22
|
return str.endsWith("/") ? str.slice(0, -1) : str;
|
|
22
23
|
};
|
|
24
|
+
const resolveStringArray = (value) => {
|
|
25
|
+
if (!Array.isArray(value))
|
|
26
|
+
return undefined;
|
|
27
|
+
const entries = value
|
|
28
|
+
.map((entry) => resolveString(entry))
|
|
29
|
+
.filter((entry) => Boolean(entry));
|
|
30
|
+
return entries.length ? entries : undefined;
|
|
31
|
+
};
|
|
32
|
+
const normalizeBooleanMap = (value) => {
|
|
33
|
+
if (!isRecord(value))
|
|
34
|
+
return undefined;
|
|
35
|
+
const output = {};
|
|
36
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
37
|
+
if (typeof entry === "boolean")
|
|
38
|
+
output[key] = entry;
|
|
39
|
+
}
|
|
40
|
+
return Object.keys(output).length ? output : undefined;
|
|
41
|
+
};
|
|
42
|
+
const firstDefined = (...values) => values.find((value) => value !== undefined);
|
|
43
|
+
const readRecord = (record, key) => {
|
|
44
|
+
const value = record?.[key];
|
|
45
|
+
return isRecord(value) ? value : undefined;
|
|
46
|
+
};
|
|
23
47
|
const buildRateLimitProbeMessage = (response, responseText) => {
|
|
24
48
|
const parts = [`openai_probe http ${response.status}`];
|
|
25
49
|
const retryAfter = response.headers.get("retry-after")?.trim();
|
|
@@ -62,6 +86,99 @@ const resolveBaseUrl = (config) => {
|
|
|
62
86
|
normalizeBaseUrl(agentConfig?.apiBaseUrl) ??
|
|
63
87
|
DEFAULT_BASE_URL);
|
|
64
88
|
};
|
|
89
|
+
const isManagedMswarmConfig = (config) => {
|
|
90
|
+
const anyConfig = config;
|
|
91
|
+
const agentConfig = config.agent?.config;
|
|
92
|
+
const cloud = readRecord(anyConfig, "mswarmCloud") ?? readRecord(agentConfig, "mswarmCloud");
|
|
93
|
+
const selfHosted = readRecord(anyConfig, "mswarmSelfHosted") ?? readRecord(agentConfig, "mswarmSelfHosted");
|
|
94
|
+
return cloud?.managed === true || selfHosted?.managed === true;
|
|
95
|
+
};
|
|
96
|
+
const resolveDocdexContext = (config, metadata) => {
|
|
97
|
+
if (!isManagedMswarmConfig(config))
|
|
98
|
+
return undefined;
|
|
99
|
+
const anyConfig = config;
|
|
100
|
+
const configDocdex = isRecord(anyConfig.docdex) ? anyConfig.docdex : undefined;
|
|
101
|
+
const metadataDocdexValue = metadata?.docdex;
|
|
102
|
+
const metadataDocdex = isRecord(metadataDocdexValue) ? metadataDocdexValue : undefined;
|
|
103
|
+
const enabled = firstDefined(resolveBoolean(metadataDocdex?.enabled), resolveBoolean(metadata?.docdexEnabled), resolveBoolean(metadata?.docdex_enabled), resolveBoolean(configDocdex?.enabled));
|
|
104
|
+
if (enabled === false)
|
|
105
|
+
return undefined;
|
|
106
|
+
const baseUrl = firstDefined(resolveString(metadataDocdex?.baseUrl), resolveString(metadataDocdex?.base_url), resolveString(metadata?.docdexBaseUrl), resolveString(metadata?.docdex_base_url), resolveString(anyConfig.docdexBaseUrl), resolveString(configDocdex?.baseUrl), resolveString(configDocdex?.base_url));
|
|
107
|
+
const repoId = firstDefined(resolveString(metadataDocdex?.repoId), resolveString(metadataDocdex?.repo_id), resolveString(metadata?.docdexRepoId), resolveString(metadata?.docdex_repo_id), resolveString(anyConfig.docdexRepoId), resolveString(configDocdex?.repoId), resolveString(configDocdex?.repo_id));
|
|
108
|
+
const repoRoot = firstDefined(resolveString(metadataDocdex?.repoRoot), resolveString(metadataDocdex?.repo_root), resolveString(metadata?.docdexRepoRoot), resolveString(metadata?.docdex_repo_root), resolveString(anyConfig.docdexRepoRoot), resolveString(configDocdex?.repoRoot), resolveString(configDocdex?.repo_root));
|
|
109
|
+
const required = firstDefined(resolveBoolean(metadataDocdex?.required), resolveBoolean(metadata?.docdexRequired), resolveBoolean(metadata?.docdex_required), resolveBoolean(configDocdex?.required));
|
|
110
|
+
const allowedOperations = firstDefined(resolveStringArray(metadataDocdex?.allowedOperations), resolveStringArray(metadataDocdex?.allowed_operations), resolveStringArray(metadata?.docdexAllowedOperations), resolveStringArray(metadata?.docdex_allowed_operations), resolveStringArray(configDocdex?.allowedOperations), resolveStringArray(configDocdex?.allowed_operations));
|
|
111
|
+
const credentialSource = firstDefined(resolveString(metadataDocdex?.credentialSource), resolveString(metadataDocdex?.credential_source), resolveString(metadata?.docdexCredentialSource), resolveString(metadata?.docdex_credential_source), resolveString(configDocdex?.credentialSource), resolveString(configDocdex?.credential_source));
|
|
112
|
+
const capabilities = firstDefined(normalizeBooleanMap(metadataDocdex?.capabilities), normalizeBooleanMap(metadata?.docdexCapabilities), normalizeBooleanMap(metadata?.docdex_capabilities), normalizeBooleanMap(configDocdex?.capabilities));
|
|
113
|
+
const dagSessionId = firstDefined(resolveString(metadataDocdex?.dagSessionId), resolveString(metadataDocdex?.dag_session_id), resolveString(metadata?.docdexDagSessionId), resolveString(metadata?.docdex_dag_session_id), resolveString(configDocdex?.dagSessionId), resolveString(configDocdex?.dag_session_id));
|
|
114
|
+
const initialize = firstDefined(resolveBoolean(metadataDocdex?.initialize), resolveBoolean(configDocdex?.initialize));
|
|
115
|
+
const allowWeb = firstDefined(resolveBoolean(metadataDocdex?.allowWeb), resolveBoolean(metadataDocdex?.allow_web), resolveBoolean(configDocdex?.allowWeb), resolveBoolean(configDocdex?.allow_web));
|
|
116
|
+
const allowMemoryWrite = firstDefined(resolveBoolean(metadataDocdex?.allowMemoryWrite), resolveBoolean(metadataDocdex?.allow_memory_write), resolveBoolean(configDocdex?.allowMemoryWrite), resolveBoolean(configDocdex?.allow_memory_write));
|
|
117
|
+
const allowProfileWrite = firstDefined(resolveBoolean(metadataDocdex?.allowProfileWrite), resolveBoolean(metadataDocdex?.allow_profile_write), resolveBoolean(configDocdex?.allowProfileWrite), resolveBoolean(configDocdex?.allow_profile_write));
|
|
118
|
+
const allowIndexRebuild = firstDefined(resolveBoolean(metadataDocdex?.allowIndexRebuild), resolveBoolean(metadataDocdex?.allow_index_rebuild), resolveBoolean(configDocdex?.allowIndexRebuild), resolveBoolean(configDocdex?.allow_index_rebuild));
|
|
119
|
+
const hasContext = baseUrl !== undefined ||
|
|
120
|
+
repoId !== undefined ||
|
|
121
|
+
repoRoot !== undefined ||
|
|
122
|
+
required !== undefined ||
|
|
123
|
+
allowedOperations !== undefined ||
|
|
124
|
+
capabilities !== undefined ||
|
|
125
|
+
dagSessionId !== undefined ||
|
|
126
|
+
initialize !== undefined ||
|
|
127
|
+
allowWeb !== undefined ||
|
|
128
|
+
allowMemoryWrite !== undefined ||
|
|
129
|
+
allowProfileWrite !== undefined ||
|
|
130
|
+
allowIndexRebuild !== undefined ||
|
|
131
|
+
metadataDocdex !== undefined ||
|
|
132
|
+
configDocdex !== undefined;
|
|
133
|
+
if (!hasContext)
|
|
134
|
+
return undefined;
|
|
135
|
+
return {
|
|
136
|
+
enabled: true,
|
|
137
|
+
baseUrl,
|
|
138
|
+
repoId,
|
|
139
|
+
repoRoot,
|
|
140
|
+
dagSessionId,
|
|
141
|
+
required,
|
|
142
|
+
allowedOperations,
|
|
143
|
+
credentialSource: credentialSource ?? "attached_mswarm_api_key",
|
|
144
|
+
capabilities,
|
|
145
|
+
initialize,
|
|
146
|
+
allowWeb,
|
|
147
|
+
allowMemoryWrite,
|
|
148
|
+
allowProfileWrite,
|
|
149
|
+
allowIndexRebuild,
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
const toDocdexRequestBody = (context) => {
|
|
153
|
+
const body = {};
|
|
154
|
+
if (context.baseUrl !== undefined)
|
|
155
|
+
body.base_url = context.baseUrl;
|
|
156
|
+
if (context.repoId !== undefined)
|
|
157
|
+
body.repo_id = context.repoId;
|
|
158
|
+
if (context.repoRoot !== undefined)
|
|
159
|
+
body.repo_root = context.repoRoot;
|
|
160
|
+
if (context.dagSessionId !== undefined)
|
|
161
|
+
body.dag_session_id = context.dagSessionId;
|
|
162
|
+
if (context.required !== undefined)
|
|
163
|
+
body.required = context.required;
|
|
164
|
+
if (context.allowedOperations !== undefined)
|
|
165
|
+
body.allowed_operations = context.allowedOperations;
|
|
166
|
+
if (context.credentialSource !== undefined)
|
|
167
|
+
body.credential_source = context.credentialSource;
|
|
168
|
+
if (context.capabilities !== undefined)
|
|
169
|
+
body.capabilities = context.capabilities;
|
|
170
|
+
if (context.initialize !== undefined)
|
|
171
|
+
body.initialize = context.initialize;
|
|
172
|
+
if (context.allowWeb !== undefined)
|
|
173
|
+
body.allow_web = context.allowWeb;
|
|
174
|
+
if (context.allowMemoryWrite !== undefined)
|
|
175
|
+
body.allow_memory_write = context.allowMemoryWrite;
|
|
176
|
+
if (context.allowProfileWrite !== undefined)
|
|
177
|
+
body.allow_profile_write = context.allowProfileWrite;
|
|
178
|
+
if (context.allowIndexRebuild !== undefined)
|
|
179
|
+
body.allow_index_rebuild = context.allowIndexRebuild;
|
|
180
|
+
return body;
|
|
181
|
+
};
|
|
65
182
|
const extractUsage = (usage) => {
|
|
66
183
|
if (!isRecord(usage))
|
|
67
184
|
return undefined;
|
|
@@ -272,10 +389,11 @@ export class OpenAiAdapter {
|
|
|
272
389
|
const url = this.ensureBaseUrl();
|
|
273
390
|
const model = this.ensureModel();
|
|
274
391
|
const apiKey = this.ensureApiKey();
|
|
392
|
+
const docdex = resolveDocdexContext(this.config, request.metadata);
|
|
275
393
|
const resp = await fetch(`${url}/chat/completions`, {
|
|
276
394
|
method: "POST",
|
|
277
|
-
headers: this.buildHeaders(apiKey, false),
|
|
278
|
-
body: JSON.stringify(this.buildBody(request.input, model, false)),
|
|
395
|
+
headers: this.buildHeaders(apiKey, false, docdex),
|
|
396
|
+
body: JSON.stringify(this.buildBody(request.input, model, false, docdex)),
|
|
279
397
|
});
|
|
280
398
|
if (!resp.ok) {
|
|
281
399
|
const text = await resp.text().catch(() => "");
|
|
@@ -310,10 +428,11 @@ export class OpenAiAdapter {
|
|
|
310
428
|
const url = this.ensureBaseUrl();
|
|
311
429
|
const model = this.ensureModel();
|
|
312
430
|
const apiKey = this.ensureApiKey();
|
|
431
|
+
const docdex = resolveDocdexContext(this.config, request.metadata);
|
|
313
432
|
const resp = await fetch(`${url}/chat/completions`, {
|
|
314
433
|
method: "POST",
|
|
315
|
-
headers: this.buildHeaders(apiKey, true),
|
|
316
|
-
body: JSON.stringify(this.buildBody(request.input, model, true)),
|
|
434
|
+
headers: this.buildHeaders(apiKey, true, docdex),
|
|
435
|
+
body: JSON.stringify(this.buildBody(request.input, model, true, docdex)),
|
|
317
436
|
});
|
|
318
437
|
if (!resp.ok || !resp.body) {
|
|
319
438
|
const text = !resp.ok ? await resp.text().catch(() => "") : "";
|
|
@@ -422,20 +541,26 @@ export class OpenAiAdapter {
|
|
|
422
541
|
}
|
|
423
542
|
return this.config.apiKey;
|
|
424
543
|
}
|
|
425
|
-
buildHeaders(apiKey, streaming) {
|
|
544
|
+
buildHeaders(apiKey, streaming, docdex) {
|
|
426
545
|
return {
|
|
427
546
|
Authorization: `Bearer ${apiKey}`,
|
|
428
547
|
"Content-Type": "application/json",
|
|
429
548
|
Accept: streaming ? "text/event-stream" : "application/json",
|
|
549
|
+
...(docdex?.repoId ? { "x-docdex-repo-id": docdex.repoId } : {}),
|
|
550
|
+
...(docdex?.repoRoot ? { "x-docdex-repo-root": docdex.repoRoot } : {}),
|
|
551
|
+
...(docdex?.dagSessionId ? { "x-docdex-dag-session": docdex.dagSessionId } : {}),
|
|
430
552
|
...(this.headers ?? {}),
|
|
431
553
|
};
|
|
432
554
|
}
|
|
433
|
-
buildBody(input, model, stream) {
|
|
555
|
+
buildBody(input, model, stream, docdex) {
|
|
434
556
|
const body = {
|
|
435
557
|
model,
|
|
436
558
|
messages: [{ role: "user", content: input }],
|
|
437
559
|
stream,
|
|
438
560
|
};
|
|
561
|
+
if (docdex) {
|
|
562
|
+
body.docdex = toDocdexRequestBody(docdex);
|
|
563
|
+
}
|
|
439
564
|
if (typeof this.temperature === "number") {
|
|
440
565
|
body.temperature = this.temperature;
|
|
441
566
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mcoda/agents",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.65",
|
|
4
4
|
"description": "Agent registry and capabilities for mcoda.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"access": "public"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@mcoda/shared": "0.1.
|
|
34
|
-
"@mcoda/db": "0.1.
|
|
33
|
+
"@mcoda/shared": "0.1.65",
|
|
34
|
+
"@mcoda/db": "0.1.65"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"build": "tsc -p tsconfig.json",
|