@juspay/neurolink 12.49.13 → 12.49.15
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/CHANGELOG.md +2 -2
- package/dist/browser/neurolink.min.js +411 -421
- package/dist/cli/factories/commandFactory.d.ts +12 -0
- package/dist/cli/factories/commandFactory.js +11 -1
- package/dist/constants/bedrockIdentifiers.d.ts +16 -0
- package/dist/constants/bedrockIdentifiers.js +79 -0
- package/dist/constants/contextWindows.d.ts +6 -15
- package/dist/constants/contextWindows.js +18 -52
- package/dist/constants/enums.d.ts +12 -0
- package/dist/constants/enums.js +15 -0
- package/dist/constants/tokens.js +9 -0
- package/dist/core/loopEngine.js +8 -0
- package/dist/providers/amazonBedrock/client.js +3 -0
- package/dist/providers/amazonBedrock/inferenceProfile.js +9 -5
- package/dist/providers/catalog/abliteration.json +85 -0
- package/dist/providers/catalog/aihubmix.json +77 -0
- package/dist/providers/catalog/api-route.json +1 -1
- package/dist/providers/catalog/baseten.json +1 -1
- package/dist/providers/catalog/deepseek.json +1 -1
- package/dist/providers/catalog/gmicloud.json +1 -1
- package/dist/providers/catalog/huggingface.json +1 -1
- package/dist/providers/catalog/inception-labs.json +1 -1
- package/dist/providers/catalog/index.generated.d.ts +1 -1
- package/dist/providers/catalog/index.generated.js +9 -0
- package/dist/providers/catalog/io-intelligence.json +1 -1
- package/dist/providers/catalog/loader.js +3 -0
- package/dist/providers/catalog/mancer.json +1 -1
- package/dist/providers/catalog/morph.json +1 -1
- package/dist/providers/catalog/naver-clova-studio.json +68 -0
- package/dist/providers/catalog/novita.json +1 -1
- package/dist/providers/catalog/provider-catalog.schema.json +27 -4
- package/dist/providers/catalog/schema.d.ts +3 -1
- package/dist/providers/catalog/schema.js +15 -2
- package/dist/providers/catalog/upstage.json +1 -1
- package/dist/providers/cohere.js +7 -2
- package/dist/providers/configuredOpenAICompat.js +7 -0
- package/dist/providers/embeddingResponseParsing.d.ts +15 -0
- package/dist/providers/embeddingResponseParsing.js +4 -3
- package/dist/providers/googleAiStudio/client.js +104 -26
- package/dist/rag/chunking/htmlChunker.js +4 -11
- package/dist/rag/document/loaders.js +12 -14
- package/dist/server/openapi/generator.d.ts +0 -6
- package/dist/server/openapi/generator.js +2 -72
- package/dist/types/cli.d.ts +6 -0
- package/dist/types/loopEngine.d.ts +7 -0
- package/dist/types/providerCatalog.d.ts +15 -1
- package/dist/types/providerCatalog.generated.d.ts +2 -2
- package/dist/types/providers.d.ts +15 -0
- package/dist/types/safeFetch.d.ts +1 -1
- package/dist/utils/htmlEntities.d.ts +8 -0
- package/dist/utils/htmlEntities.js +29 -0
- package/dist/utils/safeFetch.js +11 -3
- package/dist/utils/tokenLimits.js +23 -4
- package/docs-site/static/search-index.json +27 -16
- package/package.json +5 -3
|
@@ -187,6 +187,12 @@ export declare class CLICommandFactory {
|
|
|
187
187
|
default: boolean;
|
|
188
188
|
description: string;
|
|
189
189
|
};
|
|
190
|
+
disableInternalFallback: {
|
|
191
|
+
type: "boolean";
|
|
192
|
+
default: boolean;
|
|
193
|
+
alias: string;
|
|
194
|
+
description: string;
|
|
195
|
+
};
|
|
190
196
|
enableAnalytics: {
|
|
191
197
|
type: "boolean";
|
|
192
198
|
default: boolean;
|
|
@@ -1115,6 +1121,12 @@ export declare const commonOptions: {
|
|
|
1115
1121
|
default: boolean;
|
|
1116
1122
|
description: string;
|
|
1117
1123
|
};
|
|
1124
|
+
disableInternalFallback: {
|
|
1125
|
+
type: "boolean";
|
|
1126
|
+
default: boolean;
|
|
1127
|
+
alias: string;
|
|
1128
|
+
description: string;
|
|
1129
|
+
};
|
|
1118
1130
|
enableAnalytics: {
|
|
1119
1131
|
type: "boolean";
|
|
1120
1132
|
default: boolean;
|
|
@@ -298,6 +298,12 @@ export class CLICommandFactory {
|
|
|
298
298
|
default: false,
|
|
299
299
|
description: "Disable MCP tool integration (tools enabled by default)",
|
|
300
300
|
},
|
|
301
|
+
disableInternalFallback: {
|
|
302
|
+
type: "boolean",
|
|
303
|
+
default: false,
|
|
304
|
+
alias: "disable-internal-fallback",
|
|
305
|
+
description: "Disable automatic provider and model fallback",
|
|
306
|
+
},
|
|
301
307
|
enableAnalytics: {
|
|
302
308
|
type: "boolean",
|
|
303
309
|
default: false,
|
|
@@ -956,6 +962,7 @@ export class CLICommandFactory {
|
|
|
956
962
|
maxSteps: argv.maxSteps,
|
|
957
963
|
timeout: argv.timeout,
|
|
958
964
|
disableTools: argv.disableTools,
|
|
965
|
+
disableInternalFallback: argv.disableInternalFallback,
|
|
959
966
|
enableAnalytics: argv.enableAnalytics,
|
|
960
967
|
enableEvaluation: argv.enableEvaluation,
|
|
961
968
|
domain: argv.domain,
|
|
@@ -2781,6 +2788,7 @@ export class CLICommandFactory {
|
|
|
2781
2788
|
? enhancedOptions.timeout * 1000
|
|
2782
2789
|
: undefined,
|
|
2783
2790
|
disableTools: enhancedOptions.disableTools,
|
|
2791
|
+
disableInternalFallback: enhancedOptions.disableInternalFallback,
|
|
2784
2792
|
enabledToolNames: enhancedOptions.enabledToolNames,
|
|
2785
2793
|
// Loop `set` variables the schema accepts; without an explicit
|
|
2786
2794
|
// entry here they were echoed as set and then dropped.
|
|
@@ -3039,6 +3047,7 @@ export class CLICommandFactory {
|
|
|
3039
3047
|
? enhancedOptions.timeout * 1000
|
|
3040
3048
|
: undefined,
|
|
3041
3049
|
disableTools: enhancedOptions.disableTools,
|
|
3050
|
+
disableInternalFallback: enhancedOptions.disableInternalFallback,
|
|
3042
3051
|
enabledToolNames: enhancedOptions.enabledToolNames,
|
|
3043
3052
|
...CLICommandFactory.loopToolStepOptions(enhancedOptions),
|
|
3044
3053
|
enableAnalytics: enhancedOptions.enableAnalytics,
|
|
@@ -3647,6 +3656,7 @@ export class CLICommandFactory {
|
|
|
3647
3656
|
? enhancedOptions.timeout * 1000
|
|
3648
3657
|
: undefined,
|
|
3649
3658
|
disableTools: enhancedOptions.disableTools,
|
|
3659
|
+
disableInternalFallback: enhancedOptions.disableInternalFallback,
|
|
3650
3660
|
enabledToolNames: enhancedOptions.enabledToolNames,
|
|
3651
3661
|
evaluationDomain: enhancedOptions.evaluationDomain,
|
|
3652
3662
|
toolUsageContext: enhancedOptions.toolUsageContext,
|
|
@@ -4535,7 +4545,7 @@ export class CLICommandFactory {
|
|
|
4535
4545
|
" return 0\n" +
|
|
4536
4546
|
" ;;\n" +
|
|
4537
4547
|
" *)\n" +
|
|
4538
|
-
' opts="--provider --model --temperature --maxTokens --system --format --output --timeout --delay --disableTools --enableAnalytics --enableEvaluation --debug --quiet --noColor --configFile --dryRun"\n' +
|
|
4548
|
+
' opts="--provider --model --temperature --maxTokens --system --format --output --timeout --delay --disableTools --disableInternalFallback --disable-internal-fallback --enableAnalytics --enableEvaluation --debug --quiet --noColor --configFile --dryRun"\n' +
|
|
4539
4549
|
' COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )\n' +
|
|
4540
4550
|
" return 0\n" +
|
|
4541
4551
|
" ;;\n" +
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Recognize an already supplied profile; never prefix it a second time. */
|
|
2
|
+
export declare function hasBedrockProfilePrefix(model: string): boolean;
|
|
3
|
+
/** Remove one known geography only when followed by a shipped model vendor. */
|
|
4
|
+
export declare function stripBedrockGeoPrefix(model: string): string | undefined;
|
|
5
|
+
/**
|
|
6
|
+
* Metadata lookup identity, never the identity sent to AWS.
|
|
7
|
+
*
|
|
8
|
+
* Converse documents foundation-model and inference-profile ARNs:
|
|
9
|
+
* https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html
|
|
10
|
+
* A foundation-model ARN contains its model id. A system inference-profile ARN
|
|
11
|
+
* contains the geography-prefixed model id (see CreateInferenceProfile's
|
|
12
|
+
* cross-region example). Application profiles, provisioned/custom models and
|
|
13
|
+
* opaque profile IDs do not reveal their model; keep their existing fallback.
|
|
14
|
+
* Exact rows for the original identifier must be consulted before this helper.
|
|
15
|
+
*/
|
|
16
|
+
export declare function bedrockModelIdForLookup(model: string): string | undefined;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { BedrockModels } from "./enums.js";
|
|
2
|
+
import { bedrockManifest } from "../models/manifests/bedrock.js";
|
|
3
|
+
// The existing closed geography set used by Bedrock's metadata tables.
|
|
4
|
+
// Recognition of a supplied prefix does not claim that a particular model or
|
|
5
|
+
// source region supports that profile (AWS publishes support per model card).
|
|
6
|
+
const BEDROCK_GEO_PREFIXES = new Set([
|
|
7
|
+
"us",
|
|
8
|
+
"eu",
|
|
9
|
+
"apac",
|
|
10
|
+
"jp",
|
|
11
|
+
"au",
|
|
12
|
+
"in",
|
|
13
|
+
"us-gov",
|
|
14
|
+
"global",
|
|
15
|
+
]);
|
|
16
|
+
const BEDROCK_VENDORS = new Set(Object.values(BedrockModels)
|
|
17
|
+
.map((id) => id.split(".")[0])
|
|
18
|
+
.filter((vendor) => !BEDROCK_GEO_PREFIXES.has(vendor)));
|
|
19
|
+
/** Recognize an already supplied profile; never prefix it a second time. */
|
|
20
|
+
export function hasBedrockProfilePrefix(model) {
|
|
21
|
+
return BEDROCK_GEO_PREFIXES.has(model.split(".")[0]) && model.includes(".");
|
|
22
|
+
}
|
|
23
|
+
/** Remove one known geography only when followed by a shipped model vendor. */
|
|
24
|
+
export function stripBedrockGeoPrefix(model) {
|
|
25
|
+
const [geo, vendor, ...rest] = model.split(".");
|
|
26
|
+
if (rest.length === 0 ||
|
|
27
|
+
!BEDROCK_GEO_PREFIXES.has(geo) ||
|
|
28
|
+
!BEDROCK_VENDORS.has(vendor)) {
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
return model.slice(geo.length + 1);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Metadata lookup identity, never the identity sent to AWS.
|
|
35
|
+
*
|
|
36
|
+
* Converse documents foundation-model and inference-profile ARNs:
|
|
37
|
+
* https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html
|
|
38
|
+
* A foundation-model ARN contains its model id. A system inference-profile ARN
|
|
39
|
+
* contains the geography-prefixed model id (see CreateInferenceProfile's
|
|
40
|
+
* cross-region example). Application profiles, provisioned/custom models and
|
|
41
|
+
* opaque profile IDs do not reveal their model; keep their existing fallback.
|
|
42
|
+
* Exact rows for the original identifier must be consulted before this helper.
|
|
43
|
+
*/
|
|
44
|
+
export function bedrockModelIdForLookup(model) {
|
|
45
|
+
if (!model.startsWith("arn:")) {
|
|
46
|
+
// These are already executable aliases in ProviderFactory. Options retain
|
|
47
|
+
// the caller's alias even after the factory constructs a canonical model,
|
|
48
|
+
// so metadata must follow the same identity rather than take the default.
|
|
49
|
+
const declaredAlias = Object.entries(bedrockManifest.models).find(([, entry]) => entry.aliases.includes(model.toLowerCase()));
|
|
50
|
+
if (declaredAlias) {
|
|
51
|
+
return declaredAlias[0];
|
|
52
|
+
}
|
|
53
|
+
return stripBedrockGeoPrefix(model);
|
|
54
|
+
}
|
|
55
|
+
if (model.length > 2048) {
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
const match = /^arn:aws(?:-cn|-us-gov|-iso|-iso-b)?:bedrock:([a-z0-9-]{1,20}):([0-9]{12})?:(foundation-model|inference-profile)\/([a-zA-Z0-9:.-]+)$/.exec(model);
|
|
59
|
+
if (!match) {
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
const [, , account, resourceType, id] = match;
|
|
63
|
+
if (resourceType === "inference-profile") {
|
|
64
|
+
// A system profile must carry a known geography, vendor and model. Opaque
|
|
65
|
+
// IDs cannot be decoded, even when AWS accepts them for invocation.
|
|
66
|
+
return account &&
|
|
67
|
+
/^[a-z0-9-]+\.[a-z0-9-]+\.[a-z0-9-]+(?:[.:][a-z0-9-]+)*$/.test(id) &&
|
|
68
|
+
stripBedrockGeoPrefix(id)
|
|
69
|
+
? id
|
|
70
|
+
: undefined;
|
|
71
|
+
}
|
|
72
|
+
const [vendor, ...rest] = id.split(".");
|
|
73
|
+
return !account &&
|
|
74
|
+
/^[a-z0-9-]{1,63}\.[a-z0-9-]{1,63}(?:[.:]?[a-z0-9-]{1,63})?$/.test(id) &&
|
|
75
|
+
rest.length > 0 &&
|
|
76
|
+
BEDROCK_VENDORS.has(vendor)
|
|
77
|
+
? id
|
|
78
|
+
: undefined;
|
|
79
|
+
}
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* - Google: https://ai.google.dev/gemini-api/docs/models
|
|
11
11
|
* - Others: Provider documentation as of Feb 2026
|
|
12
12
|
*/
|
|
13
|
+
export { stripBedrockGeoPrefix } from "./bedrockIdentifiers.js";
|
|
13
14
|
/** Default context window when provider/model is unknown */
|
|
14
15
|
export declare const DEFAULT_CONTEXT_WINDOW = 128000;
|
|
15
16
|
/** Maximum output reserve when maxTokens not specified */
|
|
@@ -56,17 +57,6 @@ export declare function getRuntimeOutputCeiling(provider: string, model?: string
|
|
|
56
57
|
export declare function clearRuntimeOutputCeiling(provider: string, model: string): void;
|
|
57
58
|
/** Test hook: clear runtime-discovered output ceilings (state is module-global). */
|
|
58
59
|
export declare function clearRuntimeOutputCeilings(): void;
|
|
59
|
-
/**
|
|
60
|
-
* `us.anthropic.claude-sonnet-4-6` -> `anthropic.claude-sonnet-4-6`.
|
|
61
|
-
*
|
|
62
|
-
* Undefined for any other shape, so an id that merely starts with `us.` is
|
|
63
|
-
* never rewritten. Removes one geography at most: no vendor is a geography.
|
|
64
|
-
*
|
|
65
|
-
* Every Bedrock table keyed by bare ids (context windows here, output ceilings
|
|
66
|
-
* in `getSafeMaxTokens`) goes through this one function, so they cannot
|
|
67
|
-
* disagree about which ids are cross-region profile ids.
|
|
68
|
-
*/
|
|
69
|
-
export declare function stripBedrockGeoPrefix(model: string): string | undefined;
|
|
70
60
|
/**
|
|
71
61
|
* Resolve context window size for a provider/model combination.
|
|
72
62
|
*
|
|
@@ -92,10 +82,11 @@ export declare function stripBedrockGeoPrefix(model: string): string | undefined
|
|
|
92
82
|
* MODEL_CONTEXT_WINDOWS.mistral values).
|
|
93
83
|
* 2. Exact model match under provider in static registry
|
|
94
84
|
* 3. Prefix match under provider in static registry
|
|
95
|
-
* 3.5 Bedrock only:
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
85
|
+
* 3.5 Bedrock only: a published model-bearing ARN is resolved again from
|
|
86
|
+
* step 0 using its model/profile id; a `<geography>.<vendor>.<model>`
|
|
87
|
+
* profile is then resolved without its geography. Every step above saw
|
|
88
|
+
* the original id, so its explicit row or discovered window still wins.
|
|
89
|
+
* Opaque/application profile identifiers keep the provider default.
|
|
99
90
|
* 4. Provider's _default in static registry
|
|
100
91
|
* 5. Global DEFAULT_CONTEXT_WINDOW
|
|
101
92
|
*/
|
|
@@ -14,7 +14,8 @@ import { DynamicModelProvider } from "../core/dynamicModels.js";
|
|
|
14
14
|
import { logger } from "../utils/logger.js";
|
|
15
15
|
import { resolveManifestEntryStrict } from "../models/manifestRegistry.js";
|
|
16
16
|
import { getCatalogJsonEntries } from "../providers/catalog/loader.js";
|
|
17
|
-
import {
|
|
17
|
+
import { bedrockModelIdForLookup } from "./bedrockIdentifiers.js";
|
|
18
|
+
export { stripBedrockGeoPrefix } from "./bedrockIdentifiers.js";
|
|
18
19
|
/**
|
|
19
20
|
* Per-provider context window blocks for the 9 JSON-catalog providers
|
|
20
21
|
* (cerebras, cloudflare, fireworks, groq, mistral, perplexity, sambanova,
|
|
@@ -380,6 +381,7 @@ const PROVIDER_ALIAS_MAP = {
|
|
|
380
381
|
// by ~8x, so AI Studio agent loops reclaimed tool history that still fitted
|
|
381
382
|
// comfortably. `google-ai` itself only resolved via the raw-provider
|
|
382
383
|
// fallback below, which the normalized lookup now covers directly.
|
|
384
|
+
aws: "bedrock",
|
|
383
385
|
googleaistudio: "google-ai",
|
|
384
386
|
googleai: "google-ai",
|
|
385
387
|
lmstudio: "lm-studio",
|
|
@@ -479,48 +481,6 @@ export function clearRuntimeOutputCeiling(provider, model) {
|
|
|
479
481
|
export function clearRuntimeOutputCeilings() {
|
|
480
482
|
RUNTIME_OUTPUT_CEILINGS.clear();
|
|
481
483
|
}
|
|
482
|
-
/**
|
|
483
|
-
* Geographies AWS puts in front of a model id to name a cross-region inference
|
|
484
|
-
* profile (`us.anthropic.claude-sonnet-4-6`). For many models that prefixed id
|
|
485
|
-
* is the only one a caller can invoke, but the Bedrock table above is keyed by
|
|
486
|
-
* bare ids, apart from one explicit `us.` row. AWS lists the prefixes on each
|
|
487
|
-
* model card, not in one place, and the set differs by model, so it is closed
|
|
488
|
-
* on purpose: a geography added later keeps taking the Bedrock default instead
|
|
489
|
-
* of being guessed at.
|
|
490
|
-
*/
|
|
491
|
-
const BEDROCK_GEO_PREFIXES = new Set([
|
|
492
|
-
"us",
|
|
493
|
-
"eu",
|
|
494
|
-
"apac",
|
|
495
|
-
"jp",
|
|
496
|
-
"au",
|
|
497
|
-
"in",
|
|
498
|
-
"us-gov",
|
|
499
|
-
"global",
|
|
500
|
-
]);
|
|
501
|
-
/** Vendor segment of every id `BedrockModels` ships: `anthropic`, `amazon`, `meta`, ... */
|
|
502
|
-
const BEDROCK_VENDORS = new Set(Object.values(BedrockModels)
|
|
503
|
-
.map((id) => id.split(".")[0])
|
|
504
|
-
.filter((vendor) => !BEDROCK_GEO_PREFIXES.has(vendor)));
|
|
505
|
-
/**
|
|
506
|
-
* `us.anthropic.claude-sonnet-4-6` -> `anthropic.claude-sonnet-4-6`.
|
|
507
|
-
*
|
|
508
|
-
* Undefined for any other shape, so an id that merely starts with `us.` is
|
|
509
|
-
* never rewritten. Removes one geography at most: no vendor is a geography.
|
|
510
|
-
*
|
|
511
|
-
* Every Bedrock table keyed by bare ids (context windows here, output ceilings
|
|
512
|
-
* in `getSafeMaxTokens`) goes through this one function, so they cannot
|
|
513
|
-
* disagree about which ids are cross-region profile ids.
|
|
514
|
-
*/
|
|
515
|
-
export function stripBedrockGeoPrefix(model) {
|
|
516
|
-
const [geo, vendor, ...rest] = model.split(".");
|
|
517
|
-
if (rest.length === 0 ||
|
|
518
|
-
!BEDROCK_GEO_PREFIXES.has(geo) ||
|
|
519
|
-
!BEDROCK_VENDORS.has(vendor)) {
|
|
520
|
-
return undefined;
|
|
521
|
-
}
|
|
522
|
-
return model.slice(geo.length + 1);
|
|
523
|
-
}
|
|
524
484
|
/**
|
|
525
485
|
* Resolve context window size for a provider/model combination.
|
|
526
486
|
*
|
|
@@ -546,14 +506,16 @@ export function stripBedrockGeoPrefix(model) {
|
|
|
546
506
|
* MODEL_CONTEXT_WINDOWS.mistral values).
|
|
547
507
|
* 2. Exact model match under provider in static registry
|
|
548
508
|
* 3. Prefix match under provider in static registry
|
|
549
|
-
* 3.5 Bedrock only:
|
|
550
|
-
*
|
|
551
|
-
*
|
|
552
|
-
*
|
|
509
|
+
* 3.5 Bedrock only: a published model-bearing ARN is resolved again from
|
|
510
|
+
* step 0 using its model/profile id; a `<geography>.<vendor>.<model>`
|
|
511
|
+
* profile is then resolved without its geography. Every step above saw
|
|
512
|
+
* the original id, so its explicit row or discovered window still wins.
|
|
513
|
+
* Opaque/application profile identifiers keep the provider default.
|
|
553
514
|
* 4. Provider's _default in static registry
|
|
554
515
|
* 5. Global DEFAULT_CONTEXT_WINDOW
|
|
555
516
|
*/
|
|
556
517
|
export function getContextWindowSize(provider, model) {
|
|
518
|
+
const canonical = normalizeProviderForLookup(provider);
|
|
557
519
|
// Step 0: Check dynamic model registry first.
|
|
558
520
|
// This resolves cases where the runtime provider differs from the model's
|
|
559
521
|
// origin (e.g. Claude running via Vertex would hit Vertex's Gemini default
|
|
@@ -573,14 +535,16 @@ export function getContextWindowSize(provider, model) {
|
|
|
573
535
|
}
|
|
574
536
|
// Step 0.5: Runtime-discovered window for this exact provider/model.
|
|
575
537
|
if (model) {
|
|
576
|
-
const discovered = RUNTIME_CONTEXT_WINDOWS.get(`${provider}:${model}`)
|
|
538
|
+
const discovered = RUNTIME_CONTEXT_WINDOWS.get(`${provider}:${model}`) ??
|
|
539
|
+
(canonical === "bedrock"
|
|
540
|
+
? RUNTIME_CONTEXT_WINDOWS.get(`${canonical}:${model}`)
|
|
541
|
+
: undefined);
|
|
577
542
|
if (discovered !== undefined) {
|
|
578
543
|
return discovered;
|
|
579
544
|
}
|
|
580
545
|
}
|
|
581
546
|
// Static fallback chain — normalize aliases first so "lmstudio" / "llama.cpp" /
|
|
582
547
|
// "nvidianim" find their canonical entries instead of falling back to default.
|
|
583
|
-
const canonical = normalizeProviderForLookup(provider);
|
|
584
548
|
// Step 1: Manifest real-entry lookup (exact id, alias, or longest-prefix —
|
|
585
549
|
// see resolveManifestEntryStrict's docblock). Tries the alias-normalized
|
|
586
550
|
// provider key first, then the raw provider string, mirroring the
|
|
@@ -612,9 +576,11 @@ export function getContextWindowSize(provider, model) {
|
|
|
612
576
|
}
|
|
613
577
|
}
|
|
614
578
|
}
|
|
615
|
-
const
|
|
616
|
-
|
|
617
|
-
|
|
579
|
+
const lookupModel = canonical === "bedrock" && model
|
|
580
|
+
? bedrockModelIdForLookup(model)
|
|
581
|
+
: undefined;
|
|
582
|
+
if (lookupModel !== undefined) {
|
|
583
|
+
return getContextWindowSize(provider, lookupModel);
|
|
618
584
|
}
|
|
619
585
|
return providerWindows._default ?? DEFAULT_CONTEXT_WINDOW;
|
|
620
586
|
}
|
|
@@ -17,9 +17,11 @@ export declare enum AIProviderName {
|
|
|
17
17
|
LM_STUDIO = "lm-studio",
|
|
18
18
|
LLAMACPP = "llamacpp",
|
|
19
19
|
A2AGENT = "a2agent",
|
|
20
|
+
ABLITERATION = "abliteration",
|
|
20
21
|
ABOVE_DEV = "above-dev",
|
|
21
22
|
AI21 = "ai21",
|
|
22
23
|
AIAND = "aiand",
|
|
24
|
+
AIHUBMIX = "aihubmix",
|
|
23
25
|
AIONLABS = "aionlabs",
|
|
24
26
|
AMBIENT = "ambient",
|
|
25
27
|
API_ROUTE = "api-route",
|
|
@@ -65,6 +67,7 @@ export declare enum AIProviderName {
|
|
|
65
67
|
MODELSCOPE = "modelscope",
|
|
66
68
|
MOONSHOT_AI = "moonshot-ai",
|
|
67
69
|
MORPH = "morph",
|
|
70
|
+
NAVER_CLOVA_STUDIO = "naver-clova-studio",
|
|
68
71
|
NEBIUS = "nebius",
|
|
69
72
|
NEURALWATT = "neuralwatt",
|
|
70
73
|
NOVITA = "novita",
|
|
@@ -854,6 +857,9 @@ export declare const TOKEN_EXPIRY_BUFFER_MS: number;
|
|
|
854
857
|
export declare enum A2agentModels {
|
|
855
858
|
DEEPSEEK_V4_FLASH = "deepseek-v4-flash"
|
|
856
859
|
}
|
|
860
|
+
export declare enum AbliterationModels {
|
|
861
|
+
ABLITERATED_MODEL = "abliterated-model"
|
|
862
|
+
}
|
|
857
863
|
export declare enum AboveDevModels {
|
|
858
864
|
DEEPSEEK_V4_1_FLASH = "deepseek-v4.1-flash",
|
|
859
865
|
DEEPSEEK_V4_PRO = "deepseek-v4-pro",
|
|
@@ -886,6 +892,9 @@ export declare enum AiandModels {
|
|
|
886
892
|
MOTIF_TECHNOLOGIES_MOTIF_3 = "motif-technologies/motif-3",
|
|
887
893
|
GOOGLE_GEMMA_4_31B_IT = "google/gemma-4-31b-it"
|
|
888
894
|
}
|
|
895
|
+
export declare enum AIHubMixModels {
|
|
896
|
+
GPT_4O_MINI = "gpt-4o-mini"
|
|
897
|
+
}
|
|
889
898
|
export declare enum AionlabsModels {
|
|
890
899
|
AION_LABS_AION_3_5 = "aion-labs/aion-3.5",
|
|
891
900
|
AION_LABS_AION_3_5_MINI = "aion-labs/aion-3.5-mini",
|
|
@@ -1427,6 +1436,9 @@ export declare enum MorphModels {
|
|
|
1427
1436
|
MORPH_V3_LARGE = "morph-v3-large",
|
|
1428
1437
|
MORPH_V3_FAST = "morph-v3-fast"
|
|
1429
1438
|
}
|
|
1439
|
+
export declare enum NaverClovaStudioModels {
|
|
1440
|
+
HCX_005 = "HCX-005"
|
|
1441
|
+
}
|
|
1430
1442
|
export declare enum NebiusModels {
|
|
1431
1443
|
QWEN_QWEN3_235B_A22B_INSTRUCT_2507 = "Qwen/Qwen3-235B-A22B-Instruct-2507",
|
|
1432
1444
|
DEEPSEEK_AI_DEEPSEEK_V4_FLASH_0731 = "deepseek-ai/DeepSeek-V4-Flash-0731",
|
package/dist/constants/enums.js
CHANGED
|
@@ -22,9 +22,11 @@ export var AIProviderName;
|
|
|
22
22
|
AIProviderName["LLAMACPP"] = "llamacpp";
|
|
23
23
|
// ── BEGIN GENERATED(provider-members): provider catalog (pnpm run codegen:catalog) ──
|
|
24
24
|
AIProviderName["A2AGENT"] = "a2agent";
|
|
25
|
+
AIProviderName["ABLITERATION"] = "abliteration";
|
|
25
26
|
AIProviderName["ABOVE_DEV"] = "above-dev";
|
|
26
27
|
AIProviderName["AI21"] = "ai21";
|
|
27
28
|
AIProviderName["AIAND"] = "aiand";
|
|
29
|
+
AIProviderName["AIHUBMIX"] = "aihubmix";
|
|
28
30
|
AIProviderName["AIONLABS"] = "aionlabs";
|
|
29
31
|
AIProviderName["AMBIENT"] = "ambient";
|
|
30
32
|
AIProviderName["API_ROUTE"] = "api-route";
|
|
@@ -70,6 +72,7 @@ export var AIProviderName;
|
|
|
70
72
|
AIProviderName["MODELSCOPE"] = "modelscope";
|
|
71
73
|
AIProviderName["MOONSHOT_AI"] = "moonshot-ai";
|
|
72
74
|
AIProviderName["MORPH"] = "morph";
|
|
75
|
+
AIProviderName["NAVER_CLOVA_STUDIO"] = "naver-clova-studio";
|
|
73
76
|
AIProviderName["NEBIUS"] = "nebius";
|
|
74
77
|
AIProviderName["NEURALWATT"] = "neuralwatt";
|
|
75
78
|
AIProviderName["NOVITA"] = "novita";
|
|
@@ -1091,6 +1094,10 @@ export var A2agentModels;
|
|
|
1091
1094
|
(function (A2agentModels) {
|
|
1092
1095
|
A2agentModels["DEEPSEEK_V4_FLASH"] = "deepseek-v4-flash";
|
|
1093
1096
|
})(A2agentModels || (A2agentModels = {}));
|
|
1097
|
+
export var AbliterationModels;
|
|
1098
|
+
(function (AbliterationModels) {
|
|
1099
|
+
AbliterationModels["ABLITERATED_MODEL"] = "abliterated-model";
|
|
1100
|
+
})(AbliterationModels || (AbliterationModels = {}));
|
|
1094
1101
|
export var AboveDevModels;
|
|
1095
1102
|
(function (AboveDevModels) {
|
|
1096
1103
|
AboveDevModels["DEEPSEEK_V4_1_FLASH"] = "deepseek-v4.1-flash";
|
|
@@ -1126,6 +1133,10 @@ export var AiandModels;
|
|
|
1126
1133
|
AiandModels["MOTIF_TECHNOLOGIES_MOTIF_3"] = "motif-technologies/motif-3";
|
|
1127
1134
|
AiandModels["GOOGLE_GEMMA_4_31B_IT"] = "google/gemma-4-31b-it";
|
|
1128
1135
|
})(AiandModels || (AiandModels = {}));
|
|
1136
|
+
export var AIHubMixModels;
|
|
1137
|
+
(function (AIHubMixModels) {
|
|
1138
|
+
AIHubMixModels["GPT_4O_MINI"] = "gpt-4o-mini";
|
|
1139
|
+
})(AIHubMixModels || (AIHubMixModels = {}));
|
|
1129
1140
|
export var AionlabsModels;
|
|
1130
1141
|
(function (AionlabsModels) {
|
|
1131
1142
|
AionlabsModels["AION_LABS_AION_3_5"] = "aion-labs/aion-3.5";
|
|
@@ -1712,6 +1723,10 @@ export var MorphModels;
|
|
|
1712
1723
|
MorphModels["MORPH_V3_LARGE"] = "morph-v3-large";
|
|
1713
1724
|
MorphModels["MORPH_V3_FAST"] = "morph-v3-fast";
|
|
1714
1725
|
})(MorphModels || (MorphModels = {}));
|
|
1726
|
+
export var NaverClovaStudioModels;
|
|
1727
|
+
(function (NaverClovaStudioModels) {
|
|
1728
|
+
NaverClovaStudioModels["HCX_005"] = "HCX-005";
|
|
1729
|
+
})(NaverClovaStudioModels || (NaverClovaStudioModels = {}));
|
|
1715
1730
|
export var NebiusModels;
|
|
1716
1731
|
(function (NebiusModels) {
|
|
1717
1732
|
NebiusModels["QWEN_QWEN3_235B_A22B_INSTRUCT_2507"] = "Qwen/Qwen3-235B-A22B-Instruct-2507";
|
package/dist/constants/tokens.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { bedrockModelIdForLookup } from "./bedrockIdentifiers.js";
|
|
1
2
|
/**
|
|
2
3
|
* Token Limit Constants for NeuroLink
|
|
3
4
|
*
|
|
@@ -273,6 +274,7 @@ export const TokenUtils = {
|
|
|
273
274
|
case "vertex":
|
|
274
275
|
providerLimits = PROVIDER_TOKEN_LIMITS.VERTEX;
|
|
275
276
|
break;
|
|
277
|
+
case "aws":
|
|
276
278
|
case "bedrock":
|
|
277
279
|
providerLimits = PROVIDER_TOKEN_LIMITS.BEDROCK;
|
|
278
280
|
break;
|
|
@@ -297,6 +299,13 @@ export const TokenUtils = {
|
|
|
297
299
|
if (model && providerLimits[model]) {
|
|
298
300
|
return providerLimits[model];
|
|
299
301
|
}
|
|
302
|
+
if (model &&
|
|
303
|
+
(normalizedProvider === "bedrock" || normalizedProvider === "aws")) {
|
|
304
|
+
const lookupModel = bedrockModelIdForLookup(model);
|
|
305
|
+
if (lookupModel !== undefined) {
|
|
306
|
+
return TokenUtils.getProviderTokenLimit("bedrock", lookupModel);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
300
309
|
return providerLimits.default || PROVIDER_TOKEN_LIMITS.DEFAULT;
|
|
301
310
|
},
|
|
302
311
|
/**
|
package/dist/core/loopEngine.js
CHANGED
|
@@ -484,6 +484,14 @@ export function runAgenticLoop(adapter, initialConversation, options) {
|
|
|
484
484
|
// reason is real and is kept.
|
|
485
485
|
finishReason: aborted && rawStopReason === undefined ? "other" : finishReason,
|
|
486
486
|
rawStopReason,
|
|
487
|
+
// The engine owns the actual cap (including mid-turn renewal), so a
|
|
488
|
+
// provider must not infer this from raw "tool_use" or a step count.
|
|
489
|
+
// Cancellation takes priority when it interrupts the last tool batch.
|
|
490
|
+
stopReason: aborted
|
|
491
|
+
? "aborted"
|
|
492
|
+
: hadToolCallsAtCap
|
|
493
|
+
? "step-cap"
|
|
494
|
+
: undefined,
|
|
487
495
|
conversation,
|
|
488
496
|
aborted,
|
|
489
497
|
};
|
|
@@ -1394,6 +1394,9 @@ export class AmazonBedrockProvider extends BaseProvider {
|
|
|
1394
1394
|
self.conversationHistory = outcome.result.conversation;
|
|
1395
1395
|
metadata.finishReason = outcome.result.finishReason;
|
|
1396
1396
|
metadata.rawFinishReason = outcome.result.rawStopReason;
|
|
1397
|
+
// Read after drain by the facade's fallbackOnMaxSteps gate. Keep
|
|
1398
|
+
// the engine's own outcome; raw tool_use alone is not a step cap.
|
|
1399
|
+
metadata.stopReason = outcome.result.stopReason;
|
|
1397
1400
|
streamSpan.setAttribute("gen_ai.response.stop_reason", outcome.result.rawStopReason ?? "unknown");
|
|
1398
1401
|
}
|
|
1399
1402
|
// Analytics is resolved off `settled` above, so it lands whether or
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
* candidates needs neither, and costs at most two extra attempts once per
|
|
33
33
|
* model/region pair.
|
|
34
34
|
*/
|
|
35
|
+
import { hasBedrockProfilePrefix } from "../../constants/bedrockIdentifiers.js";
|
|
35
36
|
import { logger } from "../../utils/logger.js";
|
|
36
37
|
/**
|
|
37
38
|
* Geography prefixes, in the order AWS documents them. `global.` is not a
|
|
@@ -65,10 +66,6 @@ function geoPrefixForRegion(region) {
|
|
|
65
66
|
}
|
|
66
67
|
return undefined;
|
|
67
68
|
}
|
|
68
|
-
/** True when `modelId` already carries a geography or global prefix. */
|
|
69
|
-
function hasProfilePrefix(modelId) {
|
|
70
|
-
return /^(us|eu|au|jp|apac|global)\./.test(modelId);
|
|
71
|
-
}
|
|
72
69
|
/**
|
|
73
70
|
* Does this error mean "this model needs an inference profile in this region"?
|
|
74
71
|
*
|
|
@@ -108,7 +105,14 @@ export function inferenceProfileCandidates(modelId, region) {
|
|
|
108
105
|
// this provider accepts one as a model id (see `extractRegionFromArn`).
|
|
109
106
|
// Prefixing it yields a malformed identifier whose ValidationException would
|
|
110
107
|
// then replace the original, accurate error.
|
|
111
|
-
|
|
108
|
+
// Converse's published foundation-model ID grammar. Application-profile
|
|
109
|
+
// IDs are opaque, so a matching error must never turn them into guessed
|
|
110
|
+
// us.<id>/global.<id> model IDs. Keep valid new vendors without an enum gate.
|
|
111
|
+
// https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html
|
|
112
|
+
const foundationModelId = /^[a-z0-9-]{1,63}\.[a-z0-9-]{1,63}([.:]?[a-z0-9-]{1,63})$/.test(modelId);
|
|
113
|
+
if (!foundationModelId ||
|
|
114
|
+
modelId.startsWith("arn:") ||
|
|
115
|
+
hasBedrockProfilePrefix(modelId)) {
|
|
112
116
|
return [];
|
|
113
117
|
}
|
|
114
118
|
const candidates = [];
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./provider-catalog.schema.json",
|
|
3
|
+
"id": "abliteration",
|
|
4
|
+
"displayName": "Abliteration AI",
|
|
5
|
+
"aliases": [],
|
|
6
|
+
"tier": 2,
|
|
7
|
+
"wire": {
|
|
8
|
+
"baseURL": "https://api.abliteration.ai/v1"
|
|
9
|
+
},
|
|
10
|
+
"models": {
|
|
11
|
+
"default": "abliterated-model",
|
|
12
|
+
"fallbacks": ["abliterated-model"],
|
|
13
|
+
"defaultContextWindow": 262144,
|
|
14
|
+
"defaultMaxOutputTokens": 262134,
|
|
15
|
+
"catalog": {
|
|
16
|
+
"abliterated-model": {
|
|
17
|
+
"vision": true,
|
|
18
|
+
"tools": true,
|
|
19
|
+
"status": "production",
|
|
20
|
+
"contextWindow": 262144,
|
|
21
|
+
"maxOutputTokens": 262134,
|
|
22
|
+
"pricingPerMTok": {
|
|
23
|
+
"input": 1,
|
|
24
|
+
"output": 3,
|
|
25
|
+
"cachedInput": 0.1
|
|
26
|
+
},
|
|
27
|
+
"description": "Source documentation only (2026-10-09). The vendor Limits table lists 262,144 combined context tokens and 262,134 maximum completion tokens for abliterated-model; maximum output is reachable only with a small prompt. This is the documented general-purpose model with image input. Account-specific availability and live execution are unverified. Other models and protocol families are outside this initial entry."
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"topModels": ["abliterated-model"]
|
|
31
|
+
},
|
|
32
|
+
"capabilities": {
|
|
33
|
+
"text": true,
|
|
34
|
+
"streaming": true,
|
|
35
|
+
"tools": true,
|
|
36
|
+
"toolsWithStreaming": true,
|
|
37
|
+
"structuredOutput": true,
|
|
38
|
+
"structuredOutputWithTools": false,
|
|
39
|
+
"embeddings": false,
|
|
40
|
+
"thinking": false
|
|
41
|
+
},
|
|
42
|
+
"errorRules": [
|
|
43
|
+
{
|
|
44
|
+
"status": 401,
|
|
45
|
+
"class": "authentication",
|
|
46
|
+
"message": "Abliteration requires an API key. https://docs.abliteration.ai/api/errors.md documents HTTP 401 for missing or invalid Bearer credentials."
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"status": 402,
|
|
50
|
+
"class": "provider",
|
|
51
|
+
"message": "Abliteration documents HTTP 402 for insufficient credits. This is a billing block, not a rate limit. See https://docs.abliteration.ai/api/errors.md."
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"status": 429,
|
|
55
|
+
"class": "rate-limit",
|
|
56
|
+
"message": "Abliteration documents HTTP 429 rate limiting and Retry-After at https://docs.abliteration.ai/api/errors.md."
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
"setup": {
|
|
60
|
+
"url": "https://abliteration.ai/console",
|
|
61
|
+
"apiKeyFormat": null,
|
|
62
|
+
"billingPolicy": "free-tier",
|
|
63
|
+
"instructions": [
|
|
64
|
+
"Create an API key in https://abliteration.ai/console. The public pricing page, retrieved 2026-10-09, states a one-credit free preview without a card; account eligibility and remaining credit are unverified.",
|
|
65
|
+
"Set {apiKeyEnvVar}. The chat endpoint is https://api.abliteration.ai/v1/chat/completions with Authorization: Bearer authentication.",
|
|
66
|
+
"This entry includes only abliterated-model. Public documentation describes image input, tools, streamed tools and JSON/schema; vendor and account acceptance remain pending.",
|
|
67
|
+
"Reasoning is on by default at the service. SDK effort/toggle controls and native tool-plus-schema combinations are outside this initial declared scope."
|
|
68
|
+
],
|
|
69
|
+
"description": "Source-docs/local-contract pilot, not live or delivered-provider certification. Public documents specify the model-bound integer ceilings and prepaid usage pricing, and the pricing page states a no-card free preview. No authenticated roster, account creation, payment or inference was performed."
|
|
70
|
+
},
|
|
71
|
+
"evidence": {
|
|
72
|
+
"rosterVerified": {
|
|
73
|
+
"date": "2026-10-09",
|
|
74
|
+
"code": "DOCS_ONLY_ROSTER_NOT_OBSERVED",
|
|
75
|
+
"method": "Source documentation recorded in the legacy required field, not an observed roster: https://docs.abliteration.ai/models.md Limits table and quickstart, compatibility, streaming and tool documentation retrieved 2026-10-09. No GET /models, credentials or inference used. Authenticated roster remains pending."
|
|
76
|
+
},
|
|
77
|
+
"billingProbe": {
|
|
78
|
+
"date": "2026-10-09",
|
|
79
|
+
"code": "PUBLIC_DOCS_ONLY_ACCOUNT_NOT_TESTED",
|
|
80
|
+
"method": "Public documentation only: https://abliteration.ai/pricing states a one-credit free preview without a credit card; https://docs.abliteration.ai/pricing.md lists USD prepaid balance and $1.00 input / $0.10 cached input / $3.00 output per million tokens for abliterated-model. Account eligibility, balance and billing execution are untested."
|
|
81
|
+
},
|
|
82
|
+
"liveMatrix": null,
|
|
83
|
+
"addedInPR": "https://github.com/juspay/neurolink/pull/1966"
|
|
84
|
+
}
|
|
85
|
+
}
|